lxh 1 dzień temu
rodzic
commit
972975bcea
1 zmienionych plików z 28 dodań i 56 usunięć
  1. 28 56
      src/views/vent/safetyList/common/detail-130.vue

+ 28 - 56
src/views/vent/safetyList/common/detail-130.vue

@@ -154,10 +154,7 @@
 
           <a-table size="small" :scroll="{ y: 710 }" :row-key="(record) => record.stationId"
             :expandedRowKeys="expandedRowKeys" :columns="columnsDetail" :data-source="tableData1" @expand="tableExpand">
-            <!-- <template #action="{ record }">
-              <a-button v-if="hasPermission('operateRecord:return') && record.devInfoList" type="primary" size="small"
-                @click="handleEdit(record)">编辑</a-button>
-            </template> -->
+
             <template #bodyCell="{ column, text }"></template>
             <template #expandedRowRender="{ record }">
               <a-table :columns="deviceColumns130" :data-source="record.devInfoList" :pagination="false" maxWidth="340"
@@ -171,8 +168,7 @@
           </a-table>
           <!-- 编辑弹窗 -->
           <a-modal v-model:visible="visibleModalEdit1" :width="1100" @cancel="cancenModal"
-            :bodyStyle="{ height: '680px', 'overflow-y': 'auto', 'margin-bottom': '15px' }" title="编辑信息"
-            :footer="null">
+            :bodyStyle="{ height: '680px', 'overflow-y': 'auto', 'margin-bottom': '15px' }" title="编辑信息" :footer="null">
             <!-- <a-form :model="formView" labelAlign="right" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
               <a-form-item label="第一路风速风向:">
                 <a-input v-model:value="formView.dylfsfx" placeholder="请输入" disabled
@@ -377,6 +373,7 @@ import { AesEncryption } from '/@/utils/cipher';
 import { loginCipher } from '/@/settings/encryptionSetting';
 import { message } from 'ant-design-vue';
 
+
 let expandedRowKeys = reactive<any[]>([])
 const { hasPermission } = usePermission();
 let activeKey = ref('device');
@@ -486,9 +483,11 @@ let timer: null | NodeJS.Timeout = null;
 function getMonitor(flag = false) {
   timer = setTimeout(
     async () => {
-      await getSubStationList();
       if (activeKey.value == 'device') {
+        await getSubStationList();
         await getStationList1();
+      } else if (activeKey.value == 'manageAuto') {
+        await getStationList();
       }
       if (timer) {
         timer = null;
@@ -498,32 +497,19 @@ function getMonitor(flag = false) {
     flag ? 0 : 3000
   );
 }
-let timer1: null | NodeJS.Timeout = null;
-function getMonitor1(flag = false) {
-  timer1 = setTimeout(
-    async () => {
-      await getStationList();
-      if (timer1) {
-        timer1 = null;
-      }
-      getMonitor1();
-    },
-    flag ? 0 : 3000
-  );
-}
-let timer2: null | NodeJS.Timeout = null;
-function getMonitor2(flag = false) {
-  timer2 = setTimeout(
-    async () => {
-      await getShowReadList();
-      if (timer2) {
-        timer2 = null;
-      }
-      getMonitor2();
-    },
-    flag ? 0 : 3000
-  );
-}
+// let timer2: null | NodeJS.Timeout = null;
+// function getMonitor2(flag = false) {
+//   timer2 = setTimeout(
+//     async () => {
+//       await getShowReadList();
+//       if (timer2) {
+//         timer2 = null;
+//       }
+//       getMonitor2();
+//     },
+//     flag ? 0 : 3000
+//   );
+// }
 let timer3: null | NodeJS.Timeout = null;
 function getMonitor3(flag = false) {
   timer3 = setTimeout(
@@ -558,27 +544,11 @@ function getMonitor3(flag = false) {
 //   }
 // }
 async function tableExpand(expaned, record) {
-  // let res = await set130StationDevicesRead({ stationId: record.stationId })
-  // if (res && expaned) {
-  //   // expandedRowKeys.length=0
-  //   let data = await get130StationData();
-  //   tableData1.value = data
-  //   expandedRowKeys.push(record.stationId)
-  // } else {
-  //   expandedRowKeys.length = 0
-  // }
   if (expaned) {
-    tableData1.value.forEach(el => {
-      el.devInfoList.forEach(v => {
-        v = Object.assign({}, v, v.param)
-      })
-    })
     expandedRowKeys.push(record.stationId)
   } else {
     expandedRowKeys.length = 0
   }
-
-
 }
 
 
@@ -586,15 +556,15 @@ async function tableExpand(expaned, record) {
 async function onChangeTab(tab) {
   activeKey.value = tab;
   stationId.value = ''
-  clearTimeout(timer1);
   clearTimeout(timer);
+  timer = undefined
   if (activeKey.value == 'device') {
     // await getSubStationList();
     // await getStationList1();
     getMonitor()
   } else if (activeKey.value == 'manageAuto') {
     await getStationList();
-    getMonitor1(true);
+    getMonitor();
   } else if (activeKey.value == 'operationRecord') {
     await getSearchRecord({ stationId: '', deviceId: '' })
   }
@@ -648,6 +618,9 @@ async function getStationList() {
   res.forEach((el) => {
     el.linkstatusC = el.linkstatus ? '连接' : '断开';
     el.key = el.stationId
+    el.devInfoList = el.devInfoList.map(v => {
+      return { ...v, ...v.param }
+    })
   });
   tableData1.value = res;
 }
@@ -819,6 +792,7 @@ async function getSubStationList() {
 //分站站点选项点击
 function cardClick(item, index) {
   clearTimeout(timer3)
+  clearTimeout(timer)
   selectedIndex.value = index; // 更新选中索引
   activeIndex.value = item.isNewAccess || !item.linkstatus ? index : null;
   stationName.value = item.strname;
@@ -896,6 +870,7 @@ async function getStationListAll() {
 //显示全部
 function getAllShow() {
   clearTimeout(timer)
+  clearTimeout(timer3)
   getStationListAll()
   getMonitor3()
 }
@@ -957,7 +932,7 @@ function debugClick(record) {
 async function handleOkDebugEnd() {
   const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
   let res = await updateDebugStatus({ pwd: encryption.encryptByAES(startupDataDebugEnd.pwd), stationId: debugStationId.value, deviceId: debugDeviceId.value, debugFlag: '0' });
-  if (res.code = 500) {
+  if (res.code == 500) {
     message.error(res.message);
   } else {
     visibleModalDebugEnd.value = false;
@@ -1064,10 +1039,7 @@ onUnmounted(() => {
     clearTimeout(timer);
     timer = undefined;
   }
-  if (timer1) {
-    clearTimeout(timer1);
-    timer1 = undefined;
-  }
+
 });
 </script>