评分规则调整1

This commit is contained in:
fan 2024-03-01 15:23:02 +08:00
parent f5dcc979bf
commit a1f2fab981
2 changed files with 13 additions and 44 deletions

View File

@ -12,10 +12,9 @@
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="描述" prop="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="描述" prop="name" />
<el-table-column label="评分标准" prop="criteria" />
<el-table-column label="分值" prop="score" width="50" />
</el-table>
</el-dialog>
</template>
@ -43,29 +42,19 @@ export default {
handleClose() {
this.dialogVisible = false;
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
handleSummaries(data, sums) {
data.forEach(item => {
sums[3] += Number(item.score);
if (item.children && item.children.length) {
this.handleSummaries(item.children, sums);
}
});
},
getSummaries(param) {
const { columns, data } = param;
const sums = ['总分', '/', '/', 0, '/'];
console.log(columns, '===');
this.handleSummaries(data, sums);
return sums;
}
}

View File

@ -167,26 +167,6 @@ export default {
const sums = ['总分', '/', '/', 0, '/'];
console.log(columns, '===');
this.handleSummaries(data, sums);
// columns.forEach((column, index) => {
// if (index === 0) {
// sums[index] = '';
// return;
// }
// if (index === 3) {
// const values = data.map(item => Number(item[column.property]));
// sums[index] = values.reduce((prev, curr) => {
// const value = Number(curr);
// if (!isNaN(value)) {
// return prev + curr;
// } else {
// return prev;
// }
// }, 0);
// sums[index] += '';
// } else {
// sums[index] = '/';
// }
// });
return sums;
}
}