| | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | <script setup> |
| | | import { defineProps, ref, watch } from 'vue'; |
| | | import { DeviceInfoType } from '@/types/device'; |
| | | import { useMyStore } from '@/store'; |
| | | import { cloneDeep } from 'lodash'; |
| | | import { |
| | | initDeviceSetting, |
| | | initDeviceSettingFormModel, |
| | | DeviceSettingKeyEnum, |
| | | } from '@/types/device-setting'; |
| | | import { initDeviceSetting, initDeviceSettingFormModel } from '@/types/device-setting'; |
| | | import { |
| | | updateDeviceSettingInfoByOsd, |
| | | updateDeviceSettingFormModelByOsd, |
| | | } from '@/utils/device-setting'; |
| | | import { useDeviceSetting } from './use-device-setting'; |
| | | import DeviceSettingPopover from './DeviceSettingPopover.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | sn: string; |
| | | deviceInfo: DeviceInfoType; |
| | | }>(); |
| | | const props = defineProps(); |
| | | |
| | | const store = useMyStore(); |
| | | const deviceSetting = ref(cloneDeep(initDeviceSetting)); |
| | | const deviceSettingFormModelFromOsd = ref(cloneDeep(initDeviceSettingFormModel)); |
| | | const deviceSettingFormModel = ref(cloneDeep(initDeviceSettingFormModel)); // 真实使用的formModel |
| | |
| | | } |
| | | ); |
| | | |
| | | function onShowPopConfirm(settingKey: DeviceSettingKeyEnum) { |
| | | function onShowPopConfirm(settingKey) { |
| | | deviceSetting.value[settingKey].popConfirm.visible = true; |
| | | deviceSettingFormModel.value = cloneDeep(deviceSettingFormModelFromOsd.value); |
| | | } |
| | | |
| | | function onCancel(settingKey: DeviceSettingKeyEnum) { |
| | | function onCancel(settingKey) { |
| | | deviceSetting.value[settingKey].popConfirm.visible = false; |
| | | } |
| | | |
| | | async function onConfirm(settingKey: DeviceSettingKeyEnum) { |
| | | async function onConfirm(settingKey) { |
| | | deviceSetting.value[settingKey].popConfirm.loading = true; |
| | | const body = genDevicePropsBySettingKey(settingKey, deviceSettingFormModel.value); |
| | | await setDeviceProps(props.sn, body); |