odc.xiaohui
2023-07-05 820fdb2db321c699568a54e8e3d7bb8f5c657b7f
src/views/exam/paper/edit.vue
@@ -37,13 +37,26 @@
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item :key="key" :label="titlejs(key)"   required  v-for="(value,key,index) in form.subjectSource"  v-if="form.paperType ==7">
      <el-form-item :key="item.subjectId" :label="item.label"   required  v-for="(item,key,index) in form.questionTypeVMS"  v-if="form.paperType ==7">
        <el-row >
          <el-col :span="3" >
            <span>题目数量:</span>
            <span>多选题:</span>
          </el-col>
          <el-col :span="9">
            <el-input v-model="form.subjectSource[key]" style="width: 80%"/>
          <el-col :span="3">
            <el-input v-model="form.questionTypeVMS[key].multipleChoice" style="width: 80%"/>
          </el-col>
          <el-col :span="3" >
            <span>单选题:</span>
          </el-col>
          <el-col :span="3">
            <el-input v-model="form.questionTypeVMS[key].singleChoice" style="width: 80%"/>
          </el-col>
          <el-col :span="3" >
            <span>判断题:</span>
          </el-col>
          <el-col :span="3">
            <el-input v-model="form.questionTypeVMS[key].trueFalse" style="width: 80%"/>
          </el-col>
        </el-row>
      </el-form-item>
@@ -135,7 +148,8 @@
        name: '',
        suggestTime: null,
        titleItems: [],
        subjectSource:{}
        subjectSource:{},
        questionTypeVMS:[]
      },
      subjectFilter: null,
      formLoading: false,
@@ -207,19 +221,29 @@
        this.$refs.subjectIdRef.selected.forEach(item=>{
          arr.push({
            label:item.label,
            id:item.value
            subjectId:item.value,
            singleChoice:'',
            multipleChoice:'',
            trueFalse:''
          })
        })
        console.log(arr)
        this.form.questionTypeVMS = arr
      }
      if (this.form.paperType ==7){
        //說明是隨機
        this.subjectIdList = arr
        let obj1={}
        let arr1 = []
        arr.forEach((item,index)=>{
          obj1[item.id]=''
          // obj1[item.id]=''
          arr1.push({
            subjectId:item.id,
            singleChoice:'',
            multipleChoice:'',
            trueFalse:''
          })
          // let obj={
          //   item
          // }
@@ -233,7 +257,9 @@
          // }
        })
        this.form.subjectSource = obj1
        console.log(this.form.subjectSource)
        console.log(this.form.questionTypeVMS)
        // this.form.paperType = 7
        this.form.titleItems = []
      }else {
@@ -344,15 +370,18 @@
    resetForm () {
      let lastId = this.form.id
      this.$refs['form'].resetFields()
      this.form = {
        id: null,
        departmentIds: [],
        subjectId: null,
        paperType: 1,
        limitDateTime: [],
        name: '',
        suggestTime: null,
        titleItems: []
      this.form= {
        aggregateSource:100,
          id: null,
          departmentIds: [],
          subjectId: [],
          paperType: 1,
          limitDateTime: [],
          name: '',
          suggestTime: null,
          titleItems: [],
          subjectSource:null,
          questionTypeVMS:[]
      }
      this.form.id = lastId
    },