Compare commits

...

4 Commits

Author SHA1 Message Date
zhaichao ca7d7b6869 Merge branch 'main' of https://gitea.fengyingkj.top/zhaichao/education 2026-08-26 14:12:30 +08:00
zhaichao d0d871f7c6 教学大纲 2026-08-26 14:12:19 +08:00
zhaichao 4f9b543c74 课表调整申请新增 2026-08-26 14:12:00 +08:00
zhaichao 9ae21acaf8 校历 2026-08-26 14:10:01 +08:00
7 changed files with 248 additions and 95 deletions
+3 -11
View File
@@ -48,19 +48,11 @@ export function getSyllabus(bh) {
}) })
} }
// 查询所有(返回 List,无分页,前端本地分页) // 列表查询(支持 zydh、ty 及分页参数)
export function listSyllabus() { export function listSyllabus(query) {
return request({ return request({
url: '/zyjxjhb/list', url: '/zyjxjhb/list',
method: 'get'
})
}
// 根据专业代号和停用标识查询(zydh、ty 均必填,等值匹配)
export function listSyllabusByZydhAndTy(zydh, ty) {
return request({
url: '/zyjxjhb/listByZydhAndTy',
method: 'get', method: 'get',
params: { zydh, ty } params: query
}) })
} }
+9
View File
@@ -10,6 +10,15 @@ export function listElective(query) {
}) })
} }
// 新建选修课(body: ElectiveCourseSaveDTO)
export function addElective(data) {
return request({
url: '/jys/elective/add',
method: 'post',
data: data
})
}
// 批量开放报名 // 批量开放报名
export function batchOpenElective(bhList) { export function batchOpenElective(bhList) {
return request({ return request({
@@ -74,7 +74,7 @@
:data-key="cellKey(wIdx, col.colIndex)" :data-key="cellKey(wIdx, col.colIndex)"
@dblclick="onCellDblClick(wIdx, col)" @dblclick="onCellDblClick(wIdx, col)"
> >
<span v-if="getEvent(wIdx, col.colIndex)" class="sce-event-name" :class="{ 'is-bold': getEvent(wIdx, col.colIndex).bold }">{{ getEvent(wIdx, col.colIndex).name }}</span> <span v-if="getEvent(wIdx, col.colIndex) && getEvent(wIdx, col.colIndex).name" class="sce-event-name" :class="{ 'is-bold': getEvent(wIdx, col.colIndex).bold }">{{ getEvent(wIdx, col.colIndex).name }}</span>
<span v-else class="sce-date-num">{{ dateNumberOf(wIdx, col.dayIndex) }}</span> <span v-else class="sce-date-num">{{ dateNumberOf(wIdx, col.dayIndex) }}</span>
</td> </td>
</tr> </tr>
@@ -134,6 +134,8 @@ export default {
// 学期日期范围 // 学期日期范围
startDate: null, startDate: null,
endDate: null, endDate: null,
// 日历渲染起点(学期当周周一)
calendarStart: null,
totalWeeks: 0, totalWeeks: 0,
dateRangeText: '', dateRangeText: '',
weeks: [], weeks: [],
@@ -248,6 +250,7 @@ export default {
if (kx && jx) { if (kx && jx) {
this.startDate = new Date(kx.replace(/-/g, '/')) this.startDate = new Date(kx.replace(/-/g, '/'))
this.endDate = new Date(jx.replace(/-/g, '/')) this.endDate = new Date(jx.replace(/-/g, '/'))
this.calendarStart = null
this.buildWeeks() this.buildWeeks()
} }
this.loadXqxlbEvents() this.loadXqxlbEvents()
@@ -292,10 +295,10 @@ export default {
}, },
// 根据假期记录反推时间格位置(jqsj 日期 + courseClass 节次),与列是否可见无关 // 根据假期记录反推时间格位置(jqsj 日期 + courseClass 节次),与列是否可见无关
locateXqxlb(item) { locateXqxlb(item) {
if (!this.startDate || !item.jqsj) return null if (!this.calendarStart || !item.jqsj) return null
const d = new Date(String(item.jqsj).slice(0, 10).replace(/-/g, '/')) const d = new Date(String(item.jqsj).slice(0, 10).replace(/-/g, '/'))
if (isNaN(d.getTime())) return null if (isNaN(d.getTime())) return null
const offset = Math.round((d - this.startDate) / (24 * 3600 * 1000)) const offset = Math.round((d - this.calendarStart) / (24 * 3600 * 1000))
if (offset < 0) return null if (offset < 0) return null
const wIdx = Math.floor(offset / 7) const wIdx = Math.floor(offset / 7)
const dayIndex = offset % 7 const dayIndex = offset % 7
@@ -315,13 +318,22 @@ export default {
if (s === '1112') return 'late' if (s === '1112') return 'late'
return null return null
}, },
// 获取日期所在周的周一(周一为一周起点)
getMonday(d) {
const date = new Date(d)
const day = date.getDay() // 0=周日,1=周一,...,6=周六
const diff = date.getDate() - day + (day === 0 ? -6 : 1)
date.setDate(diff)
return date
},
buildWeeks() { buildWeeks() {
if (!this.startDate || !this.endDate) return if (!this.startDate || !this.endDate) return
const start = new Date(this.startDate) const start = this.getMonday(new Date(this.startDate))
const end = new Date(this.endDate) const end = new Date(this.endDate)
this.calendarStart = start
const days = Math.round((end - start) / (24 * 3600 * 1000)) + 1 const days = Math.round((end - start) / (24 * 3600 * 1000)) + 1
this.totalWeeks = Math.ceil(days / 7) this.totalWeeks = Math.ceil(days / 7)
this.dateRangeText = fmtDate(start) + ' 到 ' + fmtDate(end) this.dateRangeText = fmtDate(new Date(this.startDate)) + ' 到 ' + fmtDate(new Date(this.endDate))
const weeks = [] const weeks = []
for (let w = 0; w < this.totalWeeks; w++) { for (let w = 0; w < this.totalWeeks; w++) {
const wkStart = new Date(start) const wkStart = new Date(start)
@@ -355,21 +367,18 @@ export default {
}, },
// 单元格内显示的日期数字(如 0703) // 单元格内显示的日期数字(如 0703)
dateNumberOf(wIdx, dayIndex) { dateNumberOf(wIdx, dayIndex) {
if (!this.startDate) return '' if (!this.calendarStart) return ''
const d = new Date(this.startDate) const d = new Date(this.calendarStart)
d.setDate(this.startDate.getDate() + wIdx * 7 + dayIndex) d.setDate(this.calendarStart.getDate() + wIdx * 7 + dayIndex)
return pad2(d.getMonth() + 1) + pad2(d.getDate()) return pad2(d.getMonth() + 1) + pad2(d.getDate())
}, },
cellClass(wIdx, col) { cellClass(wIdx, col) {
const classes = [] const classes = []
// 星期交替背景(单双日不同底色)
if (col.dayIndex % 2 === 0) classes.push('sce-cell-odd')
else classes.push('sce-cell-even')
if (this.selectedKeys.includes(this.cellKey(wIdx, col.colIndex))) classes.push('is-selected') if (this.selectedKeys.includes(this.cellKey(wIdx, col.colIndex))) classes.push('is-selected')
const ev = this.getEvent(wIdx, col.colIndex) const ev = this.getEvent(wIdx, col.colIndex)
if (ev) { // 可排课的全部白色;不可排课且事件名非空才标红
classes.push('has-event') if (ev && ev.name && !ev.schedulable) {
if (!ev.schedulable) classes.push('no-schedule') classes.push('no-schedule')
} }
return classes return classes
}, },
@@ -467,8 +476,9 @@ export default {
return return
} }
const name = this.toolbar.eventName.trim() const name = this.toolbar.eventName.trim()
// 空名称时按清除处理
if (!name) { if (!name) {
this.$message.warning('请输入事件名称') this.deleteEvent()
return return
} }
const keys = [...this.selectedKeys] const keys = [...this.selectedKeys]
@@ -492,16 +502,20 @@ export default {
return return
} }
const keys = [...this.selectedKeys] const keys = [...this.selectedKeys]
keys.forEach(key => { this.persistDeleteEvents(keys).then(({ ok, fail }) => {
this.$delete(this.events, key) if (fail === 0) {
keys.forEach(key => {
this.$delete(this.events, key)
})
this.selectedKeys = []
}
}) })
this.$message.success('已删除 ' + keys.length + ' 个时间格事件')
}, },
absorbEvent() { absorbEvent() {
// 吸取:取选择中第一个有事件的格 // 吸取:取选择中第一个事件名非空的格
let target = null let target = null
for (const key of this.selectedKeys) { for (const key of this.selectedKeys) {
if (this.events[key]) { target = this.events[key]; break } if (this.events[key] && this.events[key].name) { target = this.events[key]; break }
} }
if (!target) { if (!target) {
this.$message.warning('所选时间格中无事件可吸取') this.$message.warning('所选时间格中无事件可吸取')
@@ -517,7 +531,7 @@ export default {
}, },
onCellDblClick(wIdx, col) { onCellDblClick(wIdx, col) {
const ev = this.getEvent(wIdx, col.colIndex) const ev = this.getEvent(wIdx, col.colIndex)
if (ev) { if (ev && ev.name) {
this.toolbar.eventName = ev.name this.toolbar.eventName = ev.name
this.toolbar.bold = !!ev.bold this.toolbar.bold = !!ev.bold
this.toolbar.schedulable = !!ev.schedulable this.toolbar.schedulable = !!ev.schedulable
@@ -561,12 +575,35 @@ export default {
return { ok: ok, fail: fail } return { ok: ok, fail: fail }
}) })
}, },
// 批量删除选中格事件
persistDeleteEvents(keys) {
const tasks = keys
.filter(key => this.events[key])
.map(key => {
const payload = this.buildXqxlbPayload(key, this.events[key])
if (!payload) return Promise.resolve(false)
payload.delFlag = 1
return updateXqxlb(payload)
.then(() => true)
.catch(() => false)
})
return Promise.all(tasks).then(results => {
const ok = results.filter(r => r === true).length
const fail = results.length - ok
if (fail > 0) {
this.$message.error(fail + ' 个事件删除失败,请检查后端接口')
} else if (ok > 0) {
this.$message.success('已删除 ' + ok + ' 个时间格事件')
}
return { ok: ok, fail: fail }
})
},
// 构造 xqxlb 提交数据 // 构造 xqxlb 提交数据
buildXqxlbPayload(key, ev) { buildXqxlbPayload(key, ev) {
const pos = this.parseCellKey(key) const pos = this.parseCellKey(key)
if (!pos) return null if (!pos) return null
const d = new Date(this.startDate) const d = new Date(this.calendarStart)
d.setDate(this.startDate.getDate() + pos.wIdx * 7 + pos.dayIndex) d.setDate(this.calendarStart.getDate() + pos.wIdx * 7 + pos.dayIndex)
return { return {
delFlag: 0, delFlag: 0,
bh: ev.bh || undefined, bh: ev.bh || undefined,
@@ -722,14 +759,20 @@ export default {
background: #fff; background: #fff;
transition: background 0.15s; transition: background 0.15s;
.sce-date-num { color: #c0c4cc; } .sce-event-name {
display: block;
line-height: 1;
padding: 2px 0;
}
// 星期交替底色:周一/三/五/日为浅绿,周二/四/六为白,便于区分星期 .sce-date-num {
&.sce-cell-odd { background: #eef6f1; } display: block;
&.sce-cell-even { background: #ffffff; } font-size: 10px;
&.has-event { background: #e6f4ea; } color: #c0c4cc;
&.has-event .sce-event-name { color: #00663e; font-weight: 500; } line-height: 1;
&.has-event .sce-event-name.is-bold { font-weight: 700; } }
// 可排课白色,不可排课且有事件标红
&.no-schedule { background: #fde2e2; } &.no-schedule { background: #fde2e2; }
&.is-selected { &.is-selected {
@@ -40,7 +40,7 @@
class="cal-cell" class="cal-cell"
:class="cellClass(wIdx, col)" :class="cellClass(wIdx, col)"
> >
<template v-if="getEvent(wIdx, col.colIndex)"> <template v-if="getEvent(wIdx, col.colIndex) && getEvent(wIdx, col.colIndex).name">
<span class="cal-event-name">{{ getEvent(wIdx, col.colIndex).name }}</span> <span class="cal-event-name">{{ getEvent(wIdx, col.colIndex).name }}</span>
</template> </template>
<span v-else-if="showDate" class="cal-date-num">{{ dateNumberOf(wIdx, col.dayIndex) }}</span> <span v-else-if="showDate" class="cal-date-num">{{ dateNumberOf(wIdx, col.dayIndex) }}</span>
@@ -102,6 +102,8 @@ export default {
// 学期日期范围 // 学期日期范围
startDate: null, startDate: null,
endDate: null, endDate: null,
// 日历渲染起点(学期当周周一)
calendarStart: null,
totalWeeks: 0, totalWeeks: 0,
dateRangeText: '', dateRangeText: '',
weeks: [], weeks: [],
@@ -173,6 +175,7 @@ export default {
if (!this.nd) return if (!this.nd) return
this.startDate = null this.startDate = null
this.endDate = null this.endDate = null
this.calendarStart = null
getSemester(this.nd) getSemester(this.nd)
.then(res => { .then(res => {
const data = res.data || res || {} const data = res.data || res || {}
@@ -215,10 +218,10 @@ export default {
}, },
// 根据假期记录反推时间格 key(jqsj 日期 + courseClass 节次) // 根据假期记录反推时间格 key(jqsj 日期 + courseClass 节次)
locateXqxlb(item) { locateXqxlb(item) {
if (!this.startDate || !item.jqsj) return null if (!this.calendarStart || !item.jqsj) return null
const d = new Date(String(item.jqsj).slice(0, 10).replace(/-/g, '/')) const d = new Date(String(item.jqsj).slice(0, 10).replace(/-/g, '/'))
if (isNaN(d.getTime())) return null if (isNaN(d.getTime())) return null
const offset = Math.round((d - this.startDate) / (24 * 3600 * 1000)) const offset = Math.round((d - this.calendarStart) / (24 * 3600 * 1000))
if (offset < 0) return null if (offset < 0) return null
const wIdx = Math.floor(offset / 7) const wIdx = Math.floor(offset / 7)
const dayIndex = offset % 7 const dayIndex = offset % 7
@@ -240,13 +243,22 @@ export default {
if (s === '1112') return 'late' if (s === '1112') return 'late'
return null return null
}, },
// 获取日期所在周的周一(周一为一周起点)
getMonday(d) {
const date = new Date(d)
const day = date.getDay() // 0=周日,1=周一,...,6=周六
const diff = date.getDate() - day + (day === 0 ? -6 : 1)
date.setDate(diff)
return date
},
buildWeeks() { buildWeeks() {
if (!this.startDate || !this.endDate) return if (!this.startDate || !this.endDate) return
const start = new Date(this.startDate) const start = this.getMonday(new Date(this.startDate))
const end = new Date(this.endDate) const end = new Date(this.endDate)
this.calendarStart = start
const days = Math.round((end - start) / (24 * 3600 * 1000)) + 1 const days = Math.round((end - start) / (24 * 3600 * 1000)) + 1
this.totalWeeks = Math.ceil(days / 7) this.totalWeeks = Math.ceil(days / 7)
this.dateRangeText = fmtDate(start) + ' 到 ' + fmtDate(end) this.dateRangeText = fmtDate(new Date(this.startDate)) + ' 到 ' + fmtDate(new Date(this.endDate))
const weeks = [] const weeks = []
for (let w = 0; w < this.totalWeeks; w++) { for (let w = 0; w < this.totalWeeks; w++) {
const wkStart = new Date(start) const wkStart = new Date(start)
@@ -276,20 +288,17 @@ export default {
}, },
// 单元格内显示的日期数字(如 0703) // 单元格内显示的日期数字(如 0703)
dateNumberOf(wIdx, dayIndex) { dateNumberOf(wIdx, dayIndex) {
if (!this.startDate) return '' if (!this.calendarStart) return ''
const d = new Date(this.startDate) const d = new Date(this.calendarStart)
d.setDate(this.startDate.getDate() + wIdx * 7 + dayIndex) d.setDate(this.calendarStart.getDate() + wIdx * 7 + dayIndex)
return pad2(d.getMonth() + 1) + pad2(d.getDate()) return pad2(d.getMonth() + 1) + pad2(d.getDate())
}, },
cellClass(wIdx, col) { cellClass(wIdx, col) {
const classes = [] const classes = []
// 星期交替背景(单双日不同底色)
if (col.dayIndex % 2 === 0) classes.push('cal-cell-odd')
else classes.push('cal-cell-even')
const ev = this.getEvent(wIdx, col.colIndex) const ev = this.getEvent(wIdx, col.colIndex)
if (ev) { // 可排课的全部白色;不可排课且事件名非空才标红
classes.push('has-event') if (ev && ev.name && !ev.schedulable) {
if (!ev.schedulable) classes.push('no-schedule') classes.push('no-schedule')
} }
return classes return classes
}, },
@@ -339,7 +348,7 @@ export default {
html += '<td>' + week.rangeText + '</td>' html += '<td>' + week.rangeText + '</td>'
this.visibleColumns.forEach(col => { this.visibleColumns.forEach(col => {
const ev = this.getEvent(wIdx, col.colIndex) const ev = this.getEvent(wIdx, col.colIndex)
if (ev) { if (ev && ev.name) {
const remark = ev.remark && ev.remarkShow ? '(' + ev.remark + ')' : '' const remark = ev.remark && ev.remarkShow ? '(' + ev.remark + ')' : ''
html += '<td>' + ev.name + remark + '</td>' html += '<td>' + ev.name + remark + '</td>'
} else if (this.showDate) { } else if (this.showDate) {
@@ -466,13 +475,20 @@ export default {
position: relative; position: relative;
background: #fff; background: #fff;
.cal-date-num { color: #c0c4cc; } .cal-event-name {
display: block;
line-height: 1;
padding: 2px 0;
}
// 星期交替底色:周一/三/五/日为浅绿,周二/四/六为白 .cal-date-num {
&.cal-cell-odd { background: #eef6f1; } display: block;
&.cal-cell-even { background: #ffffff; } font-size: 10px;
&.has-event { background: #e6f4ea; } color: #c0c4cc;
&.has-event .cal-event-name { color: #00663e; font-weight: 500; } line-height: 1;
}
// 可排课白色,不可排课且有事件标红
&.no-schedule { background: #fde2e2; } &.no-schedule { background: #fde2e2; }
} }
} }
@@ -46,10 +46,13 @@
<el-table v-loading="loading" :data="pagedData" border stripe highlight-current-row <el-table v-loading="loading" :data="pagedData" border stripe highlight-current-row
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column prop="bh" label="编号" width="170" show-overflow-tooltip align="center" /> <el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="zydh" label="专业代号" width="150" align="center" /> <el-table-column prop="zydh" label="专业代号" width="150" align="center" />
<el-table-column prop="kbh" label="课编号" width="110" show-overflow-tooltip align="center" /> <el-table-column prop="kbh" label="课编号" width="110" show-overflow-tooltip align="center" />
<el-table-column prop="jc" label="简称" width="100" show-overflow-tooltip align="center" /> <el-table-column prop="jc" label="简称" width="100" show-overflow-tooltip align="center" />
<el-table-column prop="kcdw" label="课程定位" width="120" show-overflow-tooltip align="center" />
<el-table-column prop="mk" label="模块" width="100" show-overflow-tooltip align="center" />
<el-table-column prop="jysdh" label="教研室" width="100" show-overflow-tooltip align="center" />
<el-table-column prop="klx" label="课类型" width="80" align="center" /> <el-table-column prop="klx" label="课类型" width="80" align="center" />
<el-table-column prop="xqdc" label="学期第次" width="80" align="center" /> <el-table-column prop="xqdc" label="学期第次" width="80" align="center" />
<el-table-column prop="xs" label="学时" width="70" align="center" /> <el-table-column prop="xs" label="学时" width="70" align="center" />
@@ -58,6 +61,13 @@
<el-table-column prop="sjxs" label="实践学时" width="80" align="center" /> <el-table-column prop="sjxs" label="实践学时" width="80" align="center" />
<el-table-column prop="zks" label="周课时" width="70" align="center" /> <el-table-column prop="zks" label="周课时" width="70" align="center" />
<el-table-column prop="ksks" label="考试课时" width="80" align="center" /> <el-table-column prop="ksks" label="考试课时" width="80" align="center" />
<el-table-column prop="cjfz" label="成绩分制" width="90" align="center" />
<el-table-column label="不计入平均分" width="110" align="center">
<template slot-scope="scope">{{ fmtYesNo(scope.row.bjrxypjf) }}</template>
</el-table-column>
<el-table-column label="考试课时不显示" width="130" align="center">
<template slot-scope="scope">{{ fmtYesNo(scope.row.ksksbxs) }}</template>
</el-table-column>
<el-table-column label="大纲课程" width="90" align="center"> <el-table-column label="大纲课程" width="90" align="center">
<template slot-scope="scope">{{ fmtYesNo(scope.row.dgkc) }}</template> <template slot-scope="scope">{{ fmtYesNo(scope.row.dgkc) }}</template>
</el-table-column> </el-table-column>
@@ -278,8 +288,7 @@ import {
deleteSyllabus, deleteSyllabus,
batchDeleteSyllabus, batchDeleteSyllabus,
updateSyllabus, updateSyllabus,
listSyllabus, listSyllabus
listSyllabusByZydhAndTy
} from '@/api/teachBusiness/syllabus' } from '@/api/teachBusiness/syllabus'
import { listMajor } from '@/api/subjectMajor/major' import { listMajor } from '@/api/subjectMajor/major'
import { listKb } from '@/api/teachOffice/kb' import { listKb } from '@/api/teachOffice/kb'
@@ -302,6 +311,7 @@ export default {
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
localPaging: false,
selection: [], selection: [],
referenceDataLoading: false, referenceDataLoading: false,
majorOptions: [], majorOptions: [],
@@ -326,6 +336,9 @@ export default {
}, },
computed: { computed: {
pagedData() { pagedData() {
if (!this.localPaging) {
return this.tableData
}
const start = (this.pageNum - 1) * this.pageSize const start = (this.pageNum - 1) * this.pageSize
return this.tableData.slice(start, start + this.pageSize) return this.tableData.slice(start, start + this.pageSize)
} }
@@ -380,21 +393,26 @@ export default {
/* ---------- 列表加载 ---------- */ /* ---------- 列表加载 ---------- */
fetchList() { fetchList() {
this.loading = true this.loading = true
const { zydh, ty } = this.searchForm const query = {
// 专业代号存在时走后端组合查询;否则查全部后按停用标识过滤 pageNum: this.pageNum,
const useApiQuery = Boolean(zydh) pageSize: this.pageSize,
const req = useApiQuery ty: this.searchForm.ty
? listSyllabusByZydhAndTy(zydh, ty) }
: listSyllabus() if (this.searchForm.zydh) {
req.then(response => { query.zydh = this.searchForm.zydh
let list = response.data || [] }
if (!useApiQuery) { listSyllabus(query).then(response => {
if (zydh) list = list.filter(i => i.zydh && i.zydh.indexOf(zydh) !== -1) const data = response.data
list = list.filter(i => Number(i.ty) === Number(ty)) if (Array.isArray(data)) {
this.tableData = data
this.total = data.length
this.localPaging = true
} else {
const pageData = data || {}
this.tableData = pageData.records || []
this.total = pageData.total || 0
this.localPaging = false
} }
this.tableData = list
this.total = list.length
this.pageNum = 1
}).catch(() => { }).catch(() => {
this.tableData = [] this.tableData = []
this.total = 0 this.total = 0
@@ -403,10 +421,12 @@ export default {
}) })
}, },
handleQuery() { handleQuery() {
this.pageNum = 1
this.fetchList() this.fetchList()
}, },
handleReset() { handleReset() {
this.searchForm = { zydh: '', ty: 0 } this.searchForm = { zydh: '', ty: 0 }
this.pageNum = 1
this.fetchList() this.fetchList()
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
@@ -487,9 +507,15 @@ export default {
handleSizeChange(size) { handleSizeChange(size) {
this.pageSize = size this.pageSize = size
this.pageNum = 1 this.pageNum = 1
if (!this.localPaging) {
this.fetchList()
}
}, },
handlePageChange(page) { handlePageChange(page) {
this.pageNum = page this.pageNum = page
if (!this.localPaging) {
this.fetchList()
}
}, },
/* ---------- 工具 ---------- */ /* ---------- 工具 ---------- */
@@ -80,7 +80,7 @@
<div class="ops-cell"> <div class="ops-cell">
<el-button type="text" size="mini" icon="el-icon-view" @click="openDetail(scope.row)">详情</el-button> <el-button type="text" size="mini" icon="el-icon-view" @click="openDetail(scope.row)">详情</el-button>
<el-button v-if="showAuditMenu(scope.row)" type="text" size="mini" @click="openAudit(scope.row)">审批</el-button> <el-button v-if="showAuditMenu(scope.row)" type="text" size="mini" @click="openAudit(scope.row)">审批</el-button>
<el-button v-if="scope.row.sczt === 0 && scope.row.jyspzzt !== 1" type="text" size="mini" class="danger-btn" @click="handleCancel(scope.row)">撤销</el-button> <el-button v-if="scope.row.sczt === 0 && scope.row.jyspzzt !== 1 && scope.row.jyspzzt !== 3" type="text" size="mini" class="danger-btn" @click="handleCancel(scope.row)">撤销</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -194,9 +194,6 @@
<el-form-item label="审批意见"> <el-form-item label="审批意见">
<el-input v-model="auditForm.fhyj" type="textarea" :rows="3" placeholder="请输入审批意见(发回/拒绝时必填)" /> <el-input v-model="auditForm.fhyj" type="textarea" :rows="3" placeholder="请输入审批意见(发回/拒绝时必填)" />
</el-form-item> </el-form-item>
<el-form-item label="审批人编号">
<el-input v-model="auditForm.sprbh" placeholder="不填默认取当前登录人" />
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="auditLoading" @click="submitAudit">确定</el-button> <el-button type="primary" :loading="auditLoading" @click="submitAudit">确定</el-button>
@@ -223,6 +220,7 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="教研室审批人">{{ detailData.jyspzrbh || '-' }}</el-descriptions-item> <el-descriptions-item label="教研室审批人">{{ detailData.jyspzrbh || '-' }}</el-descriptions-item>
<el-descriptions-item label="教研室审批时间">{{ fmtDateTime(detailData.jyspzsj) }}</el-descriptions-item> <el-descriptions-item label="教研室审批时间">{{ fmtDateTime(detailData.jyspzsj) }}</el-descriptions-item>
<el-descriptions-item label="审批意见" :span="2">{{ detailData.fhyj || '-' }}</el-descriptions-item>
<el-descriptions-item label="教研室查收人">{{ detailData.jyscsrbh || '-' }}</el-descriptions-item> <el-descriptions-item label="教研室查收人">{{ detailData.jyscsrbh || '-' }}</el-descriptions-item>
<el-descriptions-item label="教研室查收时间">{{ fmtDateTime(detailData.jyscssj) }}</el-descriptions-item> <el-descriptions-item label="教研室查收时间">{{ fmtDateTime(detailData.jyscssj) }}</el-descriptions-item>
<el-descriptions-item label="教学内容" :span="2">{{ detailData.jxnr || '-' }}</el-descriptions-item> <el-descriptions-item label="教学内容" :span="2">{{ detailData.jxnr || '-' }}</el-descriptions-item>
@@ -316,6 +314,7 @@ import {
} from '@/api/teachBusiness/courseRunning' } from '@/api/teachBusiness/courseRunning'
import { listAllSemester } from '@/api/teachBusiness/semester' import { listAllSemester } from '@/api/teachBusiness/semester'
import { listAllClassroom } from '@/api/teachBusiness/classroom' import { listAllClassroom } from '@/api/teachBusiness/classroom'
import { mapGetters } from 'vuex'
// 节次 -> 节次区间映射 // 节次 -> 节次区间映射
const JC_SECTION = { const JC_SECTION = {
@@ -381,13 +380,22 @@ export default {
// 审批 // 审批
auditVisible: false, auditVisible: false,
auditLoading: false, auditLoading: false,
auditForm: { ssdksqbh: '', spzt: 1, fhyj: '', sprbh: '' }, auditForm: { ssdksqbh: '', spzt: 1, fhyj: '' },
// 详情 // 详情
detailVisible: false, detailVisible: false,
detailLoading: false, detailLoading: false,
detailData: null detailData: null
} }
}, },
computed: {
...mapGetters(['roles']),
isTeacher() {
const r = this.roles || []
const hasTeacher = r.includes('TEACHER') || r.includes('teacher') || r.includes('ROLE_TEACHER')
const hasAdmin = r.includes('admin') || r.includes('ROLE_ADMIN')
return hasTeacher && !hasAdmin
}
},
created() { created() {
this.loadYearOptions().then(() => { this.loadYearOptions().then(() => {
this.loadStatistics() this.loadStatistics()
@@ -740,14 +748,15 @@ export default {
}, },
/* ---------- 审批 ---------- */ /* ---------- 审批 ---------- */
showAuditMenu(row) { showAuditMenu(row) {
return row.sczt === 0 && (row.jyspzzt === 0 || row.jyspzzt === 2 || row.jyspzzt === 3) // 教员角色不展示审批入口;已拒绝状态不展示审批
if (this.isTeacher) return false
return row.sczt === 0 && (row.jyspzzt === 0 || row.jyspzzt === 2)
}, },
openAudit(row) { openAudit(row) {
this.auditForm = { this.auditForm = {
ssdksqbh: row.ssdksqbh, ssdksqbh: row.ssdksqbh,
spzt: 1, spzt: 1,
fhyj: '', fhyj: ''
sprbh: ''
} }
this.auditVisible = true this.auditVisible = true
}, },
@@ -762,7 +771,6 @@ export default {
spzt: f.spzt, spzt: f.spzt,
fhyj: f.fhyj fhyj: f.fhyj
} }
if (f.sprbh) payload.sprbh = f.sprbh
this.auditLoading = true this.auditLoading = true
auditByTeachingOffice(payload).then(() => { auditByTeachingOffice(payload).then(() => {
this.auditLoading = false this.auditLoading = false
@@ -186,17 +186,23 @@
@update:visible="val => (dialogVisible = val)" @update:visible="val => (dialogVisible = val)"
> >
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px"> <el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-form-item label="选修班名称" prop="xxbmc">
<el-input v-model="form.xxbmc" placeholder="请输入选修班名称" clearable />
</el-form-item>
<el-form-item label="年级">
<el-input v-model="form.nj" placeholder="新建选修班时填写,如 2024" clearable />
</el-form-item>
<el-form-item label="课程名称" prop="kcmc"> <el-form-item label="课程名称" prop="kcmc">
<el-input v-model="form.kcmc" placeholder="请输入课程名称" clearable /> <el-input v-model="form.kcmc" placeholder="请输入课程名称,提交时按名称查找课编号" clearable />
</el-form-item> </el-form-item>
<el-form-item label="实施教员" prop="js"> <el-form-item label="实施教员" prop="js">
<el-input v-model="form.js" placeholder="请输入实施教员" clearable /> <el-input v-model="form.js" placeholder="请输入实施教员,提交时按名称查找教员编号" clearable />
</el-form-item> </el-form-item>
<el-form-item label="教材"> <el-form-item label="教材">
<el-input v-model="form.jc" placeholder="请输入教材" clearable /> <el-input v-model="form.jc" placeholder="请输入教材" clearable />
</el-form-item> </el-form-item>
<el-form-item label="教学场地"> <el-form-item label="教学场地">
<el-input v-model="form.jxcd" placeholder="请输入教学场地" clearable /> <el-input v-model="form.jxcd" placeholder="请输入教学场地,提交时按名称查找教室编号" clearable />
</el-form-item> </el-form-item>
<el-form-item label="计划学时"> <el-form-item label="计划学时">
<el-input-number v-model="form.jhsxs" :min="0" :precision="0" class="w-full" /> <el-input-number v-model="form.jhsxs" :min="0" :precision="0" class="w-full" />
@@ -222,6 +228,7 @@
<script> <script>
import { import {
listElective, listElective,
addElective,
batchOpenElective, batchOpenElective,
batchCancelOpenElective, batchCancelOpenElective,
batchStopElective, batchStopElective,
@@ -229,6 +236,9 @@ import {
exportElectiveStudentsExcel, exportElectiveStudentsExcel,
exportElectiveStudentsWord exportElectiveStudentsWord
} from '@/api/teachOffice/elective' } from '@/api/teachOffice/elective'
import { listKb } from '@/api/teachOffice/kb'
import { listTeacher } from '@/api/teachOffice/teacher'
import { listClassroom } from '@/api/teachBusiness/classroom'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
export default { export default {
@@ -261,6 +271,8 @@ export default {
// ==================== 新建选修课弹窗 ==================== // ==================== 新建选修课弹窗 ====================
dialogVisible: false, dialogVisible: false,
form: { form: {
xxbmc: '',
nj: '',
kcmc: '', kcmc: '',
js: '', js: '',
jc: '', jc: '',
@@ -271,6 +283,7 @@ export default {
jh: 0 jh: 0
}, },
rules: { rules: {
xxbmc: [{ required: true, message: '请输入选修班名称', trigger: 'blur' }],
kcmc: [{ required: true, message: '请输入课程名称', trigger: 'blur' }], kcmc: [{ required: true, message: '请输入课程名称', trigger: 'blur' }],
js: [{ required: true, message: '请输入实施教员', trigger: 'blur' }] js: [{ required: true, message: '请输入实施教员', trigger: 'blur' }]
}, },
@@ -425,17 +438,63 @@ export default {
// ==================== 新建选修课弹窗 ==================== // ==================== 新建选修课弹窗 ====================
handleOpenNew() { handleOpenNew() {
this.$message.warning('后端暂未提供该接口') this.form = {
xxbmc: '',
nj: '',
kcmc: '',
js: '',
jc: '',
jxcd: '',
jhsxs: 0,
yxsxs: 0,
xf: 0,
jh: 0
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.formRef && this.$refs.formRef.clearValidate()
})
}, },
handleNewConfirm() { handleNewConfirm() {
if (!this.$refs.formRef) return if (!this.$refs.formRef) return
this.$refs.formRef.validate((valid) => { this.$refs.formRef.validate((valid) => {
if (!valid) return if (!valid) return
console.log('新建选修课:', JSON.parse(JSON.stringify(this.form))) this.submitNewElective()
this.$message.success('新建选修课成功(前端模拟)')
this.dialogVisible = false
}) })
}, },
submitNewElective() {
const emptyPage = { data: { records: [] } }
Promise.all([
listKb({ pageNum: 1, pageSize: 1, kmc: this.form.kcmc }),
listTeacher({ pageNum: 1, pageSize: 1, jyxm: this.form.js }),
this.form.jxcd ? listClassroom({ pageNum: 1, pageSize: 1, jsmc: this.form.jxcd }) : Promise.resolve(emptyPage)
])
.then(([kbRes, teacherRes, roomRes]) => {
const kbh = kbRes?.data?.records?.[0]?.kbh
const jybh = teacherRes?.data?.records?.[0]?.jybh
const jsbh = roomRes?.data?.records?.[0]?.jsbh
if (!kbh) {
this.$message.warning(`未找到课程科目:${this.form.kcmc}`)
return
}
const dto = {
kbh: kbh,
xxbmc: this.form.xxbmc,
nj: this.form.nj || undefined,
jybh: jybh || undefined,
jsbh: jsbh || undefined,
rs: this.form.jh || undefined,
xs: this.form.jhsxs || undefined,
xf: this.form.xf || undefined
}
return addElective(dto).then(() => {
this.$message.success('新建选修课成功')
this.dialogVisible = false
this.loadList()
})
})
.catch(() => {})
},
// ==================== 分页 ==================== // ==================== 分页 ====================
handlePageChange(page) { handlePageChange(page) {