Bläddra i källkod

158分站更新

lxh 1 månad sedan
förälder
incheckning
ccaeef2a2d

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

@@ -179,9 +179,10 @@
         <!-- 监测详情 -->
         <div class="detail-content" v-if="activeKey == 'manageAuto'">
           <!-- <a-button preIcon="ant-design:sync-outlined" @click="visibleModalEdit1 = true">重置</a-button> -->
-          <a-table size="small" :scroll="{ y: 710 }" :columns="columnsDetail" :data-source="tableData1">
+          <a-table size="small" :scroll="{ y: 710 }" :columns="columnsDetail" :data-source="tableData1"
+            @expand="tableExpand">
             <template #action="{ record }">
-              <a-button v-if="hasPermission('operateRecord:return')" type="primary" size="small"
+              <a-button v-if="hasPermission('operateRecord:return') && record.deviceList" type="primary" size="small"
                 @click="handleEdit(record)">编辑</a-button>
             </template>
             <template #bodyCell="{ column, text }"></template>
@@ -363,6 +364,7 @@ import {
   update158DevName,
   updateDebugStatus,
   get158StationData,
+  set158StationDevicesRead,
   set158StationData,
   get158StationDevices,
   set158StationRead,
@@ -506,25 +508,40 @@ function getMonitor1(flag = false) {
     flag ? 0 : 5000
   );
 }
+let timer2: null | NodeJS.Timeout = null;
+function getMonitor2(flag = false) {
+  timer2 = setTimeout(
+    async () => {
+      await getShowReadList();
+      if (timer2) {
+        timer2 = null;
+      }
+      getMonitor2();
+    },
+    flag ? 0 : 3000
+  );
+}
 async function getDeviceList() {
   let res = await set158StationRead({ stationId: devStationId.value, deviceId: formEdit.cgq });
   if (res) {
-    let data = await get158StationData();
-    let list = data.filter((v) => v.stationId == devStationId.value)[0];
-    // formView = {
-    //   dylfsfx: list.dylfsfx,
-    //   dylbjzt: list.dylbjzt,
-    //   dyl1f2sADz: list.dyl1f2sADz,
-    //   dyl2f1sADz: list.dyl2f1sADz,
-    //   tfl: list.tfl,
-    //   yjbb: list.yjbb,
-    //   rjbb: list.rjbb,
-    //   zxlxbz: list.zxlxbz,
-    //   rqsj: list.rqsj,
-    // };
-    formView = Object.assign({}, list)
+    getMonitor2(true)
   }
 }
+async function getShowReadList(){
+ let data = await get158StationData();
+ if(data && data.length!=0){
+  let list = data.filter((v) => v.stationId == devStationId.value)[0];
+  formView = Object.assign({}, list)
+ }
+}
+async function tableExpand(expaned, record) {
+  let res = await set158StationDevicesRead({ stationId: record.stationId })
+  if (res) {
+    clearTimeout(timer1)
+    getMonitor1(true)
+  }
+
+}
 //tab选项切换
 async function onChangeTab(tab) {
   activeKey.value = tab;
@@ -541,7 +558,7 @@ async function onChangeTab(tab) {
     getMonitor()
   } else if (activeKey.value == 'manageAuto') {
     await getStationList();
-    getMonitor1();
+    getMonitor1(true);
   } else if (activeKey.value == 'operationRecord') {
     await getSearchRecord({ stationId: '', deviceId: '' })
   }
@@ -549,6 +566,7 @@ async function onChangeTab(tab) {
 
 //弹窗关闭
 function cancenModal() {
+  clearTimeout(timer2)
   formEdit.id = ''
   formEdit.cgq = ''
   formEdit.rs485modbusdz = ''
@@ -576,20 +594,26 @@ function cancenModal() {
   formEdit.sgzjbcmm = ''
 
   formView.dylfsfx = ''
-    formView.dylbjzt = ''
-    formView.dyl1f2sADz = ''
-    formView.dyl2f1sADz = ''
-    formView.tfl = ''
-    formView.yjbb = ''
-    formView.rjbb = ''
-    formView.zxlxbz = ''
-    formView.rqsj = ''
+  formView.dylbjzt = ''
+  formView.dyl1f2sADz = ''
+  formView.dyl2f1sADz = ''
+  formView.tfl = ''
+  formView.yjbb = ''
+  formView.rjbb = ''
+  formView.zxlxbz = ''
+  formView.rqsj = ''
 }
 //获取详细信息列表
 async function getStationList() {
   let res = await get158StationData();
   res.forEach((el) => {
+    el.key = el.deviceId
     el.linkstatusC = el.linkstatus ? '连接' : '断开';
+    el.children = el.deviceList
+    el.children.forEach(ec => {
+      ec.key = ec.deviceId
+      ec.linkstatusC = ec.linkstatus ? '连接' : '断开';
+    })
   });
   tableData1.value = res;
 }
@@ -1457,9 +1481,9 @@ onUnmounted(() => {
   border: 1px solid #3ad8ff77 !important;
 }
 
-::v-deep(.zxm-select-selection-item) {
-  color: #fff !important;
-}
+// ::v-deep(.zxm-select-selection-item) {
+//   color: #fff ;
+// }
 
 // ::v-deep(.zxm-form-item-label > label) {
 //   color: #fff !important;

+ 4 - 1
src/views/vent/safetyList/safetyList.api.ts

@@ -13,7 +13,8 @@ enum Api {
   set158StationRead = '/safety/ventanalyDeviceInfo/set158StationRead',
   remove158Substation='/safety/ventanalyDeviceInfo/remove158Substation',//删除158分站及其关联传感器
   get158SetLog='/safety/ventanalySubStation/get158SetLog',//操作记录
-  remove158Device='/safety/ventanalyDeviceInfo/remove158Device'//删除158分站传感器
+  remove158Device='/safety/ventanalyDeviceInfo/remove158Device',//删除158分站传感器
+  set158StationDevicesRead='/safety/ventanalyDeviceInfo/set158StationDevicesRead'
 }
 
 // 分站查询接口
@@ -44,3 +45,5 @@ export const remove158Substation = (params) => defHttp.post({ url: Api.remove158
 export const get158SetLog = (params) => defHttp.post({ url: Api.get158SetLog,params }, { joinParamsToUrl: true });
 //删除158分站传感器
 export const remove158Device = (params) => defHttp.post({ url: Api.remove158Device, params });
+//158监测详情读取列表
+export const set158StationDevicesRead = (params) => defHttp.post({ url: Api.set158StationDevicesRead,params }, { joinParamsToUrl: true });