zhouwx
2024-08-02 926fd4d1b89e7e5e6338d8f292edc4f728049856
src/views/onlineEducation/groupExams/components/examDialog.vue
@@ -151,8 +151,49 @@
            </el-radio-group>
          </div>
        </div>
        <div  style="display: flex">
          <div class="group">
            <div>
              简答:<el-input style="max-width: 40px" v-model="state.form.easyNum"></el-input>&nbsp;题
            </div>
            <div style="margin-left: 20px">
              每题:<el-input style="max-width: 40px" v-model="state.form.easyScore"></el-input>&nbsp;分
            </div>
          </div>
          <div class="group" >
            <div>
              共&nbsp;
              <span style="max-width: 30px" v-show="state.form.easyNum && state.form.easyScore">{{state.form.easyNum * state.form.easyScore}}</span>
              <!--              <span v-else></span>-->
              &nbsp;分
            </div>
            <el-select
                clearable
                v-model="state.form.easyBankId"
                style="width: 160px;margin: 0 20px"
                v-loadMoreNew:[reselectSingle]="handleScroll"
                :popper-class="reselectSingle.name"
                class="item-width"
                placeholder="请选择简答题题库"
            >
              <el-option
                  v-for="item in state.bankListSingle"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
              />
            </el-select>
            <el-radio-group v-model="state.form.easyMethod"  >
              <el-radio :label="1" style="max-width: 30px">随机</el-radio>
              <el-radio :label="2" style="max-width: 30px">顺序</el-radio>
            </el-radio-group>
            <el-radio-group v-model="state.form.easyRebuild" style="margin-left: 30px" >
              <el-radio :label="1" v-if="title === '编辑'" style="max-width: 30px">重新出题</el-radio>
            </el-radio-group>
          </div>
        </div>
        <span class="group" style="margin-bottom: 20px">共计:
          {{state.form.judgeNum * state.form.judgeScore+state.form.multiNum * state.form.multiScore+state.form.singleNum * state.form.singleScore}}
          {{state.form.judgeNum * state.form.judgeScore+state.form.multiNum * state.form.multiScore+state.form.singleNum * state.form.singleScore+state.form.easyNum * state.form.easyScore}}
          &nbsp;分</span>
        <div style="display: flex;justify-content: space-between;align-items: center">
          <el-form-item label="合格分数:" prop="passScore">
@@ -273,10 +314,15 @@
    limited: 1,
    limitTime: null,
    passScore: null,
    judgeRebuild: 0,
    multiRebuild: 0,
    singleRebuild: 0,
    deadline: ''
    judgeRebuild: null,
    multiRebuild: null,
    singleRebuild: null,
    easyRebuild: null,
    deadline: '',
    easyNum: null,
    easyScore: null,
    easyBankId: null,
    easyMethod: 1,
  },
  formRules: {
@@ -315,6 +361,14 @@
  title.value = type === 'addFirst' || type === 'add' ? '新增' : type ==='edit' ? '编辑' : '' ;
  if(type === 'edit') {
    state.form = value
    state.form.easyNum = state.form.easyNum ? state.form.easyNum: null
    state.form.easyScore = state.form.easyScore ? state.form.easyScore: null
    state.form.singleNum = state.form.singleNum ? state.form.singleNum: null
    state.form.singleScore = state.form.singleScore ? state.form.singleScore: null
    state.form.multiNum = state.form.multiNum ? state.form.multiNum: null
    state.form.multiScore = state.form.multiScore ? state.form.multiScore: null
    state.form.judgeNum = state.form.judgeNum ? state.form.judgeNum: null
    state.form.judgeScore = state.form.judgeScore ? state.form.judgeScore: null
    startUsername.value = value.name;
  }else if(type === 'add' && value ){
    state.form.parentId = value.id
@@ -330,7 +384,7 @@
  //   });
  //   return;
  // }
  const total = state.form.judgeNum * state.form.judgeScore+state.form.multiNum * state.form.multiScore+state.form.singleNum * state.form.singleScore
  const total = state.form.judgeNum * state.form.judgeScore+state.form.multiNum * state.form.multiScore+state.form.singleNum * state.form.singleScore+state.form.easyNum * state.form.easyScore
  if(state.form.passScore > total){
      ElMessage({
        type: 'warning',
@@ -338,13 +392,13 @@
      });
      return;
  }
  if(!(state.form.judgeBankId || state.form.multiBankId || state.form.singleBankId)){
      ElMessage({
        type: 'warning',
        message: '请选择题库'
      });
      return;
  }
  // if(!(state.form.judgeBankId || state.form.multiBankId || state.form.singleBankId)){
  //     ElMessage({
  //       type: 'warning',
  //       message: '请选择题库'
  //     });
  //     return;
  // }
  const valid = await busRef.value.validate();
  if(valid){
    if(title.value === '新增'){
@@ -447,9 +501,14 @@
    limited: 1,
    limitTime: null,
    passScore: null,
    judgeRebuild: 0,
    multiRebuild: 0,
    singleRebuild: 0,
    judgeRebuild: null,
    multiRebuild: null,
    singleRebuild: null,
    easyRebuild: null,
    easyNum: null,
    easyScore: null,
    easyBankId: null,
    easyMethod: 1,
    deadline: ''
  }
  state.bankListSingle = [];