| | |
| | | </QueryFilterItem> |
| | | </template> |
| | | <template #btn> |
| | | <el-button @click="openDialog()" icon="Plus" type="primary">新增</el-button> |
| | | <el-button |
| | | v-if="checkSubModuleItemShow('pageButton', 'addBtn')" |
| | | @click="openDialog()" |
| | | icon="Plus" |
| | | type="primary" |
| | | >新增</el-button |
| | | > |
| | | </template> |
| | | </ProTableQueryFilterBar> |
| | | <ProTableV2 |
| | | v-bind="proTableProps" |
| | | :columns="UserManageColumns" |
| | | :operationBtns="operationBtns" |
| | | > |
| | | <ProTableV2 v-bind="proTableProps" :columns="column" :operationBtns="operationBtns"> |
| | | <template #status="{ row }"> |
| | | <FieldSwitch |
| | | v-model="row.status" |
| | | active-text="启用" |
| | | :active-value="EnumUserStatus.Normal" |
| | | inactive-text="禁用" |
| | | :inactive-value="EnumUserStatus.Disabled" |
| | | :before-change="() => setUserInfoStatus(row)" |
| | | /> |
| | | </template> |
| | | </ProTableV2> |
| | | </AppContainer> |
| | | <AddOrEditUserDialog v-bind="dialogProps" /> |
| | |
| | | useTable, |
| | | useFormDialog, |
| | | defineOperationBtns, |
| | | FieldSwitch, |
| | | } from '@bole-core/components'; |
| | | import * as userServices from '@/services/api/user'; |
| | | import { UserManageColumns } from './constants'; |
| | | import { EnumUserStatusText } from '@/constants'; |
| | | import { EnumUserStatus, EnumUserStatusText } from '@/constants'; |
| | | import { ModelValueType } from 'element-plus'; |
| | | import { Message } from '@bole-core/core'; |
| | | import AddOrEditUserDialog from './components/AddOrEditUserDialog.vue'; |
| | |
| | | name: 'UserManageList', |
| | | }); |
| | | |
| | | const operationBtns = defineOperationBtns([ |
| | | { |
| | | data: { |
| | | enCode: 'editBtn', |
| | | name: '编辑', |
| | | }, |
| | | const operationBtnMap: Record<string, OperationBtnType> = { |
| | | editBtn: { |
| | | emits: { |
| | | onClick: (role) => openDialog(role), |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | | enCode: 'resetPasswordBtn', |
| | | name: '重置密码', |
| | | }, |
| | | props: { |
| | | type: 'danger', |
| | | }, |
| | | resetPasswordBtn: { |
| | | emits: { |
| | | onClick: (role) => openResetPasswordDialog(role), |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | | enCode: 'resetOperatorPasswordBtn', |
| | | name: '重置操作密码', |
| | | }, |
| | | props: { |
| | | type: 'danger', |
| | | }, |
| | | resetOperatorPasswordBtn: { |
| | | emits: { |
| | | onClick: (role) => openResetOperatorPasswordDialog(role), |
| | | }, |
| | | }, |
| | | ]); |
| | | }; |
| | | |
| | | const { column, operationBtns, checkSubModuleItemShow } = useAccess({ |
| | | operationBtnMap, |
| | | }); |
| | | |
| | | const router = useRouter(); |
| | | const BaseState = { |
| | |
| | | formatter: (role: API.GetOperationUserInfosQueryResultItem) => |
| | | role.roles?.length > 0 ? role.roles.map((x) => x.name).join(',') : '', |
| | | }, |
| | | status: { type: 'enum', valueEnum: EnumUserStatusText }, |
| | | // status: { type: 'enum', valueEnum: EnumUserStatusText }, |
| | | }, |
| | | } |
| | | ); |
| | |
| | | }); |
| | | } |
| | | |
| | | async function setUserInfoStatus(row: API.GetOperationUserInfosQueryResultItem) { |
| | | try { |
| | | await Message.tipMessage( |
| | | `确认要${row.status === EnumUserStatus.Normal ? '禁用' : '启用'}该用户吗?` |
| | | ); |
| | | const res = await userServices.setUserInfoStatus({ |
| | | ids: [row.id], |
| | | status: |
| | | row.status === EnumUserStatus.Normal ? EnumUserStatus.Disabled : EnumUserStatus.Normal, |
| | | }); |
| | | if (res) { |
| | | getList(paginationState.pageIndex); |
| | | Message.successMessage(`操作成功`); |
| | | return !!res; |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function resetPassword() { |
| | | try { |
| | | let params: API.ResetUserPasswordsCommand = { |