Commit 437eb4311ee8a23e1803484cc205699cbc97c284

Authored by xp.Huang
2 parents 62c99076 45a693eb

Merge branch 'ft' into 'main_dev'

fix: 修改Teambition上的问题

See merge request yunteng/thingskit-front!849
@@ -34,6 +34,7 @@ enum Api { @@ -34,6 +34,7 @@ enum Api {
34 GetAllRoleList = '/role/find/list', 34 GetAllRoleList = '/role/find/list',
35 BaseUserUrl = '/user', 35 BaseUserUrl = '/user',
36 BaseOrganization = '/organization', 36 BaseOrganization = '/organization',
  37 + RESET_USER_PASSWORD = '/user/reset_password/',
37 } 38 }
38 39
39 export const getAccountInfo = (userId: string) => 40 export const getAccountInfo = (userId: string) =>
@@ -172,3 +173,12 @@ export const resetPassword = (params: ChangeAccountParams) => @@ -172,3 +173,12 @@ export const resetPassword = (params: ChangeAccountParams) =>
172 url: Api.BaseUserUrl + '/reset', 173 url: Api.BaseUserUrl + '/reset',
173 params: params, 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,6 +273,7 @@
273 event: DropMenuEvent.SET_DEFAULT, 273 event: DropMenuEvent.SET_DEFAULT,
274 icon: 'ant-design:unordered-list-outlined', 274 icon: 'ant-design:unordered-list-outlined',
275 onClick: handleSetDefault.bind(null, item), 275 onClick: handleSetDefault.bind(null, item),
  276 + disabled: item.default,
276 }, 277 },
277 { 278 {
278 text: '删除', 279 text: '删除',
@@ -283,6 +284,7 @@ @@ -283,6 +284,7 @@
283 title: '是否确认删除操作?', 284 title: '是否确认删除操作?',
284 onConfirm: handleDelete.bind(null, [item.id]), 285 onConfirm: handleDelete.bind(null, [item.id]),
285 }, 286 },
  287 + disabled: item.default,
286 }, 288 },
287 ]" 289 ]"
288 /> 290 />
@@ -47,12 +47,12 @@ @@ -47,12 +47,12 @@
47 {{ t('sys.login.loginButton') }} 47 {{ t('sys.login.loginButton') }}
48 </Button> 48 </Button>
49 </FormItem> 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 <Button block @click="setLoginState(LoginStateEnum.LOGIN)"> 52 <Button block @click="setLoginState(LoginStateEnum.LOGIN)">
53 {{ t('sys.login.userNameInFormTitle') }} 53 {{ t('sys.login.userNameInFormTitle') }}
54 </Button> 54 </Button>
55 - </ACol> 55 + </ACol> -->
56 <ACol :md="11" :xs="24"> 56 <ACol :md="11" :xs="24">
57 <Button block @click="setLoginState(LoginStateEnum.MOBILE)"> 57 <Button block @click="setLoginState(LoginStateEnum.MOBILE)">
58 {{ t('sys.login.mobileSignInFormTitle') }} 58 {{ t('sys.login.mobileSignInFormTitle') }}
@@ -81,6 +81,17 @@ @@ -81,6 +81,17 @@
81 confirm: handleDeleteOrBatchDelete.bind(null, record), 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 </template> 97 </template>
@@ -107,6 +118,8 @@ @@ -107,6 +118,8 @@
107 import { isAdmin } from '/@/enums/roleEnum'; 118 import { isAdmin } from '/@/enums/roleEnum';
108 import { TenantListItemRecord } from '/@/api/tenant/tenantInfo'; 119 import { TenantListItemRecord } from '/@/api/tenant/tenantInfo';
109 import { useFastEnter } from '/@/hooks/business/useFastEnter'; 120 import { useFastEnter } from '/@/hooks/business/useFastEnter';
  121 + import { clearUserPassword } from '/@/api/system/system';
  122 + import { useMessage } from '/@/hooks/web/useMessage';
110 123
111 export default defineComponent({ 124 export default defineComponent({
112 name: 'AccountManagement', 125 name: 'AccountManagement',
@@ -121,6 +134,7 @@ @@ -121,6 +134,7 @@
121 Popconfirm, 134 Popconfirm,
122 }, 135 },
123 setup() { 136 setup() {
  137 + const { createMessage } = useMessage();
124 const userInfo: any = getAuthCache(USER_INFO_KEY); 138 const userInfo: any = getAuthCache(USER_INFO_KEY);
125 const role: string = userInfo?.roles[0]; 139 const role: string = userInfo?.roles[0];
126 140
@@ -192,6 +206,13 @@ @@ -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 return { 216 return {
196 handleLoginCustomAdmin, 217 handleLoginCustomAdmin,
197 registerTable, 218 registerTable,
@@ -206,6 +227,7 @@ @@ -206,6 +227,7 @@
206 handleDeleteOrBatchDelete, 227 handleDeleteOrBatchDelete,
207 isAdmin, 228 isAdmin,
208 role, 229 role,
  230 + handleClearPassword,
209 }; 231 };
210 }, 232 },
211 }); 233 });
@@ -5,14 +5,26 @@ export const formSchema: FormSchema[] = [ @@ -5,14 +5,26 @@ export const formSchema: FormSchema[] = [
5 field: 'passwordOld', 5 field: 'passwordOld',
6 label: '当前密码', 6 label: '当前密码',
7 component: 'InputPassword', 7 component: 'InputPassword',
  8 + componentProps: {
  9 + placeholder: '请输入当前密码',
  10 + },
8 required: true, 11 required: true,
9 }, 12 },
10 { 13 {
11 field: 'passwordNew', 14 field: 'passwordNew',
12 label: '新密码', 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 rules: [ 29 rules: [
18 { 30 {
@@ -25,7 +37,9 @@ export const formSchema: FormSchema[] = [ @@ -25,7 +37,9 @@ export const formSchema: FormSchema[] = [
25 field: 'confirmPassword', 37 field: 'confirmPassword',
26 label: '确认密码', 38 label: '确认密码',
27 component: 'InputPassword', 39 component: 'InputPassword',
28 - 40 + componentProps: {
  41 + placeholder: '请输入确认密码',
  42 + },
29 dynamicRules: ({ values }) => { 43 dynamicRules: ({ values }) => {
30 return [ 44 return [
31 { 45 {
@@ -37,7 +51,6 @@ export const formSchema: FormSchema[] = [ @@ -37,7 +51,6 @@ export const formSchema: FormSchema[] = [
37 if (value !== values.passwordNew) { 51 if (value !== values.passwordNew) {
38 return Promise.reject('两次输入的密码不一致!'); 52 return Promise.reject('两次输入的密码不一致!');
39 } 53 }
40 -  
41 const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); 54 const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT);
42 if (!pwdRegex.test(value)) { 55 if (!pwdRegex.test(value)) {
43 return Promise.reject( 56 return Promise.reject(
@@ -124,6 +124,8 @@ @@ -124,6 +124,8 @@
124 let ids = record?.id?.id; 124 let ids = record?.id?.id;
125 await deleteTenantProfileApi(ids); 125 await deleteTenantProfileApi(ids);
126 createMessage.success('删除成功'); 126 createMessage.success('删除成功');
  127 + selectedRowKeys.length = 0;
  128 + disabled.value = true;
127 reload(); 129 reload();
128 } else { 130 } else {
129 createMessage.warning(message); 131 createMessage.warning(message);
@@ -148,9 +150,6 @@ @@ -148,9 +150,6 @@
148 createMessage.success('删除成功'); 150 createMessage.success('删除成功');
149 reload(); 151 reload();
150 selectedRowKeys.length = 0; 152 selectedRowKeys.length = 0;
151 - setTimeout(() => {  
152 - disabled.value = false;  
153 - }, 3000);  
154 }); 153 });
155 }; 154 };
156 155
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 label: '账号', 46 label: '账号',
47 component: 'Input', 47 component: 'Input',
48 componentProps: { 48 componentProps: {
49 - maxLength: 255, 49 + maxLength: 64,
50 placeholder: '请输入账号', 50 placeholder: '请输入账号',
51 }, 51 },
52 dynamicRules: ({ values }) => { 52 dynamicRules: ({ values }) => {
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 required: true, 87 required: true,
88 component: 'Input', 88 component: 'Input',
89 componentProps: { 89 componentProps: {
90 - maxLength: 255, 90 + maxLength: 64,
91 placeholder: '请输入真实名字', 91 placeholder: '请输入真实名字',
92 }, 92 },
93 rules: chineseAndEnlishRule, 93 rules: chineseAndEnlishRule,
@@ -97,12 +97,20 @@ @@ -97,12 +97,20 @@
97 label: '电话号码', 97 label: '电话号码',
98 required: true, 98 required: true,
99 component: 'Input', 99 component: 'Input',
  100 + componentProps: {
  101 + maxLength: 11,
  102 + placeholder: '请输入电话号码',
  103 + },
100 rules: phoneRule, 104 rules: phoneRule,
101 }, 105 },
102 { 106 {
103 field: 'email', 107 field: 'email',
104 label: '邮件', 108 label: '邮件',
105 component: 'Input', 109 component: 'Input',
  110 + componentProps: {
  111 + maxLength: 64,
  112 + placeholder: '请输入邮件',
  113 + },
106 rules: emailRule, 114 rules: emailRule,
107 }, 115 },
108 { 116 {
@@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
44 icon: 'ant-design:usergroup-add-outlined', 44 icon: 'ant-design:usergroup-add-outlined',
45 label: '租户管理员', 45 label: '租户管理员',
46 onClick: handleTenantAdminDrawer.bind(null, record), 46 onClick: handleTenantAdminDrawer.bind(null, record),
  47 + disabled: record.enabled === false,
47 }, 48 },
48 { 49 {
49 icon: 'clarity:note-edit-line', 50 icon: 'clarity:note-edit-line',