| | |
| | | </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 { |
| | |
| | | // 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) |
| | | }, |
| | | { |
| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | <style lang="scss" scoped> |
| | | .device-setting-wrapper { |
| | | border-bottom: 1px solid #515151; |
| | | //border-bottom: 1px solid #515151; |
| | | |
| | | .device-setting-header { |
| | | font-size: 14px; |