实训 评分代码调整

This commit is contained in:
joylink_cuiweidong 2022-09-19 16:56:10 +08:00
parent 402eb691d1
commit 718c69c04b

View File

@ -43,7 +43,7 @@
width="200"
>
<template v-if="addModel.memberId==scope.row.memberId" slot-scope="scope">
<el-input-number v-model="currentStepMap['step' + scope.row.id]" style="width:145px" :min="0" size="mini" :step="1" />
<el-input-number v-model="currentStepMap[scope.row.id]" style="width:145px" :min="0" size="mini" :step="1" />
</template>
</el-table-column>
</el-table>
@ -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;