Commit a2db471713ff8618c3386ab81bb48ef9d8d614a1

Authored by xp.Huang
2 parents d228a191 2d6c34c6

Merge branch 'ww' into 'main'

fix:  in teambition bug && pref device list page new add device select device configuration automatically link device type

See merge request huang/yun-teng-iot-front!374
@@ -34,10 +34,30 @@ export const step1Schemas: FormSchema[] = [ @@ -34,10 +34,30 @@ export const step1Schemas: FormSchema[] = [
34 slot: 'snCode', 34 slot: 'snCode',
35 }, 35 },
36 { 36 {
  37 + field: 'profileId',
  38 + label: '设备配置',
  39 + required: true,
  40 + component: 'ApiSelect',
  41 + componentProps: ({ formActionType }) => {
  42 + const { setFieldsValue } = formActionType;
  43 + return {
  44 + api: deviceProfile,
  45 + labelField: 'name',
  46 + valueField: 'id',
  47 + onChange(_value: string, option: { deviceType: string }) {
  48 + const { deviceType } = option;
  49 + setFieldsValue({ deviceType: deviceType });
  50 + },
  51 + };
  52 + },
  53 + },
  54 + {
37 field: 'deviceType', 55 field: 'deviceType',
38 label: '设备类型', 56 label: '设备类型',
39 required: true, 57 required: true,
40 component: 'ApiSelect', 58 component: 'ApiSelect',
  59 + dynamicDisabled: true,
  60 + helpMessage: ['选择设备配置,自动关联设备类型'],
41 componentProps: { 61 componentProps: {
42 placeholder: '设备类型', 62 placeholder: '设备类型',
43 api: findDictItemByCode, 63 api: findDictItemByCode,
@@ -67,17 +87,7 @@ export const step1Schemas: FormSchema[] = [ @@ -67,17 +87,7 @@ export const step1Schemas: FormSchema[] = [
67 }, 87 },
68 ifShow: ({ values }) => isGateWay(values.deviceType), 88 ifShow: ({ values }) => isGateWay(values.deviceType),
69 }, 89 },
70 - {  
71 - field: 'profileId',  
72 - label: '设备配置',  
73 - required: true,  
74 - component: 'ApiSelect',  
75 - componentProps: {  
76 - api: deviceProfile,  
77 - labelField: 'name',  
78 - valueField: 'id',  
79 - },  
80 - }, 90 +
81 { 91 {
82 field: 'organizationId', 92 field: 'organizationId',
83 label: '所属组织', 93 label: '所属组织',
@@ -34,18 +34,30 @@ @@ -34,18 +34,30 @@
34 @change="handleChange" 34 @change="handleChange"
35 > 35 >
36 <TabPane forceRender key="1" tab="设备配置"> 36 <TabPane forceRender key="1" tab="设备配置">
37 - <DeviceConfigurationStep  
38 - :ifShowBtn="isViewDetail ? false : true"  
39 - v-show="activeKey === '1'"  
40 - ref="DevConStRef"  
41 - /> 37 + <div class="relative">
  38 + <DeviceConfigurationStep
  39 + :ifShowBtn="isViewDetail ? false : true"
  40 + v-show="activeKey === '1'"
  41 + ref="DevConStRef"
  42 + />
  43 + <div
  44 + v-show="isViewDetail"
  45 + class="absolute w-full h-full top-0 cursor-not-allowed"
  46 + ></div>
  47 + </div>
42 </TabPane> 48 </TabPane>
43 <TabPane forceRender key="2" tab="传输配置"> 49 <TabPane forceRender key="2" tab="传输配置">
44 - <TransportConfigurationStep  
45 - :ifShowBtn="isViewDetail ? false : true"  
46 - v-show="activeKey === '2'"  
47 - ref="TransConStRef"  
48 - /> 50 + <div class="relative">
  51 + <TransportConfigurationStep
  52 + :ifShowBtn="isViewDetail ? false : true"
  53 + v-show="activeKey === '2'"
  54 + ref="TransConStRef"
  55 + />
  56 + <div
  57 + v-show="isViewDetail"
  58 + class="absolute w-full h-full top-0 cursor-not-allowed"
  59 + ></div>
  60 + </div>
49 </TabPane> 61 </TabPane>
50 <TabPane forceRender key="3" v-show="activeKey === '3'" tab="物模型管理"> 62 <TabPane forceRender key="3" v-show="activeKey === '3'" tab="物模型管理">
51 <PhysicalModelManagementStep v-show="activeKey === '3'" ref="PhysicalModManRef" /> 63 <PhysicalModelManagementStep v-show="activeKey === '3'" ref="PhysicalModManRef" />
@@ -293,7 +293,7 @@ @@ -293,7 +293,7 @@
293 } 293 }
294 294
295 const handleSetDefault = async (record: Recordable) => { 295 const handleSetDefault = async (record: Recordable) => {
296 - let id = record.id; 296 + let id = record.tbProfileId;
297 const data = await setDeviceProfileIsDefaultApi(id, 'default', defaultObj); 297 const data = await setDeviceProfileIsDefaultApi(id, 'default', defaultObj);
298 if (!data) return createMessage.error('设置该设备配置为默认失败'); 298 if (!data) return createMessage.error('设置该设备配置为默认失败');
299 createMessage.success('设置该设备配置为默认成功'); 299 createMessage.success('设置该设备配置为默认成功');