From 5b73519a2c26fea97b4dfd7f56ee6c4e5ea27dde Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Thu, 11 Sep 2025 15:55:37 +0800
Subject: [PATCH] Merge branch 'feature/v5.0/5.0.5' into feature/v6.0/6.0.1

---
 src/views/device/airport.vue |   58 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index a6aa2e2..a02e974 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -126,11 +126,12 @@
       <el-input v-model="operate_password" disabled></el-input>
     </el-dialog>
 
-    <el-dialog title="注销" append-to-body v-model="cancenOperate" width="460px">
-      <div style="display: flex;justify-content: end;">注销 <span style="color:cornflowerblue;">{{ cancelSNName }}</span> 设备可能会影响相关数据,确认注销吗?</div>
-      <div style="display: flex;justify-content: end;">
-        <div><el-checkbox v-model="deleteFlag"></el-checkbox>删除相关图片、视频、事件</div>
-      </div>
+    <el-dialog title="注销" class="zx-cancel" append-to-body v-model="cancenOperate" width="460px">
+      <div style="display: flex;justify-content: center;margin-bottom: 10px;">注销
+        <span style="color:cornflowerblue;font-weight: bolder;margin: 0px 4px;">
+          {{ cancelSNName }}
+        </span> 设备可能会影响相关数据,确认注销吗?</div>
+        <div style="display: flex;justify-content: center;color:red;font-size: 12px;">*删除相关图片、视频、事件</div>
       <template #footer>
         <span class="dialog-footer" style="display: flex;justify-content: center;">
           <el-button @click="cancenOperate = false">取 消</el-button>
@@ -211,7 +212,8 @@
   getDeviceFirmwareList,
   getDevices,
   deviceOffline,
-  devicesUpdate
+  devicesUpdate,
+  devicesUpAndDown
 } from '@/api/device/device'
 import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
 import { getListPage as getOssList } from '@/api/resource/oss'
@@ -247,6 +249,7 @@
       }
     }
     return {
+      treeResolveMap: new Map(),
       rules: {
         password: [{ required: true, validator: validatePass, trigger: 'blur' }],
         password2: [{ required: true, validator: validatePass2, trigger: 'blur' }],
@@ -532,7 +535,7 @@
             endPlaceholder: '保险结束日期',
             rules: [
               {
-                required: true,
+                required: false,
                 message: '请选择保险有效期',
                 trigger: 'blur',
               },
@@ -850,6 +853,7 @@
     },
   },
   destroyed () {
+    this.treeResolveMap.clear()
     this.websocketMap.forEach((k, v) => {
       if (null != v) {
         v.close()
@@ -963,10 +967,9 @@
     },
 
     cancenOperateDo () {
-      console.log('333')
       this.cancenOperate = false
       this.deleteFlag = false
-      deviceOffline(this.cancenOperateRow.device_sn, this.deleteFlag).then(res => {
+      deviceOffline(this.cancenOperateRow.device_sn, true).then(res => {
         ElMessage.success('注销成功')
         
         this.init()
@@ -1009,7 +1012,7 @@
       })
         .then(() => {
           let hidden_flag = row.hidden_flag === 1?0:1
-          devicesUpdate({id:row.id, hiddenFlag:hidden_flag})
+          devicesUpAndDown({id:row.id, hiddenFlag:hidden_flag})
             .then(res => {
               ElMessage.success(`${txt}成功`)
               this.init()
@@ -1295,8 +1298,8 @@
       const submitData = {
         ...row,
         area_code: row.area_code.split(',').pop(),
-        insure_start_time: row.duration_of_insurance[0],
-        insure_expired_time: row.duration_of_insurance[1],
+        insure_start_time: row.duration_of_insurance[0] || null,
+        insure_expired_time: row.duration_of_insurance[1] || null,
         deptId: row.dept_id,
         areaCode: row.area_code.split(',').pop(),
       }
@@ -1307,7 +1310,25 @@
 
       update(submitData).then(
         () => {
-          this.onLoad(this.page)
+          if (row.domain === 0) {
+            // 获取保存的 resolve 函数
+            const resolve = this.treeResolveMap.get(row.device_sn)
+            if (resolve) {
+              // 重新加载子节点数据
+              var params = {
+                childSn: row.device_sn,
+              }
+              getList(1, 10, params).then(res => {
+                const data = res.data.data.records
+                data.forEach(e => {
+                  e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
+                })
+                resolve(data)
+              })
+            }
+          } else {
+            this.onLoad(this.page)
+          }
           this.$message({
             type: 'success',
             message: '操作成功!',
@@ -1459,11 +1480,16 @@
       })
     },
     treeLoad (tree, treeNode, resolve) {
+      // 保存resolve
+      this.treeResolveMap.set(tree.child_sn, resolve)
       var params = {
         childSn: tree.child_sn,
       }
       getList(1, 10, params).then(res => {
         const data = res.data.data.records
+        data.forEach(e => {
+          e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
+        })
         resolve(data)
       })
     },
@@ -1602,5 +1628,11 @@
   right: 0;
 }
 
+:deep(.avue-crud__pagination) {
+  position: fixed;
+  bottom: 10px;
+  right: 30px;
+}
+
 
 </style>

--
Gitblit v1.9.3