评分规则调整
This commit is contained in:
parent
01b95a3fd4
commit
f5dcc979bf
@ -1,21 +1,22 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
|
||||
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="130px">
|
||||
<el-form-item label="单元描述:" prop="name">
|
||||
<el-form-item label="项目:" prop="name">
|
||||
<el-input v-model="formModel.name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作业程序:" prop="content">
|
||||
<el-input v-model="formModel.content" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="作业程序:" prop="content">-->
|
||||
<!-- <el-input v-model="formModel.content" style="width: 200px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="场景步骤ID:" prop="sceneStepId">-->
|
||||
<!-- <el-input v-model="formModel.sceneStepId" style="width: 200px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="单元分值:" prop="score">
|
||||
<el-input-number v-model="formModel.score" style="width: 200px;" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="评分标准:" prop="criteria">
|
||||
<el-input v-model="formModel.criteria" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单元分值:" prop="score">
|
||||
<el-input-number v-model="formModel.score" style="width: 200px;" :min="0" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
@ -31,7 +32,6 @@ export default {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
name: '',
|
||||
content: '',
|
||||
score: 0,
|
||||
criteria: '',
|
||||
sceneStepId: '',
|
||||
@ -46,7 +46,7 @@ export default {
|
||||
rules() {
|
||||
const crules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入单元描述', trigger: 'blur' }
|
||||
{ required: true, message: '请输入项目', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
@ -62,7 +62,6 @@ export default {
|
||||
this.index = index;
|
||||
if (row) {
|
||||
this.formModel.name = row.name;
|
||||
this.formModel.content = row.content;
|
||||
this.formModel.score = row.score;
|
||||
this.formModel.criteria = row.criteria;
|
||||
this.formModel.sceneStepId = row.sceneStepId;
|
||||
@ -73,7 +72,6 @@ export default {
|
||||
this.type = 'edit';
|
||||
this.formModel = {
|
||||
name: '',
|
||||
content: '',
|
||||
score: 0,
|
||||
criteria: '',
|
||||
sceneStepId: '',
|
||||
|
@ -23,10 +23,9 @@
|
||||
style="width: 100%;margin-top: 10px;"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="描述" prop="name" />
|
||||
<el-table-column label="作业程序" prop="content" />
|
||||
<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-column label="场景步骤ID" prop="sceneStepId" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{ scope.row.sceneStepId === 0? '': scope.row.sceneStepId }}</span>-->
|
||||
@ -155,29 +154,39 @@ export default {
|
||||
}
|
||||
this.tableData = [...this.tableData];
|
||||
},
|
||||
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);
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user