Commit d4fc7d62 by zhaopanyu

zpy 班主任选课修改

parent ef1f2373
...@@ -117,6 +117,7 @@ export default { ...@@ -117,6 +117,7 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
this.loading = true this.loading = true
let data = { let data = {
curriculaId: this.queryParams.curriculaName, curriculaId: this.queryParams.curriculaName,
...@@ -131,6 +132,8 @@ export default { ...@@ -131,6 +132,8 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.courseSelectionData = res.rows; this.courseSelectionData = res.rows;
console.log('res.rows', res.rows); console.log('res.rows', res.rows);
// 更新人数/总人数
this.calculateStats();
this.total = res.total this.total = res.total
this.loading = false this.loading = false
} }
...@@ -144,10 +147,6 @@ export default { ...@@ -144,10 +147,6 @@ export default {
getDetailInfo({ ...this.queryParams }).then(res => { getDetailInfo({ ...this.queryParams }).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.taskNameList = res.data; this.taskNameList = res.data;
console.log('this.taskNameList', this.taskNameList);
this.taskNameList.zrs = res.data.zrs;
this.taskNameList.yxrs = res.data.yxrs;
console.log(this.taskNameList.zrs, this.taskNameList.xkrs);
// 获取最新一次的任务名称 // 获取最新一次的任务名称
const latestTask = this.taskNameList[0]; // 假设任务名称列表按照时间降序排列 const latestTask = this.taskNameList[0]; // 假设任务名称列表按照时间降序排列
// 设置默认选中的任务名称 // 设置默认选中的任务名称
...@@ -156,7 +155,7 @@ export default { ...@@ -156,7 +155,7 @@ export default {
this.getList(latestTask.curriculaId); this.getList(latestTask.curriculaId);
this.getClassList(latestTask.grade); this.getClassList(latestTask.grade);
//人数总人数 //人数总人数
this.calculateStats(); // this.calculateStats();
// console.log('this.taskNameList', this.taskNameList); // console.log('this.taskNameList', this.taskNameList);
this.grades = res.data.map(item => { this.grades = res.data.map(item => {
return { return {
...@@ -173,14 +172,17 @@ export default { ...@@ -173,14 +172,17 @@ export default {
const selectedTask = this.taskNameList.find(item => item.curriculaId === selectedCurriculaId); const selectedTask = this.taskNameList.find(item => item.curriculaId === selectedCurriculaId);
const selectedGrade = selectedTask.grade; const selectedGrade = selectedTask.grade;
this.getClassList(selectedGrade); this.getClassList(selectedGrade);
this.calculateStats(); // this.calculateStats();
}, },
//任务名称和人数数据联动 //任务名称和人数数据联动
calculateStats() { calculateStats() {
const selectedTask = this.taskNameList.find(item => item.curriculaId === this.queryParams.curriculaName); const selectedTask = this.taskNameList.find(item => item.curriculaId === this.queryParams.curriculaName);
this.taskStats.total = selectedTask.zrs; if (selectedTask) {
this.taskStats.selected = selectedTask.yxrs; this.taskStats.total = selectedTask.zrs;
this.taskStats.selected = selectedTask.yxrs;
}
}, },
//班级下拉框 //班级下拉框
getClassList(grades) { getClassList(grades) {
classList(grades).then(res => { classList(grades).then(res => {
...@@ -200,6 +202,7 @@ export default { ...@@ -200,6 +202,7 @@ export default {
}; };
this.taskStats.total = 0; this.taskStats.total = 0;
this.taskStats.selected = 0; this.taskStats.selected = 0;
this.calculateStats();
this.resetForm("queryForm"); this.resetForm("queryForm");
this.getList(); this.getList();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment