Commit 7e31d3aa33c50f23922a90c9bc472446d26bd0ea

Authored by xp.Huang
2 parents 64735627 da2f608d

Merge branch 'ww' into 'main'

fix: DEFECT-981 update product profile happend error

See merge request huang/yun-teng-iot-front!442
@@ -162,10 +162,10 @@ @@ -162,10 +162,10 @@
162 ...postSubmitFormData.deviceConfData, 162 ...postSubmitFormData.deviceConfData,
163 ...{ transportType: !isEmptyObj ? transportTypeStr.value : 'DEFAULT' }, 163 ...{ transportType: !isEmptyObj ? transportTypeStr.value : 'DEFAULT' },
164 ...{ profileData: !isEmptyObj ? transportConfData.profileData : null }, 164 ...{ profileData: !isEmptyObj ? transportConfData.profileData : null },
165 - ...{ id: isUpdate.value ? null : isEditId.value },  
166 - ...{ createTime: isUpdate.value ? null : isEditCreatTime.value }, 165 + ...{ id: isUpdate.value ? isEditId.value : null },
  166 + ...{ createTime: isUpdate.value ? isEditCreatTime.value : null },
167 }); 167 });
168 - createMessage.success(isUpdate.value ? `新增成功` : `编辑成功`); 168 + createMessage.success(isUpdate.value ? `编辑成功` : `新增成功`);
169 handleCancel(); 169 handleCancel();
170 emits('success'); 170 emits('success');
171 }; 171 };
@@ -517,7 +517,7 @@ export const actionSchema: FormSchema[] = [ @@ -517,7 +517,7 @@ export const actionSchema: FormSchema[] = [
517 colProps: { 517 colProps: {
518 span: 6, 518 span: 6,
519 }, 519 },
520 - defaultValue: 0, 520 + defaultValue: '0',
521 componentProps: ({ formActionType }) => { 521 componentProps: ({ formActionType }) => {
522 const { setFieldsValue } = formActionType; 522 const { setFieldsValue } = formActionType;
523 return { 523 return {
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 {