refactor: 代码重构优化(VueUse使用)

Former-commit-id: f33b8d352dd9e9b2a706c94cdd7afa150ac12931
This commit is contained in:
haoxr
2023-03-01 00:47:39 +08:00
parent 1e6e202ce6
commit 599624e944
16 changed files with 164 additions and 194 deletions

View File

@@ -46,9 +46,9 @@ import {
} from '@element-plus/icons-vue';
import {
UserForm,
UserImportData,
UserImportVO,
UserQuery,
UserType
UserPageVO
} from '@/api/user/types';
const deptTreeRef = ref(ElTree); // 部门树
@@ -65,7 +65,7 @@ const state = reactive({
ids: [] as number[],
// 总条数
total: 0,
userList: [] as UserType[],
userList: [] as UserPageVO[],
dialog: {
visible: false
} as DialogType,
@@ -110,7 +110,7 @@ const state = reactive({
title: '用户导入',
visible: false
} as DialogType,
importFormData: {} as UserImportData,
importFormData: {} as UserImportVO,
excelFile: undefined as any,
excelFilelist: [] as File[]
});
@@ -396,7 +396,7 @@ function handleExcelChange(file: UploadFile) {
/**
* Excel文件上传
*/
function submitImportForm() {
function uploadUser() {
importFormRef.value.validate((valid: any) => {
if (valid) {
if (!state.excelFile) {
@@ -805,7 +805,7 @@ onMounted(() => {
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitImportForm"> </el-button>
<el-button type="primary" @click="uploadUser"> </el-button>
<el-button @click="closeImportDialog"> </el-button>
</div>
</template>