Commit 51a71cddfd5265d6808c32d41ff50c337b38931e
1 parent
40b3e733
fix: DEFECT-1639 租户创建用户,新增账号,直接点击确认,弹出必填提示,全部填完后,角色仍然显示请选择角色
Showing
1 changed file
with
23 additions
and
1 deletions
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | ref="basicTreeRef" |
19 | 19 | checkable |
20 | 20 | toolbar |
21 | + @change="handleTreeSelect" | |
21 | 22 | /> |
22 | 23 | </template> |
23 | 24 | <template #roleSlot="{ model, field }"> |
... | ... | @@ -26,6 +27,7 @@ |
26 | 27 | allowClear |
27 | 28 | placeholder="请选择角色" |
28 | 29 | v-model:value="model[field]" |
30 | + @change="handleRoleSelect" | |
29 | 31 | :options="roleOptions.map((item) => ({ value: item.value, label: item.label }))" |
30 | 32 | > |
31 | 33 | <template #dropdownRender="{ menuNode: menu }"> |
... | ... | @@ -108,12 +110,30 @@ |
108 | 110 | isUpdate: false, |
109 | 111 | }); |
110 | 112 | }; |
113 | + const clearValidateByField = (field: string) => { | |
114 | + clearValidate(field); | |
115 | + }; | |
116 | + const handleRoleSelect = (e) => { | |
117 | + if (e?.length > 0) clearValidateByField('roleIds'); | |
118 | + else validateFields(['roleIds']); | |
119 | + }; | |
120 | + const handleTreeSelect = (e) => { | |
121 | + if (e) clearValidateByField('organizationIds'); | |
122 | + }; | |
111 | 123 | const handleSuccess = async () => { |
112 | 124 | await getRoleList(); |
113 | 125 | }; |
114 | 126 | const [ |
115 | 127 | registerForm, |
116 | - { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, | |
128 | + { | |
129 | + setFieldsValue, | |
130 | + updateSchema, | |
131 | + resetFields, | |
132 | + validate, | |
133 | + getFieldsValue, | |
134 | + clearValidate, | |
135 | + validateFields, | |
136 | + }, | |
117 | 137 | ] = useForm({ |
118 | 138 | labelWidth: 100, |
119 | 139 | schemas: accountFormSchema, |
... | ... | @@ -225,6 +245,8 @@ |
225 | 245 | registerRoleDrawer, |
226 | 246 | handleOpenRole, |
227 | 247 | handleSuccess, |
248 | + handleRoleSelect, | |
249 | + handleTreeSelect, | |
228 | 250 | }; |
229 | 251 | }, |
230 | 252 | }); | ... | ... |