无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
src/views/device/components/DeviceSettingBox.vue
@@ -312,7 +312,8 @@
</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';
import {
@@ -325,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)
  },
  {
@@ -352,11 +356,11 @@
  deviceSetting.value[settingKey].popConfirm.visible = false;
}
async function onConfirm(settingKey) {
async function onConfirm(settingKey,) {
  deviceSetting.value[settingKey].popConfirm.loading = true;
  const body = genDevicePropsBySettingKey(settingKey, deviceSettingFormModel.value);
  console.log(body, '顶顶顶顶顶')
  await setDeviceProps(props.sn, body);
  localStorage.setItem(ELocalStorageKey.WorkspaceId, props.deviceInfo.workspace_id)
  await setDeviceProps(props.sn, props.deviceInfo.workspace_id, body);
  deviceSetting.value[settingKey].popConfirm.loading = false;
  deviceSetting.value[settingKey].popConfirm.visible = false;
}
@@ -367,7 +371,7 @@
<style lang="scss" scoped>
.device-setting-wrapper {
  border-bottom: 1px solid #515151;
  //border-bottom: 1px solid #515151;
  .device-setting-header {
    font-size: 14px;