Commit 437eb4311ee8a23e1803484cc205699cbc97c284
Merge branch 'ft' into 'main_dev'
fix: 修改Teambition上的问题 See merge request yunteng/thingskit-front!849
Showing
8 changed files
with
68 additions
and
13 deletions
... | ... | @@ -34,6 +34,7 @@ enum Api { |
34 | 34 | GetAllRoleList = '/role/find/list', |
35 | 35 | BaseUserUrl = '/user', |
36 | 36 | BaseOrganization = '/organization', |
37 | + RESET_USER_PASSWORD = '/user/reset_password/', | |
37 | 38 | } |
38 | 39 | |
39 | 40 | export const getAccountInfo = (userId: string) => |
... | ... | @@ -172,3 +173,12 @@ export const resetPassword = (params: ChangeAccountParams) => |
172 | 173 | url: Api.BaseUserUrl + '/reset', |
173 | 174 | params: params, |
174 | 175 | }); |
176 | + | |
177 | +/** | |
178 | + * 清除密码 | |
179 | + * @param params | |
180 | + */ | |
181 | +export const clearUserPassword = (userId: string) => | |
182 | + defHttp.post({ | |
183 | + url: Api.RESET_USER_PASSWORD + userId, | |
184 | + }); | ... | ... |
... | ... | @@ -273,6 +273,7 @@ |
273 | 273 | event: DropMenuEvent.SET_DEFAULT, |
274 | 274 | icon: 'ant-design:unordered-list-outlined', |
275 | 275 | onClick: handleSetDefault.bind(null, item), |
276 | + disabled: item.default, | |
276 | 277 | }, |
277 | 278 | { |
278 | 279 | text: '删除', |
... | ... | @@ -283,6 +284,7 @@ |
283 | 284 | title: '是否确认删除操作?', |
284 | 285 | onConfirm: handleDelete.bind(null, [item.id]), |
285 | 286 | }, |
287 | + disabled: item.default, | |
286 | 288 | }, |
287 | 289 | ]" |
288 | 290 | /> | ... | ... |
... | ... | @@ -47,12 +47,12 @@ |
47 | 47 | {{ t('sys.login.loginButton') }} |
48 | 48 | </Button> |
49 | 49 | </FormItem> |
50 | - <ARow class="enter-x flex justify-between"> | |
51 | - <ACol :md="11" :xs="24"> | |
50 | + <ARow class="enter-x flex justify-center"> | |
51 | + <!-- <ACol :md="11" :xs="24"> | |
52 | 52 | <Button block @click="setLoginState(LoginStateEnum.LOGIN)"> |
53 | 53 | {{ t('sys.login.userNameInFormTitle') }} |
54 | 54 | </Button> |
55 | - </ACol> | |
55 | + </ACol> --> | |
56 | 56 | <ACol :md="11" :xs="24"> |
57 | 57 | <Button block @click="setLoginState(LoginStateEnum.MOBILE)"> |
58 | 58 | {{ t('sys.login.mobileSignInFormTitle') }} | ... | ... |
... | ... | @@ -81,6 +81,17 @@ |
81 | 81 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
82 | 82 | }, |
83 | 83 | }, |
84 | + { | |
85 | + label: '清除密码', | |
86 | + auth: 'api:yt:user:resetPassword', | |
87 | + icon: 'ant-design:delete-outlined', | |
88 | + color: 'error', | |
89 | + tooltip: '清除密码', | |
90 | + popConfirm: { | |
91 | + title: '是否确认清除密码', | |
92 | + confirm: handleClearPassword.bind(null, record), | |
93 | + }, | |
94 | + }, | |
84 | 95 | ]" |
85 | 96 | /> |
86 | 97 | </template> |
... | ... | @@ -107,6 +118,8 @@ |
107 | 118 | import { isAdmin } from '/@/enums/roleEnum'; |
108 | 119 | import { TenantListItemRecord } from '/@/api/tenant/tenantInfo'; |
109 | 120 | import { useFastEnter } from '/@/hooks/business/useFastEnter'; |
121 | + import { clearUserPassword } from '/@/api/system/system'; | |
122 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
110 | 123 | |
111 | 124 | export default defineComponent({ |
112 | 125 | name: 'AccountManagement', |
... | ... | @@ -121,6 +134,7 @@ |
121 | 134 | Popconfirm, |
122 | 135 | }, |
123 | 136 | setup() { |
137 | + const { createMessage } = useMessage(); | |
124 | 138 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
125 | 139 | const role: string = userInfo?.roles[0]; |
126 | 140 | |
... | ... | @@ -192,6 +206,13 @@ |
192 | 206 | } |
193 | 207 | } |
194 | 208 | |
209 | + const handleClearPassword = async (record: Recordable) => { | |
210 | + const { id } = record; | |
211 | + if (!id) return; | |
212 | + const { message } = await clearUserPassword(id); | |
213 | + createMessage.success(message); | |
214 | + }; | |
215 | + | |
195 | 216 | return { |
196 | 217 | handleLoginCustomAdmin, |
197 | 218 | registerTable, |
... | ... | @@ -206,6 +227,7 @@ |
206 | 227 | handleDeleteOrBatchDelete, |
207 | 228 | isAdmin, |
208 | 229 | role, |
230 | + handleClearPassword, | |
209 | 231 | }; |
210 | 232 | }, |
211 | 233 | }); | ... | ... |
... | ... | @@ -5,14 +5,26 @@ export const formSchema: FormSchema[] = [ |
5 | 5 | field: 'passwordOld', |
6 | 6 | label: '当前密码', |
7 | 7 | component: 'InputPassword', |
8 | + componentProps: { | |
9 | + placeholder: '请输入当前密码', | |
10 | + }, | |
8 | 11 | required: true, |
9 | 12 | }, |
10 | 13 | { |
11 | 14 | field: 'passwordNew', |
12 | 15 | label: '新密码', |
13 | - component: 'StrengthMeter', | |
14 | - componentProps: { | |
15 | - placeholder: '新密码', | |
16 | + component: 'InputPassword', | |
17 | + componentProps({ formModel, formActionType }) { | |
18 | + return { | |
19 | + placeholder: '请输入新密码', | |
20 | + onInput({ target }) { | |
21 | + const { value } = target; | |
22 | + const { confirmPassword } = formModel; | |
23 | + if (value === confirmPassword) { | |
24 | + formActionType.clearValidate('confirmPassword'); | |
25 | + } | |
26 | + }, | |
27 | + }; | |
16 | 28 | }, |
17 | 29 | rules: [ |
18 | 30 | { |
... | ... | @@ -25,7 +37,9 @@ export const formSchema: FormSchema[] = [ |
25 | 37 | field: 'confirmPassword', |
26 | 38 | label: '确认密码', |
27 | 39 | component: 'InputPassword', |
28 | - | |
40 | + componentProps: { | |
41 | + placeholder: '请输入确认密码', | |
42 | + }, | |
29 | 43 | dynamicRules: ({ values }) => { |
30 | 44 | return [ |
31 | 45 | { |
... | ... | @@ -37,7 +51,6 @@ export const formSchema: FormSchema[] = [ |
37 | 51 | if (value !== values.passwordNew) { |
38 | 52 | return Promise.reject('两次输入的密码不一致!'); |
39 | 53 | } |
40 | - | |
41 | 54 | const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); |
42 | 55 | if (!pwdRegex.test(value)) { |
43 | 56 | return Promise.reject( | ... | ... |
... | ... | @@ -124,6 +124,8 @@ |
124 | 124 | let ids = record?.id?.id; |
125 | 125 | await deleteTenantProfileApi(ids); |
126 | 126 | createMessage.success('删除成功'); |
127 | + selectedRowKeys.length = 0; | |
128 | + disabled.value = true; | |
127 | 129 | reload(); |
128 | 130 | } else { |
129 | 131 | createMessage.warning(message); |
... | ... | @@ -148,9 +150,6 @@ |
148 | 150 | createMessage.success('删除成功'); |
149 | 151 | reload(); |
150 | 152 | selectedRowKeys.length = 0; |
151 | - setTimeout(() => { | |
152 | - disabled.value = false; | |
153 | - }, 3000); | |
154 | 153 | }); |
155 | 154 | }; |
156 | 155 | ... | ... |
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | label: '账号', |
47 | 47 | component: 'Input', |
48 | 48 | componentProps: { |
49 | - maxLength: 255, | |
49 | + maxLength: 64, | |
50 | 50 | placeholder: '请输入账号', |
51 | 51 | }, |
52 | 52 | dynamicRules: ({ values }) => { |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | required: true, |
88 | 88 | component: 'Input', |
89 | 89 | componentProps: { |
90 | - maxLength: 255, | |
90 | + maxLength: 64, | |
91 | 91 | placeholder: '请输入真实名字', |
92 | 92 | }, |
93 | 93 | rules: chineseAndEnlishRule, |
... | ... | @@ -97,12 +97,20 @@ |
97 | 97 | label: '电话号码', |
98 | 98 | required: true, |
99 | 99 | component: 'Input', |
100 | + componentProps: { | |
101 | + maxLength: 11, | |
102 | + placeholder: '请输入电话号码', | |
103 | + }, | |
100 | 104 | rules: phoneRule, |
101 | 105 | }, |
102 | 106 | { |
103 | 107 | field: 'email', |
104 | 108 | label: '邮件', |
105 | 109 | component: 'Input', |
110 | + componentProps: { | |
111 | + maxLength: 64, | |
112 | + placeholder: '请输入邮件', | |
113 | + }, | |
106 | 114 | rules: emailRule, |
107 | 115 | }, |
108 | 116 | { | ... | ... |