|
@@ -376,7 +376,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup lang="ts">
|
|
|
+<script setup>
|
|
|
defineOptions({
|
|
|
name: "User",
|
|
|
inheritAttrs: false,
|
|
@@ -396,26 +396,24 @@ import {
|
|
|
import { treeList } from "@/api/system/dept";
|
|
|
import { getRoleOptions } from "@/api/system/role";
|
|
|
|
|
|
-import {UserQuery, UserPageVO } from "@/api/system/user/types";
|
|
|
-import type { UploadInstance } from "element-plus";
|
|
|
import { genFileId } from "element-plus";
|
|
|
|
|
|
const queryFormRef = ref(ElForm); // 查询表单
|
|
|
const userFormRef = ref(ElForm); // 用户表单
|
|
|
-const uploadRef = ref<UploadInstance>(); // 上传组件
|
|
|
+const uploadRef = ref(); // 上传组件
|
|
|
|
|
|
const loading = ref(false); // 加载状态
|
|
|
const removeIds = ref([]); // 删除用户ID集合 用于批量删除
|
|
|
-const queryParams = reactive<UserQuery>({
|
|
|
+const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
});
|
|
|
const dateTimeRange = ref("");
|
|
|
const total = ref(0); // 数据总数
|
|
|
-const pageData = ref<UserPageVO[]>(); // 用户分页数据
|
|
|
-const deptList = ref<OptionType[]>(); // 部门下拉数据源
|
|
|
-const roleList = ref<OptionType[]>(); // 角色下拉数据源
|
|
|
-const postList = ref<OptionType[]>(); // 岗位下拉数据源
|
|
|
+const pageData = ref(); // 用户分页数据
|
|
|
+const deptList = ref(); // 部门下拉数据源
|
|
|
+const roleList = ref(); // 角色下拉数据源
|
|
|
+const postList = ref(); // 岗位下拉数据源
|
|
|
|
|
|
|
|
|
// 弹窗对象
|
|
@@ -429,7 +427,8 @@ const dialog = reactive({
|
|
|
// 用户表单数据
|
|
|
const formData = reactive({
|
|
|
state: 0,
|
|
|
- sex: 0
|
|
|
+ sex: 0,
|
|
|
+ email: '',
|
|
|
});
|
|
|
|
|
|
// 用户导入数据
|
|
@@ -443,6 +442,7 @@ const importData = reactive({
|
|
|
const rules = reactive({
|
|
|
userName: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
|
|
|
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
|
|
+ employeeCode: [{ required: true, message: "员工编号不能为空", trigger: "blur" }],
|
|
|
deptIds: [{ required: true, message: "所属部门不能为空", trigger: "blur" }],
|
|
|
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "blur" }],
|
|
|
postIds: [{ required: true, message: "用户岗位不能为空", trigger: "blur" }],
|
|
@@ -480,19 +480,19 @@ function resetQuery() {
|
|
|
queryFormRef.value.resetFields();
|
|
|
dateTimeRange.value = "";
|
|
|
queryParams.pageNo = 1;
|
|
|
- queryParams.deptId = undefined;
|
|
|
+ //queryParams.deptId = undefined;
|
|
|
queryParams.startTime = undefined;
|
|
|
queryParams.endTime = undefined;
|
|
|
handleQuery();
|
|
|
}
|
|
|
|
|
|
/** 行选中 */
|
|
|
-function handleSelectionChange(selection: any) {
|
|
|
- removeIds.value = selection.map((item: any) => item.id);
|
|
|
+function handleSelectionChange(selection) {
|
|
|
+ removeIds.value = selection.map((item) => item.id);
|
|
|
}
|
|
|
|
|
|
/** 重置密码 */
|
|
|
-function resetPassword(row: { [key: string]: any }) {
|
|
|
+function resetPassword(row) {
|
|
|
ElMessageBox.confirm("确认重置用户密码吗?", "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
@@ -529,7 +529,7 @@ async function loadDeptOptions() {
|
|
|
* @param type 弹窗类型 用户表单:user-form | 用户导入:user-import
|
|
|
* @param id 用户ID
|
|
|
*/
|
|
|
-async function openDialog(type: string, row?: number) {
|
|
|
+async function openDialog(type, row) {
|
|
|
dialog.visible = true;
|
|
|
dialog.type = type;
|
|
|
|
|
@@ -574,7 +574,7 @@ function closeDialog() {
|
|
|
/** 表单提交 */
|
|
|
const handleSubmit = useThrottleFn(() => {
|
|
|
if (dialog.type === "user-form") {
|
|
|
- userFormRef.value.validate((valid: any) => {
|
|
|
+ userFormRef.value.validate((valid) => {
|
|
|
if (valid) {
|
|
|
const userId = formData.id;
|
|
|
loading.value = true;
|
|
@@ -615,7 +615,7 @@ const handleSubmit = useThrottleFn(() => {
|
|
|
}, 3000);
|
|
|
|
|
|
/** 删除用户 */
|
|
|
-function handleDelete(id?: number) {
|
|
|
+function handleDelete(id) {
|
|
|
|
|
|
ElMessageBox.confirm("确认删除用户?", "警告", {
|
|
|
confirmButtonText: "确定",
|
|
@@ -631,7 +631,7 @@ function handleDelete(id?: number) {
|
|
|
|
|
|
/** 下载导入模板 */
|
|
|
function downloadTemplate() {
|
|
|
- downloadTemplateApi().then((response: any) => {
|
|
|
+ downloadTemplateApi().then((response) => {
|
|
|
const fileData = response.data;
|
|
|
const fileName = decodeURI(
|
|
|
response.headers["content-disposition"].split(";")[1].split("=")[1]
|
|
@@ -655,22 +655,22 @@ function downloadTemplate() {
|
|
|
}
|
|
|
|
|
|
/** Excel文件 Change */
|
|
|
-function handleFileChange(file: any) {
|
|
|
+function handleFileChange(file) {
|
|
|
importData.file = file.raw;
|
|
|
}
|
|
|
|
|
|
/** Excel文件 Exceed */
|
|
|
-function handleFileExceed(files: any) {
|
|
|
- uploadRef.value!.clearFiles();
|
|
|
+function handleFileExceed(files) {
|
|
|
+ uploadRef.value.clearFiles();
|
|
|
const file = files[0];
|
|
|
file.uid = genFileId();
|
|
|
- uploadRef.value!.handleStart(file);
|
|
|
+ uploadRef.value.handleStart(file);
|
|
|
importData.file = file;
|
|
|
}
|
|
|
|
|
|
/** 导出用户 */
|
|
|
function handleExport() {
|
|
|
- exportUser(queryParams).then((response: any) => {
|
|
|
+ exportUser(queryParams).then((response) => {
|
|
|
const fileData = response.data;
|
|
|
const fileName = decodeURI(
|
|
|
response.headers["content-disposition"].split(";")[1].split("=")[1]
|