1
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
<el-button type="warning" icon="Bell" @click="handleSendWarning" :loading="warningLoading">发送预警</el-button>
|
||||
<el-button type="success" icon="Download" @click="handleDownloadTemplate">导入模板</el-button>
|
||||
<el-button type="primary" icon="Upload" @click="handleImport">导入考核</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
@@ -155,16 +157,50 @@
|
||||
<el-empty description="暂无考核记录" :image-size="80" />
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入操行考核弹窗 -->
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="StuConductTerm">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { getStuConductTerm, queryDataByStuNo, sendConductWarning } from "/@/api/stuwork/stuconduct";
|
||||
import { exportConductAssessmentTemplate, importConductAssessment, downloadBlobFile } from "/@/api/stuwork/file";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { UploadFilled } from '@element-plus/icons-vue'
|
||||
|
||||
// 表格样式 - 在组件内部定义,不从外部导入
|
||||
const tableStyle = {
|
||||
@@ -174,6 +210,7 @@ const tableStyle = {
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const uploadRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const loading = ref(false)
|
||||
const warningLoading = ref(false)
|
||||
@@ -185,6 +222,9 @@ const viewDialogVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const viewRow = ref<any>(null)
|
||||
const viewDetailList = ref<any[]>([])
|
||||
const importDialogVisible = ref(false)
|
||||
const importFile = ref<File | null>(null)
|
||||
const importLoading = ref(false)
|
||||
|
||||
// 查询表单
|
||||
const queryForm = reactive({
|
||||
@@ -390,6 +430,51 @@ const handleSendWarning = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 下载导入模板
|
||||
const handleDownloadTemplate = async () => {
|
||||
try {
|
||||
await downloadBlobFile(exportConductAssessmentTemplate(), `操行考核导入模板_${Date.now()}.xlsx`)
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || '下载模板失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 打开导入弹窗
|
||||
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 {
|
||||
const formData = new FormData()
|
||||
formData.append('file', importFile.value)
|
||||
await importConductAssessment(formData)
|
||||
useMessage().success('导入成功')
|
||||
importDialogVisible.value = false
|
||||
importFile.value = null
|
||||
uploadRef.value?.clearFiles()
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导入失败')
|
||||
} finally {
|
||||
importLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user