| | |
| | | </div> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item :label="`评价项${index + 1}`" style="width: 100%" :prop="item.questionName"> |
| | | <el-form-item :label="`评价项${index + 1}`" :prop="`${index}`" style="width: 100%" :rules="[ |
| | | { |
| | | validator: validateSubField, |
| | | trigger: 'blur' |
| | | } |
| | | ]"> |
| | | <el-input |
| | | placeholder="请输入" |
| | | v-model="item.questionName" |
| | |
| | | } |
| | | ] |
| | | }) |
| | | const instance = getCurrentInstance() |
| | | |
| | | function getListEvaluate() { |
| | | listEvaluate().then((val) => { |
| | | form.value.questionList = val.data.questionList |
| | |
| | | questionStatus: 0, |
| | | questionType: 2, |
| | | questionScore: 5, |
| | | questionName: '', |
| | | answerList: [] |
| | | }) |
| | | } |
| | |
| | | formRef.value.validate((valid) => { |
| | | console.log(valid) |
| | | if(valid) { |
| | | // saveEvaluate({questionList: form.value.questionList}).then(val => { |
| | | // ElMessage.success(item||'保存成功') |
| | | // }) |
| | | saveEvaluate({questionList: form.value.questionList}).then(val => { |
| | | ElMessage.success(item||'保存成功') |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | function validateSubField(rule: any, value: any, callback: any) { |
| | | // console.log(rule, value) |
| | | // console.log(proxy['form']) |
| | | if(!form.value.questionList[rule.field].questionName) { |
| | | callback(new Error('请入评价项')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | function changeValue(event, index, childIndex) { |
| | | // form.value.questionList[index].isScore = event.target. |
| | | form.value.questionList[index].answerList.forEach((item: { isScore: number }) => { |