|
@@ -19,7 +19,7 @@
|
|
|
@keyup.enter="handleQuery"
|
|
@keyup.enter="handleQuery"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-form-item label="状态" prop="status">
|
|
<el-form-item label="状态" prop="status">
|
|
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
|
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
@@ -43,7 +43,7 @@
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</div>
|
|
</div>
|
|
|
</transition>
|
|
</transition>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-card shadow="hover">
|
|
<el-card shadow="hover">
|
|
|
<template #header>
|
|
<template #header>
|
|
|
<el-row :gutter="10">
|
|
<el-row :gutter="10">
|
|
@@ -78,7 +78,7 @@
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns" :search="true"></right-toolbar>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns" :search="true"></right-toolbar>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
|
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
|
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
|
@@ -100,13 +100,13 @@
|
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<span>{{ scope.row.createTime }}</span>
|
|
<span>{{ scope.row.createTime }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
|
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
|
@@ -115,18 +115,18 @@
|
|
|
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
|
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
|
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
|
|
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
|
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
|
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
|
|
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
|
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<pagination
|
|
<pagination
|
|
|
v-show="total > 0"
|
|
v-show="total > 0"
|
|
|
:total="total"
|
|
:total="total"
|
|
@@ -137,7 +137,7 @@
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 添加或修改用户配置对话框 -->
|
|
<!-- 添加或修改用户配置对话框 -->
|
|
|
<el-dialog ref="formDialogRef" :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body @close="closeDialog">
|
|
<el-dialog ref="formDialogRef" :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body @close="closeDialog">
|
|
|
<el-form :model="form" :rules="rules" ref="userFormRef" label-width="80px">
|
|
<el-form :model="form" :rules="rules" ref="userFormRef" label-width="80px">
|
|
@@ -247,7 +247,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 用户导入对话框 -->
|
|
<!-- 用户导入对话框 -->
|
|
|
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
|
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
|
|
<el-upload
|
|
<el-upload
|
|
@@ -283,7 +283,7 @@
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<script setup name="User" lang="ts">
|
|
<script setup name="User" lang="ts">
|
|
|
import api from "@/api/system/user"
|
|
import api from "@/api/system/user"
|
|
|
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
|
|
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
|
|
@@ -293,11 +293,11 @@
|
|
|
import { PostVO } from "@/api/system/post/types";
|
|
import { PostVO } from "@/api/system/post/types";
|
|
|
import { to } from "await-to-js";
|
|
import { to } from "await-to-js";
|
|
|
import { globalHeaders } from "@/utils/request";
|
|
import { globalHeaders } from "@/utils/request";
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
|
|
const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const userList = ref<UserVO[]>();
|
|
const userList = ref<UserVO[]>();
|
|
|
const loading = ref(true);
|
|
const loading = ref(true);
|
|
|
const showSearch = ref(true)
|
|
const showSearch = ref(true)
|
|
@@ -336,19 +336,19 @@
|
|
|
{ key: 5, label: `状态`, visible: true,children: [] },
|
|
{ key: 5, label: `状态`, visible: true,children: [] },
|
|
|
{ key: 6, label: `创建时间`, visible: true,children: [] }
|
|
{ key: 6, label: `创建时间`, visible: true,children: [] }
|
|
|
])
|
|
])
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const deptTreeRef = ref<ElTreeInstance>();
|
|
const deptTreeRef = ref<ElTreeInstance>();
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const userFormRef = ref<ElFormInstance>();
|
|
const userFormRef = ref<ElFormInstance>();
|
|
|
const uploadRef = ref<ElUploadInstance>();
|
|
const uploadRef = ref<ElUploadInstance>();
|
|
|
const formDialogRef = ref<ElDialogInstance>();
|
|
const formDialogRef = ref<ElDialogInstance>();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const dialog = reactive<DialogOption>({
|
|
const dialog = reactive<DialogOption>({
|
|
|
visible: false,
|
|
visible: false,
|
|
|
title: ''
|
|
title: ''
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const initFormData: UserForm = {
|
|
const initFormData: UserForm = {
|
|
|
userId: undefined,
|
|
userId: undefined,
|
|
|
deptId: undefined,
|
|
deptId: undefined,
|
|
@@ -384,9 +384,9 @@
|
|
|
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
|
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data)
|
|
const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 通过条件过滤节点 */
|
|
/** 通过条件过滤节点 */
|
|
|
const filterNode = (value: string, data: any) => {
|
|
const filterNode = (value: string, data: any) => {
|
|
|
if (!value) return true
|
|
if (!value) return true
|
|
@@ -399,30 +399,29 @@
|
|
|
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
|
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 查询部门下拉树结构 */
|
|
/** 查询部门下拉树结构 */
|
|
|
const getTreeSelect = async () => {
|
|
const getTreeSelect = async () => {
|
|
|
const res = await api.deptTreeSelect();
|
|
const res = await api.deptTreeSelect();
|
|
|
deptOptions.value = res.data;
|
|
deptOptions.value = res.data;
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 查询用户列表 */
|
|
/** 查询用户列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
|
|
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
|
|
|
- console.log(res)
|
|
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
userList.value = res.rows;
|
|
userList.value = res.rows;
|
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 节点单击事件 */
|
|
/** 节点单击事件 */
|
|
|
const handleNodeClick = (data: DeptVO) => {
|
|
const handleNodeClick = (data: DeptVO) => {
|
|
|
queryParams.value.deptId = data.id;
|
|
queryParams.value.deptId = data.id;
|
|
|
handleQuery()
|
|
handleQuery()
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
|
queryParams.value.pageNum = 1
|
|
queryParams.value.pageNum = 1
|
|
@@ -437,7 +436,7 @@
|
|
|
deptTreeRef.value?.setCurrentKey(undefined);
|
|
deptTreeRef.value?.setCurrentKey(undefined);
|
|
|
handleQuery();
|
|
handleQuery();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
|
const handleDelete = async (row?: UserVO) => {
|
|
const handleDelete = async (row?: UserVO) => {
|
|
|
const userIds = row?.userId || ids.value;
|
|
const userIds = row?.userId || ids.value;
|
|
@@ -448,7 +447,7 @@
|
|
|
proxy?.$modal.msgSuccess("删除成功");
|
|
proxy?.$modal.msgSuccess("删除成功");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 用户状态修改 */
|
|
/** 用户状态修改 */
|
|
|
const handleStatusChange = async (row: UserVO) => {
|
|
const handleStatusChange = async (row: UserVO) => {
|
|
|
let text = row.status === "0" ? "启用" : "停用"
|
|
let text = row.status === "0" ? "启用" : "停用"
|
|
@@ -465,7 +464,7 @@
|
|
|
const userId = row.userId;
|
|
const userId = row.userId;
|
|
|
router.push("/system/user-auth/role/" + userId);
|
|
router.push("/system/user-auth/role/" + userId);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 重置密码按钮操作 */
|
|
/** 重置密码按钮操作 */
|
|
|
const handleResetPwd = async (row: UserVO) => {
|
|
const handleResetPwd = async (row: UserVO) => {
|
|
|
const [err, res] = await to(ElMessageBox.prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
|
const [err, res] = await to(ElMessageBox.prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
|
@@ -480,14 +479,14 @@
|
|
|
proxy?.$modal.msgSuccess("修改成功,新密码是:" + res.value);
|
|
proxy?.$modal.msgSuccess("修改成功,新密码是:" + res.value);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 选择条数 */
|
|
/** 选择条数 */
|
|
|
const handleSelectionChange = (selection: UserVO[]) => {
|
|
const handleSelectionChange = (selection: UserVO[]) => {
|
|
|
ids.value = selection.map((item) => item.userId);
|
|
ids.value = selection.map((item) => item.userId);
|
|
|
single.value = selection.length != 1;
|
|
single.value = selection.length != 1;
|
|
|
multiple.value = !selection.length;
|
|
multiple.value = !selection.length;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 导入按钮操作 */
|
|
/** 导入按钮操作 */
|
|
|
const handleImport = () => {
|
|
const handleImport = () => {
|
|
|
upload.title = "用户导入";
|
|
upload.title = "用户导入";
|
|
@@ -504,7 +503,7 @@
|
|
|
proxy?.download("system/user/importTemplate", {
|
|
proxy?.download("system/user/importTemplate", {
|
|
|
}, `user_template_${new Date().getTime()}.xlsx`);
|
|
}, `user_template_${new Date().getTime()}.xlsx`);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**文件上传中处理 */
|
|
/**文件上传中处理 */
|
|
|
const handleFileUploadProgress = () => {
|
|
const handleFileUploadProgress = () => {
|
|
|
upload.isUploading = true;
|
|
upload.isUploading = true;
|
|
@@ -517,12 +516,12 @@
|
|
|
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
|
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
getList();
|
|
getList();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 提交上传文件 */
|
|
/** 提交上传文件 */
|
|
|
function submitFileForm() {
|
|
function submitFileForm() {
|
|
|
uploadRef.value?.submit();
|
|
uploadRef.value?.submit();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 初始化部门数据 */
|
|
/** 初始化部门数据 */
|
|
|
const initTreeData = async () => {
|
|
const initTreeData = async () => {
|
|
|
// 判断部门的数据是否存在,存在不获取,不存在则获取
|
|
// 判断部门的数据是否存在,存在不获取,不存在则获取
|
|
@@ -531,8 +530,8 @@
|
|
|
deptOptions.value = data;
|
|
deptOptions.value = data;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/** 重置操作表单 */
|
|
/** 重置操作表单 */
|
|
|
const reset = () => {
|
|
const reset = () => {
|
|
|
form.value = { ...initFormData };
|
|
form.value = { ...initFormData };
|
|
@@ -543,7 +542,7 @@
|
|
|
dialog.visible = false;
|
|
dialog.visible = false;
|
|
|
reset();
|
|
reset();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
|
const handleAdd = async () => {
|
|
const handleAdd = async () => {
|
|
|
reset();
|
|
reset();
|
|
@@ -570,7 +569,7 @@
|
|
|
form.value.roleIds = data.roleIds;
|
|
form.value.roleIds = data.roleIds;
|
|
|
form.value.password = "";
|
|
form.value.password = "";
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
const submitForm = () => {
|
|
|
userFormRef.value?.validate(async (valid: boolean) => {
|
|
userFormRef.value?.validate(async (valid: boolean) => {
|
|
@@ -582,8 +581,8 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 关闭用户弹窗
|
|
* 关闭用户弹窗
|
|
|
*/
|
|
*/
|
|
@@ -591,14 +590,14 @@
|
|
|
dialog.visible = false;
|
|
dialog.visible = false;
|
|
|
resetForm();
|
|
resetForm();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 重置表单
|
|
* 重置表单
|
|
|
*/
|
|
*/
|
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
|
userFormRef.value?.resetFields();
|
|
userFormRef.value?.resetFields();
|
|
|
userFormRef.value?.clearValidate();
|
|
userFormRef.value?.clearValidate();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
form.value.id = undefined;
|
|
form.value.id = undefined;
|
|
|
form.value.status = '1';
|
|
form.value.status = '1';
|
|
|
}
|
|
}
|
|
@@ -610,6 +609,5 @@
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<style lang="scss" scoped></style>
|
|
<style lang="scss" scoped></style>
|
|
|
-
|
|
|