| | |
| | | </ProTableV2> |
| | | </AppContainer> |
| | | <AddOrEditUserDialog v-bind="dialogProps" /> |
| | | <ResetPasswordDialog v-bind="resetPasswordDialogProps"></ResetPasswordDialog> |
| | | <ResetOperatorPasswordDialog |
| | | v-bind="resetOperatorPasswordDialogProps" |
| | | ></ResetOperatorPasswordDialog> |
| | | </LoadingLayout> |
| | | </template> |
| | | |
| | |
| | | import { ModelValueType } from 'element-plus'; |
| | | import { Message } from '@bole-core/core'; |
| | | import AddOrEditUserDialog from './components/AddOrEditUserDialog.vue'; |
| | | import ResetPasswordDialog from './components/ResetPasswordDialog.vue'; |
| | | import ResetOperatorPasswordDialog from './components/ResetOperatorPasswordDialog.vue'; |
| | | |
| | | defineOptions({ |
| | | name: 'UserManageList', |
| | |
| | | }, |
| | | emits: { |
| | | onClick: (role) => openDialog(role), |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | | enCode: 'resetPasswordBtn', |
| | | name: '重置密码', |
| | | }, |
| | | props: { |
| | | type: 'danger', |
| | | }, |
| | | emits: { |
| | | onClick: (role) => openResetPasswordDialog(role), |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | | enCode: 'resetOperatorPasswordBtn', |
| | | name: '重置操作密码', |
| | | }, |
| | | props: { |
| | | type: 'danger', |
| | | }, |
| | | emits: { |
| | | onClick: (role) => openResetOperatorPasswordDialog(role), |
| | | }, |
| | | }, |
| | | ]); |
| | |
| | | userName: '', |
| | | phoneNumber: '', |
| | | remark: '', |
| | | status: '' as any as EnumUserStatus, |
| | | roleIds: [] as string[], |
| | | password: '', |
| | | operatorPassword: '', |
| | | }, |
| | | }); |
| | | |
| | |
| | | phoneNumber: row.phoneNumber, |
| | | remark: row.remark, |
| | | roleIds: row.roles?.map((x) => x.id) ?? [], |
| | | status: row.status, |
| | | password: '', |
| | | operatorPassword: '', |
| | | }); |
| | | } else { |
| | | handleAdd(); |
| | |
| | | name: editForm.name, |
| | | userName: editForm.userName, |
| | | phoneNumber: editForm.phoneNumber, |
| | | password: editForm.password, |
| | | roleIds: editForm.roleIds, |
| | | remark: editForm.remark, |
| | | status: editForm.status ? editForm.status : EnumUserStatus.Normal, |
| | | }; |
| | | if (!editForm.id) { |
| | | params.password = editForm.password; |
| | | params.operatorPassword = editForm.operatorPassword; |
| | | } |
| | | if (editForm.id) { |
| | | params.id = editForm.id; |
| | | } |
| | |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const { |
| | | dialogProps: resetOperatorPasswordDialogProps, |
| | | handleAdd: handleResetOperatorPasswordAdd, |
| | | editForm: resetOperatorPasswordEditForm, |
| | | } = useFormDialog({ |
| | | onConfirm: resetOperatorPassword, |
| | | defaultFormParams: { |
| | | ids: '', |
| | | operatorPassword: '', |
| | | }, |
| | | }); |
| | | |
| | | function openResetOperatorPasswordDialog(row: API.GetOperationUserInfosQueryResultItem) { |
| | | handleResetOperatorPasswordAdd({ |
| | | ids: row.id, |
| | | operatorPassword: '', |
| | | }); |
| | | } |
| | | |
| | | async function resetOperatorPassword() { |
| | | try { |
| | | let params: API.ResetUserOperatorPasswordsCommand = { |
| | | ids: [resetOperatorPasswordEditForm.ids], |
| | | operatorPassword: resetOperatorPasswordEditForm.operatorPassword, |
| | | }; |
| | | let res = await userServices.resetUserOperatorPasswords(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | const { |
| | | dialogProps: resetPasswordDialogProps, |
| | | handleAdd: handleResetPasswordAdd, |
| | | editForm: resetPasswordEditForm, |
| | | } = useFormDialog({ |
| | | onConfirm: resetPassword, |
| | | defaultFormParams: { |
| | | ids: '', |
| | | password: '', |
| | | }, |
| | | }); |
| | | |
| | | function openResetPasswordDialog(row: API.GetOperationUserInfosQueryResultItem) { |
| | | handleResetPasswordAdd({ |
| | | ids: row.id, |
| | | password: '', |
| | | }); |
| | | } |
| | | |
| | | async function resetPassword() { |
| | | try { |
| | | let params: API.ResetUserPasswordsCommand = { |
| | | ids: [resetPasswordEditForm.ids], |
| | | password: resetPasswordEditForm.password, |
| | | }; |
| | | let res = await userServices.resetUserPasswords(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | </script> |