竞赛考试结果调整

This commit is contained in:
fan 2020-05-22 16:34:05 +08:00
parent bcbb5ff512
commit 86edffb984
3 changed files with 82 additions and 50 deletions

View File

@ -5,29 +5,35 @@
</div>
<div class="context">
<el-form ref="form" :model="resultModel" size="mini">
<el-form-item :label="this.$t('exam.testQuestionsName')+':'" prop="name">
<span>{{ resultModel.examName }}</span>
</el-form-item>
<el-form-item :label="this.$t('exam.testScores')+':'" prop="score">
<span>{{ resultModel.score + ' '+ $t('exam.points') }}</span>
</el-form-item>
<el-form-item :label="this.$t('exam.whetherThrough')+':'" prop="detail">
<span v-if="resultModel.result === '01'" style="color:darkgray">{{ $t('exam.didNotCalculate') }}</span>
<span v-else-if="resultModel.result === '02'" style="color:green">{{ $t('exam.pass') }}</span>
<span v-else-if="resultModel.result === '03'" style="color:red">{{ $t('exam.notPass') }}</span>
</el-form-item>
<el-form-item :label="this.$t('exam.examTime')+':'" prop="detail">
<span>{{ Math.ceil(resultModel.usedTime/60) + ' '+ $t('global.minutes') }}</span>
<span>{{ Math.ceil((resultModel.usedTime || 0)/60) + ' '+ $t('global.minutes') }}</span>
</el-form-item>
</el-form>
<el-table :data="resultModel.userExamQuestionsVOs" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary>
<el-table-column prop="trainingName" :label="this.$t('exam.trainingName')" />
<el-table-column prop="score" :label="this.$t('exam.trainingScore')" />
<el-table-column prop="cause" label="原因/结果" />
<el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod">
<el-table-column prop="title" label="题数">
<template slot-scope="scope">
<span>{{ '第'+scope.row.title + '题' }}</span>
</template>
</el-table-column>
<el-table-column prop="score" label="分值(分)" />
<el-table-column prop="goal" label="得分(分)" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="正确答案" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">
<template slot-scope="scope">
<span>{{ '得分点'+scope.row.scoringPointIndex }}</span>
</template>
</el-table-column>
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointScore" label="得分点分值" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointGoal" label="得分点得分" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointExplain" label="得分点说明" />
</el-table>
</div>
<div class="draf_box">
<el-button type="primary " @click="back">{{ $t('exam.returnToExamList') }}</el-button>
<el-button type="primary " @click="back">返回首页</el-button>
</div>
</div>
</template>
@ -49,7 +55,20 @@ export default {
trainingName: '',
score: 0
},
loading: true
theoryData: [
{ title: '1', score: '2', goal: '0', correctAnswer: 'A', explain: '这是说明原因所有A为正确答案' },
{ title: '2', score: '2', goal: '0', correctAnswer: 'B', explain: '这是说明原因所有B为正确答案' },
{ title: '3', score: '2', goal: '0', correctAnswer: 'C', explain: '这是说明原因所有C为正确答案' },
{ title: '4', score: '2', goal: '0', correctAnswer: 'D', explain: '这是说明原因所有D为正确答案' }
],
operateData: [
{ title: '1', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '2', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '3', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] },
{ title: '4', score: '25', goal: '0', scoringPoints: [{score: '10', goal: '0', explain: '这是说明原因1'}, {score: '10', goal: '0', explain: '这是说明原因2'}, {score: '5', goal: '0', explain: '这是说明原因3'}] }
],
loading: true,
tableData: []
};
},
computed: {
@ -69,48 +88,60 @@ export default {
sums[index] = this.$t('exam.totalScore');
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += this.$t('exam.points');
} else {
sums[index] = 'N/A';
if (column.property === 'score' || column.property === 'goal' || column.property === 'scoringPointScore' || column.property === 'scoringPointGoal') {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += this.$t('exam.points');
} else {
sums[index] = '';
}
}
});
return sums;
},
submitExamData() {
// this.loading = true;
// let count = 3;
// const userExamId = this.$route.params.userExamId;
// let interval = setInterval(() => {
// submitExam(userExamId).then(response => {
this.loading = false;
// this.resultModel = response.data;
// clearInterval(interval);
// interval = null;
// }).catch(() => {
// if (count-- < 0) {
// this.loading = false;
// clearInterval(interval);
// interval = null;
// this.$messageBox(this.$t('error.submitExamFailed'));
// }
// });
// }, 1000);
if (this.$route.query.type === 'theory') {
this.tableData = this.theoryData;
} else if (this.$route.query.type === 'operate') {
this.tableData = [];
this.operateData.forEach(item => {
if (item.scoringPoints && item.scoringPoints.length) {
item.scoringPoints.forEach((elem, index) => {
this.tableData.push({
title: item.title, score: item.score, goal: item.goal, scoringPointLength: item.scoringPoints.length, scoringPointIndex: index + 1, scoringPointScore: elem.score, scoringPointGoal: elem.goal, scoringPointExplain: elem.explain
});
});
}
});
}
},
back() {
const query = {type: 'operation', mapId: this.$route.query.mapId};
this.$router.push({path: `/jsxt/examDetail`, query: query});
// const examId = this.resultModel.examId;
// this.$router.push({path: `${UrlConfig.trainingPlatform.examDetail}/${examId}`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId }});
this.$router.push({path: `/jsxt/home`, query: query});
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if ((columnIndex === 0 || columnIndex === 1 || columnIndex === 2) && row.scoringPointLength) {
if (row.scoringPointIndex === 1) {
return {
rowspan: row.scoringPointLength,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
}
}
};

View File

@ -154,7 +154,8 @@ export default {
},
doEnd() {
// console.log('');
this.$router.push({ path: `/jsxt/home`});
// this.$router.push({ path: `/jsxt/home`});
this.$router.push({ path: `/jsxt/result`, query: { type: 'theory' } });
},
onSave(data) {
console.log(data, '问答题');

View File

@ -336,7 +336,7 @@ export default {
submit() {
// this.$store.dispatch('exam/over').then(() => {
// this.$store.dispatch('trainingList/clearTrainingList');
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId } });
this.$router.replace({ path: `/jsxt/result`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId, type: 'operate' } });
// });
}
}