Commit 0dc8e021d0be848d8d60d7de1d26f43e6bdf251d
Merge branch 'feat-user-reset' into 'develop'
Feat user reset See merge request !2
Showing
8 changed files
with
98 additions
and
22 deletions
src/api/project/account.ts
@@ -6,6 +6,8 @@ enum Api { | @@ -6,6 +6,8 @@ enum Api { | ||
6 | USER_ADD = '/order/erp/users/add', | 6 | USER_ADD = '/order/erp/users/add', |
7 | USER_EDIT = '/order/erp/users/edit', | 7 | USER_EDIT = '/order/erp/users/edit', |
8 | USER_DELETE = '/order/erp/users/delete', | 8 | USER_DELETE = '/order/erp/users/delete', |
9 | + USER_OPT = '/order/erp/users/opt', | ||
10 | + USER_RESET_PASSWORD = '/order/erp/users/reset', // 管理员重置密码 | ||
9 | } | 11 | } |
10 | 12 | ||
11 | export const getRoleList = async (params: any) => { | 13 | export const getRoleList = async (params: any) => { |
@@ -61,3 +63,23 @@ export const userDelete = async (params: any) => { | @@ -61,3 +63,23 @@ export const userDelete = async (params: any) => { | ||
61 | params, | 63 | params, |
62 | }); | 64 | }); |
63 | }; | 65 | }; |
66 | + | ||
67 | +export const userOpt = async (params: any) => { | ||
68 | + return defHttp.post<any>( | ||
69 | + { | ||
70 | + url: Api.USER_OPT, | ||
71 | + params, | ||
72 | + }, | ||
73 | + { message: '操作成功' }, | ||
74 | + ); | ||
75 | +}; | ||
76 | + | ||
77 | +export const userResetPassword = async (params: any) => { | ||
78 | + return defHttp.post<any>( | ||
79 | + { | ||
80 | + url: Api.USER_RESET_PASSWORD, | ||
81 | + params, | ||
82 | + }, | ||
83 | + { message: '重置密码成功' }, | ||
84 | + ); | ||
85 | +}; |
src/api/sys/user.ts
@@ -10,7 +10,7 @@ enum Api { | @@ -10,7 +10,7 @@ enum Api { | ||
10 | GetUserInfo = '/getUserInfo', | 10 | GetUserInfo = '/getUserInfo', |
11 | GetPermCode = '/getPermCode', | 11 | GetPermCode = '/getPermCode', |
12 | TestRetry = '/testRetry', | 12 | TestRetry = '/testRetry', |
13 | - MODIFY_PASSWORD = '/order/erp/users/update_pass', | 13 | + MODIFY_PASSWORD = '/order/erp/users/update_pass', // 用户修改自己的密码,不需要验证码 |
14 | FORGET_PASSWORD = '/order/erp/auth/password_modify', | 14 | FORGET_PASSWORD = '/order/erp/auth/password_modify', |
15 | RESET = '/order/erp/users/reset', | 15 | RESET = '/order/erp/users/reset', |
16 | CAPTCHA = '/order/erp/captcha/get_img_captcha_code', | 16 | CAPTCHA = '/order/erp/captcha/get_img_captcha_code', |
@@ -32,7 +32,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | @@ -32,7 +32,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | ||
32 | ); | 32 | ); |
33 | } | 33 | } |
34 | 34 | ||
35 | -export function MODIFY_PASSWORD(params: LoginParams, mode: ErrorMessageMode = 'modal') { | 35 | +export function modifyPassword(params: LoginParams, mode: ErrorMessageMode = 'modal') { |
36 | return defHttp.post<LoginResultModel>( | 36 | return defHttp.post<LoginResultModel>( |
37 | { | 37 | { |
38 | url: Api.MODIFY_PASSWORD, | 38 | url: Api.MODIFY_PASSWORD, |
src/views/demo/system/password/index.vue
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | import { useUserStoreWithOut } from '/@/store/modules/user'; | 16 | import { useUserStoreWithOut } from '/@/store/modules/user'; |
17 | 17 | ||
18 | import { formSchema } from './pwd.data'; | 18 | import { formSchema } from './pwd.data'; |
19 | - import { forgetPassword } from '/@/api/sys/user'; | 19 | + import { modifyPassword } from '/@/api/sys/user'; |
20 | 20 | ||
21 | export default defineComponent({ | 21 | export default defineComponent({ |
22 | name: 'ChangePassword', | 22 | name: 'ChangePassword', |
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | 38 | ||
39 | const userInfo = userStore.getUserInfo; | 39 | const userInfo = userStore.getUserInfo; |
40 | 40 | ||
41 | - await forgetPassword({ ...values, userId: userInfo.id }); | 41 | + await modifyPassword({ ...values, userId: userInfo.id }); |
42 | } catch (error) {} | 42 | } catch (error) {} |
43 | } | 43 | } |
44 | 44 |
src/views/project/account/AccountModal.vue
src/views/project/account/account.data.ts renamed to src/views/project/account/account.data.tsx
1 | import { getRoleList } from '/@/api/project/account'; | 1 | import { getRoleList } from '/@/api/project/account'; |
2 | +import { Tag } from 'ant-design-vue'; | ||
2 | 3 | ||
3 | export const columns: BasicColumn[] = [ | 4 | export const columns: BasicColumn[] = [ |
4 | { | 5 | { |
@@ -27,6 +28,15 @@ export const columns: BasicColumn[] = [ | @@ -27,6 +28,15 @@ export const columns: BasicColumn[] = [ | ||
27 | width: 200, | 28 | width: 200, |
28 | }, | 29 | }, |
29 | { | 30 | { |
31 | + title: '状态', | ||
32 | + dataIndex: 'status', | ||
33 | + width: 200, | ||
34 | + customRender: (column) => { | ||
35 | + const { record } = column || {}; | ||
36 | + return record.status === 10 ? <Tag color="green">正常</Tag> : <Tag color="red">离职</Tag>; | ||
37 | + }, | ||
38 | + }, | ||
39 | + { | ||
30 | title: '备注', | 40 | title: '备注', |
31 | dataIndex: 'remark', | 41 | dataIndex: 'remark', |
32 | }, | 42 | }, |
src/views/project/account/index.vue
@@ -19,16 +19,38 @@ | @@ -19,16 +19,38 @@ | ||
19 | // tooltip: '编辑用户资料', | 19 | // tooltip: '编辑用户资料', |
20 | onClick: handleEdit.bind(null, record), | 20 | onClick: handleEdit.bind(null, record), |
21 | }, | 21 | }, |
22 | - // { | ||
23 | - // icon: 'ant-design:delete-outlined', | ||
24 | - // color: 'error', | ||
25 | - // tooltip: '删除此账号', | ||
26 | - // popConfirm: { | ||
27 | - // title: '是否确认删除', | ||
28 | - // placement: 'left', | ||
29 | - // confirm: handleDelete.bind(null, record), | ||
30 | - // }, | ||
31 | - // }, | 22 | + { |
23 | + label: '重置密码', | ||
24 | + // tooltip: '编辑用户资料', | ||
25 | + popConfirm: { | ||
26 | + title: '是否确认重置密码', | ||
27 | + placement: 'left', | ||
28 | + confirm: handleResetPassword.bind(null, record), | ||
29 | + }, | ||
30 | + }, | ||
31 | + { | ||
32 | + // icon: 'ant-design:delete-outlined', | ||
33 | + color: 'error', | ||
34 | + label: record.status === 10 ? '离职' : '启用', | ||
35 | + popConfirm: { | ||
36 | + title: | ||
37 | + record.status === 10 | ||
38 | + ? '是否确认离职该用户,离职用户无法通过忘记密码进行手机验证码修改密码。请管理员重置其账号密码并修改。' | ||
39 | + : '是否确认启用', | ||
40 | + placement: 'left', | ||
41 | + confirm: handleForbid.bind(null, record), | ||
42 | + }, | ||
43 | + }, | ||
44 | + { | ||
45 | + // icon: 'ant-design:delete-outlined', | ||
46 | + color: 'error', | ||
47 | + label: '删除', | ||
48 | + popConfirm: { | ||
49 | + title: '是否确认删除', | ||
50 | + placement: 'left', | ||
51 | + confirm: handleDelete.bind(null, record), | ||
52 | + }, | ||
53 | + }, | ||
32 | ]" | 54 | ]" |
33 | /> | 55 | /> |
34 | </template> | 56 | </template> |
@@ -41,7 +63,13 @@ | @@ -41,7 +63,13 @@ | ||
41 | import { defineComponent, reactive } from 'vue'; | 63 | import { defineComponent, reactive } from 'vue'; |
42 | 64 | ||
43 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 65 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
44 | - import { getUserList, userAdd, userEdit } from '/@/api/project/account'; | 66 | + import { |
67 | + getUserList, | ||
68 | + userAdd, | ||
69 | + userEdit, | ||
70 | + userOpt, | ||
71 | + userResetPassword, | ||
72 | + } from '/@/api/project/account'; | ||
45 | import { PageWrapper } from '/@/components/Page'; | 73 | import { PageWrapper } from '/@/components/Page'; |
46 | import DeptTree from './DeptTree.vue'; | 74 | import DeptTree from './DeptTree.vue'; |
47 | 75 | ||
@@ -58,7 +86,7 @@ | @@ -58,7 +86,7 @@ | ||
58 | const go = useGo(); | 86 | const go = useGo(); |
59 | const [registerModal, { openModal }] = useModal(); | 87 | const [registerModal, { openModal }] = useModal(); |
60 | const searchInfo = reactive({}); | 88 | const searchInfo = reactive({}); |
61 | - const [registerTable, { reload, updateTableDataRecord }] = useTable({ | 89 | + const [registerTable, { reload }] = useTable({ |
62 | title: '账号列表', | 90 | title: '账号列表', |
63 | api: getUserList, | 91 | api: getUserList, |
64 | rowKey: 'id', | 92 | rowKey: 'id', |
@@ -79,7 +107,7 @@ | @@ -79,7 +107,7 @@ | ||
79 | return info; | 107 | return info; |
80 | }, | 108 | }, |
81 | actionColumn: { | 109 | actionColumn: { |
82 | - width: 120, | 110 | + width: 280, |
83 | title: '操作', | 111 | title: '操作', |
84 | dataIndex: 'action', | 112 | dataIndex: 'action', |
85 | // slots: { customRender: 'action' }, | 113 | // slots: { customRender: 'action' }, |
@@ -92,7 +120,7 @@ | @@ -92,7 +120,7 @@ | ||
92 | }); | 120 | }); |
93 | } | 121 | } |
94 | 122 | ||
95 | - function handleEdit(record: Recordable) { | 123 | + function handleEdit(record) { |
96 | console.log(record); | 124 | console.log(record); |
97 | openModal(true, { | 125 | openModal(true, { |
98 | record, | 126 | record, |
@@ -100,8 +128,9 @@ | @@ -100,8 +128,9 @@ | ||
100 | }); | 128 | }); |
101 | } | 129 | } |
102 | 130 | ||
103 | - function handleDelete(record: Recordable) { | ||
104 | - console.log(record); | 131 | + async function handleDelete(record) { |
132 | + await userOpt({ ids: [record.id], optType: 20 }); | ||
133 | + reload(); | ||
105 | } | 134 | } |
106 | 135 | ||
107 | async function handleSuccess({ isUpdate, values }) { | 136 | async function handleSuccess({ isUpdate, values }) { |
@@ -114,12 +143,22 @@ | @@ -114,12 +143,22 @@ | ||
114 | reload(); | 143 | reload(); |
115 | } | 144 | } |
116 | 145 | ||
146 | + async function handleForbid(record) { | ||
147 | + await userOpt({ ids: [record.id], optType: record.status === 10 ? 30 : 10 }); | ||
148 | + reload(); | ||
149 | + } | ||
150 | + | ||
151 | + async function handleResetPassword(record) { | ||
152 | + await userResetPassword({ userId: record.id }); | ||
153 | + // reload(); | ||
154 | + } | ||
155 | + | ||
117 | function handleSelect(deptId = '') { | 156 | function handleSelect(deptId = '') { |
118 | searchInfo.deptId = deptId; | 157 | searchInfo.deptId = deptId; |
119 | reload(); | 158 | reload(); |
120 | } | 159 | } |
121 | 160 | ||
122 | - function handleView(record: Recordable) { | 161 | + function handleView(record) { |
123 | go('/system/account_detail/' + record.id); | 162 | go('/system/account_detail/' + record.id); |
124 | } | 163 | } |
125 | 164 | ||
@@ -132,6 +171,8 @@ | @@ -132,6 +171,8 @@ | ||
132 | handleSuccess, | 171 | handleSuccess, |
133 | handleSelect, | 172 | handleSelect, |
134 | handleView, | 173 | handleView, |
174 | + handleForbid, | ||
175 | + handleResetPassword, | ||
135 | searchInfo, | 176 | searchInfo, |
136 | }; | 177 | }; |
137 | }, | 178 | }, |
src/views/project/order/tableData.tsx
@@ -1135,6 +1135,7 @@ export const FIELDS_INSPECTION_INFO = [ | @@ -1135,6 +1135,7 @@ export const FIELDS_INSPECTION_INFO = [ | ||
1135 | component: 'Select', | 1135 | component: 'Select', |
1136 | optionField: 'midCheckResult', | 1136 | optionField: 'midCheckResult', |
1137 | label: '中期验货结果PASS / FAIL', | 1137 | label: '中期验货结果PASS / FAIL', |
1138 | + labelWidth: 400, | ||
1138 | // rules: [{ required: true }], | 1139 | // rules: [{ required: true }], |
1139 | }, | 1140 | }, |
1140 | { | 1141 | { |
tsconfig.json
@@ -22,7 +22,8 @@ | @@ -22,7 +22,8 @@ | ||
22 | "build/**/*.ts", | 22 | "build/**/*.ts", |
23 | "build/**/*.d.ts", | 23 | "build/**/*.d.ts", |
24 | "mock/**/*.ts", | 24 | "mock/**/*.ts", |
25 | - "vite.config.ts" | 25 | + "vite.config.ts", |
26 | + "src/views/project/account/account.data.tsx4" | ||
26 | ], | 27 | ], |
27 | "exclude": ["node_modules", "tests/server/**/*.ts", "dist", "**/*.js"] | 28 | "exclude": ["node_modules", "tests/server/**/*.ts", "dist", "**/*.js"] |
28 | } | 29 | } |