1、选修课保存调整,加上教材的保存;

2、课程可以下拉选择;
This commit is contained in:
2026-09-22 16:25:55 +08:00
parent 97ae86f9c7
commit 1ac022757d
2 changed files with 57 additions and 30 deletions
@@ -3,6 +3,7 @@ package com.roomroot.jwgl.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -24,36 +25,43 @@ public class KCJC {
/** /**
* 课编号 * 课编号
*/ */
@TableField("课编号")
private String kbh; private String kbh;
/** /**
* 教材编号 * 教材编号
*/ */
@TableField("教材编号")
private String jcbh; private String jcbh;
/** /**
* 教材选用说明 * 教材选用说明
*/ */
@TableField("教材选用说明")
private String jcxysm; private String jcxysm;
/** /**
* 备注 * 备注
*/ */
@TableField("备注")
private String bz; private String bz;
/** /**
* 停用 * 停用
*/ */
@TableField("停用")
private Integer ty; private Integer ty;
/** /**
* 停用日期 * 停用日期
*/ */
@TableField("停用日期")
private LocalDateTime tyrq; private LocalDateTime tyrq;
/** /**
* 教材性质 * 教材性质
*/ */
@TableField("教材性质")
private String jcxz; private String jcxz;
} }
@@ -145,8 +145,22 @@
<el-form-item label="年级"> <el-form-item label="年级">
<el-input v-model="form.nj" placeholder="新建选修班时填写,如 2024" clearable /> <el-input v-model="form.nj" placeholder="新建选修班时填写,如 2024" clearable />
</el-form-item> </el-form-item>
<el-form-item label="课程名称" prop="kcmc"> <el-form-item label="课程名称" prop="kbh">
<el-input v-model="form.kcmc" placeholder="请输入课程名称,提交时按名称查找课编号" clearable /> <el-select
v-model="form.kbh"
placeholder="请选择课程名称"
clearable
filterable
:loading="courseLoading"
class="w-full"
>
<el-option
v-for="c in courseOptions"
:key="c.kbh"
:label="(c.kmc || '-') + '' + c.kbh + ''"
:value="c.kbh"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="实施教员" prop="js"> <el-form-item label="实施教员" prop="js">
<el-select <el-select
@@ -271,7 +285,7 @@ export default {
form: { form: {
xxbmc: '', xxbmc: '',
nj: '', nj: '',
kcmc: '', kbh: '',
js: '', js: '',
jc: '', jc: '',
jxcd: '', jxcd: '',
@@ -281,6 +295,8 @@ export default {
jh: 0 jh: 0
}, },
// ==================== 新建弹窗下拉选项 ==================== // ==================== 新建弹窗下拉选项 ====================
courseOptions: [],
courseLoading: false,
teacherOptions: [], teacherOptions: [],
teacherLoading: false, teacherLoading: false,
classroomOptions: [], classroomOptions: [],
@@ -290,7 +306,7 @@ export default {
rules: { rules: {
xxbmc: [{ required: true, message: '请输入选修班名称', trigger: 'blur' }], xxbmc: [{ required: true, message: '请输入选修班名称', trigger: 'blur' }],
kcmc: [{ required: true, message: '请输入课程名称', trigger: 'blur' }], kbh: [{ required: true, message: '请选择课程名称', trigger: 'change' }],
js: [{ required: true, message: '请选择实施教员', trigger: 'change' }] js: [{ required: true, message: '请选择实施教员', trigger: 'change' }]
}, },
@@ -444,7 +460,7 @@ export default {
this.form = { this.form = {
xxbmc: '', xxbmc: '',
nj: '', nj: '',
kcmc: '', kbh: '',
js: '', js: '',
jc: '', jc: '',
jxcd: '', jxcd: '',
@@ -454,6 +470,7 @@ export default {
jh: 0 jh: 0
} }
this.dialogVisible = true this.dialogVisible = true
this.loadCourseOptions()
this.loadTeacherOptions() this.loadTeacherOptions()
this.loadClassroomOptions() this.loadClassroomOptions()
this.loadMaterialOptions() this.loadMaterialOptions()
@@ -461,6 +478,17 @@ export default {
this.$refs.formRef && this.$refs.formRef.clearValidate() this.$refs.formRef && this.$refs.formRef.clearValidate()
}) })
}, },
loadCourseOptions() {
if (this.courseOptions.length || this.courseLoading) return
this.courseLoading = true
listKb({ pageNum: 1, pageSize: 500 }).then(res => {
this.courseOptions = (res && res.data && res.data.records) || []
}).catch(() => {
this.courseOptions = []
}).finally(() => {
this.courseLoading = false
})
},
loadTeacherOptions() { loadTeacherOptions() {
if (this.teacherOptions.length || this.teacherLoading) return if (this.teacherOptions.length || this.teacherLoading) return
this.teacherLoading = true this.teacherLoading = true
@@ -506,15 +534,8 @@ export default {
}) })
}, },
submitNewElective() { submitNewElective() {
listKb({ pageNum: 1, pageSize: 1, kmc: this.form.kcmc })
.then(kbRes => {
const kbh = kbRes?.data?.records?.[0]?.kbh
if (!kbh) {
this.$message.warning(`未找到课程科目:${this.form.kcmc}`)
return
}
const dto = { const dto = {
kbh: kbh, kbh: this.form.kbh,
xxbmc: this.form.xxbmc, xxbmc: this.form.xxbmc,
nj: this.form.nj || undefined, nj: this.form.nj || undefined,
jybh: this.form.js || undefined, jybh: this.form.js || undefined,
@@ -524,13 +545,11 @@ export default {
xs: this.form.jhsxs || undefined, xs: this.form.jhsxs || undefined,
xf: this.form.xf || undefined xf: this.form.xf || undefined
} }
return addElective(dto).then(() => { addElective(dto).then(() => {
this.$message.success('新建选修课成功') this.$message.success('新建选修课成功')
this.dialogVisible = false this.dialogVisible = false
this.loadList() this.loadList()
}) }).catch(() => {})
})
.catch(() => {})
}, },
// ==================== 分页 ==================== // ==================== 分页 ====================