Browse Source

158分站结束调试接口修改

lxh 2 days ago
parent
commit
ef4f27a04d
1 changed files with 43 additions and 21 deletions
  1. 43 21
      src/views/vent/safetyList/common/detail.vue

+ 43 - 21
src/views/vent/safetyList/common/detail.vue

@@ -71,7 +71,6 @@
                 </a-popconfirm>
                 <a-button type="primary" v-if="!record.devInfoList" size="small" @click="debugClick(record)">{{
                   record.debugTitle }}</a-button>
-              
               </template>
               <template #bodyCell="{ column, text }">
                 <template v-if="column.dataIndex === 'valueJc' && text">
@@ -137,6 +136,17 @@
                 </a-form-item>
               </a-form>
             </a-modal>
+            <!-- 结束调试弹窗 -->
+            <a-modal style="top: 300px; left: 360px" v-model:visible="visibleModalDebugEnd" :width="450" title="调试信息"
+              @ok="handleOkDebugEnd" @cancel="handleCancelDebugEnd">
+              <a-form :model="startupDataDebugEnd" labelAlign="right" :label-col="{ span: 12 }"
+                :wrapper-col="{ span: 12 }">
+                <a-form-item label="密码">
+                  <a-input type="password" v-model:value="startupDataDebugEnd.pwd" placeholder="请输入"
+                    style="width: 260px" />
+                </a-form-item>
+              </a-form>
+            </a-modal>
           </div>
         </div>
         <!-- 历史数据 -->
@@ -397,7 +407,7 @@ import customHeader from '/@/components/vent/customHeader.vue';
 import operateRecord from './operateRecord.vue'
 import { AesEncryption } from '/@/utils/cipher';
 import { loginCipher } from '/@/settings/encryptionSetting';
-
+import { message } from 'ant-design-vue';
 
 let expandedRowKeys = reactive<any[]>([])
 const { hasPermission } = usePermission();
@@ -496,6 +506,12 @@ let stationId = ref('');
 const scroll = reactive({
   y: 680,
 });
+//结束调试弹窗相关信息
+let visibleModalDebugEnd = ref(false);
+let startupDataDebugEnd = reactive({
+  pwd: '',
+});
+
 let operationData = ref<any[]>([])//操作记录列表
 //定时刷新左侧分站数据
 let timer: null | NodeJS.Timeout = null;
@@ -653,7 +669,6 @@ async function handleEdit(record) {
   visibleModalEdit1.value = true;
   devStationId.value = record.stationId;
   let res = await get158StationDevices({ stationId: devStationId.value });
-  console.log(res, '分站下设备下拉选项-------------');
   if (res.length != 0) {
     res.forEach((el) => {
       cgqList.push({ label: el.strinstallpos, value: el.id });
@@ -917,6 +932,7 @@ function debugClick(record) {
   } else if (record.debugTitle == '结束调试') {
     debugFlag.value = 'device';
     debugDeviceId.value = record.id;
+    visibleModalDebugEnd.value = true
     tableData.value.forEach((el) => {
       el.devInfoList.forEach((v) => {
         if (v.id == debugDeviceId.value) {
@@ -925,17 +941,25 @@ function debugClick(record) {
       });
     });
     // record.debugTitle = '调试';
-    stopDebug();
-
   }
 }
-//停止调试
-async function stopDebug() {
-  let res = await updateDebugStatus({ stationId: debugStationId.value, deviceId: debugDeviceId.value, debugFlag: '0' });
-  if (res) {
+//确定结束调试
+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) {
+    message.error(res.message);
+  } else {
+    visibleModalDebugEnd.value = false;
     getStationList1();
   }
-
+}
+//取消结束调试
+function handleCancelDebugEnd() {
+  visibleModalDebugEnd.value = false;
+  debugFlag.value = '';
+  debugStationId.value = '';
+  debugDeviceId.value = '';
 }
 async function handleOk() {
   let res = await runDeviceMonitor({ devId: devId.value, devName: startupData.address });
@@ -950,12 +974,10 @@ function handleCancel() {
 async function handleOkEdit() {
   if (paramId.value == 'subId') {
     let res = await update158DevName({ subId: devId.value, devName: startupDataEdit.address });
-    console.log(res, '设备名称编辑---');
     visibleModalEdit.value = false;
     getStationList1();
   } else {
     let res = await update158DevName({ devId: devId.value, devName: startupDataEdit.address });
-    console.log(res, '设备名称编辑---');
     visibleModalEdit.value = false;
     getStationList1();
   }
@@ -977,21 +999,22 @@ async function handleOkDebug() {
     pwd: encryption.encryptByAES(startupDataDebug.pwd),
     debugFlag: '1',
   });
-  if (res) {
+  if (res.code == 500) {
+    message.error(res.message);
+  } else {
     visibleModalDebug.value = false;
     getStationList1();
   }
-
 }
 //调试取消
 function handleCancelDebug() {
   visibleModalDebug.value = false;
-  tableData.value.forEach((el) => {
-    el.devInfoList.forEach((v) => {
-      //  v.debugTitle = v.status===1 ? '结束调试'  : v.status===0 ? '调试' : ''
-      v.debugTitle = v.deviceType == 'windrect_ds_25x' || v.deviceType == 'windrect_ds_two' ? v.status === 1 ? '结束调试' : v.status === 0 ? '调试' : '' : ''
-    });
-  });
+  // tableData.value.forEach((el) => {
+  //   el.devInfoList.forEach((v) => {
+  //     //  v.debugTitle = v.status===1 ? '结束调试'  : v.status===0 ? '调试' : ''
+  //     v.debugTitle = v.deviceType == 'windrect_ds_25x' || v.deviceType == 'windrect_ds_two' ? v.status === 1 ? '结束调试' : v.status === 0 ? '调试' : '' : ''
+  //   });
+  // });
   debugFlag.value = '';
   debugStationId.value = '';
   debugDeviceId.value = '';
@@ -1006,7 +1029,6 @@ function pageChange(val) {
 //删除左侧分站
 async function handleDelStation() {
   let res = await remove158Substation({ stationId: stationId.value })
-  console.log(res, '删除左侧分站')
   if (res) {
     getSubStationList();
     getStationList1();