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

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

@ -225,7 +225,7 @@
</div>
<el-table ref="table" :data="permissionData" class="table" stripe header-align="center"
@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 prop="systemName" label="系统名称" align="center"></el-table-column>
<el-table-column prop="type" label="系统类型" align="center">
@ -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;

@ -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) => {
});
}
}
};

Loading…
Cancel
Save