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