diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index bf90810..edfac15 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -225,7 +225,7 @@ - + @@ -455,6 +455,25 @@ export default { }).catch(err => { }); }, + practiceSelectable(row, index) { // 禁止勾选已经选过的系统 + // console.log(row,index); + let boolean = true; + if (this.permissions) { + this.assessmentData.length && this.assessmentData.some(e => { + if (e.systemId == row.systemId) { + boolean = false; + } + }); + } else { + this.practiceData.length && this.practiceData.some(e => { + // console.log(e.systemId, row.systemId); + if (e.systemId == row.systemId) { + boolean = false; + } + }); + } + return boolean; + }, initData() { this.$refs.table.clearSelection(); this.pageNo = 1; @@ -471,16 +490,14 @@ export default { if (!this.multipleSelection.length) { this.$message.warning("请选择系统!"); return; - } else if (this.multipleSelection.length > 1) { - this.$message.warning("只能选择一个系统!"); - return; } else { this.getConfigData(); this.configVisible = false; } }, getConfigData() { // 查询实训配置 - this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${this.multipleSelection[0].systemId}`).then((res) => { + let ids = this.multipleSelection.map(i => i.systemId); + this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${ids.toString()}`).then((res) => { let data = res.map((item, index) => { item.isShow = 0; // isShow是否展示(默认0:展示 1:不展示) item.sort = index + 1; diff --git a/src/views/course/Curriculum.vue b/src/views/course/Curriculum.vue index f1d0db3..53c56d1 100644 --- a/src/views/course/Curriculum.vue +++ b/src/views/course/Curriculum.vue @@ -147,9 +147,18 @@ export default { ProfessionalClassList: [], // 专业类 ProfessionalList: [], // 专业 multipleSelection: [], - loading: false + loading: false, + searchTimer: null }; }, + watch: { + "form.curriculumName": function(val) { + clearTimeout(this.searchTimer); + this.searchTimer = setTimeout(() => { + this.initData(); + }, 500); + } + }, mounted() { this.getSubject(); this.getData(); @@ -172,6 +181,10 @@ export default { }).catch(err => { }); }, + initData() { + this.pageNo = 1; + this.getData(); + }, // 获取学科类别 getSubject() { this.$get(this.api.courseDiscipline).then(res => { @@ -182,7 +195,7 @@ export default { // 清除学科类别 clearClass() { this.form.professionalCategoryId = "", - this.form.professionalId = ""; + this.form.professionalId = ""; }, // 获取专业类 getProfessionalClass() { @@ -240,8 +253,10 @@ export default { this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => { this.getData(); this.$message.success("删除成功"); - }).catch(err => {}); - }).catch(() => {}); + }).catch(err => { + }); + }).catch(() => { + }); }, // 处理多选 handleSelectionChange(val) { @@ -257,8 +272,10 @@ export default { this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => { this.getData(); this.$message.success("删除成功"); - }).catch(err => {}); - }).catch(() => {}); + }).catch(err => { + }); + }).catch(() => { + }); } else { this.$message.warning("请先选择课程 !"); } @@ -278,8 +295,8 @@ export default { this.$post(`${this.api.isShelves}?cid=${row.cid}&isEnable=${value}`).then((res) => { this.getData(); this.$message.success("修改上下架状态成功!"); - }).catch((res) => { - }) + }).catch((res) => { + }); } } };