From 9090ff42fb118b91817e162718c2684cc20e042d Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 03 Sep 2025 14:37:24 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v5.0/5.0.5' into patch_management

---
 src/views/odm/task.vue                            |    3 
 src/views/device/components/DockControlPanel.vue  |   16 +++
 src/page/index/tags.vue                           |    6 
 src/views/device/components/DeviceSettingBox.vue  |   13 +-
 src/utils/device-setting.js                       |  154 +++++++++++++++---------------
 src/views/device/components/use-device-setting.js |   21 +--
 src/views/device/airport.vue                      |   66 +++++++++++--
 src/api/device/device.js                          |   11 ++
 8 files changed, 180 insertions(+), 110 deletions(-)

diff --git a/src/api/device/device.js b/src/api/device/device.js
index 0e9cf9d..b3c9d62 100644
--- a/src/api/device/device.js
+++ b/src/api/device/device.js
@@ -144,10 +144,19 @@
   })
 }
 
-// 设备下线
+// 注销
 export const deviceOffline = (dockSn) => {
   return request({
     url: `/drone-device-core/manage/api/v1/devices/deviceOffline?dockSn=${dockSn}`,
     method: 'get',
   })
 }
+
+// 设备下线
+export const devicesUpdate = (param) => {
+  return request({
+    url: `/drone-device-core/manage/api/v1/devices/update`,
+    method: 'post',
+    data: param
+  })
+}
\ No newline at end of file
diff --git a/src/page/index/tags.vue b/src/page/index/tags.vue
index 1b7ae7b..39ac359 100644
--- a/src/page/index/tags.vue
+++ b/src/page/index/tags.vue
@@ -2,20 +2,20 @@
   <div class="avue-tags" v-if="setting.tag" @click="contextmenuFlag = false">
     <!-- tag盒子 -->
     <div v-if="contextmenuFlag" class="avue-tags__contentmenu"
-      :style="{ left: contentmenuX + 'px', top: contentmenuY + 'px' }">
+         :style="{ left: contentmenuX + 'px', top: contentmenuY + 'px' }">
       <div class="item" @click="closeOthersTags">{{ $t('tagsView.closeOthers') }}</div>
       <div class="item" @click="closeAllTags">{{ $t('tagsView.closeAll') }}</div>
       <div class="item" @click="clearCacheTags">{{ $t('tagsView.clearCache') }}</div>
     </div>
     <div class="avue-tags__box">
       <el-tabs v-model="active" type="card" @contextmenu="handleContextmenu" :closable="tagLen !== 1"
-        @tab-click="openTag" @edit="menuTag">
+               @tab-click="openTag" @edit="menuTag">
         <el-tab-pane v-for="(item, index) in bsTagList" :key="index" :label="generateTitle(item)" :name="item.fullPath">
           <template #label>
             <span>
               {{ generateTitle(item) }}
               <i class="el-icon-refresh" :class="{ turn: refresh }" @click="handleRefresh"
-                v-if="active === item.fullPath"></i>
+                 v-if="active === item.fullPath"></i>
             </span>
           </template>
         </el-tab-pane>
diff --git a/src/utils/device-setting.js b/src/utils/device-setting.js
index b5f356e..86cbc26 100644
--- a/src/utils/device-setting.js
+++ b/src/utils/device-setting.js
@@ -11,37 +11,38 @@
 
 /**
  * 根据osd 更新信息
- * @param deviceSetting
+ * @param deviceSetting.value
  * @param deviceInfo
  * @returns
  */
 export function updateDeviceSettingInfoByOsd(deviceSetting, deviceInfo) {
-  const { device, dock, gateway } = deviceInfo || {}
-  if (!deviceSetting) {
+  // const { device, dock, gateway } = deviceInfo.value || {}
+  let device = deviceInfo?? {}
+  if (!deviceSetting.value) {
     return
   }
   // 夜航灯
   let nightLightsState = ""
   if (isNil(device?.night_lights_state)) {
-    deviceSetting[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].editable = false
-    deviceSetting[
+    deviceSetting.value[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].editable = false
+    deviceSetting.value[
       DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET
     ].value = DEFAULT_PLACEHOLDER
     nightLightsState = DEFAULT_PLACEHOLDER
   } else {
-    deviceSetting[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].editable = true
+    deviceSetting.value[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].editable = true
     nightLightsState = device?.night_lights_state
     if (nightLightsState === NightLightsStateEnum.CLOSE) {
-      deviceSetting[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].value = "关闭"
+      deviceSetting.value[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].value = "关闭"
     } else if (nightLightsState === NightLightsStateEnum.OPEN) {
-      deviceSetting[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].value = "开启"
+      deviceSetting.value[DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET].value = "开启"
     } else {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET
       ].value = DEFAULT_PLACEHOLDER
     }
   }
-  deviceSetting[
+  deviceSetting.value[
     DeviceSettingKeyEnum.NIGHT_LIGHTS_MODE_SET
   ].trueValue = nightLightsState
 
@@ -49,169 +50,169 @@
   let heightLimit = device?.height_limit
   if (isNil(heightLimit) || heightLimit === 0) {
     heightLimit = DEFAULT_PLACEHOLDER
-    deviceSetting[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].editable = false
+    deviceSetting.value[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].editable = false
   } else {
-    deviceSetting[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].editable = true
+    deviceSetting.value[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].editable = true
   }
-  deviceSetting[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].trueValue = heightLimit
-  deviceSetting[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].value =
+  deviceSetting.value[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].trueValue = heightLimit
+  deviceSetting.value[DeviceSettingKeyEnum.HEIGHT_LIMIT_SET].value =
     heightLimit + Unit_M
 
   // 限远
   let distanceLimitStatus = ""
   if (isNil(device?.distance_limit_status?.state)) {
     distanceLimitStatus = DEFAULT_PLACEHOLDER
-    deviceSetting[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].editable = false
-    deviceSetting[
+    deviceSetting.value[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].editable = false
+    deviceSetting.value[
       DeviceSettingKeyEnum.DISTANCE_LIMIT_SET
     ].value = DEFAULT_PLACEHOLDER
   } else {
-    deviceSetting[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].editable = true
+    deviceSetting.value[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].editable = true
     distanceLimitStatus = device?.distance_limit_status?.state
     if (distanceLimitStatus === DistanceLimitStatusEnum.UNSET) {
-      deviceSetting[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].value = "关闭"
+      deviceSetting.value[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].value = "关闭"
     } else if (distanceLimitStatus === DistanceLimitStatusEnum.SET) {
       const distanceLimit = device?.distance_limit_status?.distance_limit
       if (distanceLimit) {
-        deviceSetting[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].value =
+        deviceSetting.value[DeviceSettingKeyEnum.DISTANCE_LIMIT_SET].value =
           distanceLimit + Unit_M
       } else {
-        deviceSetting[
+        deviceSetting.value[
           DeviceSettingKeyEnum.DISTANCE_LIMIT_SET
         ].value = DEFAULT_PLACEHOLDER
       }
     } else {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.DISTANCE_LIMIT_SET
       ].value = DEFAULT_PLACEHOLDER
     }
   }
-  deviceSetting[
+  deviceSetting.value[
     DeviceSettingKeyEnum.DISTANCE_LIMIT_SET
   ].trueValue = distanceLimitStatus
 
   // 避障
   if (isNil(device?.obstacle_avoidance)) {
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
     ].editable = false
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
     ].value = DEFAULT_PLACEHOLDER
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
     ].trueValue = DEFAULT_PLACEHOLDER
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
     ].editable = false
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
     ].value = DEFAULT_PLACEHOLDER
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
     ].trueValue = DEFAULT_PLACEHOLDER
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
     ].editable = false
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
     ].value = DEFAULT_PLACEHOLDER
-    deviceSetting[
+    deviceSetting.value[
       DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
     ].trueValue = DEFAULT_PLACEHOLDER
   } else {
     const { horizon, upside, downside } = device.obstacle_avoidance || {}
     if (isNil(horizon)) {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
       ].editable = false
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
       ].value = DEFAULT_PLACEHOLDER
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
       ].trueValue = DEFAULT_PLACEHOLDER
     } else {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
       ].editable = false
       if (horizon === ObstacleAvoidanceStatusEnum.CLOSE) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON].value =
           "关闭"
       } else if (horizon === ObstacleAvoidanceStatusEnum.OPEN) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON].value =
           "开启"
       } else {
-        deviceSetting[
+        deviceSetting.value[
           DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
         ].value = DEFAULT_PLACEHOLDER
       }
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_HORIZON
       ].trueValue = horizon
     }
 
     if (isNil(upside)) {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
       ].editable = false
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
       ].value = DEFAULT_PLACEHOLDER
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
       ].trueValue = DEFAULT_PLACEHOLDER
     } else {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
       ].editable = false
       if (upside === ObstacleAvoidanceStatusEnum.CLOSE) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE].value =
           "关闭"
       } else if (upside === ObstacleAvoidanceStatusEnum.OPEN) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE].value =
           "开启"
       } else {
-        deviceSetting[
+        deviceSetting.value[
           DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
         ].value = DEFAULT_PLACEHOLDER
       }
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_UPSIDE
       ].trueValue = upside
     }
 
     if (isNil(downside)) {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
       ].editable = false
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
       ].value = DEFAULT_PLACEHOLDER
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
       ].trueValue = DEFAULT_PLACEHOLDER
     } else {
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
       ].editable = false
       if (downside === ObstacleAvoidanceStatusEnum.CLOSE) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE].value =
           "关闭"
       } else if (downside === ObstacleAvoidanceStatusEnum.OPEN) {
-        deviceSetting[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE].value =
+        deviceSetting.value[DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE].value =
           "开启"
       } else {
-        deviceSetting[
+        deviceSetting.value[
           DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
         ].value = DEFAULT_PLACEHOLDER
       }
-      deviceSetting[
+      deviceSetting.value[
         DeviceSettingKeyEnum.OBSTACLE_AVOIDANCE_DOWNSIDE
       ].trueValue = downside
     }
   }
-  return deviceSetting
+  return deviceSetting.value
 }
 
 // 更新formModel
@@ -219,8 +220,9 @@
   deviceSettingFormModelFromOsd,
   deviceInfo
 ) {
-  const { device, dock, gateway } = deviceInfo || {}
-  if (!deviceSettingFormModelFromOsd) {
+  // const { device, dock, gateway } = deviceInfo || {}
+  let device = deviceInfo?? {}
+  if (!deviceSettingFormModelFromOsd.value) {
     return
   }
   // 夜航灯
@@ -229,17 +231,17 @@
     !isNil(nightLightsState) &&
     nightLightsState === NightLightsStateEnum.OPEN
   ) {
-    deviceSettingFormModelFromOsd.nightLightsState = true
+    deviceSettingFormModelFromOsd.value.nightLightsState = true
   } else {
-    deviceSettingFormModelFromOsd.nightLightsState = false
+    deviceSettingFormModelFromOsd.value.nightLightsState = false
   }
 
   // 限高
   const heightLimit = device?.height_limit
   if (isNil(heightLimit) || heightLimit === 0) {
-    deviceSettingFormModelFromOsd.heightLimit = 20
+    deviceSettingFormModelFromOsd.value.heightLimit = 20
   } else {
-    deviceSettingFormModelFromOsd.heightLimit = heightLimit
+    deviceSettingFormModelFromOsd.value.heightLimit = heightLimit
   }
 
   // 限远
@@ -248,36 +250,36 @@
     !isNil(distanceLimitStatus) &&
     distanceLimitStatus === DistanceLimitStatusEnum.SET
   ) {
-    deviceSettingFormModelFromOsd.distanceLimitStatus.state = true
-    deviceSettingFormModelFromOsd.distanceLimitStatus.distanceLimit =
+    deviceSettingFormModelFromOsd.value.distanceLimitStatus.state = true
+    deviceSettingFormModelFromOsd.value.distanceLimitStatus.distanceLimit =
       device?.distance_limit_status?.distance_limit || 15
   } else {
-    deviceSettingFormModelFromOsd.distanceLimitStatus.state = false
-    deviceSettingFormModelFromOsd.distanceLimitStatus.distanceLimit = 15
+    deviceSettingFormModelFromOsd.value.distanceLimitStatus.state = false
+    deviceSettingFormModelFromOsd.value.distanceLimitStatus.distanceLimit = 15
   }
 
   // 避障
   if (isNil(device?.obstacle_avoidance)) {
-    deviceSettingFormModelFromOsd.obstacleAvoidanceHorizon = false
-    deviceSettingFormModelFromOsd.obstacleAvoidanceUpside = false
-    deviceSettingFormModelFromOsd.obstacleAvoidanceDownside = false
+    deviceSettingFormModelFromOsd.value.obstacleAvoidanceHorizon = false
+    deviceSettingFormModelFromOsd.value.obstacleAvoidanceUpside = false
+    deviceSettingFormModelFromOsd.value.obstacleAvoidanceDownside = false
   } else {
     const { horizon, upside, downside } = device.obstacle_avoidance || {}
     if (!isNil(horizon) && horizon === ObstacleAvoidanceStatusEnum.OPEN) {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceHorizon = true
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceHorizon = true
     } else {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceHorizon = false
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceHorizon = false
     }
     if (!isNil(upside) && upside === ObstacleAvoidanceStatusEnum.OPEN) {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceUpside = true
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceUpside = true
     } else {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceUpside = false
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceUpside = false
     }
     if (!isNil(downside) && downside === ObstacleAvoidanceStatusEnum.OPEN) {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceDownside = true
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceDownside = true
     } else {
-      deviceSettingFormModelFromOsd.obstacleAvoidanceDownside = false
+      deviceSettingFormModelFromOsd.value.obstacleAvoidanceDownside = false
     }
   }
-  return deviceSettingFormModelFromOsd
+  return deviceSettingFormModelFromOsd.value
 }
diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index 9aac805..c4ca19c 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -74,6 +74,11 @@
                   <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-collection" v-if="permission.fly_device_offline"
                         @click.stop="rollFirmware(scope.row)">固件版本管理</el-button>
                   </el-dropdown-item>
+                  <el-dropdown-item command="d">
+                    <el-button type="primary" text icon="el-icon-collection" v-if="!scope.row.status" @click.stop="dockNotLine(scope.row)">
+                      {{ scope.row.hidden_flag == 1 ? '设备上线' : '设备下线'}}
+                    </el-button>
+                  </el-dropdown-item>
                   <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-document-delete" v-if="permission.fly_device_offline"
                     @click.stop="handleDeviceOffline(scope.row)">注销</el-button>
                   </el-dropdown-item>
@@ -190,7 +195,8 @@
   ota,
   getDeviceFirmwareList,
   getDevices,
-  deviceOffline
+  deviceOffline,
+  devicesUpdate
 } from '@/api/device/device'
 import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
 import { getListPage as getOssList } from '@/api/resource/oss'
@@ -280,6 +286,7 @@
         searchMenuSpan: 6,
         border: true,
         index: true,
+        indexLabel: '序号',
         viewBtn: true,
         delBtn: false,
         selection: true,
@@ -295,14 +302,15 @@
           {
             label: '设备类型',
             prop: 'domain',
-            editDisabled: true,
+            editDisabled: false,
             editDisplay: false, //编辑显示
-            viewDisplay: true, //查看显示
+            viewDisplay: false, //查看显示
             search: false,
             slot: true,
             searchSpan: 4,
             labelWidth: 130,
             width: 120,
+            // formatter: (row) => row.domain == 3 ? '机巢' : '无人机'
             // rules: [
             //   {
             //     required: true,
@@ -310,6 +318,16 @@
             //     trigger: 'blur',
             //   },
             // ],
+          },
+          {
+            label: '设备类型',
+            prop: 'domainTxt',
+            editDisabled: true,
+            editDisplay: false, //编辑显示
+            viewDisplay: true, //查看显示
+            labelWidth: 130,
+            width: 120,
+            hide: true
           },
           {
             label: '设备型号',
@@ -361,7 +379,7 @@
             label: '设备名称',
             prop: 'nickname',
             labelWidth: 130,
-            width: 100,
+            width: 160,
             searchSpan: 4,
             search: true,
             overHidden: true,
@@ -382,7 +400,7 @@
             editDisplay: false, //编辑显示
             viewDisplay: false, //查看显示
             labelWidth: 130,
-            width: 100,
+            width: 200,
           },
           {
             label: '设备位置',
@@ -459,12 +477,12 @@
           //     },
           //   ],
           // },
-          
+
           {
             label: '负载设备',
             prop: 'payload_str',
             labelWidth: 130,
-            width: 100,
+            width: 160,
             overHidden: true,
             editDisabled: true,
             // rules: [
@@ -608,13 +626,14 @@
           //     },
           //   ],
           // },
-          
+
 
           {
-            hide: true,
+            // hide: true,
             label: '保险有效期',
             prop: 'duration_of_insurance',
             labelWidth: 130,
+            width: 160,
             type: 'daterange',
             format: 'YYYY-MM-DD',
             valueFormat: 'YYYY-MM-DD HH:mm:ss',
@@ -926,6 +945,27 @@
         that.$refs.firmwareManage.init(row)
       })
     },
+    // 设备下线
+    dockNotLine(row) {
+      let txt = row.hidden_flag === 1?'上线':'下线'
+      ElMessageBox.confirm(`确定${txt}该设备吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          let hidden_flag = row.hidden_flag === 1?0:1
+          devicesUpdate({id:row.id, hidden_flag:hidden_flag})
+            .then(res => {
+              ElMessage.success('下线成功')
+              this.init()
+            })
+            .catch(error => {
+              ElMessage.error('下线失败')
+            })
+        })
+        .catch(() => { })
+    },
     // 版本回退点击事件
     rollFirmware (row) {
       if (row.status == 0) {
@@ -1204,7 +1244,9 @@
         insure_start_time: row.duration_of_insurance[0],
         insure_expired_time: row.duration_of_insurance[1],
       }
-
+      if (submitData.traffic_expire_time === '') {
+        delete submitData.traffic_expire_time
+      }
       delete submitData.duration_of_insurance
 
       update(submitData).then(
@@ -1306,7 +1348,8 @@
             area_code: await this.getFullAreaCode(data.area_code),
             area_name: this.form.area_name,
             cnmode_code: this.getDockModeText(this.form.mode_code),
-            domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
+            // domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
+            domainTxt: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
             cnstatus: this.form.status === false ? '离线' : '在线',
             duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || ''],
           }
@@ -1349,6 +1392,7 @@
           if (e.firmware_status == 4) {
             this.connectWebSocket(e)
           }
+          e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
         })
         this.data = data.records
         this.loading = false
diff --git a/src/views/device/components/DeviceSettingBox.vue b/src/views/device/components/DeviceSettingBox.vue
index 92a4b44..1b25451 100644
--- a/src/views/device/components/DeviceSettingBox.vue
+++ b/src/views/device/components/DeviceSettingBox.vue
@@ -312,7 +312,7 @@
 </template>
 
 <script setup>
-import { defineProps, ref, watch } from 'vue';
+import { defineProps, inject, ref, watch } from 'vue';
 import { ELocalStorageKey } from '@/types'
 import { cloneDeep } from 'lodash';
 import { initDeviceSetting, initDeviceSettingFormModel, DeviceSettingKeyEnum } from '@/types/device-setting';
@@ -326,16 +326,19 @@
 // const props = defineProps();
 const props = defineProps(['sn', 'deviceInfo'])
 
-const deviceSetting = ref(cloneDeep(initDeviceSetting));
-const deviceSettingFormModelFromOsd = ref(cloneDeep(initDeviceSettingFormModel));
+// const deviceSetting = ref(cloneDeep(initDeviceSetting));
+// const deviceSettingFormModelFromOsd = ref(cloneDeep(initDeviceSettingFormModel));
 const deviceSettingFormModel = ref(cloneDeep(initDeviceSettingFormModel)); // 真实使用的formModel
 
+const deviceSetting = inject('deviceSetting')
+const deviceSettingFormModelFromOsd = inject('deviceSettingFormModelFromOsd')
 // 根据设备osd信息更新信息
 watch(
   () => props.deviceInfo,
   value => {
-    updateDeviceSettingInfoByOsd(deviceSetting.value, value);
-    updateDeviceSettingFormModelByOsd(deviceSettingFormModelFromOsd.value, value);
+    // console.log('9999',value)
+    // updateDeviceSettingInfoByOsd(deviceSetting, value);
+    // updateDeviceSettingFormModelByOsd(deviceSettingFormModelFromOsd, value);
     // console.log('deviceInfo', value)
   },
   {
diff --git a/src/views/device/components/DockControlPanel.vue b/src/views/device/components/DockControlPanel.vue
index cf2eb78..bc4a330 100644
--- a/src/views/device/components/DockControlPanel.vue
+++ b/src/views/device/components/DockControlPanel.vue
@@ -82,6 +82,8 @@
 import { cmdList as baseCmdList } from '@/types/device-cmd'
 import { useDockControl } from './use-dock-control'
 import { EDockModeCode } from '@/types/device'
+import { updateDeviceSettingFormModelByOsd, updateDeviceSettingInfoByOsd } from '@/utils/device-setting';
+import { initDeviceSetting, initDeviceSettingFormModel } from '@/types/device-setting';
 import { updateDeviceCmdInfoByOsd, updateDeviceCmdInfoByExecuteInfo } from '@/utils/device-cmd'
 import { setThermalCurrentPaletteStyle, setPhotoStorageSet, setVideoStorageSet, getLiveStatus, setStreamsSwitch, photoAndVideoCmd } from '@/api/device-setting'
 import DeviceSettingBox from './DeviceSettingBox.vue'
@@ -89,12 +91,21 @@
 import { useConnectWebSocket } from '@/utils/websocket/connect-websocket';
 import { getWebsocketUrl } from '@/utils/websocket/config';
 import EventBus from '@/utils/eventBus';
+import { cloneDeep } from 'lodash';
 
 const valueStyle = ref(0)
 const cameraModeValue = ref(0)
 const videoValue = ref("zoom")
 const photo_storage_settings = ref([])
 const video_storage_settings = ref([])
+
+
+
+let deviceSetting = ref(cloneDeep(initDeviceSetting));
+const deviceSettingFormModelFromOsd = ref(cloneDeep(initDeviceSettingFormModel));
+
+provide('deviceSetting', deviceSetting)
+provide('deviceSettingFormModelFromOsd', deviceSettingFormModelFromOsd)
 
 // 定义一个数据videoList
 const videoList = reactive([])
@@ -222,7 +233,7 @@
 watch(
   () => Store.getters.deviceState,
   value => {
-    // console.log('设备状态变化', value)
+    // console.log('设备状态变化', value.deviceInfo[props.deviceInfo.child_sn])
     if (props.sn && (value.currentSn === props.deviceInfo.child_sn || value.currentSn === props.deviceInfo.device_sn)) {
       debugStatus.value = value.dockInfo[props.deviceInfo.device_sn]?.basic_osd?.mode_code === EDockModeCode.Remote_Debugging
       const devices = {}
@@ -240,6 +251,9 @@
       }
       deviceInfo = ref(value.deviceInfo[props.deviceInfo.child_sn])
       updateDeviceCmdInfoByOsd(cmdList.value, devices)
+      // by cpz
+      updateDeviceSettingInfoByOsd(deviceSetting, value.deviceInfo[props.deviceInfo.child_sn]);
+      updateDeviceSettingFormModelByOsd(deviceSettingFormModelFromOsd, value.deviceInfo[props.deviceInfo.child_sn])
     }
   },
   {
diff --git a/src/views/device/components/use-device-setting.js b/src/views/device/components/use-device-setting.js
index c1d803f..258c6bf 100644
--- a/src/views/device/components/use-device-setting.js
+++ b/src/views/device/components/use-device-setting.js
@@ -52,20 +52,15 @@
   // 设置设备属性
   async function setDeviceProps(sn, body) {
     try {
-      const { code, message: msg } = await putDeviceProps(sn, body);
-      console.log(code,messages)
-      if (code === 0) {
-        ElMessage({
-          message: '设备属性设置成功!',
-          type: 'success',
-        });
-      }
-      throw msg;
+       await putDeviceProps(sn, body).then(res => {
+         if (res.data.code === 0) {
+           ElMessage({
+             message: '设备属性设置成功!',
+             type: 'success',
+           });
+         }
+      });
     } catch (e) {
-      // ElMessage({
-      //   message: '设备属性设置失败',
-      //   type: 'error',
-      // });
       return false;
     }
   }
diff --git a/src/views/odm/task.vue b/src/views/odm/task.vue
index dd25b5b..eb76d57 100644
--- a/src/views/odm/task.vue
+++ b/src/views/odm/task.vue
@@ -100,6 +100,7 @@
             label: '任务名称',
             prop: 'taskName',
             search: true,
+            labelWidth: 130,
             searchSpan: 4,
             searchLabelWidth: 100,
             //labelWidth: 130,
@@ -176,6 +177,7 @@
             prop: 'airportName',
             searchSpan: 4,
             searchLabelWidth: 100,
+            labelWidth: 130,
             //search: true,
           },
           {
@@ -204,6 +206,7 @@
             searchSpan: 4,
             searchLabelWidth: 100,
             searchPlaceholder: '任务状态',
+            labelWidth: 130,
             width: 90,
             dicData: [
               { label: '待启动', value: 0 },

--
Gitblit v1.9.3