1
This commit is contained in:
@@ -64,9 +64,7 @@
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="Plus" type="primary" @click="formDialogRef.openDialog()"> 新增 </el-button>
|
||||
<el-button icon="Upload" type="success" class="ml10" @click="handleImport"> 导入行为记录 </el-button>
|
||||
<el-button icon="Download" type="primary" plain class="ml10" @click="handleDownloadConductTemplate"> 导入考核模板 </el-button>
|
||||
<el-button icon="Upload" type="warning" class="ml10" @click="handleConductImport"> 导入考核 </el-button>
|
||||
<el-button icon="Upload" type="success" class="ml10" @click="handleConductImport"> 导入考核 </el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList">
|
||||
<TableColumnControl
|
||||
ref="columnControlRef"
|
||||
@@ -168,42 +166,14 @@
|
||||
<!-- 新增/编辑对话框 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<el-dialog title="导入行为记录" v-model="importDialogVisible" :width="500" :close-on-click-modal="false" draggable>
|
||||
<el-upload ref="uploadRef" :auto-upload="false" :on-change="handleFileChange" :limit="1" accept=".xlsx,.xls" drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">只能上传 xlsx/xls 文件</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="importDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleImportSubmit" :disabled="!importFile || importLoading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入操行考核弹窗 -->
|
||||
<el-dialog title="导入操行考核数据" v-model="conductImportDialogVisible" :width="500" :close-on-click-modal="false" draggable>
|
||||
<div style="margin-bottom: 15px">
|
||||
<el-button icon="Download" type="success" @click="handleDownloadConductTemplate"> 下载模板 </el-button>
|
||||
</div>
|
||||
<el-upload :auto-upload="false" :on-change="handleConductFileChange" :limit="1" accept=".xlsx,.xls" drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">只能上传 xlsx/xls 文件,请先下载导入模板</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="conductImportDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleConductImportSubmit" :disabled="!conductImportFile || conductImportLoading">确认导入</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<upload-excel
|
||||
ref="conductUploadExcelRef"
|
||||
:title="'导入操行考核'"
|
||||
:url="'/stuwork/file/importConductAssessment'"
|
||||
:temp-url="'/stuwork/file/exportConductAssessmentTemplate'"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -211,8 +181,7 @@
|
||||
import { reactive, ref, onMounted, computed, nextTick } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { fetchList, delObj, importExcel } from '/@/api/stuwork/stuconduct';
|
||||
import { exportConductAssessmentTemplate, importConductAssessment, downloadBlobFile } from '/@/api/stuwork/file';
|
||||
import { fetchList, delObj } from '/@/api/stuwork/stuconduct';
|
||||
import { getDeptList } from '/@/api/basic/basicclass';
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear';
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass';
|
||||
@@ -220,7 +189,6 @@ import { getDicts } from '/@/api/admin/dict';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue';
|
||||
import {
|
||||
UploadFilled,
|
||||
List,
|
||||
CreditCard,
|
||||
Calendar,
|
||||
@@ -242,7 +210,6 @@ import FormDialog from './form.vue';
|
||||
const route = useRoute();
|
||||
const formDialogRef = ref();
|
||||
const columnControlRef = ref<any>();
|
||||
const uploadRef = ref();
|
||||
const searchFormRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const schoolYearList = ref<any[]>([]);
|
||||
@@ -250,12 +217,7 @@ const schoolTermList = ref<any[]>([]);
|
||||
const deptList = ref<any[]>([]);
|
||||
const classList = ref<any[]>([]);
|
||||
const typeList = ref<any[]>([]);
|
||||
const importDialogVisible = ref(false);
|
||||
const importFile = ref<File | null>(null);
|
||||
const importLoading = ref(false);
|
||||
const conductImportDialogVisible = ref(false);
|
||||
const conductImportFile = ref<File | null>(null);
|
||||
const conductImportLoading = ref(false);
|
||||
const conductUploadExcelRef = ref();
|
||||
|
||||
// 表格列配置
|
||||
const tableColumns = [
|
||||
@@ -357,81 +319,9 @@ const handleViewAttachment = (row: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 导入
|
||||
const handleImport = () => {
|
||||
importDialogVisible.value = true;
|
||||
importFile.value = null;
|
||||
uploadRef.value?.clearFiles();
|
||||
};
|
||||
|
||||
// 文件变化
|
||||
const handleFileChange = (file: any) => {
|
||||
importFile.value = file.raw;
|
||||
};
|
||||
|
||||
// 提交导入
|
||||
const handleImportSubmit = async () => {
|
||||
if (!importFile.value) {
|
||||
useMessage().warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
importLoading.value = true;
|
||||
try {
|
||||
await importExcel(importFile.value);
|
||||
useMessage().success('导入成功');
|
||||
importDialogVisible.value = false;
|
||||
importFile.value = null;
|
||||
uploadRef.value?.clearFiles();
|
||||
getDataList();
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导入失败');
|
||||
} finally {
|
||||
importLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 下载操行考核导入模板
|
||||
const handleDownloadConductTemplate = async () => {
|
||||
try {
|
||||
await downloadBlobFile(exportConductAssessmentTemplate(), `操行考核导入模板_${Date.now()}.xlsx`);
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || '下载模板失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 打开操行考核导入弹窗
|
||||
// 导入操行考核
|
||||
const handleConductImport = () => {
|
||||
conductImportDialogVisible.value = true;
|
||||
conductImportFile.value = null;
|
||||
};
|
||||
|
||||
// 操行考核文件变化
|
||||
const handleConductFileChange = (file: any) => {
|
||||
conductImportFile.value = file.raw;
|
||||
};
|
||||
|
||||
// 提交操行考核导入
|
||||
const handleConductImportSubmit = async () => {
|
||||
if (!conductImportFile.value) {
|
||||
useMessage().warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
conductImportLoading.value = true;
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append('file', conductImportFile.value);
|
||||
await importConductAssessment(formData);
|
||||
useMessage().success('导入成功');
|
||||
conductImportDialogVisible.value = false;
|
||||
conductImportFile.value = null;
|
||||
getDataList();
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导入失败');
|
||||
} finally {
|
||||
conductImportLoading.value = false;
|
||||
}
|
||||
conductUploadExcelRef.value?.show();
|
||||
};
|
||||
|
||||
// 编辑
|
||||
|
||||
@@ -210,37 +210,13 @@
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<el-dialog
|
||||
title="导入数据"
|
||||
v-model="importDialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
width="500px">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="handleFileChange"
|
||||
:file-list="fileList"
|
||||
accept=".xlsx,.xls"
|
||||
drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或<em>点击上传</em>
|
||||
</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
只能上传 xlsx/xls 文件
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="importDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleImportSubmit" :loading="importLoading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<upload-excel
|
||||
ref="uploadExcelRef"
|
||||
:title="'导入团员'"
|
||||
:url="'/stuwork/file/importStuUnionLeague'"
|
||||
:temp-url="'/stuwork/file/exportStuUnionLeagueTemplate'"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
|
||||
<!-- 统计对话框 -->
|
||||
<el-dialog
|
||||
@@ -290,16 +266,15 @@ import { reactive, ref, onMounted, computed, nextTick } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObj, getStatistics } from "/@/api/stuwork/stuunionleague";
|
||||
import { exportStuUnionLeagueTemplate, importStuUnionLeague, makeExportStuUnionLeagueTask } from "/@/api/stuwork/file";
|
||||
import { makeExportStuUnionLeagueTask } from "/@/api/stuwork/file";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { getGradeList } from "/@/api/basic/basicclass";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { parseTime } from "/@/utils/formatTime";
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||
import { UploadFilled, List, OfficeBuilding, Grid, CreditCard, Avatar, Phone, Calendar, Postcard, Briefcase, Setting, Menu, Search, Document, DataAnalysis } from '@element-plus/icons-vue'
|
||||
import { List, OfficeBuilding, Grid, CreditCard, Avatar, Phone, Calendar, Postcard, Briefcase, Setting, Menu, Search, Document, DataAnalysis } from '@element-plus/icons-vue'
|
||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||
|
||||
import type { UploadFile, UploadFiles } from 'element-plus';
|
||||
import FormDialog from './form.vue'
|
||||
|
||||
// 定义变量
|
||||
@@ -307,13 +282,10 @@ const route = useRoute()
|
||||
const formDialogRef = ref()
|
||||
const columnControlRef = ref<any>()
|
||||
const searchFormRef = ref()
|
||||
const uploadRef = ref()
|
||||
const uploadExcelRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const classList = ref<any[]>([])
|
||||
const gradeList = ref<any[]>([])
|
||||
const importDialogVisible = ref(false)
|
||||
const importLoading = ref(false)
|
||||
const fileList = ref<UploadFile[]>([])
|
||||
|
||||
// 统计相关变量
|
||||
const statisticsDialogVisible = ref(false)
|
||||
@@ -420,47 +392,7 @@ const handleDelete = async (row: any) => {
|
||||
|
||||
// 导入
|
||||
const handleImport = () => {
|
||||
importDialogVisible.value = true
|
||||
fileList.value = []
|
||||
}
|
||||
|
||||
// 文件变化
|
||||
const handleFileChange = (file: UploadFile, files: UploadFiles) => {
|
||||
fileList.value = [file]
|
||||
}
|
||||
|
||||
// 文件超出限制
|
||||
const handleExceed = () => {
|
||||
useMessage().warning('文件数量超出限制')
|
||||
}
|
||||
|
||||
// 提交导入
|
||||
const handleImportSubmit = async () => {
|
||||
if (fileList.value.length === 0) {
|
||||
useMessage().warning('请先选择要上传的文件')
|
||||
return
|
||||
}
|
||||
|
||||
const file = fileList.value[0].raw
|
||||
if (!file) {
|
||||
useMessage().warning('文件无效')
|
||||
return
|
||||
}
|
||||
|
||||
importLoading.value = true
|
||||
try {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file as File)
|
||||
await importStuUnionLeague(formData)
|
||||
useMessage().success('导入成功')
|
||||
importDialogVisible.value = false
|
||||
fileList.value = []
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导入失败')
|
||||
} finally {
|
||||
importLoading.value = false
|
||||
}
|
||||
uploadExcelRef.value?.show()
|
||||
}
|
||||
|
||||
// 导出
|
||||
|
||||
Reference in New Issue
Block a user