From 718c69c04b2dddb27ec86e49f90213acdbd92f36 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 19 Sep 2022 16:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=20=E8=AF=84=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/trainingManage/gradeRules.vue | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/views/trainingManage/gradeRules.vue b/src/views/trainingManage/gradeRules.vue index c95aa0c95..422f3e064 100644 --- a/src/views/trainingManage/gradeRules.vue +++ b/src/views/trainingManage/gradeRules.vue @@ -43,7 +43,7 @@ width="200" > @@ -134,17 +134,17 @@ export default { }, changeMember(memberId) { const currentStepMap = {}; + this.allstepList.forEach(each=>{ + if (each.memberId == memberId) { + currentStepMap[each.id] = 0; + } + }); if (this.gradeRulesMap[memberId]) { this.addModel.fullMarks = this.gradeRulesMap[memberId].fullMarks; this.gradeRulesMap[memberId].details.forEach(each=>{ - currentStepMap['step' + each.elementId] = each.score; + currentStepMap[each.elementId] = each.score; }); } else { - this.allstepList.forEach(each=>{ - if (each.memberId == memberId) { - currentStepMap['step' + each.id] = 0; - } - }); this.addModel.fullMarks = ''; this.addModel.details = []; } @@ -178,6 +178,20 @@ export default { gradeRulesList.push(that.addModel); } if (that.addModel.details.length > 0) { + let result = false; + gradeRulesList.forEach(gradeRules=>{ + let total = 0; + gradeRules.details.forEach(detail=>{ + total += detail.score || 0; + }); + if (total !== gradeRules.fullMarks) { + result = result || true; + } + }); + if (result) { + that.$message.error('步骤分总和不等于总分'); + return; + } that.loading = true; updateTrainingGradeRules(that.trainingId, gradeRulesList).then(resp => { that.loading = false;