|
|
|
@ -48,16 +48,15 @@ |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.score" class="score-input" > |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.taskOperate" class="score-input" > |
|
|
|
|
<el-select v-model="scope.row.taskOperate" size="small" style="width: 100px;"> |
|
|
|
|
<el-option label="大于" value="1"></el-option> |
|
|
|
|
<el-option label="等于" value="2"></el-option> |
|
|
|
|
<el-option label="小于" value="3"></el-option> |
|
|
|
|
<el-option label="小于" value="2"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.taskRate'" :rules="dataRule.score" class="score-input" > |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.taskRate'" :rules="dataRule.taskRate" class="score-input" > |
|
|
|
|
<el-input size="small" v-model.trim="scope.row.taskRate" :disabled="formAction == 2" style="width: 100px;"> |
|
|
|
|
<i slot="suffix">%</i> |
|
|
|
|
</el-input> |
|
|
|
@ -66,10 +65,10 @@ |
|
|
|
|
</el-row> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="score" label="分数" width="120"> |
|
|
|
|
<el-table-column prop="taskScore" label="分数" width="120"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.score'" :rules="dataRule.score" class="score-input"> |
|
|
|
|
<el-input size="small" v-model.trim="scope.row.score" :disabled="formAction == 2" style="width: 100px;"><i slot="suffix">分</i></el-input> |
|
|
|
|
<el-form-item :prop="'taskList.'+scope.$index+'.taskScore'" :rules="dataRule.taskScore" class="score-input"> |
|
|
|
|
<el-input size="small" v-model.trim="scope.row.taskScore" :disabled="formAction == 2" style="width: 100px;"><i slot="suffix">分</i></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -104,17 +103,17 @@ |
|
|
|
|
var validateScore = (rule, value, callback) => { |
|
|
|
|
if (!value) { |
|
|
|
|
callback(new Error('请输入分数')); |
|
|
|
|
} else if (!(/^(([1-9][0-9]*)|(([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2})))$/.test(value)) || value > 100) { |
|
|
|
|
callback(new Error('请输入0-100之间最多两位小数的数字')); |
|
|
|
|
} else if (!(/^[1-9][0-9]{0,2}$/.test(value)) || value > 100) { |
|
|
|
|
callback(new Error('请输入1-100之间的正整数')); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var validateContent = (rule, value, callback) => { |
|
|
|
|
if (!value.trim()) { |
|
|
|
|
callback(new Error('请填写案例描述')); |
|
|
|
|
} else if (value.length > 3000) { |
|
|
|
|
callback(new Error('长度在 1 到 3000 个字符')); |
|
|
|
|
var validateTaskRate = (rule, value, callback) => { |
|
|
|
|
if (!value) { |
|
|
|
|
callback(new Error('请输入任务目标')); |
|
|
|
|
} else if (!(/^(([1-9][0-9]*)|(([0]\.\d|[1-9][0-9]*\.\d)))$/.test(value)) || value > 100) { |
|
|
|
|
callback(new Error('请输入100以内最多一位小数的正数')); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
@ -137,10 +136,13 @@ |
|
|
|
|
type: [ |
|
|
|
|
{ required: true, message: '请选择实训用途', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
// content: [ |
|
|
|
|
// {validator: validateContent, trigger: 'blur'} |
|
|
|
|
// ], |
|
|
|
|
score: [ |
|
|
|
|
taskOperate: [ |
|
|
|
|
{ required: true, message: '请选择设置项', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
taskRate: [ |
|
|
|
|
{validator: validateTaskRate, trigger: 'blur'} |
|
|
|
|
], |
|
|
|
|
taskScore: [ |
|
|
|
|
{validator: validateScore, trigger: 'blur'} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
@ -216,8 +218,8 @@ |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
goBackList() { |
|
|
|
|
// this.$router.push({name: 'CaseList'}); |
|
|
|
|
this.$router.go(-1); |
|
|
|
|
this.$router.push({name: 'CaseList'}); |
|
|
|
|
// this.$router.go(-1); |
|
|
|
|
}, |
|
|
|
|
initTargetList(searchObj) { |
|
|
|
|
Train.getTargetList(searchObj).then(res => { |
|
|
|
@ -247,8 +249,7 @@ |
|
|
|
|
item=Object.assign({}, item, { |
|
|
|
|
taskOperate: null, |
|
|
|
|
taskRate: null, |
|
|
|
|
score: null, |
|
|
|
|
taskSeq: null |
|
|
|
|
taskScore: null |
|
|
|
|
}) |
|
|
|
|
//右侧添加选中的数据 |
|
|
|
|
this.rightTargetList.push(item); |
|
|
|
@ -303,7 +304,7 @@ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (index === 3) { // 分数栏 |
|
|
|
|
values = data.map(item => Number(item['score'])); |
|
|
|
|
values = data.map(item => Number(item['taskScore'])); |
|
|
|
|
sums[index] = values.reduce((prev, curr) => { |
|
|
|
|
const value = Number(curr); |
|
|
|
|
if (!isNaN(value)) { |
|
|
|
|