Commit e7a8ff3a8f703585be7b9829afc284c2c0378089

Authored by ww
1 parent 8cc19c9e

fix: DEFECT-982 checkout checked component dashboard bind device type happend change

1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 - import { ref } from 'vue'; 2 + import { ref, onMounted, unref } from 'vue';
3 import { FrontComponent } from '../../../const/const'; 3 import { FrontComponent } from '../../../const/const';
4 - import { dataSourceSchema } from '../../config/basicConfiguration'; 4 + import { DataSourceField, dataSourceSchema } from '../../config/basicConfiguration';
  5 + import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
5 import { FormActionType } from '/@/components/Form'; 6 import { FormActionType } from '/@/components/Form';
6 import BasicForm from '/@/components/Form/src/BasicForm.vue'; 7 import BasicForm from '/@/components/Form/src/BasicForm.vue';
7 const formEl = ref<Nullable<FormActionType>>(null); 8 const formEl = ref<Nullable<FormActionType>>(null);
@@ -11,6 +12,10 @@ @@ -11,6 +12,10 @@
11 }>(); 12 }>();
12 13
13 defineExpose({ formActionType: formEl }); 14 defineExpose({ formActionType: formEl });
  15 +
  16 + onMounted(() => {
  17 + unref(formEl)?.setFieldsValue({ [DataSourceField.DEVICE_TYPE]: DeviceTypeEnum.SENSOR });
  18 + });
14 </script> 19 </script>
15 20
16 <template> 21 <template>
@@ -117,7 +117,6 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { @@ -117,7 +117,6 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => {
117 component: 'ApiSelect', 117 component: 'ApiSelect',
118 label: '设备类型', 118 label: '设备类型',
119 colProps: { span: 8 }, 119 colProps: { span: 8 },
120 - defaultValue: DeviceTypeEnum.SENSOR,  
121 componentProps: ({ formActionType }) => { 120 componentProps: ({ formActionType }) => {
122 const { setFieldsValue } = formActionType; 121 const { setFieldsValue } = formActionType;
123 return { 122 return {