Commit 1a7682726afe0ee5e15f8aa39e67a43ef3a338c7
1 parent
efb2ef3e
fix: DEFECT-994 gateway device options incomplete on select sensor device
Showing
2 changed files
with
13 additions
and
5 deletions
@@ -80,10 +80,9 @@ export const deleteDevice = (ids: string[]) => { | @@ -80,10 +80,9 @@ export const deleteDevice = (ids: string[]) => { | ||
80 | * 查询设备配置 | 80 | * 查询设备配置 |
81 | * @param params pageSize page name | 81 | * @param params pageSize page name |
82 | */ | 82 | */ |
83 | -export const deviceProfile = (params) => { | ||
84 | - return defHttp.get({ | 83 | +export const deviceProfile = () => { |
84 | + return defHttp.get<DeviceRecord[]>({ | ||
85 | url: DeviceManagerApi.DEVICE_PROFILE_URL_ME, | 85 | url: DeviceManagerApi.DEVICE_PROFILE_URL_ME, |
86 | - params, | ||
87 | }); | 86 | }); |
88 | }; | 87 | }; |
89 | 88 |
@@ -62,10 +62,18 @@ export const step1Schemas: FormSchema[] = [ | @@ -62,10 +62,18 @@ export const step1Schemas: FormSchema[] = [ | ||
62 | label: '所属产品', | 62 | label: '所属产品', |
63 | required: true, | 63 | required: true, |
64 | component: 'ApiSelect', | 64 | component: 'ApiSelect', |
65 | - componentProps: ({ formActionType }) => { | 65 | + componentProps: ({ formActionType, formModel }) => { |
66 | const { setFieldsValue } = formActionType; | 66 | const { setFieldsValue } = formActionType; |
67 | return { | 67 | return { |
68 | - api: deviceProfile, | 68 | + api: async () => { |
69 | + const options = await deviceProfile(); | ||
70 | + const { profileId } = formModel; | ||
71 | + if (profileId) { | ||
72 | + const selectRecord = options.find((item) => item.tbProfileId === profileId); | ||
73 | + selectRecord && setFieldsValue({ transportType: selectRecord!.transportType }); | ||
74 | + } | ||
75 | + return options; | ||
76 | + }, | ||
69 | labelField: 'name', | 77 | labelField: 'name', |
70 | valueField: 'tbProfileId', | 78 | valueField: 'tbProfileId', |
71 | onChange( | 79 | onChange( |
@@ -148,6 +156,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -148,6 +156,7 @@ export const step1Schemas: FormSchema[] = [ | ||
148 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | 156 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, |
149 | componentProps: ({ formModel }) => { | 157 | componentProps: ({ formModel }) => { |
150 | const { organizationId, transportType } = formModel; | 158 | const { organizationId, transportType } = formModel; |
159 | + if (![organizationId, transportType].every(Boolean)) return {}; | ||
151 | return { | 160 | return { |
152 | api: getGatewayDevice, | 161 | api: getGatewayDevice, |
153 | showSearch: true, | 162 | showSearch: true, |