通过AI比对原操作文档,生成系统功能完善方案,根据方案进行增补,完善从学期新增到最终的排课功能

This commit is contained in:
2026-09-15 14:42:43 +08:00
parent 5187435285
commit e8a58b19fe
54 changed files with 4577 additions and 134 deletions
@@ -116,7 +116,7 @@
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="课类型">
<el-form-item label="课类型" prop="klx">
<el-input v-model="editForm.klx" placeholder="如 必修/选修/实践" clearable />
</el-form-item>
</el-col>
@@ -165,7 +165,7 @@
<div class="form-section-title">学时学分</div>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="学时">
<el-form-item label="学时" prop="xs">
<el-input-number v-model="editForm.xs" :min="1" controls-position="right" style="width: 100%" />
</el-form-item>
</el-col>
@@ -233,7 +233,7 @@
<div class="form-section-title">教研室计划</div>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="教研室代号">
<el-form-item label="教研室代号" prop="jysdh">
<el-input v-model="editForm.jysdh" placeholder="教研室代号" clearable />
</el-form-item>
</el-col>
@@ -418,7 +418,11 @@ export default {
editMode: 'add',
editForm: this.createEmptyEditForm(),
editRules: {
jc: [{ required: true, message: '请输入课程简称', trigger: 'blur' }]
jc: [{ required: true, message: '请输入课程简称', trigger: 'blur' }],
// 以下三列在库中「非空且无默认值」,留空会写入无意义值,这里前置拦截
xs: [{ required: true, message: '请输入学时', trigger: 'blur' }],
klx: [{ required: true, message: '请输入课类型', trigger: 'blur' }],
jysdh: [{ required: true, message: '请输入教研室代号', trigger: 'blur' }]
},
// ==================== 复制到其它班次 ====================
@@ -427,6 +431,7 @@ export default {
copyNote: '',
clipboardCount: 0,
planMap: {},
planByKbh: {},
libraryVisible: false,
libraryKeyword: '',
libraryRows: [],
@@ -532,19 +537,31 @@ export default {
]).then(([taskRes, planRes]) => {
this.records = (taskRes && taskRes.data) || []
const plans = (planRes && planRes.data) || []
const map = {}
// 同一课编号可能出现在人培的多个学期第次里,按「课编号@学期第次」精确配对,
// 再退化为只按课编号配对,避免拿别的学期的人培行来判「人培差异」。
const exact = {}
const byKbh = {}
plans.forEach(item => {
if (item.kbh) map[item.kbh] = item
if (!item.kbh) return
if (item.xqdc !== undefined && item.xqdc !== null && item.xqdc !== '') {
exact[item.kbh + '@' + item.xqdc] = item
}
if (!byKbh[item.kbh]) byKbh[item.kbh] = item
})
this.planMap = map
this.planMap = exact
this.planByKbh = byKbh
this.loading = false
}).catch(() => {
this.records = []
this.loading = false
})
},
findPlan(row) {
if (!row || !row.kbh) return null
return this.planMap[row.kbh + '@' + row.xqdc] || this.planByKbh[row.kbh] || null
},
isPlanMismatch(row) {
const plan = row && row.kbh ? this.planMap[row.kbh] : null
const plan = this.findPlan(row)
if (!plan) return false
return String(row.xs || '') !== String(plan.xs || '')
|| String(row.klx || '') !== String(plan.klx || '')
@@ -674,7 +691,7 @@ export default {
/* ---------- 自动生成必修课程 ---------- */
handleAutoGenerate() {
const s = this.semester || {}
if (!s.xydbh || !s.xqdc) {
if (!s.bh || !s.xydbh || !s.xqdc) {
this.$message.warning('当前班次学期缺少学员队编号或学期第次,无法自动生成')
return
}
@@ -683,7 +700,9 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
autoGenerateRequiredCourses(s.xydbh, s.xqdc).then(res => {
// 传班次学期编号:同一学员队在多个年度可能有学期第次相同的班次学期,
// 只用 (学员队编号, 学期第次) 会写进别的学年。
autoGenerateRequiredCourses(s.bh).then(res => {
const count = (res && res.data) || 0
this.$message.success(`已自动生成 ${count} 门必修课程`)
this.loadData()