Commit 0c06ba918fe7628f9b52bb1df09d43286341b950
Merge branch 'fix/DEFECT-1653' into 'main_dev'
fix: 修复导入设备,切换选择的组织没有清空上个组织下的网关设备 See merge request yunteng/thingskit-front!927
Showing
1 changed file
with
13 additions
and
2 deletions
| @@ -109,7 +109,8 @@ export const basicInfoForm: FormSchema[] = [ | @@ -109,7 +109,8 @@ export const basicInfoForm: FormSchema[] = [ | ||
| 109 | label: '所属组织', | 109 | label: '所属组织', |
| 110 | component: 'ApiTreeSelect', | 110 | component: 'ApiTreeSelect', |
| 111 | rules: [{ required: true, message: '所属组织为必填项' }], | 111 | rules: [{ required: true, message: '所属组织为必填项' }], |
| 112 | - componentProps: () => { | 112 | + componentProps: ({ formModel, formActionType }) => { |
| 113 | + const { setFieldsValue } = formActionType; | ||
| 113 | return { | 114 | return { |
| 114 | maxLength: 250, | 115 | maxLength: 250, |
| 115 | placeholder: '请选择所属组织', | 116 | placeholder: '请选择所属组织', |
| @@ -119,6 +120,11 @@ export const basicInfoForm: FormSchema[] = [ | @@ -119,6 +120,11 @@ export const basicInfoForm: FormSchema[] = [ | ||
| 119 | return data; | 120 | return data; |
| 120 | }, | 121 | }, |
| 121 | getPopupContainer: () => document.body, | 122 | getPopupContainer: () => document.body, |
| 123 | + onChange(e) { | ||
| 124 | + if (e != formModel?.[FieldsEnum.ORGANIZATION_ID]) { | ||
| 125 | + setFieldsValue({ [FieldsEnum.GATEWAY_TB_DEVICE_ID]: null }); | ||
| 126 | + } | ||
| 127 | + }, | ||
| 122 | }; | 128 | }; |
| 123 | }, | 129 | }, |
| 124 | }, | 130 | }, |
| @@ -193,7 +199,12 @@ export const basicInfoForm: FormSchema[] = [ | @@ -193,7 +199,12 @@ export const basicInfoForm: FormSchema[] = [ | ||
| 193 | deviceType: DeviceTypeEnum.GATEWAY, | 199 | deviceType: DeviceTypeEnum.GATEWAY, |
| 194 | organizationId, | 200 | organizationId, |
| 195 | }); | 201 | }); |
| 196 | - return result; | 202 | + return result.map((item) => { |
| 203 | + return { | ||
| 204 | + ...item, | ||
| 205 | + name: item.alias || item.name, | ||
| 206 | + }; | ||
| 207 | + }); | ||
| 197 | } catch (error) { | 208 | } catch (error) { |
| 198 | return []; | 209 | return []; |
| 199 | } | 210 | } |