Jelajahi Sumber

[Feat 0000] 预警分析全系页面解决问题功能对接

houzekong 3 bulan lalu
induk
melakukan
571304a498

+ 1 - 1
src/design/var/index.less

@@ -6,7 +6,7 @@
 
 // tabs
 // updateBy:sunjianlei---updateDate:2021-09-03---修改tab切换栏样式:更改高度
-@multiple-height: 43px;
+@multiple-height: 34px;
 @multiple-card-height: 50px;
 // update-begin--author:liaozhiyang---date:20240407---for:【QQYUN-8762】标签页圆滑高度
 @multiple-smooth-height: 48px;

+ 37 - 1
src/views/analysis/common/analysis.ts

@@ -2,8 +2,12 @@ import { ref } from 'vue';
 import { first } from 'lodash';
 import { getGoafSelectOption } from '../../monitor/sealedMonitor/monitor.api';
 import { useMineDepartmentStore } from '/@/store/modules/mine';
+import { resolveAlarm } from '../warningAnalysis/airLeakStatus/airLeak.api';
+import { message } from 'ant-design-vue';
+import { useModal } from '/@/components/Modal';
+import { TableActionType } from '/@/components/Table';
 
-export function useInitForm() {
+export function useInitForm(ctx?: TableActionType) {
   const mineStore = useMineDepartmentStore();
   // 给历史数据默认填充的矿码
   const hiscode = first(mineStore.getMineCode.split(','));
@@ -24,10 +28,42 @@ export function useInitForm() {
     });
   }
 
+  const [registerModal, modalCtx] = useModal();
+
+  function openModal(record) {
+    resolveId.value = record.id;
+    modalCtx.openModal(true);
+  }
+
+  const resolveId = ref('');
+  const resolveValue = ref('');
+
+  function handleResolve() {
+    const params = {
+      id: resolveId.value,
+      content: resolveValue.value,
+    };
+
+    resolveAlarm(params)
+      .then(() => {
+        message.success('操作成功');
+        modalCtx.closeModal();
+        if (ctx) ctx.reload();
+      })
+      .catch(() => {
+        message.error('操作失败');
+      });
+  }
+
   return {
     goafOptions,
     goafId,
     hiscode,
+    resolveId,
+    resolveValue,
+    registerModal,
+    openModal,
     initGoafOptions,
+    handleResolve,
   };
 }

+ 7 - 11
src/views/analysis/warningAnalysis/airLeakStatus/index.vue

@@ -16,7 +16,7 @@
             <span class="action-text">详情</span>
           </button> -->
           <!-- 已解决按钮 -->
-          <button @click="openModal(record, 'resolved')" class="resolved-btn" title="解决">
+          <button @click="openModal(record)" class="resolved-btn" title="解决">
             <SvgIcon name="details" />
           </button>
         </template>
@@ -40,7 +40,7 @@
     </TabPane>
   </Tabs>
   <!-- 弹窗组件 -->
-  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况">
+  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
     <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
   </BasicModal>
 </template>
@@ -55,15 +55,12 @@
   import { columns } from './airLeakStatus.data';
   import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './airLeak.api';
   import { useInitForm } from '../../common/analysis';
-  import { BasicModal, useModal } from '/@/components/Modal/index';
+  import { BasicModal } from '/@/components/Modal/index';
   import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
   import { useIntervalFn } from '@vueuse/core';
 
   // 激活的Tab页签
   const activeTab = ref('realtime');
-  const resolveValue = ref('');
-
-  const { goafOptions, goafId, hiscode, initGoafOptions } = useInitForm();
 
   const boardData = ref([
     { label: '存在风险情况数量', value: '-' },
@@ -72,7 +69,7 @@
   ]);
 
   // 注册实时数据表格
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, tableCtx] = useTable({
     title: '密闭漏风状态判定',
     api: getProvinceAlarm,
     columns,
@@ -102,6 +99,8 @@
     },
   });
 
+  const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm(tableCtx);
+
   // 注册历史数据表格
   const [registerHistoryTable, historyTable] = useTable({
     columns,
@@ -174,9 +173,6 @@
     // },
   });
 
-  // 弹窗引用
-  const [registerModal, { openModal }] = useModal();
-
   async function getAlarmTotalData() {
     const params = {
       alarmType: 'leakageAlarm',
@@ -187,7 +183,7 @@
     boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2;
   }
 
-  useIntervalFn(() => reload({ silence: true }), 10000);
+  useIntervalFn(() => tableCtx.reload({ silence: true }), 10000);
 
   onMounted(() => {
     // 页面挂载时的逻辑

+ 7 - 11
src/views/analysis/warningAnalysis/autoFireAnalysis/index.vue

@@ -20,7 +20,7 @@
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
-              <button @click="openModal(record, 'resolved')" class="resolved-btn" title="解决">
+              <button @click="openModal(record)" class="resolved-btn" title="解决">
                 <SvgIcon name="details" />
               </button>
             </div>
@@ -45,7 +45,7 @@
       </TabPane>
     </Tabs>
     <!-- 弹窗组件 -->
-    <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况">
+    <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
       <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
     </BasicModal>
   </div>
@@ -61,15 +61,12 @@
   import { columns } from './autoFireAnalysis.data';
   import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './autoFire.api';
   import { useInitForm } from '../../common/analysis';
-  import { BasicModal, useModal } from '/@/components/Modal/index';
+  import { BasicModal } from '/@/components/Modal/index';
   import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
   import { useIntervalFn } from '@vueuse/core';
 
   // 激活的Tab页签
   const activeTab = ref('realtime');
-  const resolveValue = ref('');
-
-  const { goafOptions, goafId, hiscode, initGoafOptions } = useInitForm();
 
   const boardData = ref([
     {
@@ -95,7 +92,7 @@
   ]);
 
   // 注册实时数据表格
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, tableCtx] = useTable({
     columns,
     api: getProvinceAlarm,
     formConfig: {
@@ -126,6 +123,8 @@
     },
   });
 
+  const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm(tableCtx);
+
   // 注册历史数据表格
   const [registerHistoryTable, historyTable] = useTable({
     columns,
@@ -197,9 +196,6 @@
     // },
   });
 
-  // 弹窗引用
-  const [registerModal, { openModal }] = useModal();
-
   async function getAlarmTotalData() {
     const params = {
       alarmType: 'fireAlarm',
@@ -212,7 +208,7 @@
     boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
   }
 
-  useIntervalFn(() => reload({ silence: true }), 10000);
+  useIntervalFn(() => tableCtx.reload({ silence: true }), 10000);
 
   onMounted(() => {
     // 页面挂载时的逻辑

+ 7 - 11
src/views/analysis/warningAnalysis/fireAreaJudgeAnalysis/index.vue

@@ -19,7 +19,7 @@
         <template #action="{ record }">
           <div class="action-buttons">
             <!-- 已解决按钮 -->
-            <button @click="openModal(record, 'resolved')" class="resolved-btn" title="解决">
+            <button @click="openModal(record)" class="resolved-btn" title="解决">
               <SvgIcon name="details" />
             </button>
           </div>
@@ -44,7 +44,7 @@
     </TabPane>
   </Tabs>
   <!-- 弹窗组件 -->
-  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况">
+  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
     <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
   </BasicModal>
 </template>
@@ -59,15 +59,12 @@
   import { columns } from './fireAreaJudgeAnalysis.data';
   import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './fireAreaJudge.api';
   import { useInitForm } from '../../common/analysis';
-  import { BasicModal, useModal } from '/@/components/Modal/index';
+  import { BasicModal } from '/@/components/Modal/index';
   import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
   import { useIntervalFn } from '@vueuse/core';
 
   // 激活的Tab页签
   const activeTab = ref('realtime');
-  const resolveValue = ref('');
-
-  const { goafOptions, goafId, hiscode, initGoafOptions } = useInitForm();
 
   const boardData = ref([
     {
@@ -85,7 +82,7 @@
   ]);
 
   // 注册实时数据表格
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, tableCtx] = useTable({
     columns,
     api: getProvinceAlarm,
     formConfig: {
@@ -116,6 +113,8 @@
     },
   });
 
+  const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm(tableCtx);
+
   // 注册历史数据表格
   const [registerHistoryTable, historyTable] = useTable({
     columns,
@@ -187,9 +186,6 @@
     // },
   });
 
-  // 弹窗引用
-  const [registerModal, { openModal }] = useModal();
-
   async function getAlarmTotalData() {
     const params = {
       alarmType: 'unsealAlarm',
@@ -200,7 +196,7 @@
     boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4 + result.alarmLevel5;
   }
 
-  useIntervalFn(() => reload({ silence: true }), 10000);
+  useIntervalFn(() => tableCtx.reload({ silence: true }), 10000);
 
   onMounted(() => {
     // 页面挂载时的逻辑

+ 7 - 11
src/views/analysis/warningAnalysis/overlimitAlarm/index.vue

@@ -19,7 +19,7 @@
         <template #action="{ record }">
           <div class="action-buttons">
             <!-- 操作按钮 -->
-            <button @click="openModal(record, 'resolved')" class="resolved-btn" title="解决">
+            <button @click="openModal(record)" class="resolved-btn" title="解决">
               <SvgIcon name="details" />
             </button>
           </div>
@@ -44,7 +44,7 @@
     </TabPane>
   </Tabs>
   <!-- 弹窗组件 -->
-  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况">
+  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
     <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
   </BasicModal>
 </template>
@@ -59,15 +59,12 @@
   import { columns } from './overlimitAlarm.data';
   import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './overlimit.api';
   import { useInitForm } from '../../common/analysis';
-  import { BasicModal, useModal } from '/@/components/Modal/index';
+  import { BasicModal } from '/@/components/Modal/index';
   import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
   import { useIntervalFn } from '@vueuse/core';
 
   // 激活的Tab页签
   const activeTab = ref('realtime');
-  const resolveValue = ref('');
-
-  const { goafOptions, goafId, hiscode, initGoafOptions } = useInitForm();
 
   const boardData = ref([
     {
@@ -93,7 +90,7 @@
   ]);
 
   // 注册实时数据表格
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, tableCtx] = useTable({
     columns,
     api: getProvinceAlarm,
     formConfig: {
@@ -124,6 +121,8 @@
     },
   });
 
+  const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm(tableCtx);
+
   // 注册历史数据表格
   const [registerHistoryTable, historyTable] = useTable({
     columns,
@@ -195,9 +194,6 @@
     // },
   });
 
-  // 弹窗引用
-  const [registerModal, { openModal }] = useModal();
-
   async function getAlarmTotalData() {
     const params = {
       alarmType: 'overLimitAlarm',
@@ -210,7 +206,7 @@
     boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
   }
 
-  useIntervalFn(() => reload({ silence: true }), 10000);
+  useIntervalFn(() => tableCtx.reload({ silence: true }), 10000);
 
   onMounted(() => {
     // 页面挂载时的逻辑

+ 7 - 11
src/views/analysis/warningAnalysis/pressureDiffAnalysis/index.vue

@@ -23,7 +23,7 @@
               <span class="action-text">详情</span>
             </button> -->
             <!-- 已解决按钮 -->
-            <button @click="openModal(record, 'resolved')" class="resolved-btn" title="解决">
+            <button @click="openModal(record)" class="resolved-btn" title="解决">
               <SvgIcon name="details" />
             </button>
           </div>
@@ -59,7 +59,7 @@
     <a-table></a-table>
   </a-modal> -->
   <!-- 弹窗组件 -->
-  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况">
+  <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
     <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
   </BasicModal>
 </template>
@@ -74,15 +74,12 @@
   import { columns } from './pressureDiffAnalysis.data';
   import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './pressureDiff.api';
   import { useInitForm } from '../../common/analysis';
-  import { BasicModal, useModal } from '/@/components/Modal/index';
+  import { BasicModal } from '/@/components/Modal/index';
   import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
   import { useIntervalFn } from '@vueuse/core';
 
   // 激活的Tab页签
   const activeTab = ref('realtime');
-  const resolveValue = ref('');
-
-  const { goafOptions, goafId, hiscode, initGoafOptions } = useInitForm();
 
   const boardData = ref([
     {
@@ -108,7 +105,7 @@
   ]);
 
   // 注册实时数据表格
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, tableCtx] = useTable({
     columns,
     api: getProvinceAlarm,
     formConfig: {
@@ -139,6 +136,8 @@
     },
   });
 
+  const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm(tableCtx);
+
   // 注册历史数据表格
   const [registerHistoryTable, historyTable] = useTable({
     columns,
@@ -210,9 +209,6 @@
     // },
   });
 
-  // 弹窗引用
-  const [registerModal, { openModal }] = useModal();
-
   async function getAlarmTotalData() {
     const params = {
       alarmType: 'sourcePressureAlarm',
@@ -225,7 +221,7 @@
     boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
   }
 
-  useIntervalFn(() => reload({ silence: true }), 10000);
+  useIntervalFn(() => tableCtx.reload({ silence: true }), 10000);
 
   onMounted(() => {
     // 页面挂载时的逻辑