解决课程名称筛选条件没有监听输入框变化,查询数据

dev
yujialong 3 years ago
parent 52b4308a0b
commit 99a7e26020
  1. 27
      src/views/course/AddCurriculum.vue
  2. 29
      src/views/course/Curriculum.vue

@ -225,7 +225,7 @@
</div> </div>
<el-table ref="table" :data="permissionData" class="table" stripe header-align="center" <el-table ref="table" :data="permissionData" class="table" stripe header-align="center"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column> <el-table-column type="selection" :selectable="practiceSelectable" width="55" align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="systemName" label="系统名称" align="center"></el-table-column> <el-table-column prop="systemName" label="系统名称" align="center"></el-table-column>
<el-table-column prop="type" label="系统类型" align="center"> <el-table-column prop="type" label="系统类型" align="center">
@ -455,6 +455,25 @@ export default {
}).catch(err => { }).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() { initData() {
this.$refs.table.clearSelection(); this.$refs.table.clearSelection();
this.pageNo = 1; this.pageNo = 1;
@ -471,16 +490,14 @@ export default {
if (!this.multipleSelection.length) { if (!this.multipleSelection.length) {
this.$message.warning("请选择系统!"); this.$message.warning("请选择系统!");
return; return;
} else if (this.multipleSelection.length > 1) {
this.$message.warning("只能选择一个系统!");
return;
} else { } else {
this.getConfigData(); this.getConfigData();
this.configVisible = false; this.configVisible = false;
} }
}, },
getConfigData() { // 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) => { let data = res.map((item, index) => {
item.isShow = 0; // isShow(0: 1:) item.isShow = 0; // isShow(0: 1:)
item.sort = index + 1; item.sort = index + 1;

@ -147,9 +147,18 @@ export default {
ProfessionalClassList: [], // ProfessionalClassList: [], //
ProfessionalList: [], // ProfessionalList: [], //
multipleSelection: [], multipleSelection: [],
loading: false loading: false,
searchTimer: null
}; };
}, },
watch: {
"form.curriculumName": function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
mounted() { mounted() {
this.getSubject(); this.getSubject();
this.getData(); this.getData();
@ -172,6 +181,10 @@ export default {
}).catch(err => { }).catch(err => {
}); });
}, },
initData() {
this.pageNo = 1;
this.getData();
},
// //
getSubject() { getSubject() {
this.$get(this.api.courseDiscipline).then(res => { this.$get(this.api.courseDiscipline).then(res => {
@ -240,8 +253,10 @@ export default {
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => { this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => {
this.getData(); this.getData();
this.$message.success("删除成功"); this.$message.success("删除成功");
}).catch(err => {}); }).catch(err => {
}).catch(() => {}); });
}).catch(() => {
});
}, },
// //
handleSelectionChange(val) { handleSelectionChange(val) {
@ -257,8 +272,10 @@ export default {
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => { this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => {
this.getData(); this.getData();
this.$message.success("删除成功"); this.$message.success("删除成功");
}).catch(err => {}); }).catch(err => {
}).catch(() => {}); });
}).catch(() => {
});
} else { } else {
this.$message.warning("请先选择课程 !"); this.$message.warning("请先选择课程 !");
} }
@ -279,7 +296,7 @@ export default {
this.getData(); this.getData();
this.$message.success("修改上下架状态成功!"); this.$message.success("修改上下架状态成功!");
}).catch((res) => { }).catch((res) => {
}) });
} }
} }
}; };

Loading…
Cancel
Save