课时统计功能提交

This commit is contained in:
2026-09-24 14:08:44 +08:00
parent d9f8bf705d
commit bd395a5504
5 changed files with 135 additions and 0 deletions
+9
View File
@@ -12,6 +12,15 @@ export function listHourStatistics(query) {
})
}
// 课时核算:按自然年聚合已排课次生成课时统计表(覆盖该年,仅教务)
export function recalcHourStatistics(year) {
return request({
url: '/ks/hour-stat/recalculate',
method: 'post',
params: year != null ? { year } : {}
})
}
// 导出课时统计 Excel(返回 Blob,文件名 课时统计.xlsx)
export function exportHourStatistics(query) {
return request({
@@ -31,6 +31,7 @@
<el-col :xs="24" :sm="12" :md="6" class="search-actions-col">
<div class="search-actions">
<el-button type="primary" @click="handleQuery">查询</el-button>
<el-button type="primary" plain @click="handleRecalc">课时核算</el-button>
<el-button type="primary" plain @click="handleExport">导出 Excel</el-button>
</div>
</el-col>
@@ -130,6 +131,7 @@ import { saveAs } from 'file-saver'
import {
listHourStatistics,
exportHourStatistics,
recalcHourStatistics,
listFeeStatistics,
exportFeeStatistics
} from '@/api/classHour/hourStat'
@@ -230,6 +232,21 @@ export default {
this.fetchList()
},
/** 课时核算:按学期年度(缺省当前年)聚合已排课次,覆盖该年统计 */
handleRecalc() {
const nd = (this.hourForm.nd || '').trim()
const year = nd ? Number(nd) : null
const tip = year
? `将按 ${year} 年已排课次重新核算课时统计,该年现有统计将被覆盖,是否继续?`
: '将按当前年已排课次重新核算课时统计,该年现有统计将被覆盖,是否继续?'
this.$confirm(tip, '课时核算', { type: 'warning' }).then(() => {
recalcHourStatistics(year).then(res => {
this.$message.success(`核算完成,共生成 ${(res && res.data) || 0} 名教员的课时统计`)
this.fetchList()
}).catch(() => {})
}).catch(() => {})
},
// ==================== 导出 ====================
handleExport() {
const clean = this.buildParams(this.currentForm)