修复打包问题
This commit is contained in:
@@ -81,6 +81,20 @@
|
||||
@click="formDialogRef.openDialog()">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Download"
|
||||
type="success"
|
||||
class="ml10"
|
||||
@click="handleExport">
|
||||
导 出
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="DataAnalysis"
|
||||
type="info"
|
||||
class="ml10"
|
||||
@click="handleRank">
|
||||
学期统计
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
@@ -128,17 +142,70 @@
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<!-- 学期统计对话框 -->
|
||||
<el-dialog
|
||||
title="学期统计"
|
||||
v-model="rankDialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form :inline="true" :model="rankForm">
|
||||
<el-form-item label="学年">
|
||||
<el-select
|
||||
v-model="rankForm.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<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="学期">
|
||||
<el-input
|
||||
v-model="rankForm.schoolTerm"
|
||||
placeholder="请输入学期"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getRankData">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="rankData"
|
||||
v-loading="rankLoading"
|
||||
border
|
||||
style="margin-top: 20px">
|
||||
<el-table-column type="index" label="序号" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip />
|
||||
<el-table-column prop="totalScore" label="总分数" show-overflow-tooltip />
|
||||
<el-table-column prop="count" label="记录数" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="rankDialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassCheckDaily">
|
||||
import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/classcheckdaily";
|
||||
import { fetchList, delObjs, exportData, getRank } from "/@/api/stuwork/classcheckdaily";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
import request from "/@/utils/request";
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
@@ -185,9 +252,19 @@ const {
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 学期统计相关
|
||||
const rankDialogVisible = ref(false)
|
||||
const rankLoading = ref(false)
|
||||
const rankData = ref<any[]>([])
|
||||
const rankForm = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: ''
|
||||
})
|
||||
|
||||
// 学院选择变化
|
||||
const handleDeptChange = () => {
|
||||
// 清空班号选择
|
||||
@@ -231,6 +308,60 @@ const handleDelete = async (ids: string[]) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
const res = await exportData(searchForm)
|
||||
// 处理返回的文件流
|
||||
const blob = new Blob([res.data])
|
||||
const elink = document.createElement('a')
|
||||
elink.download = '日常巡检.xlsx'
|
||||
elink.style.display = 'none'
|
||||
elink.href = URL.createObjectURL(blob)
|
||||
document.body.appendChild(elink)
|
||||
elink.click()
|
||||
URL.revokeObjectURL(elink.href)
|
||||
document.body.removeChild(elink)
|
||||
useMessage().success('导出成功')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导出失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 打开学期统计对话框
|
||||
const handleRank = () => {
|
||||
rankDialogVisible.value = true
|
||||
rankForm.schoolYear = ''
|
||||
rankForm.schoolTerm = ''
|
||||
rankData.value = []
|
||||
}
|
||||
|
||||
// 获取学期统计数据
|
||||
const getRankData = async () => {
|
||||
if (!rankForm.schoolYear || !rankForm.schoolTerm) {
|
||||
useMessage().warning('请选择学年和学期')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
rankLoading.value = true
|
||||
const res = await getRank({
|
||||
schoolYear: rankForm.schoolYear,
|
||||
schoolTerm: rankForm.schoolTerm
|
||||
})
|
||||
if (res.data) {
|
||||
rankData.value = Array.isArray(res.data) ? res.data : []
|
||||
} else {
|
||||
rankData.value = []
|
||||
}
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取统计数据失败')
|
||||
rankData.value = []
|
||||
} finally {
|
||||
rankLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user