Showing
1 changed file
with
18 additions
and
7 deletions
| @@ -58,12 +58,17 @@ export const formSchemas = (deviceTypeStr: string): FormSchema[] => { | @@ -58,12 +58,17 @@ export const formSchemas = (deviceTypeStr: string): FormSchema[] => { | ||
| 58 | component: 'Select', | 58 | component: 'Select', | 
| 59 | required: true, | 59 | required: true, | 
| 60 | defaultValue: TCPProtocolTypeEnum.MODBUS_RTU, | 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,7 +92,13 @@ export const formSchemas = (deviceTypeStr: string): FormSchema[] => { | ||
| 87 | defaultValue: TCPProtocolAccessAuthTypeEnum.RegisterSend, | 92 | defaultValue: TCPProtocolAccessAuthTypeEnum.RegisterSend, | 
| 88 | componentProps: ({ formActionType }) => { | 93 | componentProps: ({ formActionType }) => { | 
| 89 | return { | 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 | params: { | 102 | params: { | 
| 92 | dictCode: 'tcp_access_auth_type', | 103 | dictCode: 'tcp_access_auth_type', | 
| 93 | }, | 104 | }, |