|
@@ -34,8 +34,8 @@
|
|
|
<el-scrollbar class="pr10" ref="rightScrollRef">
|
|
|
<div class="flex-column">
|
|
|
<el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent>
|
|
|
- <el-form-item label="用户名" prop="Keyword">
|
|
|
- <el-input v-model="state.queryParams.Keyword" placeholder="请输入用户名" clearable @keyup.enter="handleQuery" />
|
|
|
+ <el-form-item label="关键字" prop="Keyword">
|
|
|
+ <el-input v-model="state.queryParams.Keyword" placeholder="姓名/电话号码" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="角色" prop="Role">
|
|
|
<el-select-v2 v-model="state.queryParams.Role" filterable :options="state.options" placeholder="请选择角色" clearable />
|
|
@@ -51,34 +51,29 @@
|
|
|
<p class="table-title"></p>
|
|
|
<div>
|
|
|
<el-button type="primary" @click="onOpenAddUser" v-auth="'100102'"> <SvgIcon name="ele-Plus" class="mr5" />新增 </el-button>
|
|
|
- <el-button type="primary" @click="onImportTable" :disabled="!state.multipleSelection.length">
|
|
|
- <SvgIcon name="iconfont icon-daochu" class="mr5" />导出
|
|
|
- </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
|
- <el-table :data="state.tableData" v-loading="state.tableLoading" row-key="id" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" :reserve-selection="true" />
|
|
|
+ <el-table :data="state.tableData" v-loading="state.tableLoading" row-key="id">
|
|
|
<el-table-column type="index" width="60" label="序号" />
|
|
|
- <el-table-column prop="name" label="用户名" show-overflow-tooltip width="150"></el-table-column>
|
|
|
+ <el-table-column prop="name" label="姓名" show-overflow-tooltip width="150"></el-table-column>
|
|
|
<el-table-column prop="userName" label="账号" show-overflow-tooltip width="150"></el-table-column>
|
|
|
<el-table-column prop="orgName" label="所属部门" show-overflow-tooltip width="190"></el-table-column>
|
|
|
- <el-table-column prop="roles" label="角色" show-overflow-tooltip width="300"></el-table-column>
|
|
|
+ <el-table-column prop="roleNames" label="角色" show-overflow-tooltip width="300"></el-table-column>
|
|
|
<el-table-column prop="phoneNo" label="电话号码" show-overflow-tooltip width="130"></el-table-column>
|
|
|
- <el-table-column prop="staffNo" label="工号" show-overflow-tooltip width="80"></el-table-column>
|
|
|
+ <el-table-column prop="staffNo" label="工号" show-overflow-tooltip width="120"></el-table-column>
|
|
|
<el-table-column prop="genderText" label="性别" show-overflow-tooltip width="80"></el-table-column>
|
|
|
<el-table-column prop="creationTime" label="更新时间" show-overflow-tooltip width="170">
|
|
|
<template #default="scope">
|
|
|
<span>{{ formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="state" label="状态" show-overflow-tooltip width="60"></el-table-column>
|
|
|
- <el-table-column label="操作" width="260" fixed="right" align="center">
|
|
|
- <template #default="scope">
|
|
|
- <el-button link type="primary" @click="onOpenEditUser(scope.row)" v-auth="'100103'" title="修改"> 修改 </el-button>
|
|
|
- <el-button link type="success" @click="onSetRole(scope.row)" v-auth="'100105'" title="设置角色"> 设置角色 </el-button>
|
|
|
- <el-button link type="warning" @click="onRestPwd(scope.row)" title="重置密码"> 重置密码 </el-button>
|
|
|
- <el-button link type="danger" @click="onRowDel(scope.row)" v-auth="'100104'" title="删除"> 删除 </el-button>
|
|
|
+ <el-table-column prop="state" label="状态" show-overflow-tooltip width="80"></el-table-column>
|
|
|
+ <el-table-column label="操作" width="180" fixed="right" align="center">
|
|
|
+ <template #default="{row}">
|
|
|
+ <el-button link type="primary" @click="onOpenEditUser(row)" v-auth="'100103'" title="修改" v-if="!row.isDeleted"> 修改 </el-button>
|
|
|
+ <el-button link type="warning" @click="onRestPwd(row)" title="重置密码" v-if="!row.isDeleted"> 重置密码 </el-button>
|
|
|
+ <el-button link type="danger" @click="onRowDel(row)" v-auth="'100104'" title="删除" v-if="!row.isDeleted"> 删除 </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<template #empty>
|
|
@@ -100,7 +95,6 @@
|
|
|
|
|
|
<AddUer ref="addUserRef" @updateList="handleQuery" />
|
|
|
<EditUser ref="editUserRef" @updateList="handleQuery" />
|
|
|
- <SetRole ref="setRoleRef" @updateList="handleQuery" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -108,19 +102,14 @@
|
|
|
import { defineAsyncComponent, ref, reactive, onMounted, watch, onActivated } from 'vue';
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
-import table2excel from 'js-table2excel';
|
|
|
import { formatDate } from '/@/utils/formatTime';
|
|
|
import { throttle } from '/@/utils/tools';
|
|
|
-import { useRoute } from 'vue-router';
|
|
|
-import { storeToRefs } from 'pinia';
|
|
|
-import { useThemeConfig } from '/@/stores/themeConfig';
|
|
|
import { delUser, getUserListPaged, restPwd, getRoles } from '/@/api/system/user';
|
|
|
import { getOrgList } from '/@/api/system/organize';
|
|
|
|
|
|
// 引入组件
|
|
|
const AddUer = defineAsyncComponent(() => import('/@/views/system/user/component/addUser.vue'));
|
|
|
const EditUser = defineAsyncComponent(() => import('/@/views/system/user/component/editUser.vue'));
|
|
|
-const SetRole = defineAsyncComponent(() => import('/@/views/system/user/component/setRole.vue'));
|
|
|
|
|
|
// 定义变量内容
|
|
|
const state = reactive<any>({
|
|
@@ -135,7 +124,6 @@ const state = reactive<any>({
|
|
|
total: 0,
|
|
|
loading: false,
|
|
|
tableLoading: false,
|
|
|
- multipleSelection: [],
|
|
|
orgData: [],
|
|
|
options: [],
|
|
|
defaultExpandedKeys: [],
|
|
@@ -143,11 +131,7 @@ const state = reactive<any>({
|
|
|
const ruleFormRef = ref<FormInstance>(); //表单ref
|
|
|
const addUserRef = ref(); //新增用户
|
|
|
const editUserRef = ref(); //修改用户信息
|
|
|
-const setRoleRef = ref(); //设置角色
|
|
|
const rightScrollRef = ref();
|
|
|
-const storesThemeConfig = useThemeConfig();
|
|
|
-const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
-const route = useRoute();
|
|
|
|
|
|
const filterOrg = ref('');
|
|
|
const treRef = ref();
|
|
@@ -215,14 +199,6 @@ const handleNodeClick = (data: any) => {
|
|
|
const onOpenAddUser = () => {
|
|
|
addUserRef.value.openDialog();
|
|
|
};
|
|
|
-// 打开设置用户角色弹窗
|
|
|
-const onSetRole = (row: any) => {
|
|
|
- setRoleRef.value.openDialog(row);
|
|
|
-};
|
|
|
-// 表格多选
|
|
|
-const handleSelectionChange = (val: any) => {
|
|
|
- state.multipleSelection = val;
|
|
|
-};
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = throttle((formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return;
|
|
@@ -273,24 +249,6 @@ const onRowDel = (row: any) => {
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
};
|
|
|
-// 导出表格
|
|
|
-const onImportTable = () => {
|
|
|
- const tabeHeader = [
|
|
|
- { key: 'name', colWidth: '', title: '姓名', type: 'text', isCheck: true },
|
|
|
- { key: 'userName', colWidth: '', title: '账号', type: 'text', isCheck: true },
|
|
|
- { key: 'orgName', colWidth: '', title: '所属部门', type: 'text', isCheck: true },
|
|
|
- { key: 'roles', colWidth: '', title: '角色', type: 'text', isCheck: true },
|
|
|
- { key: 'phoneNo', colWidth: '', title: '电话号码', type: 'text', isCheck: true },
|
|
|
- { key: 'staffNo', colWidth: '', title: '工号', type: 'text', isCheck: true },
|
|
|
- { key: 'defaultTelNo', colWidth: '', title: '默认分机', type: 'text', isCheck: true },
|
|
|
- { key: 'creationTime', colWidth: '', title: '更新时间', type: 'text', isCheck: true },
|
|
|
- ];
|
|
|
- table2excel(
|
|
|
- tabeHeader,
|
|
|
- state.multipleSelection,
|
|
|
- `${themeConfig.value.globalTitle}-${route.meta.title} ${formatDate(new Date(), 'YYYY-mm-dd HH-MM')}`
|
|
|
- );
|
|
|
-};
|
|
|
onMounted(() => {
|
|
|
getRolesFn();
|
|
|
getList();
|