|
|
|
@ -2,78 +2,44 @@
|
|
|
|
|
<ContentWrap> |
|
|
|
|
<section class="flex flex-col gap-20px"> |
|
|
|
|
<el-form |
|
|
|
|
class="-mb-15px" |
|
|
|
|
class="-mb-15px form-box" |
|
|
|
|
:model="queryParams" |
|
|
|
|
ref="queryFormRef" |
|
|
|
|
:inline="true" |
|
|
|
|
label-width="68px" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="用名称" prop="username"> |
|
|
|
|
<el-form-item label="" prop="username"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="queryParams.realName" |
|
|
|
|
placeholder="请输入用户名称" |
|
|
|
|
placeholder="请输入真实姓名" |
|
|
|
|
clearable |
|
|
|
|
@keyup.enter="handleQuery" |
|
|
|
|
class="!w-240px" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="" prop="mobile"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="queryParams.mobile" |
|
|
|
|
placeholder="请输入手机号码" |
|
|
|
|
clearable |
|
|
|
|
@keyup.enter="handleQuery" |
|
|
|
|
class="!w-240px" |
|
|
|
|
class="!w-370px" |
|
|
|
|
:prefix-icon="Search" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="" prop="status" v-if="!isInset"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="queryParams.status" |
|
|
|
|
placeholder="用户状态" |
|
|
|
|
v-model="queryParams.deptId" |
|
|
|
|
placeholder="请选择所属部门" |
|
|
|
|
clearable |
|
|
|
|
class="!w-240px" |
|
|
|
|
class="!w-370px" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" |
|
|
|
|
:key="dict.value" |
|
|
|
|
:label="dict.label" |
|
|
|
|
:value="dict.value" |
|
|
|
|
v-for="dict in deptList" |
|
|
|
|
:key="dict.id" |
|
|
|
|
:label="dict.name" |
|
|
|
|
:value="dict.id" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="" prop="createTime" v-if="!isInset"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="queryParams.createTime" |
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
|
|
|
type="datetimerange" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
class="!w-240px" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button> |
|
|
|
|
<el-button type="per" @click="handleQuery"><Icon icon="ep:search" /> 查询 </el-button> |
|
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="import"> |
|
|
|
|
<el-button |
|
|
|
|
type="primary" |
|
|
|
|
plain |
|
|
|
|
@click="openForm('create')" |
|
|
|
|
v-hasPermi="['system:user:create']" |
|
|
|
|
v-if="!isInset" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:plus" /> 新增 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
type="warning" |
|
|
|
|
plain |
|
|
|
|
@click="handleImport" |
|
|
|
|
v-hasPermi="['system:user:import']" |
|
|
|
|
v-if="!isInset" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:upload" /> 导入 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
type="success" |
|
|
|
|
plain |
|
|
|
|
@click="handleExport" |
|
|
|
|
:loading="exportLoading" |
|
|
|
@ -83,47 +49,48 @@
|
|
|
|
|
<Icon icon="ep:download" />导出 |
|
|
|
|
</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="list"> |
|
|
|
|
<el-table-column |
|
|
|
|
label="真实姓名" |
|
|
|
|
align="center" |
|
|
|
|
prop="realName" |
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
width="130" |
|
|
|
|
/> |
|
|
|
|
<el-table-column label="用户性别" align="center" prop="sex" width="120" > |
|
|
|
|
<el-table-column label="用户性别" prop="sex" width="130" > |
|
|
|
|
<template #default="scope"> |
|
|
|
|
{{getDictLabel(DICT_TYPE.SYSTEM_USER_SEX, scope.row.sex)}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="手机号码" align="center" prop="mobile" width="120" /> |
|
|
|
|
<el-table-column label="手机号码" prop="mobile" width="150" /> |
|
|
|
|
<el-table-column |
|
|
|
|
label="所属部门" |
|
|
|
|
align="center" |
|
|
|
|
key="deptName" |
|
|
|
|
prop="deptName" |
|
|
|
|
width="200" |
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
/> |
|
|
|
|
<el-table-column label="状态" key="status" v-if="!isInset"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="scope.row.status" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
@change="handleStatusChange(scope.row)" |
|
|
|
|
:disabled="!checkPermi(['system:user:update'])" |
|
|
|
|
<el-table-column |
|
|
|
|
label="职位权限" |
|
|
|
|
key="roleList" |
|
|
|
|
prop="roleList" |
|
|
|
|
width="200" |
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
/> |
|
|
|
|
<el-table-column label="审核状态" key="audit" v-if="!isInset" width="200"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<dict-tag :type="DICT_TYPE.USER_AUDIT_TYPE" :value="scope.row.audit" /> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
label="创建时间" |
|
|
|
|
align="center" |
|
|
|
|
prop="createTime" |
|
|
|
|
:formatter="dateFormatter" |
|
|
|
|
width="180" |
|
|
|
|
/> |
|
|
|
|
<el-table-column label="操作" align="center" width="160" v-if="!isInset"> |
|
|
|
|
<el-table-column label="操作" v-if="!isInset" align="center"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<div class="flex items-center justify-center"> |
|
|
|
|
<el-button |
|
|
|
@ -132,46 +99,9 @@
|
|
|
|
|
@click="openForm('update', scope.row.id)" |
|
|
|
|
v-hasPermi="['system:user:update']" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:edit" />修改 |
|
|
|
|
编辑 |
|
|
|
|
</el-button> |
|
|
|
|
<el-dropdown |
|
|
|
|
@command="(command) => handleCommand(command, scope.row)" |
|
|
|
|
v-hasPermi="[ |
|
|
|
|
'system:user:delete', |
|
|
|
|
'system:user:update-password', |
|
|
|
|
'system:permission:assign-user-role' |
|
|
|
|
]" |
|
|
|
|
> |
|
|
|
|
<el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button> |
|
|
|
|
<template #dropdown> |
|
|
|
|
<el-dropdown-menu> |
|
|
|
|
<el-dropdown-item |
|
|
|
|
command="handleDelete" |
|
|
|
|
v-if="checkPermi(['system:user:delete'])" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:delete" />删除 |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item |
|
|
|
|
command="handleDelete2" |
|
|
|
|
v-if="checkPermi(['system:user:deleteAllData'])" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:delete" />测试删除全部数据 |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item |
|
|
|
|
command="handleResetPwd" |
|
|
|
|
v-if="checkPermi(['system:user:update-password'])" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:key" />重置密码 |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item |
|
|
|
|
command="handleRole" |
|
|
|
|
v-if="checkPermi(['system:permission:assign-user-role'])" |
|
|
|
|
> |
|
|
|
|
<Icon icon="ep:circle-check" />分配角色 |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
</el-dropdown-menu> |
|
|
|
|
</template> |
|
|
|
|
</el-dropdown> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -204,15 +134,15 @@
|
|
|
|
|
<UserAssignRoleForm ref="assignRoleFormRef" @success="getList" /> |
|
|
|
|
</template> |
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import { DICT_TYPE, getIntDictOptions, getDictLabel } from '@/utils/dict' |
|
|
|
|
import { checkPermi } from '@/utils/permission' |
|
|
|
|
import { DICT_TYPE, getDictLabel } from '@/utils/dict' |
|
|
|
|
import { dateFormatter } from '@/utils/formatTime' |
|
|
|
|
import download from '@/utils/download' |
|
|
|
|
import { CommonStatusEnum } from '@/utils/constants' |
|
|
|
|
import * as UserApi from '@/api/system/user' |
|
|
|
|
import UserForm from './UserForm.vue' |
|
|
|
|
import UserImportForm from './UserImportForm.vue' |
|
|
|
|
import UserAssignRoleForm from './UserAssignRoleForm.vue' |
|
|
|
|
import * as DeptApi from '@/api/system/dept' |
|
|
|
|
import { Search } from '@element-plus/icons-vue' |
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'SystemUser' }) |
|
|
|
|
|
|
|
|
@ -231,7 +161,7 @@ const queryParams = reactive({
|
|
|
|
|
mobile: undefined, |
|
|
|
|
status: undefined, |
|
|
|
|
deptId: undefined, |
|
|
|
|
audit: '2', |
|
|
|
|
audit: undefined, |
|
|
|
|
userType: '3', |
|
|
|
|
createTime: [] |
|
|
|
|
}) |
|
|
|
@ -266,6 +196,8 @@ const resetQuery = () => {
|
|
|
|
|
handleQuery() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 处理部门被点击 */ |
|
|
|
|
const handleDeptNodeClick = async (row) => { |
|
|
|
|
queryParams.deptId = row.id |
|
|
|
@ -280,26 +212,26 @@ const openForm = (type: string, id?: number) => {
|
|
|
|
|
|
|
|
|
|
/** 用户导入 */ |
|
|
|
|
const importFormRef = ref() |
|
|
|
|
const handleImport = () => { |
|
|
|
|
importFormRef.value.open() |
|
|
|
|
} |
|
|
|
|
// const handleImport = () => { |
|
|
|
|
// importFormRef.value.open() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
/** 修改用户状态 */ |
|
|
|
|
const handleStatusChange = async (row: UserApi.UserVO) => { |
|
|
|
|
try { |
|
|
|
|
// 修改状态的二次确认 |
|
|
|
|
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用' |
|
|
|
|
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?') |
|
|
|
|
// 发起修改状态 |
|
|
|
|
await UserApi.updateUserStatus(row.id, row.status) |
|
|
|
|
// 刷新列表 |
|
|
|
|
await getList() |
|
|
|
|
} catch { |
|
|
|
|
// 取消后,进行恢复按钮 |
|
|
|
|
row.status = |
|
|
|
|
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// /** 修改用户状态 */ |
|
|
|
|
// const handleStatusChange = async (row: UserApi.UserVO) => { |
|
|
|
|
// try { |
|
|
|
|
// // 修改状态的二次确认 |
|
|
|
|
// const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用' |
|
|
|
|
// await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?') |
|
|
|
|
// // 发起修改状态 |
|
|
|
|
// await UserApi.updateUserStatus(row.id, row.status) |
|
|
|
|
// // 刷新列表 |
|
|
|
|
// await getList() |
|
|
|
|
// } catch { |
|
|
|
|
// // 取消后,进行恢复按钮 |
|
|
|
|
// row.status = |
|
|
|
|
// row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
|
|
const exportLoading = ref(false) |
|
|
|
@ -384,8 +316,30 @@ const handleRole = (row: UserApi.UserVO) => {
|
|
|
|
|
assignRoleFormRef.value.open(row) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//部门查询 |
|
|
|
|
const deptList:any = ref([]) // 部门列表 |
|
|
|
|
const getDeptList = async () => { |
|
|
|
|
const res = await DeptApi.getSimpleDeptList() |
|
|
|
|
deptList.value = [] |
|
|
|
|
deptList.value = res |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 初始化 */ |
|
|
|
|
onMounted(() => { |
|
|
|
|
getDeptList() |
|
|
|
|
getList() |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.form-box { |
|
|
|
|
display: flex; |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
gap: 12px; |
|
|
|
|
|
|
|
|
|
.import { |
|
|
|
|
margin-left: auto; // 新增样式 |
|
|
|
|
align-self: flex-end; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|