排课功能优化

This commit is contained in:
2026-09-17 17:14:31 +08:00
parent a958bcf059
commit 351df2cba2
26 changed files with 2699 additions and 190 deletions
@@ -64,6 +64,8 @@
<el-button type="success" plain icon="el-icon-date" :disabled="!currentRow" @click="handleEditEventCalendar">编辑班历</el-button>
<el-button type="success" plain icon="el-icon-calendar" :disabled="!currentRow" @click="handleEditCalendar">编辑班次教学任务</el-button>
<el-button type="success" plain icon="el-icon-data-line" :disabled="!currentRow" @click="handleAllocation">教学配当</el-button>
<el-button type="primary" plain icon="el-icon-upload2" :disabled="!selection.length" @click="handlePublishRunning">发布运行课表</el-button>
<el-button type="danger" plain icon="el-icon-delete-solid" :disabled="!selection.length" @click="handleWithdrawRunning">删除运行课表</el-button>
</div>
</div>
@@ -333,6 +335,7 @@ import { batchAutoGenerateTasks } from '@/api/studentRecords/classCalendar'
import { listSemester, allSemester, addSemester, updateSemester, delSemester, batchDeleteSemester, batchUpdateDateRange, batchUpdateJxrwbh, batchCreateSemester, batchUpdateXqdc, batchUpdateKfjypk, batchWaveMerge, batchWaveSplit, listCreatableClasses, presetSemesterDates } from '@/api/studentRecords/semester'
import { listAllSemester } from '@/api/teachBusiness/semester'
import { listTeachingTask } from '@/api/teachBusiness/teachingTask'
import { publishRunningCourses, withdrawRunningCourses } from '@/api/teachBusiness/schedulingWindow'
export default {
name: 'ShiftSemester',
@@ -346,6 +349,8 @@ export default {
return {
loading: false,
saving: false,
/** 运行课表批量发布/删除进行中 */
runningPublishing: false,
// ==================== 查询条件 ====================
searchForm: { xydbh: '', xqdc: undefined },
@@ -663,6 +668,70 @@ export default {
this.allocationVisible = true
},
// 批量发布【运行课表】(手册 12.1):把课程任务发布为运行课程,之后才能在排课窗口排课
handlePublishRunning() {
const rows = this.selection.slice()
if (!rows.length) {
this.$message.warning('请先勾选班次学期')
return
}
const ids = rows.map(item => item.bh || item.xydxqbh).filter(Boolean)
this.$confirm(
`将发布所选 ${ids.length} 个班次学期的课程到运行课表。<br/>发布前要求:教学任务已发布未结束、每门课程已指定责任教员与默认场地。`,
'批量发布【运行课表】',
{ type: 'warning', dangerouslyUseHTMLString: true }
).then(() => {
this.batchRunningPublish(publishRunningCourses, ids, '发布')
}).catch(() => {})
},
// 批量删除【运行课表】(手册 12.2):撤回运行课程,已排课次一并删除
handleWithdrawRunning() {
const rows = this.selection.slice()
if (!rows.length) {
this.$message.warning('请先勾选班次学期')
return
}
const ids = rows.map(item => item.bh || item.xydxqbh).filter(Boolean)
this.$confirm(
`将从运行课表删除所选 ${ids.length} 个班次学期的全部课程。<br/><b>这些班次的排课信息(已排课次)将一并删除</b>,编制侧任务保留。`,
'批量删除【运行课表】',
{ type: 'warning', dangerouslyUseHTMLString: true }
).then(() => {
this.batchRunningPublish(withdrawRunningCourses, ids, '删除')
}).catch(() => {})
},
// 批量发布/删除公共处理:逐条展示成功与失败原因
batchRunningPublish(api, ids, action) {
this.runningPublishing = true
api(ids).then(res => {
const list = (res && res.data) || []
const ok = list.filter(i => i.success)
const fail = list.filter(i => !i.success)
const okText = ok.length
? `成功 ${ok.length} 个:` + ok.map(i => `${this.semesterNameOf(i.xydxqbh)}${i.message}`).join('')
: ''
const failText = fail.length
? `失败 ${fail.length} 个:` + fail.map(i => `${this.semesterNameOf(i.xydxqbh)}${i.message}`).join('')
: ''
const html = [okText, failText].filter(Boolean).join('<br/>')
if (fail.length) {
this.$alert(html, `运行课表${action}结果`, { dangerouslyUseHTMLString: true })
} else {
this.$message.success(`运行课表${action}完成:成功 ${ok.length}`)
}
this.loadList()
}).finally(() => {
this.runningPublishing = false
})
},
semesterNameOf(bh) {
const row = this.selection.find(i => (i.bh || i.xydxqbh) === bh)
return row ? (row.xydmc || row.bh) : bh
},
handleBatchGenerateTasks() {
if (!this.selection.length) {
this.$message.warning('请先勾选班次学期')