Commit 1b919b608ebd23fdc15d99504e2502139cb34e5b
Merge branch 'fix/product-tcp-authType' into 'v1.4.0_dev'
fix: 修改创建产品时选择类型modebus时不能有数据携带选项 See merge request yunteng/thingskit-front!1353
Showing
1 changed file
with
18 additions
and
7 deletions
... | ... | @@ -58,12 +58,17 @@ export const formSchemas = (deviceTypeStr: string): FormSchema[] => { |
58 | 58 | component: 'Select', |
59 | 59 | required: true, |
60 | 60 | defaultValue: TCPProtocolTypeEnum.MODBUS_RTU, |
61 | - componentProps: { | |
62 | - options: Object.values(TCPProtocolTypeEnum).map((value) => ({ | |
63 | - label: TCPProtocolTypeNameEnum[value], | |
64 | - value, | |
65 | - })), | |
66 | - placeholder: '请选择类型', | |
61 | + componentProps({ formModel }) { | |
62 | + return { | |
63 | + options: Object.values(TCPProtocolTypeEnum).map((value) => ({ | |
64 | + label: TCPProtocolTypeNameEnum[value], | |
65 | + value, | |
66 | + })), | |
67 | + onChange() { | |
68 | + formModel[FormFieldsEnum.AuthType] = null; | |
69 | + }, | |
70 | + placeholder: '请选择类型', | |
71 | + }; | |
67 | 72 | }, |
68 | 73 | }, |
69 | 74 | { |
... | ... | @@ -87,7 +92,13 @@ export const formSchemas = (deviceTypeStr: string): FormSchema[] => { |
87 | 92 | defaultValue: TCPProtocolAccessAuthTypeEnum.RegisterSend, |
88 | 93 | componentProps: ({ formActionType }) => { |
89 | 94 | return { |
90 | - api: findDictItemByCode, | |
95 | + api: async (params) => { | |
96 | + const values = await findDictItemByCode(params); | |
97 | + const model = formActionType.getFieldsValue(); | |
98 | + if (model[FormFieldsEnum.Protocol] === TCPProtocolTypeEnum.MODBUS_RTU) | |
99 | + return values.filter((item) => item.itemValue !== 'DATA_COMBINATION'); | |
100 | + return values; | |
101 | + }, | |
91 | 102 | params: { |
92 | 103 | dictCode: 'tcp_access_auth_type', |
93 | 104 | }, | ... | ... |