Browse Source

158分站修改提交

lxh 1 tháng trước cách đây
mục cha
commit
6671f8a2a8
1 tập tin đã thay đổi với 61 bổ sung63 xóa
  1. 61 63
      src/views/vent/safetyList/common/detail.vue

+ 61 - 63
src/views/vent/safetyList/common/detail.vue

@@ -114,7 +114,7 @@
                 <a-form-item label="风向">
                   <a-select v-model:value="startupDataDebug.direction" style="width: 260px">
                     <a-select-option v-for="file in derictList" :key="file.label" :value="file.value">{{ file.label
-                      }}</a-select-option>
+                    }}</a-select-option>
                   </a-select>
                 </a-form-item>
               </a-form>
@@ -223,8 +223,8 @@
             <a-form :model="formEdit" labelAlign="right" :label-col="{ span: 7 }" :wrapper-col="{ span: 17 }">
               <a-form-item label="传感器设备:">
                 <a-select v-model:value="formEdit.cgq" @change="changeCgq" style="width: 260px; margin-right: 10px">
-                  <a-select-option v-for="file in cgqList" :key="file.label" :value="file.value">{{ file.label
-                    }}</a-select-option>
+                  <a-select-option v-for="(file, index) in cgqList" :key="index" :value="file.value">{{ file.label
+                  }}</a-select-option>
                 </a-select>
                 <a-button type="success" @click="getDeviceList">读取</a-button>
               </a-form-item>
@@ -506,54 +506,52 @@ async function getDeviceList() {
   }
 }
 //tab选项切换
-function onChangeTab(tab) {
+async function onChangeTab(tab) {
   activeKey.value = tab;
   stationId.value = ''
   clearTimeout(timer1);
   clearTimeout(timer);
   if (activeKey.value == 'device') {
+    await getSubStationList();
+    await getStationList1();
     getMonitor()
-    getSubStationList();
-    getStationList1();
   } else if (activeKey.value == 'history') {
+    await getSubStationList();
+    await getStationList();
     getMonitor()
-    getSubStationList();
-    getStationList();
   } else {
-    getStationList();
+    await getStationList();
     getMonitor1();
   }
 }
 
 //弹窗关闭
 function cancenModal() {
-  formEdit = {
-    id: '',
-    cgq: '',
-    rs485modbusdz: '',
-    ttazjl: '',
-    jxjl: '',
-    azjd: '',
-    szsz: '',
-    sjpjzq: '',
-    dylyfesPGz: '',
-    dylefysPGz: '',
-    fdjmj: '',
-    dylztxsk: '',
-    dyldydxs1: '',
-    dyldedxs2: '',
-    dyldsdxs3: '',
-    dyldsdxs4: '',
-    dyldwdxs5: '',
-    dyldldxs6: '',
-    xsKB: '',
-    xsKBfh: '',
-    gbjyz: '',
-    dbjyz: '',
-    bjsn: '',
-    dyl485btl: '',
-    sgzjbcmm: '',
-  };
+  formEdit.id = ''
+  formEdit.cgq = ''
+  formEdit.rs485modbusdz = ''
+  formEdit.ttazjl = ''
+  formEdit.jxjl = ''
+  formEdit.azjd = ''
+  formEdit.szsz = ''
+  formEdit.sjpjzq = ''
+  formEdit.dylyfesPGz = ''
+  formEdit.dylefysPGz = ''
+  formEdit.fdjmj = ''
+  formEdit.dylztxsk = ''
+  formEdit.dyldydxs1 = ''
+  formEdit.dyldedxs2 = ''
+  formEdit.dyldsdxs3 = ''
+  formEdit.dyldsdxs4 = ''
+  formEdit.dyldwdxs5 = ''
+  formEdit.dyldldxs6 = ''
+  formEdit.xsKB = ''
+  formEdit.xsKBfh = ''
+  formEdit.gbjyz = ''
+  formEdit.dbjyz = ''
+  formEdit.bjsn = ''
+  formEdit.dyl485btl = ''
+  formEdit.sgzjbcmm = ''
 }
 //获取详细信息列表
 async function getStationList() {
@@ -565,16 +563,13 @@ async function getStationList() {
 }
 //传感器选项切换
 function changeCgq(val) {
-  console.log(val, 'val---------');
   formEdit.cgq = val;
-  console.log(formEdit.cgq, 'cgq------');
 }
 //编辑
 async function handleEdit(record) {
   cgqList.length = 0;
   visibleModalEdit1.value = true;
   devStationId.value = record.stationId;
-
   let res = await get158StationDevices({ stationId: devStationId.value });
   console.log(res, '分站下设备下拉选项-------------');
   if (res.length != 0) {
@@ -743,25 +738,28 @@ function changeStatus(val) {
 //获取详细信息列表
 async function getStationList1() {
   let res = await getList({ subId: stationId.value, pageNo: pagination.current, pageSize: pagination.pageSize });
-  res.forEach((el) => {
-    el.key = el.id;
-    el.linkIdC = el.linkId || '';
-    el.stripC = el.strip || '';
-    el.linkstatusC = el.linkstatus ? '连接' : '断开';
-    el.gdmsC = el.gdms == '1' ? '直流供电' : el.gdms == '0' ? '交流供电' : '';
-    el.children = el.devInfoList;
-    el.children.forEach((v) => {
-      v.key = v.id;
-      v.debugTitle =v.deviceType=='windrect_ds_25x' || v.deviceType=='windrect_ds_two' ?  '调试' : '';
-      v.stripC = v.strserno || '';
-      v.linkstatusC = v.netStatus ? '连接' : '断开';
-      v.linkIdC = v.linkId == '0' ? '未启用' : v.linkId == '1' ? '启用' : v.linkId == '2' ? '设备异常' : '';
-      v.updateTime = v.time;
-      v.gdmsC = v.gdms == '1' ? '直流供电' : v.gdms == '0' ? '交流供电' : '';
-      v.valueJc = `风向:${v.forward || ''},风量:${v.m3 || ''}m³/min,风速:${v.windSpeed || ''}m/s,气压:${v.pa || ''}Pa,压差:${v.difPress || ''
-        }Pa,温度:${v.temperature || ''}℃,湿度:${v.humidity || ''}%,断面积:${v.area || ''}㎡`;
+  if (res && res.length != 0) {
+    res.forEach((el) => {
+      el.key = el.id;
+      el.linkIdC = el.linkId || '';
+      el.stripC = el.strip || '';
+      el.linkstatusC = el.linkstatus ? '连接' : '断开';
+      el.gdmsC = el.gdms == '1' ? '直流供电' : el.gdms == '0' ? '交流供电' : '';
+      el.children = el.devInfoList;
+      el.children.forEach((v) => {
+        v.key = v.id;
+        v.debugTitle = v.deviceType == 'windrect_ds_25x' || v.deviceType == 'windrect_ds_two' ? '调试' : '';
+        v.stripC = v.strserno || '';
+        v.linkstatusC = v.netStatus ? '连接' : '断开';
+        v.linkIdC = v.linkId == '0' ? '未启用' : v.linkId == '1' ? '启用' : v.linkId == '2' ? '设备异常' : '';
+        v.updateTime = v.time;
+        v.gdmsC = v.gdms == '1' ? '直流供电' : v.gdms == '0' ? '交流供电' : '';
+        v.valueJc = `风向:${v.forward || ''},风量:${v.m3 || ''}m³/min,风速:${v.windSpeed || ''}m/s,气压:${v.pa || ''}Pa,压差:${v.difPress || ''
+          }Pa,温度:${v.temperature || ''}℃,湿度:${v.humidity || ''}%,断面积:${v.area || ''}㎡`;
+      });
     });
-  });
+  }
+
   tableData.value = res;
   pagination.total = res.total;
 }
@@ -776,7 +774,7 @@ async function getStationListAll() {
     el.children = el.devInfoList;
     el.children.forEach((v) => {
       v.key = v.id;
-      v.debugTitle =v.deviceType=='windrect_ds_25x' || v.deviceType=='windrect_ds_two' ?  '调试' : '';
+      v.debugTitle = v.deviceType == 'windrect_ds_25x' || v.deviceType == 'windrect_ds_two' ? '调试' : '';
       v.stripC = v.strserno || '';
       v.linkstatusC = v.netStatus ? '连接' : '断开';
       v.linkIdC = v.linkId == '0' ? '未启用' : v.linkId == '1' ? '启用' : v.linkId == '2' ? '设备异常' : '';
@@ -848,7 +846,7 @@ function debugClick(record) {
     //     })
     //     record.debugTitle = '结束调试'
     // }
-  } else if(record.debugTitle == '结束调试') {
+  } else if (record.debugTitle == '结束调试') {
     debugFlag.value = 'device';
     debugDeviceId.value = record.id;
     tableData.value.forEach((el) => {
@@ -955,7 +953,7 @@ function handleCancelDebug() {
   visibleModalDebug.value = false;
   tableData.value.forEach((el) => {
     el.devInfoList.forEach((v) => {
-      v.debugTitle =v.deviceType=='windrect_ds_25x' || v.deviceType=='windrect_ds_two' ?  '调试' : '';
+      v.debugTitle = v.deviceType == 'windrect_ds_25x' || v.deviceType == 'windrect_ds_two' ? '调试' : '';
     });
   });
   debugFlag.value = '';
@@ -980,10 +978,10 @@ async function handleDelStation() {
 }
 //取消删除左侧分站
 function handleCancelDelStation() { }
-onMounted(() => {
+onMounted(async () => {
+  await getSubStationList();
+  await getStationList1();
   getMonitor()
-  getSubStationList();
-  getStationList1();
 });
 onUnmounted(() => {
   if (timer) {