| | |
| | | <template> |
| | | <el-dialog |
| | | :title="this.id?'修改':'新增'" |
| | | width="60%" |
| | | modal-append-to-body='false' |
| | | append-to-body='true' |
| | | :close-on-click-model="true" |
| | | :visible.sync="visible" |
| | | @close='closeDialog' |
| | | <el-dialog |
| | | :title="this.id ? '修改' : '新增'" |
| | | width="60%" |
| | | modal-append-to-body="false" |
| | | append-to-body="true" |
| | | :close-on-click-model="true" |
| | | :visible.sync="visible" |
| | | @close="closeDialog" |
| | | > |
| | | <el-row style="margin-left: 60px; margin-bottom: 40px"> |
| | | <el-radio-group v-model="choicesType"> |
| | | <el-radio label="0">单选题</el-radio> |
| | | <el-radio label="1">多选题</el-radio> |
| | | <el-radio label="2">判断题</el-radio> |
| | | <el-radio label="3">实操题</el-radio> |
| | | </el-radio-group> |
| | | </el-row> |
| | | <avue-form |
| | | ref="form" |
| | | :option="option" |
| | | v-model="form" |
| | | @submit="submit" |
| | | v-if="choicesType == '0'" |
| | | ></avue-form> |
| | | <avue-form |
| | | ref="formCheckbox" |
| | | :option="optionCheckbox" |
| | | v-model="formCheckbox" |
| | | @submit="submitCheckbox" |
| | | v-if="choicesType == '1'" |
| | | ></avue-form> |
| | | <avue-form |
| | | ref="formJudge" |
| | | :option="optionJudge" |
| | | v-model="formJudge" |
| | | @submit="submitJudge" |
| | | v-if="choicesType == '2'" |
| | | ></avue-form> |
| | | <avue-form |
| | | ref="formFill" |
| | | :option="optionFill" |
| | | v-model="formFill" |
| | | @submit="submitFill" |
| | | v-if="choicesType == '3'" |
| | | > |
| | | <el-row style="margin-left:60px;margin-bottom:40px"> |
| | | <el-radio-group v-model="choicesType"> |
| | | <el-radio label="0">单选题</el-radio> |
| | | <el-radio label="1">多选题</el-radio> |
| | | <el-radio label="2">判断题</el-radio> |
| | | <el-radio label="3">实操题</el-radio> |
| | | </el-radio-group> |
| | | </el-row> |
| | | <avue-form ref="form" :option="option" v-model="form" @submit="submit" v-if="choicesType=='0'"></avue-form> |
| | | <avue-form ref="formCheckbox" :option="optionCheckbox" v-model="formCheckbox" @submit="submitCheckbox" v-if="choicesType=='1'"></avue-form> |
| | | <avue-form ref="formJudge" :option="optionJudge" v-model="formJudge" @submit="submitJudge" v-if="choicesType=='2'"></avue-form> |
| | | <avue-form ref="formFill" :option="optionFill" v-model="formFill" @submit="submitFill" v-if="choicesType=='3'"> |
| | | <template slot="optionContent"> |
| | | <!-- <el-button type="success" icon="el-icon-plus" circle style="margin-bottom:20px" @click="addRows"></el-button> |
| | | <template slot="optionContent"> |
| | | <!-- <el-button type="success" icon="el-icon-plus" circle style="margin-bottom:20px" @click="addRows"></el-button> |
| | | <div v-for="(item,index) in list" :key="index"> |
| | | <div class="optionContent-suffix"> |
| | | <span>{{index+1}}: </span> |
| | |
| | | <el-button type="danger" class="optionContent-botton" icon="el-icon-delete" circle @click="deleteRows(index)"></el-button> |
| | | </div> |
| | | </div> --> |
| | | </template> |
| | | </avue-form> |
| | | </el-dialog> |
| | | </template> |
| | | </avue-form> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | import {saveSubjectChoicesAndOption} from "@/api/examapi/examSubjects"; |
| | | import {getSubjectAnswer} from "@/api/exam/subject"; |
| | | import { mapState } from "vuex"; |
| | | import { saveSubjectChoicesAndOption } from "@/api/examapi/examSubjects"; |
| | | import { getSubjectAnswer } from "@/api/exam/subject"; |
| | | |
| | | export default { |
| | | name: "add", |
| | | data() { |
| | | return { |
| | | inputs:{ |
| | | inputs: { |
| | | input1: 1, |
| | | }, |
| | | optionContentAId:null, |
| | | optionContentBId:null, |
| | | optionContentCId:null, |
| | | optionContentDId:null, |
| | | arrContent:["1"], |
| | | list:[ |
| | | optionContentAId: null, |
| | | optionContentBId: null, |
| | | optionContentCId: null, |
| | | optionContentDId: null, |
| | | arrContent: ["1"], |
| | | list: [ |
| | | { |
| | | data:1 |
| | | data: 1, |
| | | }, |
| | | { |
| | | data:1 |
| | | data: 1, |
| | | }, |
| | | { |
| | | data:1 |
| | | data: 1, |
| | | }, |
| | | ], |
| | | // index:1, |
| | | visible:false, |
| | | choicesType:"0", |
| | | visible: false, |
| | | choicesType: "0", |
| | | loading: true, |
| | | form:{ |
| | | score:1 |
| | | form: { |
| | | score: 1, |
| | | }, |
| | | option: { |
| | | height: "auto", |
| | |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: false, |
| | | border: true, //liu |
| | | stripe: true, |
| | | align: "center", |
| | | index: true, |
| | |
| | | label: "题目名称", |
| | | prop: "subjectName", |
| | | search: true, |
| | | type:"textarea", |
| | | type: "textarea", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "类型", |
| | |
| | | type: "checkbox", |
| | | dicData: [ |
| | | { |
| | | label: '简易题库', |
| | | value: 'A' |
| | | }, |
| | | label: "简易题库", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: '复杂题库', |
| | | value: 'B' |
| | | }, |
| | | label: "复杂题库", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: '模拟题库', |
| | | value: 'C' |
| | | } |
| | | label: "模拟题库", |
| | | value: "C", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "选项", |
| | | prop: "", |
| | | type:"text", |
| | | span:24 |
| | | type: "text", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "A", |
| | | prop: "optionContentA", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "B", |
| | | prop: "optionContentB", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "C", |
| | | prop: "optionContentC", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "D", |
| | | prop: "optionContentD", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: 'A', |
| | | value: 'A' |
| | | }, |
| | | label: "A", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: 'B', |
| | | value: 'B' |
| | | }, |
| | | label: "B", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: 'C', |
| | | value: 'C' |
| | | }, |
| | | label: "C", |
| | | value: "C", |
| | | }, |
| | | { |
| | | label: 'D', |
| | | value: 'D' |
| | | } |
| | | label: "D", |
| | | value: "D", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | | label: "解析", |
| | | prop: "analysis", |
| | | span:24, |
| | | type:"textarea" |
| | | span: 24, |
| | | type: "textarea", |
| | | }, |
| | | { |
| | | label: "分值", |
| | | prop: "score", |
| | | span:24, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | ], |
| | | |
| | | }, |
| | | formCheckbox:{ |
| | | score:1 |
| | | formCheckbox: { |
| | | score: 1, |
| | | }, |
| | | optionCheckbox: { |
| | | height: "auto", |
| | |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: false, |
| | | border: true, //liu |
| | | stripe: true, |
| | | align: "center", |
| | | index: true, |
| | |
| | | defaultExpandAll: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | { |
| | | label: "题目名称", |
| | | prop: "subjectName", |
| | | search: true, |
| | | type:"textarea", |
| | | type: "textarea", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "类型", |
| | |
| | | type: "checkbox", |
| | | dicData: [ |
| | | { |
| | | label: '简易题库', |
| | | value: 'A' |
| | | }, |
| | | label: "简易题库", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: '复杂题库', |
| | | value: 'B' |
| | | }, |
| | | label: "复杂题库", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: '模拟题库', |
| | | value: 'C' |
| | | } |
| | | label: "模拟题库", |
| | | value: "C", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "选项", |
| | | prop: "", |
| | | type:"text", |
| | | span:24 |
| | | type: "text", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "A", |
| | | prop: "optionContentA", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "B", |
| | | prop: "optionContentB", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "C", |
| | | prop: "optionContentC", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "D", |
| | | prop: "optionContentD", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | // type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: 'A', |
| | | value: 'A' |
| | | }, |
| | | label: "A", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: 'B', |
| | | value: 'B' |
| | | }, |
| | | label: "B", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: 'C', |
| | | value: 'C' |
| | | }, |
| | | label: "C", |
| | | value: "C", |
| | | }, |
| | | { |
| | | label: 'D', |
| | | value: 'D' |
| | | } |
| | | label: "D", |
| | | value: "D", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | | label: "解析", |
| | | prop: "analysis", |
| | | span:24, |
| | | type:"textarea" |
| | | span: 24, |
| | | type: "textarea", |
| | | }, |
| | | { |
| | | label: "分值", |
| | | prop: "score", |
| | | span:24, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | ], |
| | | |
| | | }, |
| | | formJudge:{ |
| | | score:1 |
| | | formJudge: { |
| | | score: 1, |
| | | }, |
| | | optionJudge: { |
| | | height: "auto", |
| | |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: false, |
| | | border: true, //liu |
| | | stripe: true, |
| | | align: "center", |
| | | index: true, |
| | |
| | | label: "题目名称", |
| | | prop: "subjectName", |
| | | search: true, |
| | | type:"textarea", |
| | | type: "textarea", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "类型", |
| | |
| | | type: "checkbox", |
| | | dicData: [ |
| | | { |
| | | label: '简易题库', |
| | | value: 'A' |
| | | }, |
| | | label: "简易题库", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: '复杂题库', |
| | | value: 'B' |
| | | }, |
| | | label: "复杂题库", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: '模拟题库', |
| | | value: 'C' |
| | | } |
| | | label: "模拟题库", |
| | | value: "C", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | // { |
| | | // label: "选项", |
| | |
| | | type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: '正确', |
| | | value: '正确' |
| | | }, |
| | | label: "正确", |
| | | value: "正确", |
| | | }, |
| | | { |
| | | label: '错误', |
| | | value: '错误' |
| | | } |
| | | label: "错误", |
| | | value: "错误", |
| | | }, |
| | | ], |
| | | mock:{ |
| | | type:'dic', |
| | | mock: { |
| | | type: "dic", |
| | | }, |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | | label: "解析", |
| | | prop: "analysis", |
| | | span:24, |
| | | type:"textarea" |
| | | span: 24, |
| | | type: "textarea", |
| | | }, |
| | | { |
| | | label: "分值", |
| | | prop: "score", |
| | | defaultValue:2, |
| | | span:24, |
| | | defaultValue: 2, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | ], |
| | | |
| | | }, |
| | | formFill:{ |
| | | score:1 |
| | | formFill: { |
| | | score: 1, |
| | | }, |
| | | optionFill: { |
| | | height: "auto", |
| | |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: false, |
| | | border: true, //liu |
| | | stripe: true, |
| | | align: "center", |
| | | index: true, |
| | |
| | | { |
| | | label: "题目名称", |
| | | prop: "subjectName", |
| | | type:"textarea", |
| | | type: "textarea", |
| | | search: true, |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "类型", |
| | |
| | | type: "checkbox", |
| | | dicData: [ |
| | | { |
| | | label: '简易题库', |
| | | value: 'A' |
| | | }, |
| | | label: "简易题库", |
| | | value: "A", |
| | | }, |
| | | { |
| | | label: '复杂题库', |
| | | value: 'B' |
| | | }, |
| | | label: "复杂题库", |
| | | value: "B", |
| | | }, |
| | | { |
| | | label: '模拟题库', |
| | | value: 'C' |
| | | } |
| | | label: "模拟题库", |
| | | value: "C", |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | span:24 |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "选项", |
| | | prop: "", |
| | | type:"text", |
| | | span:24 |
| | | type: "text", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "1", |
| | | prop: "optionContent1", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "2", |
| | | prop: "optionContent2", |
| | | span:24, |
| | | placeholder:"请输入内容", |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | { |
| | | label: "3", |
| | | prop: "optionContent3", |
| | | span:24, |
| | | placeholder:"请输入内容" |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | }, |
| | | { |
| | | label: "4", |
| | | prop: "optionContent4", |
| | | span:24, |
| | | placeholder:"请输入内容" |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | }, |
| | | { |
| | | label: "5", |
| | | prop: "optionContent5", |
| | | span:24, |
| | | placeholder:"请输入内容" |
| | | span: 24, |
| | | placeholder: "请输入内容", |
| | | }, |
| | | { |
| | | label: "答案", |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | | label: "解析", |
| | | prop: "analysis", |
| | | span:24, |
| | | type:"textarea" |
| | | span: 24, |
| | | type: "textarea", |
| | | }, |
| | | { |
| | | label: "分值", |
| | | prop: "score", |
| | | span:24, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | } |
| | | |
| | | }, |
| | | ], |
| | | |
| | | }, |
| | | data: [], |
| | | } |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapState({ |
| | | userInfo: state => state.user.userInfo |
| | | }) |
| | | userInfo: (state) => state.user.userInfo, |
| | | }), |
| | | }, |
| | | mounted() { |
| | | |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | //初始化 |
| | | inits(id) { |
| | | this.id = id || 0; |
| | | this.visible = true; |
| | | this.list = [{data:1}] |
| | | if(this.id){ |
| | | this.list = [{ data: 1 }]; |
| | | if (this.id) { |
| | | //查询题目信息 |
| | | this.getSubjectInfo(id); |
| | | } |
| | | }, |
| | | //查询题目信息 |
| | | getSubjectInfo(id){ |
| | | getSubjectInfo(id) { |
| | | var that = this; |
| | | var param = { |
| | | id:id |
| | | } |
| | | getSubjectAnswer((param)).then(res => { |
| | | id: id, |
| | | }; |
| | | getSubjectAnswer(param).then((res) => { |
| | | var data = res.data.data; |
| | | that.choicesType = data.choicesType.toString(); |
| | | //单选题 |
| | | if(data.choicesType==0){ |
| | | that.form = data; |
| | | that.optionContentAId = data.examSubjectOptions[0].id; |
| | | that.optionContentBId = data.examSubjectOptions[1].id; |
| | | that.optionContentCId = data.examSubjectOptions[2].id; |
| | | that.optionContentDId = data.examSubjectOptions[3].id; |
| | | that.form.optionContentA = data.examSubjectOptions[0].optionContent; |
| | | that.form.optionContentB = data.examSubjectOptions[1].optionContent; |
| | | that.form.optionContentC = data.examSubjectOptions[2].optionContent; |
| | | that.form.optionContentD = data.examSubjectOptions[3].optionContent; |
| | | if (data.choicesType == 0) { |
| | | that.form = data; |
| | | that.optionContentAId = data.examSubjectOptions[0].id; |
| | | that.optionContentBId = data.examSubjectOptions[1].id; |
| | | that.optionContentCId = data.examSubjectOptions[2].id; |
| | | that.optionContentDId = data.examSubjectOptions[3].id; |
| | | that.form.optionContentA = data.examSubjectOptions[0].optionContent; |
| | | that.form.optionContentB = data.examSubjectOptions[1].optionContent; |
| | | that.form.optionContentC = data.examSubjectOptions[2].optionContent; |
| | | that.form.optionContentD = data.examSubjectOptions[3].optionContent; |
| | | } |
| | | //多选题 |
| | | if(data.choicesType==1){ |
| | | that.formCheckbox = data; |
| | | that.optionContentAId = data.examSubjectOptions[0].id; |
| | | that.optionContentBId = data.examSubjectOptions[1].id; |
| | | that.optionContentCId = data.examSubjectOptions[2].id; |
| | | that.optionContentDId = data.examSubjectOptions[3].id; |
| | | that.formCheckbox.optionContentA = data.examSubjectOptions[0].optionContent; |
| | | that.formCheckbox.optionContentB = data.examSubjectOptions[1].optionContent; |
| | | that.formCheckbox.optionContentC = data.examSubjectOptions[2].optionContent; |
| | | that.formCheckbox.optionContentD = data.examSubjectOptions[3].optionContent; |
| | | if (data.choicesType == 1) { |
| | | that.formCheckbox = data; |
| | | that.optionContentAId = data.examSubjectOptions[0].id; |
| | | that.optionContentBId = data.examSubjectOptions[1].id; |
| | | that.optionContentCId = data.examSubjectOptions[2].id; |
| | | that.optionContentDId = data.examSubjectOptions[3].id; |
| | | that.formCheckbox.optionContentA = |
| | | data.examSubjectOptions[0].optionContent; |
| | | that.formCheckbox.optionContentB = |
| | | data.examSubjectOptions[1].optionContent; |
| | | that.formCheckbox.optionContentC = |
| | | data.examSubjectOptions[2].optionContent; |
| | | that.formCheckbox.optionContentD = |
| | | data.examSubjectOptions[3].optionContent; |
| | | } |
| | | //判断题 |
| | | if(data.choicesType==2){ |
| | | that.formJudge = data; |
| | | if (data.choicesType == 2) { |
| | | that.formJudge = data; |
| | | } |
| | | //实操题 |
| | | if(data.choicesType==3){ |
| | | that.formFill = data; |
| | | that.formFill.optionContent1 = data.examSubjectOptions[0].optionContent; |
| | | that.formFill.optionContent2 = data.examSubjectOptions[1].optionContent; |
| | | that.formFill.optionContent3 = data.examSubjectOptions[2].optionContent; |
| | | that.formFill.optionContent4 = data.examSubjectOptions[3].optionContent; |
| | | that.formFill.optionContent5 = data.examSubjectOptions[4].optionContent; |
| | | if (data.choicesType == 3) { |
| | | that.formFill = data; |
| | | that.formFill.optionContent1 = |
| | | data.examSubjectOptions[0].optionContent; |
| | | that.formFill.optionContent2 = |
| | | data.examSubjectOptions[1].optionContent; |
| | | that.formFill.optionContent3 = |
| | | data.examSubjectOptions[2].optionContent; |
| | | that.formFill.optionContent4 = |
| | | data.examSubjectOptions[3].optionContent; |
| | | that.formFill.optionContent5 = |
| | | data.examSubjectOptions[4].optionContent; |
| | | } |
| | | }); |
| | | }, |
| | | //加一行 |
| | | addRows(){ |
| | | addRows() { |
| | | //获取已有行的数据 |
| | | // debugger; |
| | | if(this.index==6){ |
| | | if (this.index == 6) { |
| | | return; |
| | | } |
| | | this.index++; |
| | | this.list.push({ |
| | | data:this.index |
| | | }) |
| | | this.inputs[`input${this.index+1}`] = ''; |
| | | console.log(this.inputs) |
| | | console.log(this.list,111); |
| | | data: this.index, |
| | | }); |
| | | this.inputs[`input${this.index + 1}`] = ""; |
| | | console.log(this.inputs); |
| | | console.log(this.list, 111); |
| | | }, |
| | | //减一行 |
| | | deleteRows(index){ |
| | | if(this.index==1){ |
| | | deleteRows(index) { |
| | | if (this.index == 1) { |
| | | return; |
| | | } |
| | | this.index--; |
| | | this.list.splice(index,1); |
| | | this.list.splice(index, 1); |
| | | }, |
| | | //单选题提交(新增)数据 |
| | | submit(row, done, loading) { |
| | | var that = this; |
| | | row['choicesType'] = this.choicesType; |
| | | row['creator'] = this.userInfo.user_name; |
| | | row["choicesType"] = this.choicesType; |
| | | row["creator"] = this.userInfo.user_name; |
| | | row.tktype = row.tktype.join(","); |
| | | //选项信息 |
| | | const examSubjectOptions = [ |
| | | { |
| | | id:that.optionContentAId, |
| | | optionName:"A", |
| | | optionContent:row.optionContentA, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentAId, |
| | | optionName: "A", |
| | | optionContent: row.optionContentA, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentBId, |
| | | optionName:"B", |
| | | optionContent:row.optionContentB, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentBId, |
| | | optionName: "B", |
| | | optionContent: row.optionContentB, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentCId, |
| | | optionName:"C", |
| | | optionContent:row.optionContentC, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentCId, |
| | | optionName: "C", |
| | | optionContent: row.optionContentC, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentDId, |
| | | optionName:"D", |
| | | optionContent:row.optionContentD, |
| | | creator:this.userInfo.user_name, |
| | | } |
| | | ] |
| | | row['examSubjectOptions'] = examSubjectOptions; |
| | | id: that.optionContentDId, |
| | | optionName: "D", |
| | | optionContent: row.optionContentD, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | ]; |
| | | row["examSubjectOptions"] = examSubjectOptions; |
| | | saveSubjectChoicesAndOption(row).then( |
| | | () => { |
| | | this.$message({ |
| | |
| | | //多选题提交(新增)数据 |
| | | submitCheckbox(row, done, loading) { |
| | | var that = this; |
| | | row['choicesType'] = this.choicesType; |
| | | row['creator'] = this.userInfo.user_name; |
| | | row["choicesType"] = this.choicesType; |
| | | row["creator"] = this.userInfo.user_name; |
| | | row.tktype = row.tktype.join(","); |
| | | row.answer = row.answer.join(","); |
| | | //选项信息 |
| | | const examSubjectOptions = [ |
| | | { |
| | | id:that.optionContentAId, |
| | | optionName:"A", |
| | | optionContent:row.optionContentA, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentAId, |
| | | optionName: "A", |
| | | optionContent: row.optionContentA, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentBId, |
| | | optionName:"B", |
| | | optionContent:row.optionContentB, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentBId, |
| | | optionName: "B", |
| | | optionContent: row.optionContentB, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentCId, |
| | | optionName:"C", |
| | | optionContent:row.optionContentC, |
| | | creator:this.userInfo.user_name, |
| | | id: that.optionContentCId, |
| | | optionName: "C", |
| | | optionContent: row.optionContentC, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | { |
| | | id:that.optionContentDId, |
| | | optionName:"D", |
| | | optionContent:row.optionContentD, |
| | | creator:this.userInfo.user_name, |
| | | } |
| | | ] |
| | | row['examSubjectOptions'] = examSubjectOptions; |
| | | id: that.optionContentDId, |
| | | optionName: "D", |
| | | optionContent: row.optionContentD, |
| | | creator: this.userInfo.user_name, |
| | | }, |
| | | ]; |
| | | row["examSubjectOptions"] = examSubjectOptions; |
| | | saveSubjectChoicesAndOption(row).then( |
| | | () => { |
| | | this.$message({ |
| | |
| | | //判断题提交(新增)数据 |
| | | submitJudge(row, done, loading) { |
| | | var that = this; |
| | | row['choicesType'] = this.choicesType; |
| | | row['creator'] = this.userInfo.user_name; |
| | | row["choicesType"] = this.choicesType; |
| | | row["creator"] = this.userInfo.user_name; |
| | | row.tktype = row.tktype.join(","); |
| | | saveSubjectChoicesAndOption(row).then( |
| | | () => { |
| | |
| | | //填空排序题提交(新增)数据 |
| | | submitFill(row, done, loading) { |
| | | var that = this; |
| | | row['choicesType'] = this.choicesType; |
| | | row['creator'] = this.userInfo.user_name; |
| | | row["choicesType"] = this.choicesType; |
| | | row["creator"] = this.userInfo.user_name; |
| | | row.tktype = row.tktype.join(","); |
| | | //选项信息 |
| | | var examSubjectOptions = []; |
| | | if(row.optionContent1){ |
| | | examSubjectOptions.push({ |
| | | optionName:"1", |
| | | optionContent:row.optionContent1, |
| | | creator:this.userInfo.user_name, |
| | | }) |
| | | if (row.optionContent1) { |
| | | examSubjectOptions.push({ |
| | | optionName: "1", |
| | | optionContent: row.optionContent1, |
| | | creator: this.userInfo.user_name, |
| | | }); |
| | | } |
| | | if(row.optionContent2){ |
| | | examSubjectOptions.push({ |
| | | optionName:"2", |
| | | optionContent:row.optionContent2, |
| | | creator:this.userInfo.user_name, |
| | | }) |
| | | if (row.optionContent2) { |
| | | examSubjectOptions.push({ |
| | | optionName: "2", |
| | | optionContent: row.optionContent2, |
| | | creator: this.userInfo.user_name, |
| | | }); |
| | | } |
| | | if(row.optionContent3){ |
| | | examSubjectOptions.push({ |
| | | optionName:"3", |
| | | optionContent:row.optionContent3, |
| | | creator:this.userInfo.user_name, |
| | | }) |
| | | if (row.optionContent3) { |
| | | examSubjectOptions.push({ |
| | | optionName: "3", |
| | | optionContent: row.optionContent3, |
| | | creator: this.userInfo.user_name, |
| | | }); |
| | | } |
| | | if(row.optionContent4){ |
| | | examSubjectOptions.push({ |
| | | optionName:"4", |
| | | optionContent:row.optionContent4, |
| | | creator:this.userInfo.user_name, |
| | | }) |
| | | if (row.optionContent4) { |
| | | examSubjectOptions.push({ |
| | | optionName: "4", |
| | | optionContent: row.optionContent4, |
| | | creator: this.userInfo.user_name, |
| | | }); |
| | | } |
| | | if(row.optionContent5){ |
| | | examSubjectOptions.push({ |
| | | optionName:"5", |
| | | optionContent:row.optionContent5, |
| | | creator:this.userInfo.user_name, |
| | | }) |
| | | if (row.optionContent5) { |
| | | examSubjectOptions.push({ |
| | | optionName: "5", |
| | | optionContent: row.optionContent5, |
| | | creator: this.userInfo.user_name, |
| | | }); |
| | | } |
| | | row['examSubjectOptions'] = examSubjectOptions; |
| | | row["examSubjectOptions"] = examSubjectOptions; |
| | | saveSubjectChoicesAndOption(row).then( |
| | | () => { |
| | | this.$message({ |
| | |
| | | ); |
| | | }, |
| | | //关闭窗口清除数据 |
| | | closeDialog(){ |
| | | if(this.choicesType==0){ |
| | | this.$refs.form.resetFields(); |
| | | closeDialog() { |
| | | if (this.choicesType == 0) { |
| | | this.$refs.form.resetFields(); |
| | | } |
| | | |
| | | if(this.choicesType==1){ |
| | | |
| | | if (this.choicesType == 1) { |
| | | this.$refs.formCheckbox.resetFields(); |
| | | } |
| | | |
| | | if(this.choicesType==2){ |
| | | if (this.choicesType == 2) { |
| | | this.$refs.formJudge.resetFields(); |
| | | } |
| | | |
| | | if(this.choicesType==3){ |
| | | if (this.choicesType == 3) { |
| | | this.$refs.formFill.resetFields(); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | |
| | | .optionContent-suffix{ |
| | | .optionContent-suffix { |
| | | margin-top: 5px; |
| | | } |
| | | |
| | | .optionContent-suffix span{ |
| | | .optionContent-suffix span { |
| | | margin-left: -20px; |
| | | } |
| | | |
| | | |
| | | .optionContent-suffix .optionContent-input{ |
| | | .optionContent-suffix .optionContent-input { |
| | | width: 90%; |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | |
| | | .optionContent-suffix .optionContent-botton{ |
| | | .optionContent-suffix .optionContent-botton { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | </style> |