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