From d92cb8634bb438633371a95cfd3d4bc9b130ce08 Mon Sep 17 00:00:00 2001
From: yaojian <1161995598@qq.com>
Date: Tue, 10 Mar 2026 14:27:36 +0800
Subject: [PATCH] 1
---
src/views/stuwork/stuconduct/index.vue | 134 ++-------------------
src/views/stuwork/stuunionleague/index.vue | 92 ++------------
2 files changed, 24 insertions(+), 202 deletions(-)
diff --git a/src/views/stuwork/stuconduct/index.vue b/src/views/stuwork/stuconduct/index.vue
index ef8989f..46885eb 100644
--- a/src/views/stuwork/stuconduct/index.vue
+++ b/src/views/stuwork/stuconduct/index.vue
@@ -64,9 +64,7 @@
@@ -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();
-const uploadRef = ref();
const searchFormRef = ref();
const showSearch = ref(true);
const schoolYearList = ref([]);
@@ -250,12 +217,7 @@ const schoolTermList = ref([]);
const deptList = ref([]);
const classList = ref([]);
const typeList = ref([]);
-const importDialogVisible = ref(false);
-const importFile = ref(null);
-const importLoading = ref(false);
-const conductImportDialogVisible = ref(false);
-const conductImportFile = ref(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();
};
// 编辑
diff --git a/src/views/stuwork/stuunionleague/index.vue b/src/views/stuwork/stuunionleague/index.vue
index f731baf..ad8dfa3 100644
--- a/src/views/stuwork/stuunionleague/index.vue
+++ b/src/views/stuwork/stuunionleague/index.vue
@@ -208,39 +208,15 @@
-
+
-
-
-
-
- 将文件拖到此处,或点击上传
-
-
-
- 只能上传 xlsx/xls 文件
-
-
-
-
-
-
-
+
()
const searchFormRef = ref()
-const uploadRef = ref()
+const uploadExcelRef = ref()
const showSearch = ref(true)
const classList = ref([])
const gradeList = ref([])
-const importDialogVisible = ref(false)
-const importLoading = ref(false)
-const fileList = ref([])
// 统计相关变量
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()
}
// 导出