Commit d3ffe4675651747cd2faee1115af59bd828c7ca7
Merge branch 'perf/device-update' into 'main_dev'
perf: 优化修改产品时变更子设备绑定的网关产品时默认选择第一项 See merge request yunteng/thingskit-front!1137
Showing
1 changed file
with
12 additions
and
1 deletions
| @@ -348,7 +348,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -348,7 +348,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 348 | popconfirmTitle: () => | 348 | popconfirmTitle: () => |
| 349 | updateOrgHelpMessage.map((text) => h('div', { style: { maxWidth: '240px' } }, text)), | 349 | updateOrgHelpMessage.map((text) => h('div', { style: { maxWidth: '240px' } }, text)), |
| 350 | }), | 350 | }), |
| 351 | - componentProps: ({ formModel }) => { | 351 | + componentProps: ({ formModel, formActionType }) => { |
| 352 | return { | 352 | return { |
| 353 | component: 'OrgTreeSelect', | 353 | component: 'OrgTreeSelect', |
| 354 | defaultLockStatus: !!formModel?.isUpdate, | 354 | defaultLockStatus: !!formModel?.isUpdate, |
| @@ -358,6 +358,17 @@ export const step1Schemas: FormSchema[] = [ | @@ -358,6 +358,17 @@ export const step1Schemas: FormSchema[] = [ | ||
| 358 | organizationId: formModel?.sensorOrganizationId, | 358 | organizationId: formModel?.sensorOrganizationId, |
| 359 | }, | 359 | }, |
| 360 | }, | 360 | }, |
| 361 | + onOptionsChange: (options: Recordable[]) => { | ||
| 362 | + if (!formModel?.organizationId && formModel?.deviceType === DeviceTypeEnum.SENSOR) { | ||
| 363 | + const firstItem = options?.[0]; | ||
| 364 | + | ||
| 365 | + if (firstItem && firstItem?.id) { | ||
| 366 | + const { setFieldsValue, clearValidate } = formActionType; | ||
| 367 | + setFieldsValue({ organizationId: firstItem.id }); | ||
| 368 | + clearValidate('organizationId'); | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + }, | ||
| 361 | }, | 372 | }, |
| 362 | }; | 373 | }; |
| 363 | }, | 374 | }, |