优化:实训评分规则总分自动统计
This commit is contained in:
parent
7fc9e0fab4
commit
9ef0780377
@ -21,7 +21,7 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="总分:" prop="fullMarks" style="display:inline-block">
|
<el-form-item label="总分:" prop="fullMarks" style="display:inline-block">
|
||||||
<el-input-number v-model="addModel.fullMarks" style="width:145px" :min="0" size="mini" :step="1" />
|
<el-input-number v-model="addModel.fullMarks" :disabled="true" style="width:145px" :min="0" size="mini" :step="1" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table
|
||||||
@ -46,7 +46,7 @@
|
|||||||
width="200"
|
width="200"
|
||||||
>
|
>
|
||||||
<template v-if="addModel.memberId == scope.row.memberId" slot-scope="scope">
|
<template v-if="addModel.memberId == scope.row.memberId" slot-scope="scope">
|
||||||
<el-input-number v-model="currentStepMap[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" @change="stepScoreChange" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -138,19 +138,15 @@ export default {
|
|||||||
this.$emit('cancel', this.source);
|
this.$emit('cancel', this.source);
|
||||||
},
|
},
|
||||||
commit() {
|
commit() {
|
||||||
|
console.log('****');
|
||||||
const that = this;
|
const that = this;
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const scoreDetails = [];
|
const scoreDetails = [];
|
||||||
let totalScore = 0;
|
|
||||||
for (const key in this.currentStepMap) {
|
for (const key in this.currentStepMap) {
|
||||||
totalScore += this.currentStepMap[key];
|
|
||||||
scoreDetails.push({elementId: key, score: this.currentStepMap[key]});
|
scoreDetails.push({elementId: key, score: this.currentStepMap[key]});
|
||||||
}
|
}
|
||||||
if (totalScore !== this.addModel.fullMarks) {
|
if (this.addModel.fullMarks === 0) {
|
||||||
this.$message.error('步骤分总和不等于总分!');
|
|
||||||
return;
|
|
||||||
} else if (this.addModel.fullMarks === 0) {
|
|
||||||
this.$message.error('规则无评分项!');
|
this.$message.error('规则无评分项!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -167,6 +163,13 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
stepScoreChange(val) {
|
||||||
|
let fullMarks = 0;
|
||||||
|
for (const stepKey in this.currentStepMap) {
|
||||||
|
fullMarks += this.currentStepMap[stepKey];
|
||||||
|
}
|
||||||
|
this.addModel.fullMarks = fullMarks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user