代码调整
This commit is contained in:
parent
f38c129319
commit
b5922b2f65
@ -146,8 +146,8 @@ export default {
|
||||
}
|
||||
});
|
||||
this.addModel.fullMarks = '';
|
||||
this.addModel.details = [];
|
||||
}
|
||||
debugger;
|
||||
this.addModel.memberId = memberId;
|
||||
},
|
||||
doClose() {
|
||||
@ -157,33 +157,38 @@ export default {
|
||||
this.doClose();
|
||||
},
|
||||
commit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
const that = this;
|
||||
that.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
const keyList = Object.keys(this.currentStepMap);
|
||||
const keyList = Object.keys(that.currentStepMap);
|
||||
const details = [];
|
||||
keyList.forEach(key=>{
|
||||
details.push({elementId:key, score:this.currentStepMap[key]});
|
||||
details.push({elementId:key, score:that.currentStepMap[key]});
|
||||
});
|
||||
this.addModel.details = details;
|
||||
const gradeRulesList = Object.values(this.gradeRulesMap);
|
||||
that.addModel.details = details;
|
||||
const gradeRulesList = Object.values(that.gradeRulesMap);
|
||||
gradeRulesList.forEach(gradeRule=>{
|
||||
if (gradeRule.memberId == this.addModel.memberId) {
|
||||
gradeRule = this.addModel;
|
||||
if (gradeRule.memberId == that.addModel.memberId) {
|
||||
gradeRule = that.addModel;
|
||||
}
|
||||
});
|
||||
if (!this.gradeRulesMap[this.addModel.memberId] && this.addModel.details.length > 0) {
|
||||
gradeRulesList.push(this.addModel);
|
||||
if (!that.gradeRulesMap[that.addModel.memberId] && that.addModel.details.length > 0) {
|
||||
gradeRulesList.push(that.addModel);
|
||||
}
|
||||
if (that.addModel.details.length > 0) {
|
||||
that.loading = true;
|
||||
updateTrainingGradeRules(that.trainingId, gradeRulesList).then(resp => {
|
||||
that.loading = false;
|
||||
that.gradeRulesMap[that.addModel.memberId] = JSON.parse(JSON.stringify(that.addModel));
|
||||
that.$message.success('更新实训评分规则成功!');
|
||||
}).catch((e) => {
|
||||
that.loading = false;
|
||||
console.error(e);
|
||||
that.$message.error('更新实训评分规则失败!');
|
||||
});
|
||||
} else {
|
||||
that.$message.error('该角色不存在');
|
||||
}
|
||||
updateTrainingGradeRules(this.trainingId, gradeRulesList).then(resp => {
|
||||
this.loading = false;
|
||||
this.$message.success('更新实训评分规则成功!');
|
||||
this.gradeRulesMap[this.addModel.memberId] = this.addModel;
|
||||
}).catch((e) => {
|
||||
this.loading = false;
|
||||
console.error(e);
|
||||
this.$message.error('更新实训评分规则失败!');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user