| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="form-content"> |
| | | <el-form inline :model="form.questionList" label-width="75px" :rules="rules"> |
| | | <el-form inline :model="form.questionList" ref="formRef" label-width="75px" :rules="rules"> |
| | | <div |
| | | class="border" |
| | | v-for="(item, index) in form.questionList" |
| | |
| | | </el-form> |
| | | <div class="center mt20 fixed"> |
| | | <el-button type="primary" @click="addContent">添加评价项</el-button> |
| | | <el-button @click="save" type="primary" >保存内容</el-button> |
| | | <el-button @click="save()" type="primary" >保存内容</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import { ElMessage, ElMessageBox} from 'element-plus' |
| | | const tableData = ref([]) |
| | | const addNewRef = ref() |
| | | const formRef = ref() |
| | | const form: any = ref({ |
| | | questionList: [] |
| | | }) |
| | | const rules = ref({ |
| | | questionName: [ |
| | | { |
| | | required: true, |
| | | message: '请输入问题', |
| | | trigger: 'blur' |
| | | required: true, |
| | | message: '请输入问题', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }) |
| | |
| | | answerList: [] |
| | | }) |
| | | } |
| | | function addOptions(index: number, name){ |
| | | function addOptions(index: number, name: any){ |
| | | if(!form.value.questionList[index].answerList) { |
| | | form.value.questionList[index].answerList = [] |
| | | } |
| | |
| | | }) |
| | | } |
| | | function save(item?: string) { |
| | | saveEvaluate({questionList: form.value.questionList}).then(val => { |
| | | ElMessage.success(item||'保存成功') |
| | | formRef.value.validate((valid) => { |
| | | console.log(valid) |
| | | if(valid) { |
| | | // saveEvaluate({questionList: form.value.questionList}).then(val => { |
| | | // ElMessage.success(item||'保存成功') |
| | | // }) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | function changeValue(event, index, childIndex) { |
| | | // form.value.questionList[index].isScore = event.target. |