From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改

---
 src/views/device/components/DockControlPanel.vue |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/src/views/device/components/DockControlPanel.vue b/src/views/device/components/DockControlPanel.vue
index 6a8d389..bc4a330 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">
@@ -77,24 +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([])
@@ -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])
     }
   },
   {
@@ -248,6 +262,9 @@
   }
 )
 onMounted(() => {
+  const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + props.deviceInfo.workspace_id
+  // 监听ws 消息
+  useConnectWebSocket(messageHandler, webSorketUrl)
   getLiveStatuss()
 });
 
@@ -292,13 +309,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
   }
@@ -384,9 +399,6 @@
   }
 }
 
-const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + props.deviceInfo.workspace_id
-// 监听ws 消息
-useConnectWebSocket(messageHandler, webSorketUrl)
 
 // 添加 changs 方法
 async function changs(value, item) {
@@ -532,4 +544,4 @@
     }
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3