-
+
-
+
选择可供调课课次
-
+
@@ -118,20 +125,34 @@
-
-
+
+
-
+
-
+
-
+
+
+
-
+
-
+
- {{ formatJc(row.jc) }}
+ {{ row.sjsj || '-' }}
@@ -45,7 +45,7 @@
-
+
{{ row.sjsj || '-' }}
@@ -132,10 +132,6 @@
import { listToday, listWeek, listClass, exportClassPlan, exportClassGrades, exportClassCourses } from '@/api/teachBusiness/timetable'
import { listTeam } from '@/api/studentRecords/team'
-const JC_SECTION = {
- 1: '1-2节', 2: '3-4节', 3: '5-6节', 4: '7-8节', 5: '9-10节', 6: '11-12节'
-}
-
const WEEK_DAY_NAMES = ['日', '一', '二', '三', '四', '五', '六']
function pad2(n) {
@@ -161,9 +157,11 @@ export default {
loading: false,
// 今日
todayDate: new Date(),
+ dayOffset: 0,
todayData: [],
// 本周
weekStart: getMonday(new Date()),
+ weekOffset: 0,
weekData: [],
// 班次
searchForm: { teamClass: '' },
@@ -173,13 +171,23 @@ export default {
}
},
computed: {
+ selectedTodayDate() {
+ const date = new Date(this.todayDate)
+ date.setDate(date.getDate() + this.dayOffset)
+ return date
+ },
+ selectedWeekStart() {
+ const date = new Date(this.weekStart)
+ date.setDate(date.getDate() + this.weekOffset * 7)
+ return date
+ },
dateTitle() {
- return formatDate(this.todayDate) + ' 今日教学实施计划'
+ return formatDate(this.selectedTodayDate) + ' 今日教学实施计划'
},
weekRangeText() {
- const end = new Date(this.weekStart)
+ const end = new Date(this.selectedWeekStart)
end.setDate(end.getDate() + 6)
- return formatDate(this.weekStart) + '(' + this.weekDayName(this.weekStart) + ') 至 ' +
+ return formatDate(this.selectedWeekStart) + '(' + this.weekDayName(this.selectedWeekStart) + ') 至 ' +
formatDate(end) + '(' + this.weekDayName(end) + ') 本周教学实施计划'
},
pageTitle() {
@@ -196,34 +204,22 @@ export default {
weekDayName(d) {
return WEEK_DAY_NAMES[d.getDay()]
},
- formatJc(jc) {
- if (jc === null || jc === undefined || jc === '') return '第?节'
- return JC_SECTION[jc] || ('第' + jc + '节')
- },
/* ---------- 今日:日期导航 ---------- */
handlePrevDay() {
- const d = new Date(this.todayDate)
- d.setDate(d.getDate() - 1)
- this.todayDate = d
+ this.dayOffset -= 1
this.getTodayList()
},
handleNextDay() {
- const d = new Date(this.todayDate)
- d.setDate(d.getDate() + 1)
- this.todayDate = d
+ this.dayOffset += 1
this.getTodayList()
},
/* ---------- 本周:周次导航 ---------- */
handlePrevWeek() {
- const d = new Date(this.weekStart)
- d.setDate(d.getDate() - 7)
- this.weekStart = d
+ this.weekOffset -= 1
this.getWeekList()
},
handleNextWeek() {
- const d = new Date(this.weekStart)
- d.setDate(d.getDate() + 7)
- this.weekStart = d
+ this.weekOffset += 1
this.getWeekList()
},
/* ---------- 队别班次下拉(真实接口) ---------- */
@@ -243,10 +239,6 @@ export default {
})
},
/* ---------- 数据字段映射(接口字段 -> 页面字段) ---------- */
- parseSection(sksj) {
- const m = String(sksj || '').match(/第(\d+)节/)
- return m ? Number(m[1]) : undefined
- },
mapLessonRow(apiRow) {
// 接口今日/本周实体:bh sksj kc zrdw bc jy cd jxnrxff bz
const row = Object.assign({}, apiRow)
@@ -256,9 +248,28 @@ export default {
row.jxnrff = apiRow.jxnrxff
row.jybz = apiRow.bz
row.sjsj = apiRow.sksj
- row.jc = this.parseSection(apiRow.sksj)
return row
},
+ extractLessonRows(response) {
+ const data = response && response.data
+ if (Array.isArray(data)) {
+ return data
+ }
+ if (!data) {
+ return []
+ }
+
+ // 新接口返回 DailyWeeklyTimetableRangeVO,列表位于 data.list;
+ // records 分支用于兼容旧分页结构,避免后端版本切换时页面再次无数据。
+ if (Array.isArray(data.list)) {
+ return data.list
+ }
+ if (Array.isArray(data.records)) {
+ return data.records
+ }
+
+ return []
+ },
mapClassRow(apiRow) {
// 接口班次实体:sskcbh kcmcksxs zrjykc jhxs yxxs khlxfs ssjy rscd ssjhbg
const row = Object.assign({}, apiRow)
@@ -271,12 +282,13 @@ export default {
},
/* ---------- 今日:拉取数据 ---------- */
getTodayList() {
+ const params = {
+ offset: this.dayOffset,
+ rq: formatDate(this.todayDate)
+ }
this.loading = true
- listToday({}).then(response => {
- const data = response.data
- this.todayData = Array.isArray(data)
- ? (data || []).map(item => this.mapLessonRow(item))
- : ((data && data.records) || []).map(item => this.mapLessonRow(item))
+ listToday(params).then(response => {
+ this.todayData = this.extractLessonRows(response).map(item => this.mapLessonRow(item))
this.loading = false
}).catch(() => {
this.todayData = []
@@ -285,12 +297,13 @@ export default {
},
/* ---------- 本周:拉取数据 ---------- */
getWeekList() {
+ const params = {
+ offset: this.weekOffset,
+ rq: formatDate(this.weekStart)
+ }
this.loading = true
- listWeek({}).then(response => {
- const data = response.data
- this.weekData = Array.isArray(data)
- ? (data || []).map(item => this.mapLessonRow(item))
- : ((data && data.records) || []).map(item => this.mapLessonRow(item))
+ listWeek(params).then(response => {
+ this.weekData = this.extractLessonRows(response).map(item => this.mapLessonRow(item))
this.loading = false
}).catch(() => {
this.weekData = []
diff --git a/frontend/src/views/teachBusiness/timetableAdjust/index.vue b/frontend/src/views/teachBusiness/timetableAdjust/index.vue
index 154e3705..3e1f2409 100644
--- a/frontend/src/views/teachBusiness/timetableAdjust/index.vue
+++ b/frontend/src/views/teachBusiness/timetableAdjust/index.vue
@@ -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)