Procházet zdrojové kódy

[Mod 0000] 修改了均压信息提示框的内容

houzekong před 2 dny
rodič
revize
903e6f2107

+ 2 - 0
src/views/vent/monitorManager/balancePressMonitor/balancePress.api.ts

@@ -11,6 +11,7 @@ enum Api {
   updatePassword = '/monitor/demo/avePress/update/password',
   validPassword = '/monitor/demo/avePress/valid/password',
   controlWindow = '/monitor/demo/avePress/controlWindow',
+  cancelcontrolWindow = '/monitor/demo/avePress/cancel-controlWindow',
 }
 /**
  * 列表接口
@@ -50,6 +51,7 @@ export const subList2 = (params) => defHttp.get({ url: Api.subList2, params });
 export const submitEdit = (params) => defHttp.post({ url: Api.submitEdit, params });
 
 export const controlWindow = (params) => defHttp.get({ url: Api.controlWindow, params }, { joinParamsToUrl: true });
+export const cancelcontrolWindow = (params) => defHttp.get({ url: Api.cancelcontrolWindow, params }, { joinParamsToUrl: true });
 
 export const updatePassword = (params) =>
   defHttp.get({ url: Api.updatePassword, params }).then((e) => {

+ 22 - 10
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHomeBD.vue

@@ -114,7 +114,7 @@
   </a-spin>
 </template>
 <script setup lang="ts">
-  import { ref, onMounted, onUnmounted, defineProps } from 'vue';
+  import { ref, onMounted, onUnmounted, defineProps, h } from 'vue';
   import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
   import { list } from '../balancePress.api';
   import ModuleCommon from '../../../home/configurable/components/ModuleCommon.vue';
@@ -214,8 +214,18 @@
     return result;
   }
 
-  const { avePressSetting, avePressLinkage, gateLinkage, formData, getAvePress, changePassword, linkageControl, settingControl, autoControl } =
-    usePressControl();
+  const {
+    avePressSetting,
+    avePressLinkage,
+    gateLinkage,
+    formData,
+    getAvePress,
+    changePassword,
+    linkageControl,
+    settingControl,
+    autoControl,
+    cancelControl,
+  } = usePressControl();
 
   const modalVisible = ref(false);
 
@@ -303,22 +313,23 @@
       if (data.cmd !== 'topic' || data.topic !== 'warn') return;
       if (!data.msgTxt) return;
 
-      const { info = '', type = '' } = JSON.parse(data.msgTxt);
+      const { info = '', type = '', avgPressLogId, date } = JSON.parse(data.msgTxt);
       switch (type) {
         case 'o2':
           if (warnModal1.value) break;
           warnModal1.value = Modal.confirm({
             title: data.msgTitle,
-            content: info,
+            content: h('div', { style: { color: '#fff' } }, [h('p', date), h('p', info)]),
             centered: true,
             okText: '下发调节指令',
             mask: true,
             class: 'balancePress',
             async onOk() {
-              await autoControl();
+              await autoControl(avgPressLogId);
               warnModal1.value = null;
             },
-            onCancel: () => {
+            async onCancel() {
+              await cancelControl(avgPressLogId);
               warnModal1.value = null;
             },
           });
@@ -332,16 +343,17 @@
           if (warnModal1.value) break;
           warnModal1.value = Modal.confirm({
             title: data.msgTitle,
-            content: info,
+            content: h('div', { style: { color: '#fff' } }, [h('p', date), h('p', info)]),
             centered: true,
             okText: '下发调节指令',
             mask: true,
             class: 'balancePress',
             async onOk() {
-              await autoControl();
+              await autoControl(avgPressLogId);
               warnModal1.value = null;
             },
-            onCancel: () => {
+            async onCancel() {
+              await cancelControl(avgPressLogId);
               warnModal1.value = null;
             },
           });

+ 14 - 3
src/views/vent/monitorManager/balancePressMonitor/hooks/useControl.ts

@@ -1,7 +1,7 @@
 import { message } from 'ant-design-vue';
 import { get } from 'lodash-es';
 import { ref } from 'vue';
-import { submitEdit, updatePassword, validPassword, subList2, controlWindow } from '../balancePress.api';
+import { submitEdit, updatePassword, validPassword, subList2, controlWindow, cancelcontrolWindow } from '../balancePress.api';
 
 export function usePressControl() {
   /** 参数与设置、风机风门联动表单数据 */
@@ -106,8 +106,18 @@ export function usePressControl() {
       });
   }
 
-  function autoControl() {
-    return controlWindow({ id: avePressSetting.value.id })
+  function autoControl(avgPressLogId) {
+    return controlWindow({ avgPressId: avePressSetting.value.id, avgPressLogId })
+      .then(() => {
+        message.success('下发成功');
+      })
+      .catch(() => {
+        message.error('下发失败');
+      });
+  }
+
+  function cancelControl(avgPressLogId) {
+    return cancelcontrolWindow({ avgPressId: avePressSetting.value.id, avgPressLogId })
       .then(() => {
         message.success('下发成功');
       })
@@ -122,6 +132,7 @@ export function usePressControl() {
     changePassword,
     getAvePress,
     autoControl,
+    cancelControl,
     avePressLinkage,
     avePressSetting,
     gateLinkage,