1
This commit is contained in:
@@ -32,7 +32,7 @@ export const importComment = (file: File) => {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
return request({
|
return request({
|
||||||
url: '/ems/emsqualityreport/importComment',
|
url: '/ems/file/importStudentComment',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: formData,
|
data: formData,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -47,7 +47,7 @@ export const importComment = (file: File) => {
|
|||||||
*/
|
*/
|
||||||
export const setClassStartTime = (data: any) => {
|
export const setClassStartTime = (data: any) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/ems/emsqualityreport/setClassStartTime',
|
url: '/ems/emsopenschooltime/edit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
@@ -66,3 +66,14 @@ export const exportExcel = (query?: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出学生评语模板
|
||||||
|
*/
|
||||||
|
export const exportStudentCommentTemplate = () => {
|
||||||
|
return request({
|
||||||
|
url: '/ems/file/exportStudentCommentTemplate',
|
||||||
|
method: 'get',
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -278,9 +278,9 @@ import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue'
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
import { fetchList, delObj, putObjs, classExportData, getDeptList, getClassListByRole } from "/@/api/basic/basicclass";
|
import { fetchList, delObj, putObjs, classExportData, getDeptList, getClassListByRole } from "/@/api/basic/basicclass";
|
||||||
|
import { makeExportClassOverviewTask } from "/@/api/stuwork/file";
|
||||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
import { fetchList as getRuleList } from "/@/api/stuwork/entrancerule";
|
import { fetchList as getRuleList } from "/@/api/stuwork/entrancerule";
|
||||||
import { downBlobFile, adaptationUrl } from "/@/utils/other";
|
|
||||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||||
import { List, OfficeBuilding, Grid, Document, UserFilled, Phone, User, Lock, CircleCheck, TrendCharts, Setting, Menu, Search } from '@element-plus/icons-vue'
|
import { List, OfficeBuilding, Grid, Document, UserFilled, Phone, User, Lock, CircleCheck, TrendCharts, Setting, Menu, Search } from '@element-plus/icons-vue'
|
||||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||||
@@ -467,8 +467,8 @@ const confirmLinkRule = async () => {
|
|||||||
// 导出
|
// 导出
|
||||||
const handleExport = async () => {
|
const handleExport = async () => {
|
||||||
try {
|
try {
|
||||||
await downBlobFile(adaptationUrl('/basic/basicclass/classExportData'), searchForm, '班级信息.xlsx')
|
await makeExportClassOverviewTask(searchForm)
|
||||||
useMessage().success('导出成功')
|
useMessage().success('导出任务已创建,请在文件管理中下载')
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg || '导出失败')
|
useMessage().error(err.msg || '导出失败')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,6 +416,44 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 学生信息导出字段选择弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
title="选择导出字段"
|
||||||
|
v-model="exportFieldDialogVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable
|
||||||
|
width="600px">
|
||||||
|
<div class="export-field-container">
|
||||||
|
<div class="field-header">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="exportFieldCheckAll"
|
||||||
|
:indeterminate="exportFieldIndeterminate"
|
||||||
|
@change="handleExportFieldCheckAllChange">
|
||||||
|
全选
|
||||||
|
</el-checkbox>
|
||||||
|
<el-button type="primary" link @click="handleExportFieldReset">重置</el-button>
|
||||||
|
</div>
|
||||||
|
<el-divider />
|
||||||
|
<el-checkbox-group v-model="selectedExportFields" class="field-checkbox-group">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="field in exportFieldOptions"
|
||||||
|
:key="field.value"
|
||||||
|
:label="field.value"
|
||||||
|
class="field-checkbox">
|
||||||
|
{{ field.label }}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="exportFieldDialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="handleExportFieldConfirm" :loading="exportFieldLoading" :disabled="selectedExportFields.length === 0">
|
||||||
|
确认导出
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -448,6 +486,7 @@ import { downBlobFile, adaptationUrl } from "/@/utils/other";
|
|||||||
import { Session } from "/@/utils/storage";
|
import { Session } from "/@/utils/storage";
|
||||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||||
import GenderTag from '/@/components/GenderTag/index.vue'
|
import GenderTag from '/@/components/GenderTag/index.vue'
|
||||||
|
import {makeExportClassRoomHygieneMonthlyTask} from "/@/api/stuwork/file";
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
@@ -472,6 +511,12 @@ const selectedRows = ref<any[]>([])
|
|||||||
const importCertificateDialogVisible = ref(false)
|
const importCertificateDialogVisible = ref(false)
|
||||||
const uploadLoading = ref(false)
|
const uploadLoading = ref(false)
|
||||||
const fileList = ref<any[]>([])
|
const fileList = ref<any[]>([])
|
||||||
|
// 导出字段选择相关
|
||||||
|
const exportFieldDialogVisible = ref(false)
|
||||||
|
const exportFieldLoading = ref(false)
|
||||||
|
const selectedExportFields = ref<string[]>([])
|
||||||
|
const exportFieldCheckAll = ref(false)
|
||||||
|
const exportFieldIndeterminate = ref(false)
|
||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
@@ -499,6 +544,36 @@ const visibleColumns = ref<string[]>([])
|
|||||||
// 列排序顺序
|
// 列排序顺序
|
||||||
const columnOrder = ref<string[]>([])
|
const columnOrder = ref<string[]>([])
|
||||||
|
|
||||||
|
// 导出字段选项
|
||||||
|
const exportFieldOptions = [
|
||||||
|
{ value: 'deptName', label: '学院' },
|
||||||
|
{ value: 'majorName', label: '专业' },
|
||||||
|
{ value: 'className', label: '班级' },
|
||||||
|
{ value: 'classNo', label: '班号' },
|
||||||
|
{ value: 'stuNo', label: '学号' },
|
||||||
|
{ value: 'realName', label: '姓名' },
|
||||||
|
{ value: 'gender', label: '性别' },
|
||||||
|
{ value: 'idCard', label: '身份证号' },
|
||||||
|
{ value: 'birthday', label: '出生日期' },
|
||||||
|
{ value: 'nation', label: '民族' },
|
||||||
|
{ value: 'politicalStatus', label: '政治面貌' },
|
||||||
|
{ value: 'phone', label: '个人电话' },
|
||||||
|
{ value: 'parentPhone', label: '家长电话' },
|
||||||
|
{ value: 'education', label: '文化程度' },
|
||||||
|
{ value: 'householdType', label: '户口性质' },
|
||||||
|
{ value: 'householdAddress', label: '户籍所在地' },
|
||||||
|
{ value: 'currentAddress', label: '现住址' },
|
||||||
|
{ value: 'isDorm', label: '是否住宿' },
|
||||||
|
{ value: 'dormNo', label: '宿舍号' },
|
||||||
|
{ value: 'enrollStatus', label: '学籍状态' },
|
||||||
|
{ value: 'stuStatus', label: '学生状态' },
|
||||||
|
{ value: 'teacherName', label: '班主任' },
|
||||||
|
{ value: 'isClassLeader', label: '是否班干部' },
|
||||||
|
{ value: 'bankCard', label: '银行卡号' },
|
||||||
|
{ value: 'bankName', label: '开户行' },
|
||||||
|
{ value: 'remark', label: '备注' }
|
||||||
|
]
|
||||||
|
|
||||||
// 从本地统一存储加载配置
|
// 从本地统一存储加载配置
|
||||||
const loadSavedConfig = () => {
|
const loadSavedConfig = () => {
|
||||||
const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
|
const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
|
||||||
@@ -654,8 +729,56 @@ const handleSelectionChange = (selection: any[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 学生信息导出
|
// 学生信息导出
|
||||||
const handleExportStudent = async () => {
|
const handleExportStudent = () => {
|
||||||
useMessage().warning('功能开发中')
|
// 打开字段选择弹窗
|
||||||
|
exportFieldDialogVisible.value = true
|
||||||
|
// 默认选中常用字段
|
||||||
|
if (selectedExportFields.value.length === 0) {
|
||||||
|
selectedExportFields.value = ['deptName', 'majorName', 'className', 'stuNo', 'realName', 'gender', 'idCard', 'phone', 'education', 'enrollStatus']
|
||||||
|
}
|
||||||
|
updateExportFieldCheckAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全选/取消全选
|
||||||
|
const handleExportFieldCheckAllChange = (val: boolean) => {
|
||||||
|
selectedExportFields.value = val ? exportFieldOptions.map(item => item.value) : []
|
||||||
|
exportFieldIndeterminate.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新全选状态
|
||||||
|
const updateExportFieldCheckAll = () => {
|
||||||
|
const total = exportFieldOptions.length
|
||||||
|
const selected = selectedExportFields.value.length
|
||||||
|
exportFieldCheckAll.value = selected === total
|
||||||
|
exportFieldIndeterminate.value = selected > 0 && selected < total
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置选择
|
||||||
|
const handleExportFieldReset = () => {
|
||||||
|
selectedExportFields.value = ['deptName', 'majorName', 'className', 'stuNo', 'realName', 'gender', 'idCard', 'phone', 'education', 'enrollStatus']
|
||||||
|
updateExportFieldCheckAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认导出
|
||||||
|
const handleExportFieldConfirm = async () => {
|
||||||
|
if (selectedExportFields.value.length === 0) {
|
||||||
|
useMessage().warning('请至少选择一个导出字段')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
exportFieldLoading.value = true
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...searchForm,
|
||||||
|
fields: selectedExportFields.value.join(',')
|
||||||
|
}
|
||||||
|
await exportStudentData(params)
|
||||||
|
useMessage().success('导出任务已创建,请在文件管理中下载')
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || '导出失败')
|
||||||
|
} finally {
|
||||||
|
exportFieldLoading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 申请顶岗
|
// 申请顶岗
|
||||||
@@ -889,3 +1012,30 @@ onMounted(() => {
|
|||||||
getStuStatusListData()
|
getStuStatusListData()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.export-field-container {
|
||||||
|
.field-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-checkbox-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
.field-checkbox {
|
||||||
|
width: calc(25% - 12px);
|
||||||
|
margin-right: 0;
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
width: calc(50% - 12px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
icon="Download"
|
icon="Download"
|
||||||
type="primary"
|
type="primary"
|
||||||
class="ml10"
|
class="ml10"
|
||||||
@click="handleExport">
|
@click="handleExportIntroduction">
|
||||||
名单导出
|
名单导出
|
||||||
</el-button>
|
</el-button>
|
||||||
<right-toolbar
|
<right-toolbar
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" />
|
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" />
|
||||||
<el-table-column prop="comment" label="评语" show-overflow-tooltip align="center" min-width="200" />
|
<el-table-column prop="comment" label="评语" show-overflow-tooltip align="center" min-width="200" />
|
||||||
<el-table-column prop="parentalMsg" label="家长寄语" show-overflow-tooltip align="center" min-width="200" />
|
<el-table-column prop="parentalMsg" label="家长寄语" show-overflow-tooltip align="center" min-width="200" />
|
||||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
<el-table-column label="操作" width="200" align="center" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
icon="Edit"
|
icon="Edit"
|
||||||
@@ -140,6 +140,13 @@
|
|||||||
@click="handleEdit(scope.row)">
|
@click="handleEdit(scope.row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="Document"
|
||||||
|
text
|
||||||
|
type="success"
|
||||||
|
@click="handleExportSingle(scope.row)">
|
||||||
|
导出评语
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -161,6 +168,9 @@
|
|||||||
:width="500"
|
:width="500"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
draggable>
|
draggable>
|
||||||
|
<div style="text-align: center; margin-bottom: 20px">
|
||||||
|
<el-button type="success" :icon="Download" @click="handleDownloadTemplate">下载模板</el-button>
|
||||||
|
</div>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
@@ -199,6 +209,35 @@
|
|||||||
:rules="startTimeRules"
|
:rules="startTimeRules"
|
||||||
label-width="120px"
|
label-width="120px"
|
||||||
v-loading="startTimeLoading">
|
v-loading="startTimeLoading">
|
||||||
|
<el-form-item label="学年" prop="schoolYear">
|
||||||
|
<el-select
|
||||||
|
v-model="startTimeForm.schoolYear"
|
||||||
|
placeholder="请选择学年"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in schoolYearList"
|
||||||
|
:key="item.year"
|
||||||
|
:label="item.year"
|
||||||
|
:value="item.year">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="学期" prop="schoolTerm">
|
||||||
|
<el-select
|
||||||
|
v-model="startTimeForm.schoolTerm"
|
||||||
|
placeholder="请选择学期"
|
||||||
|
clearable
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in schoolTermList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="班级" prop="classCode">
|
<el-form-item label="班级" prop="classCode">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="startTimeForm.classCode"
|
v-model="startTimeForm.classCode"
|
||||||
@@ -217,10 +256,10 @@
|
|||||||
<el-form-item label="开学时间" prop="startTime">
|
<el-form-item label="开学时间" prop="startTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="startTimeForm.startTime"
|
v-model="startTimeForm.startTime"
|
||||||
type="date"
|
type="datetime"
|
||||||
placeholder="选择开学时间"
|
placeholder="选择开学时间"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD HH:mm"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD HH:mm"
|
||||||
style="width: 100%" />
|
style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -237,13 +276,14 @@
|
|||||||
<script setup lang="ts" name="QualityReport">
|
<script setup lang="ts" name="QualityReport">
|
||||||
import { reactive, ref, onMounted } from 'vue'
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
import { fetchList, importComment, setClassStartTime, exportExcel } from "/@/api/ems/qualityReport";
|
import { fetchList, importComment, setClassStartTime, exportExcel, exportStudentCommentTemplate } from "/@/api/ems/qualityReport";
|
||||||
|
import { exportClassAssetsIntroduction, downloadBlobFile } from "/@/api/stuwork/file";
|
||||||
import { getDeptList } from "/@/api/basic/basicclass";
|
import { getDeptList } from "/@/api/basic/basicclass";
|
||||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||||
import { getDicts } from "/@/api/admin/dict";
|
import { getDicts } from "/@/api/admin/dict";
|
||||||
import { useMessage } from "/@/hooks/message";
|
import { useMessage } from "/@/hooks/message";
|
||||||
import { UploadFilled } from '@element-plus/icons-vue'
|
import { UploadFilled, Download } from '@element-plus/icons-vue'
|
||||||
import EditDialog from './edit.vue'
|
import EditDialog from './edit.vue'
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
@@ -265,14 +305,23 @@ const startTimeLoading = ref(false)
|
|||||||
// 设置班级开学时间表单
|
// 设置班级开学时间表单
|
||||||
const startTimeForm = reactive({
|
const startTimeForm = reactive({
|
||||||
classCode: '',
|
classCode: '',
|
||||||
|
classNo: '',
|
||||||
|
schoolYear: '',
|
||||||
|
schoolTerm: '',
|
||||||
startTime: ''
|
startTime: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
// 设置班级开学时间表单验证规则
|
// 设置班级开学时间表单验证规则
|
||||||
const startTimeRules = {
|
const startTimeRules = {
|
||||||
|
schoolYear: [
|
||||||
|
{ required: true, message: '请选择学年', trigger: 'change' }
|
||||||
|
],
|
||||||
classCode: [
|
classCode: [
|
||||||
{ required: true, message: '请选择班级', trigger: 'change' }
|
{ required: true, message: '请选择班级', trigger: 'change' }
|
||||||
],
|
],
|
||||||
|
schoolTerm: [
|
||||||
|
{ required: true, message: '请选择学期', trigger: 'change' }
|
||||||
|
],
|
||||||
startTime: [
|
startTime: [
|
||||||
{ required: true, message: '请选择开学时间', trigger: 'change' }
|
{ required: true, message: '请选择开学时间', trigger: 'change' }
|
||||||
]
|
]
|
||||||
@@ -339,6 +388,24 @@ const handleFileChange = (file: any) => {
|
|||||||
importFile.value = file.raw
|
importFile.value = file.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载模板
|
||||||
|
const handleDownloadTemplate = async () => {
|
||||||
|
try {
|
||||||
|
const res = await exportStudentCommentTemplate()
|
||||||
|
const blob = res instanceof Blob ? res : (res.data instanceof Blob ? res.data : new Blob([res.data || res]))
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '学生评语导入模板.xlsx'
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
document.body.removeChild(link)
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || '下载模板失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 提交导入
|
// 提交导入
|
||||||
const handleImportSubmit = async () => {
|
const handleImportSubmit = async () => {
|
||||||
if (!importFile.value) {
|
if (!importFile.value) {
|
||||||
@@ -365,6 +432,9 @@ const handleImportSubmit = async () => {
|
|||||||
const handleSetClassStartTime = () => {
|
const handleSetClassStartTime = () => {
|
||||||
startTimeDialogVisible.value = true
|
startTimeDialogVisible.value = true
|
||||||
startTimeForm.classCode = ''
|
startTimeForm.classCode = ''
|
||||||
|
startTimeForm.classNo = ''
|
||||||
|
startTimeForm.schoolYear = ''
|
||||||
|
startTimeForm.schoolTerm = ''
|
||||||
startTimeForm.startTime = ''
|
startTimeForm.startTime = ''
|
||||||
startTimeFormRef.value?.resetFields()
|
startTimeFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
@@ -378,9 +448,23 @@ const handleStartTimeSubmit = async () => {
|
|||||||
|
|
||||||
startTimeLoading.value = true
|
startTimeLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
// 解析开学时间
|
||||||
|
const dateTime = startTimeForm.startTime.split(' ')
|
||||||
|
const dateParts = dateTime[0].split('-')
|
||||||
|
const timeParts = dateTime[1] ? dateTime[1].split(':') : ['00', '00']
|
||||||
|
|
||||||
|
// 查找选中班级的 classNo
|
||||||
|
const selectedClass = classList.value.find(item => item.classCode === startTimeForm.classCode)
|
||||||
|
const classNo = selectedClass ? selectedClass.classCode : ''
|
||||||
|
|
||||||
await setClassStartTime({
|
await setClassStartTime({
|
||||||
classCode: startTimeForm.classCode,
|
classNo: classNo, // 班级代码
|
||||||
startTime: startTimeForm.startTime
|
schoolYear: startTimeForm.schoolYear,
|
||||||
|
schoolTerm: startTimeForm.schoolTerm || '',
|
||||||
|
openYear: dateParts[0], // 开学年
|
||||||
|
openMonth: dateParts[1], // 开学月
|
||||||
|
openDate: dateParts[2], // 开学日
|
||||||
|
openHour: timeParts[0] // 开学时
|
||||||
})
|
})
|
||||||
useMessage().success('设置成功')
|
useMessage().success('设置成功')
|
||||||
startTimeDialogVisible.value = false
|
startTimeDialogVisible.value = false
|
||||||
@@ -426,6 +510,107 @@ const handleExport = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查 blob 是否包含错误信息(后端可能将错误以 blob 格式返回)
|
||||||
|
const checkBlobError = async (blob: Blob): Promise<boolean> => {
|
||||||
|
// 尝试读取 blob 内容检查是否为 JSON 错误信息
|
||||||
|
try {
|
||||||
|
const text = await blob.text()
|
||||||
|
// 尝试解析为 JSON
|
||||||
|
const errorData = JSON.parse(text)
|
||||||
|
// 检查是否有错误标识(code 不为 0 或有 msg 字段)
|
||||||
|
if (errorData.code !== undefined && errorData.code !== 0) {
|
||||||
|
useMessage().error(errorData.msg || errorData.message || '操作失败')
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 如果有 msg 字段且不是成功状态
|
||||||
|
if (errorData.msg && errorData.code !== 0) {
|
||||||
|
useMessage().error(errorData.msg)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 解析失败,不是 JSON,继续当作文件处理
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出班级评语(整班)
|
||||||
|
const handleExportIntroduction = async () => {
|
||||||
|
// 验证是否选择了班级
|
||||||
|
if (!state.queryForm.classCode || !state.queryForm.schoolYear || !state.queryForm.schoolTerm) {
|
||||||
|
useMessage().warning('请先选择班级 学年 学期')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
classCode: state.queryForm.classCode,
|
||||||
|
schoolYear: state.queryForm.schoolYear,
|
||||||
|
schoolTerm: state.queryForm.schoolTerm,
|
||||||
|
classNo: state.queryForm.classCode
|
||||||
|
// 不传 stuNo 则整班导出
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await exportClassAssetsIntroduction(params)
|
||||||
|
|
||||||
|
// 创建 blob 对象(docx 格式)- response 直接包含文件数据
|
||||||
|
const blob = res instanceof Blob ? res : (res.data instanceof Blob ? res.data : new Blob([res.data || res]))
|
||||||
|
|
||||||
|
// 检查是否是错误响应(blob 中包含 JSON 错误信息)
|
||||||
|
const isError = await checkBlobError(blob)
|
||||||
|
if (isError) return
|
||||||
|
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = `班级评语_${state.queryForm.classCode}.docx`
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
document.body.removeChild(link)
|
||||||
|
|
||||||
|
useMessage().success('导出成功')
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('导出班级评语失败', err)
|
||||||
|
useMessage().error(err.msg || '导出失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出单个学生评语
|
||||||
|
const handleExportSingle = async (row: any) => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
classCode: row.classCode || state.queryForm.classCode,
|
||||||
|
schoolYear: state.queryForm.schoolYear,
|
||||||
|
schoolTerm: state.queryForm.schoolTerm,
|
||||||
|
classNo: state.queryForm.classCode,
|
||||||
|
stuNo: row.stuNo // 传学号则是单人导出
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await exportClassAssetsIntroduction(params)
|
||||||
|
|
||||||
|
// 创建 blob 对象(docx 格式)- response 直接包含文件数据
|
||||||
|
const blob = res instanceof Blob ? res : (res.data instanceof Blob ? res.data : new Blob([res.data || res]))
|
||||||
|
|
||||||
|
// 检查是否是错误响应(blob 中包含 JSON 错误信息)
|
||||||
|
const isError = await checkBlobError(blob)
|
||||||
|
if (isError) return
|
||||||
|
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = `学生评语_${row.realName || row.stuNo}.docx`
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
document.body.removeChild(link)
|
||||||
|
|
||||||
|
useMessage().success('导出成功')
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('导出学生评语失败', err)
|
||||||
|
useMessage().error(err.msg || '导出失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = (row: any) => {
|
const handleEdit = (row: any) => {
|
||||||
editDialogRef.value?.openDialog(row)
|
editDialogRef.value?.openDialog(row)
|
||||||
|
|||||||
Reference in New Issue
Block a user