课表以及课表调整申请

This commit is contained in:
2026-08-25 20:07:13 +08:00
parent 303d15e234
commit bfb1afb470
4 changed files with 180 additions and 65 deletions
@@ -339,9 +339,7 @@ const RECEIVE_STATUS = {
export default {
name: 'TimetableAdjust',
data() {
const curUserName = (this.$store.state.user && this.$store.state.user.name) || ''
return {
curUserName: curUserName,
loading: false,
tableData: [],
total: 0,
@@ -497,11 +495,24 @@ export default {
sy: '',
rq: '',
jc: 1,
sqjybh: this.curUserName,
sqjybh: '',
xydrwbh: '',
kbh: '',
kcbbh: '',
xydmc: '',
yjsbh: '',
xjsbh: '',
ydsjap: ''
ydsjap: '',
jxnr: '',
jxyd: '',
jxff: '',
jxbzbz: '',
ycxx: '',
bz: '',
roomList: [],
teacherList: [],
teamList: [],
supportList: []
}
this.lessonOptions = []
this.loadClassroomOptions()
@@ -509,11 +520,29 @@ export default {
this.addVisible = true
},
handleAddYearChange() {
this.addForm.sskcbbh = ''
this.addForm.xydmc = ''
this.addForm.yjsbh = ''
this.addForm.xjsbh = ''
this.addForm.ydsjap = ''
Object.assign(this.addForm, {
sskcbbh: '',
rq: '',
jc: 1,
sqjybh: '',
xydrwbh: '',
kbh: '',
kcbbh: '',
xydmc: '',
yjsbh: '',
xjsbh: '',
ydsjap: '',
jxnr: '',
jxyd: '',
jxff: '',
jxbzbz: '',
ycxx: '',
bz: '',
roomList: [],
teacherList: [],
teamList: [],
supportList: []
})
this.lessonOptions = []
},
loadClassroomOptions() {
@@ -558,12 +587,34 @@ export default {
this.$message.warning('当前课次缺少课次编号,无法选择')
return
}
this.addForm.sskcbbh = lessonNumber
this.addForm.xydmc = row.xydmc || ''
this.addForm.yjsbh = row.jsbh || row.yjsbh || ''
this.addForm.xjsbh = ''
this.addForm.ydsjap = row.rq ? this.fmtRqJc(row.rq, row.jc) : (row.ydsjap || '')
;['kbh', 'kcbbh', 'xydrwbh', 'jysdh', 'kcmc', 'sqjyxm'].forEach(key => {
const currentRoomNumber = row.jsbh || row.yjsbh || row.xjsbh || ''
const roomList = this.normalizeRoomList(row.roomList, currentRoomNumber)
const teamList = this.normalizeTeamList(row.teamList, row.xydbh)
Object.assign(this.addForm, {
sskcbbh: lessonNumber,
rq: row.rq ? String(row.rq).substring(0, 10) : '',
jc: row.jc === null || row.jc === undefined ? 1 : Number(row.jc),
nd: row.nd || this.addForm.nd,
sqjybh: row.sqjybh || '',
xydrwbh: row.xydrwbh || '',
kbh: row.kbh || '',
kcbbh: row.kcbbh || '',
xydmc: row.xydmc || '',
yjsbh: row.yjsbh || currentRoomNumber,
xjsbh: row.xjsbh || currentRoomNumber,
ydsjap: row.rq ? this.fmtRqJc(row.rq, row.jc) : (row.ydsjap || ''),
jxnr: row.jxnr || '',
jxyd: row.jxyd || '',
jxff: row.jxff || '',
jxbzbz: row.jxbzbz || '',
ycxx: row.ycxx || '',
bz: row.bz || '',
roomList: roomList,
teacherList: this.normalizeTeacherList(row.teacherList),
teamList: teamList,
supportList: this.normalizeSupportList(row.supportList)
})
;['jysdh', 'kcmc', 'sqjyxm'].forEach(key => {
if (row[key] !== undefined && row[key] !== null) this.addForm[key] = row[key]
})
this.lessonDialogVisible = false
@@ -578,14 +629,19 @@ export default {
sy: this.addForm.sy,
rq: this.addForm.rq + 'T00:00:00',
jc: this.addForm.jc,
nd: this.addForm.nd
nd: this.addForm.nd,
roomList: this.buildSubmitRoomList(),
teacherList: this.normalizeTeacherList(this.addForm.teacherList),
teamList: this.normalizeTeamList(this.addForm.teamList),
supportList: this.normalizeSupportList(this.addForm.supportList)
}
;['xydrwbh', 'kbh', 'kcbbh', 'xjsbh'].forEach(key => {
const optionalFields = [
'sqjybh', 'xydrwbh', 'kbh', 'kcbbh', 'xjsbh', 'jxnr', 'jxyd',
'jxff', 'jxbzbz', 'ycxx', 'bz'
]
optionalFields.forEach(key => {
if (this.addForm[key]) payload[key] = this.addForm[key]
})
if (this.addForm.xjsbh) {
payload.roomList = [{ jsbh: this.addForm.xjsbh }]
}
this.addLoading = true
submitScheduleAdjust(payload).then(() => {
this.addLoading = false
@@ -597,6 +653,52 @@ export default {
})
})
},
normalizeRoomList(roomList, fallbackRoomNumber) {
const normalizedList = (Array.isArray(roomList) ? roomList : [])
.filter(item => item && item.jsbh)
.map(item => ({
jsbh: item.jsbh,
bz: item.bz || ''
}))
if (normalizedList.length === 0 && fallbackRoomNumber) {
normalizedList.push({ jsbh: fallbackRoomNumber, bz: '' })
}
return normalizedList
},
normalizeTeacherList(teacherList) {
return (Array.isArray(teacherList) ? teacherList : [])
.filter(item => item && item.fzjybh)
.map(item => ({ fzjybh: item.fzjybh }))
},
normalizeTeamList(teamList, fallbackTeamNumber) {
const normalizedList = (Array.isArray(teamList) ? teamList : [])
.filter(item => item && item.xydbh)
.map(item => ({ xydbh: item.xydbh }))
if (normalizedList.length === 0 && fallbackTeamNumber) {
normalizedList.push({ xydbh: fallbackTeamNumber })
}
return normalizedList
},
normalizeSupportList(supportList) {
return (Array.isArray(supportList) ? supportList : [])
.filter(item => item && item.bztgmxbh)
.map(item => ({
bztgmxbh: item.bztgmxbh,
sl: item.sl === null || item.sl === undefined ? undefined : Number(item.sl)
}))
},
buildSubmitRoomList() {
if (!this.addForm.xjsbh) return []
const currentRoomList = this.normalizeRoomList(this.addForm.roomList)
if (this.addForm.xjsbh === this.addForm.yjsbh && currentRoomList.length > 0) {
return currentRoomList
}
const currentRoom = currentRoomList.find(item => item.jsbh === this.addForm.xjsbh)
return [{
jsbh: this.addForm.xjsbh,
bz: currentRoom ? currentRoom.bz : ''
}]
},
/* ---------- 审批 ---------- */
showAuditMenu(row) {
return row.sczt === 0 && (row.jyspzzt === 0 || row.jyspzzt === 2 || row.jyspzzt === 3)