评分规则调整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;" style="width: 100%;margin-top: 10px;"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="描述" prop="text" /> <el-table-column label="描述" prop="name" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" /> <el-table-column label="评分标准" prop="criteria" />
<el-table-column label="分值" prop="score" width="50" />
</el-table> </el-table>
</el-dialog> </el-dialog>
</template> </template>
@ -43,29 +42,19 @@ export default {
handleClose() { handleClose() {
this.dialogVisible = false; this.dialogVisible = false;
}, },
getSummaries(param) { handleSummaries(data, sums) {
const { columns, data } = param; data.forEach(item => {
const sums = []; sums[3] += Number(item.score);
columns.forEach((column, index) => { if (item.children && item.children.length) {
if (index === 0) { this.handleSummaries(item.children, sums);
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] = '/';
} }
}); });
},
getSummaries(param) {
const { columns, data } = param;
const sums = ['总分', '/', '/', 0, '/'];
console.log(columns, '===');
this.handleSummaries(data, sums);
return sums; return sums;
} }
} }

View File

@ -167,26 +167,6 @@ export default {
const sums = ['总分', '/', '/', 0, '/']; const sums = ['总分', '/', '/', 0, '/'];
console.log(columns, '==='); console.log(columns, '===');
this.handleSummaries(data, sums); 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; return sums;
} }
} }