From 5808f76456ca0d40de5074f132b73a5a488e3e13 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 09 Dec 2025 09:12:03 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.1' into test

---
 src/views/device/components/DockControlPanel.vue |   57 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/views/device/components/DockControlPanel.vue b/src/views/device/components/DockControlPanel.vue
index c56b9a2..e51976b 100644
--- a/src/views/device/components/DockControlPanel.vue
+++ b/src/views/device/components/DockControlPanel.vue
@@ -3,7 +3,7 @@
     <!-- title -->
 
     <!-- setting -->
-    <!-- <DeviceSettingBox :sn="props.sn" :deviceInfo="props.deviceInfo"></DeviceSettingBox> -->
+    <DeviceSettingBox :sn="props.sn" :deviceInfo="props.deviceInfo"></DeviceSettingBox>
     <!-- cmd -->
     <div class="control-cmd-wrapper">
       <div class="control-cmd-header">
@@ -26,7 +26,7 @@
           </div>
         </div>
       </div>
-      
+
       <el-divider v-if="deviceInfo">无人机设置</el-divider>
       <div class="control-cmd-box" v-for="(item, index) in cameras">
         <div>
@@ -54,7 +54,7 @@
           </el-form-item>
 
           <el-form-item label="照片存储设置" v-if="cameraModeValue == 0">
-            <el-select v-model="item.photo_storage_settings" collapse-tags @change="photoStorageTypeChang($event, item)"
+            <el-select v-model="photo_storage_settings" collapse-tags @change="photoStorageTypeChang($event, item)"
               multiple placeholder="请选择">
               <el-option v-for="item in photoStorageType" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
@@ -62,7 +62,7 @@
           </el-form-item>
 
           <el-form-item label="视频存储设置" v-if="cameraModeValue == 1">
-            <el-select v-model="item.video_storage_settings" collapse-tags @change="videoStorageTypeChang($event, item)"
+            <el-select v-model="video_storage_settings" collapse-tags @change="videoStorageTypeChang($event, item)"
               multiple placeholder="请选择">
               <el-option v-for="item in photoStorageType" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
@@ -77,22 +77,35 @@
 
 <script setup>
 import { ElMessage } from 'element-plus';
-import EventBus from '@/event-bus'
 import { EBizCode, ELocalStorageKey, ERouterName } from '@/types'
-import { useConnectWebSocket } from '@/hooks/use-connect-websocket'
-import { getWebsocketUrl } from '@/websocket/util/config'
 import { defineProps, ref, watch, reactive } from 'vue'
 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'
 import Store from '@/store'
+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([])
@@ -220,7 +233,8 @@
 watch(
   () => Store.getters.deviceState,
   value => {
-    // console.log('设备状态变化', 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 = {}
@@ -233,9 +247,14 @@
       // 判断cameras列表长度是否为0,如果为0,则不执行后续操作
       if (cameras.length > 0) {
         cameraModeValue.value = cameras[0].camera_mode
+        photo_storage_settings.value = cameras[0]?.photo_storage_settings ?? [];
+        video_storage_settings.value = cameras[0]?.video_storage_settings ?? [];
       }
       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])
     }
   },
   {
@@ -244,6 +263,9 @@
   }
 )
 onMounted(() => {
+  const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + props.deviceInfo.workspace_id
+  // 监听ws 消息
+  useConnectWebSocket(messageHandler, webSorketUrl)
   getLiveStatuss()
 });
 
@@ -288,13 +310,11 @@
     action: cmdItem.action,
   }
   const success = await sendDockControlCmd(params, true)
-  if (success) {
-    updateDeviceSingleCmdInfo(cmdList.value[index])
-  }
 }
 
 // webSocket 监听
 const messageHandler = async payload => {
+  payload = JSON.parse(payload)
   if (!payload) {
     return
   }
@@ -380,9 +400,6 @@
   }
 }
 
-const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + props.deviceInfo.workspace_id
-// 监听ws 消息
-useConnectWebSocket(messageHandler, webSorketUrl)
 
 // 添加 changs 方法
 async function changs(value, item) {
@@ -463,9 +480,10 @@
   border-radius: 2px;
 
   .control-cmd-wrapper {
+    font-size: 14px;
     .control-cmd-header {
       font-size: 14px;
-      font-weight: 600;
+      //font-weight: 600;
       padding: 10px 10px 0px;
 
       .debug-btn {
@@ -496,7 +514,10 @@
           flex-direction: column;
 
           .item-label {
-            font-weight: 700;
+            //font-weight: 700;
+          }
+          .item-status {
+            color: #8d8b8b;
           }
         }
       }
@@ -528,4 +549,4 @@
     }
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3