Commit 990feccee17e8cde2e3865cd45778628fdebf192
Merge branch 'fix/object-model' into 'main_dev'
fix: 修复物模型存在重复表单项 See merge request yunteng/thingskit-front!1182
Showing
2 changed files
with
10 additions
and
4 deletions
... | ... | @@ -51,7 +51,7 @@ export const validateIdentifier: ValidatorRule['validator'] = (_rule, value: any |
51 | 51 | return Promise.reject('支持大小写字母、数字和下划线.'); |
52 | 52 | }; |
53 | 53 | |
54 | -export const createFunctionNameFormItem = (): FormSchema => { | |
54 | +export const createFunctionNameFormItem = (params: Partial<FormSchema> = {}): FormSchema => { | |
55 | 55 | return { |
56 | 56 | field: FormFieldsEnum.FUNCTION_NAME, |
57 | 57 | label: FormFieldsNameEnum.FUNCTION_NAME, |
... | ... | @@ -67,10 +67,11 @@ export const createFunctionNameFormItem = (): FormSchema => { |
67 | 67 | componentProps: { |
68 | 68 | placeholder: `请输入${FormFieldsNameEnum.FUNCTION_NAME}`, |
69 | 69 | }, |
70 | + ...params, | |
70 | 71 | }; |
71 | 72 | }; |
72 | 73 | |
73 | -export const createIdentifierFormItem = (): FormSchema => { | |
74 | +export const createIdentifierFormItem = (params: Partial<FormSchema> = {}): FormSchema => { | |
74 | 75 | return { |
75 | 76 | field: FormFieldsEnum.IDENTIFIER, |
76 | 77 | label: FormFieldsNameEnum.IDENTIFIER, |
... | ... | @@ -87,6 +88,7 @@ export const createIdentifierFormItem = (): FormSchema => { |
87 | 88 | validator: validateIdentifier, |
88 | 89 | }, |
89 | 90 | ], |
91 | + ...params, | |
90 | 92 | }; |
91 | 93 | }; |
92 | 94 | ... | ... |
... | ... | @@ -115,8 +115,12 @@ export const getFormSchemas = ({ |
115 | 115 | ifShow: ({ model }) => model[FormFieldsEnum.FUNCTION_TYPE] === FunctionTypeEnum.PROPERTIES, |
116 | 116 | colSlot: FormFieldsEnum.DATA_TYPE_FORM, |
117 | 117 | }, |
118 | - createFunctionNameFormItem(), | |
119 | - createIdentifierFormItem(), | |
118 | + createFunctionNameFormItem({ | |
119 | + ifShow: ({ model }) => model[FormFieldsEnum.FUNCTION_TYPE] !== FunctionTypeEnum.PROPERTIES, | |
120 | + }), | |
121 | + createIdentifierFormItem({ | |
122 | + ifShow: ({ model }) => model[FormFieldsEnum.FUNCTION_TYPE] !== FunctionTypeEnum.PROPERTIES, | |
123 | + }), | |
120 | 124 | { |
121 | 125 | field: FormFieldsEnum.EXTENSION_DESC, |
122 | 126 | component: 'Input', | ... | ... |