| | |
| | | v-model="dialogVisible" |
| | | width="800px" |
| | | :before-close="handleClose" |
| | | destroy-on-close |
| | | > |
| | | <el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="150px" > |
| | | <span style="font-size: 20px;font-weight: 800;margin-left: 20px">考试配置</span> |
| | |
| | | <div style="display: flex"> |
| | | <div class="group"> |
| | | <div> |
| | | 单选:<el-input style="max-width: 40px"></el-input> 题 |
| | | 单选:<el-input style="max-width: 40px" v-model.trim="state.form.singleNum"></el-input> 题 |
| | | </div> |
| | | <div style="margin-left: 20px"> |
| | | 每题:<el-input style="max-width: 40px"></el-input> 分 |
| | | 每题:<el-input style="max-width: 40px" v-model.trim="state.form.singleScore"></el-input> 分 |
| | | </div> |
| | | </div> |
| | | <div class="group" > |
| | | <div> |
| | | 共 <span style="max-width: 30px">xxx</span> 分 |
| | | 共 |
| | | <span style="max-width: 30px" v-show="state.form.singleNum && state.form.singleScore">{{state.form.singleNum * state.form.singleScore}}</span> |
| | | <!-- <span v-else></span>--> |
| | | 分 |
| | | </div> |
| | | <el-select |
| | | clearable |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-radio-group v-model="radio" > |
| | | <el-radio-group v-model="state.form.singleMethod" > |
| | | <el-radio :label="1" style="max-width: 30px">随机</el-radio> |
| | | <el-radio :label="2">默认</el-radio> |
| | | <el-radio :label="2">顺序</el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </div> |
| | | <div style="display: flex"> |
| | | <div class="group"> |
| | | <div> |
| | | 多选:<el-input style="max-width: 40px"></el-input> 题 |
| | | 多选:<el-input style="max-width: 40px" v-model="state.form.multiNum"></el-input> 题 |
| | | </div> |
| | | <div style="margin-left: 20px"> |
| | | 每题:<el-input style="max-width: 40px"></el-input> 分 |
| | | 每题:<el-input style="max-width: 40px" v-model="state.form.multiScore"></el-input> 分 |
| | | </div> |
| | | </div> |
| | | <div class="group" > |
| | | <div> |
| | | 共 <span style="max-width: 30px">xxx</span> 分 |
| | | <div > |
| | | 共 |
| | | <span style="max-width: 30px" v-show="state.form.multiNum && state.form.multiScore">{{state.form.multiNum * state.form.multiScore}}</span> |
| | | <!-- <span v-else></span>--> |
| | | 分 |
| | | </div> |
| | | <el-select |
| | | clearable |
| | | v-model="state.form.singleBankId" |
| | | v-model="state.form.multiBankId" |
| | | style="width: 160px;margin: 0 20px" |
| | | v-loadMoreNew:[reselectSingle]="handleScroll" |
| | | :popper-class="reselectSingle.name" |
| | | class="item-width" |
| | | placeholder="请选择单选题题库" |
| | | placeholder="请选择多选题题库" |
| | | > |
| | | <el-option |
| | | v-for="item in state.bankListSingle" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-radio-group v-model="radio" > |
| | | <el-radio-group v-model="state.form.multiMethod" > |
| | | <el-radio :label="1" style="max-width: 30px">随机</el-radio> |
| | | <el-radio :label="2">默认</el-radio> |
| | | <el-radio :label="2">顺序</el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </div> |
| | | <div style="display: flex"> |
| | | <div class="group"> |
| | | <div> |
| | | 判断:<el-input style="max-width: 40px"></el-input> 题 |
| | | 判断:<el-input style="max-width: 40px" v-model="state.form.judgeNum"></el-input> 题 |
| | | </div> |
| | | <div style="margin-left: 20px"> |
| | | 每题:<el-input style="max-width: 40px"></el-input> 分 |
| | | 每题:<el-input style="max-width: 40px" v-model="state.form.judgeScore"></el-input> 分 |
| | | </div> |
| | | </div> |
| | | <div class="group" > |
| | | <div> |
| | | 共 <span style="max-width: 30px">xxx</span> 分 |
| | | 共 |
| | | <span style="max-width: 30px" v-show="state.form.judgeNum && state.form.judgeScore">{{state.form.judgeNum * state.form.judgeScore}}</span> |
| | | <!-- <span v-else></span>--> |
| | | 分 |
| | | </div> |
| | | <el-select |
| | | clearable |
| | | v-model="state.form.singleBankId" |
| | | v-model="state.form.judgeBankId" |
| | | style="width: 160px;margin: 0 20px" |
| | | v-loadMoreNew:[reselectSingle]="handleScroll" |
| | | :popper-class="reselectSingle.name" |
| | | class="item-width" |
| | | placeholder="请选择单选题题库" |
| | | placeholder="请选择判断题题库" |
| | | > |
| | | <el-option |
| | | v-for="item in state.bankListSingle" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-radio-group v-model="radio" > |
| | | <el-radio-group v-model="state.form.judgeMethod" > |
| | | <el-radio :label="1" style="max-width: 30px">随机</el-radio> |
| | | <el-radio :label="2">默认</el-radio> |
| | | <el-radio :label="2">顺序</el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </div> |
| | | <span class="group" style="margin-bottom: 10px">共计:xxx分</span> |
| | | <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}} |
| | | 分</span> |
| | | <div style="display: flex;justify-content: space-between;align-items: center"> |
| | | <el-form-item label="合格分数:" prop=""> |
| | | <el-input-number v-model="num" :min="1" :max="10" style="margin-right: 10px" /> (大于等于) |
| | | <el-form-item label="合格分数:" prop="passScore"> |
| | | <el-input-number v-model="state.form.passScore" :min="1" :max="1000" style="margin-right: 10px" /> (大于等于) |
| | | </el-form-item> |
| | | <el-form-item label="限制时长:" prop=""> |
| | | <el-input v-model="num1" style="max-width: 200px" > |
| | | <el-form-item label="限制时长:" prop="limitTime"> |
| | | <el-input v-model="state.form.limitTime" style="max-width: 200px" :disabled="state.form.limited === 0"> |
| | | <template #append>分钟</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | </div> |
| | | <el-form-item label="是否限制考试时长:" prop="limited" style="margin-left: 60px"> |
| | | <el-radio-group v-model="state.form.limited" @change="changeLimit" > |
| | | <el-radio :label="0" style="max-width: 30px">否</el-radio> |
| | | <el-radio :label="1">是</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | |
| | | editQuestionBank, |
| | | getQuestionBank |
| | | } from "@/api/onlineEducation/questionBank"; |
| | | import {checkExamName} from "@/api/onlineEducation/exam"; |
| | | import {addExam, checkExamName, editExam} from "@/api/onlineEducation/exam"; |
| | | |
| | | const dialogVisible = ref(false); |
| | | const title = ref(""); |
| | |
| | | name: '', |
| | | categoryId: null, |
| | | companyName: '', |
| | | companyId: null |
| | | companyId: null, |
| | | judgeBankId: null, |
| | | judgeMethod: 1, |
| | | judgeNum: null, |
| | | judgeScore: null, |
| | | multiBankId: null, |
| | | multiMethod: 1, |
| | | multiNum: null, |
| | | multiScore: null, |
| | | singleBankId: null, |
| | | singleMethod: 1, |
| | | singleNum: null, |
| | | singleScore: null, |
| | | limited: 1, |
| | | limitTime: null, |
| | | passScore: null |
| | | |
| | | }, |
| | | formRules: { |
| | | name: [{required: true, trigger: "blur", validator: validateName}], |
| | | categoryId: [{required: true, message: '请选择课程分类', trigger: 'blur'}], |
| | | limited: [{required: true, message: '请选择课程分类', trigger: 'blur'}], |
| | | limitTime: [{required: true, message: '请选择课程分类', trigger: 'blur'}], |
| | | passScore: [{required: true, message: '请选择课程分类', trigger: 'blur'}] |
| | | }, |
| | | classifyList: [], |
| | | isAdmin: false, |
| | |
| | | } |
| | | title.value = type === 'addFirst' || type === 'add' ? '新增' : type ==='edit' ? '编辑' : '' ; |
| | | if(type === 'edit') { |
| | | state.form.id = value.id |
| | | state.form.name = value.name |
| | | state.form.categoryId = value.categoryId |
| | | state.form = value |
| | | startUsername.value = value.name; |
| | | }else if(type === 'add' && value ){ |
| | | state.form.parentId = value.id |
| | |
| | | } |
| | | |
| | | const onSubmit = async () => { |
| | | if(state.isAdmin){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '管理员暂无权限' |
| | | }); |
| | | return; |
| | | } |
| | | // if(state.isAdmin){ |
| | | // ElMessage({ |
| | | // type: 'warning', |
| | | // message: '管理员暂无权限' |
| | | // }); |
| | | // return; |
| | | // } |
| | | const valid = await busRef.value.validate(); |
| | | if(valid){ |
| | | if(title.value === '新增'){ |
| | | const {id, ...data} = JSON.parse(JSON.stringify(state.form)) |
| | | const res = await addQuestionBank(data) |
| | | const res = await addExam(data) |
| | | if(res.code === 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | |
| | | dialogVisible.value = false; |
| | | }else if(title.value === '编辑'){ |
| | | const {...data} = JSON.parse(JSON.stringify(state.form)) |
| | | const res = await editQuestionBank(data) |
| | | const res = await editExam(data) |
| | | if(res.code === 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | |
| | | name: '', |
| | | categoryId: null, |
| | | companyName: '', |
| | | companyId: null |
| | | companyId: null, |
| | | judgeBankId: null, |
| | | judgeMethod: 1, |
| | | judgeNum: null, |
| | | judgeScore: null, |
| | | multiBankId: null, |
| | | multiMethod: 1, |
| | | multiNum: null, |
| | | multiScore: null, |
| | | singleBankId: null, |
| | | singleMethod: 1, |
| | | singleNum: null, |
| | | singleScore: null, |
| | | limited: 0, |
| | | limitTime: null, |
| | | passScore: null |
| | | } |
| | | } |
| | | const handleScroll = () => { |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const changeLimit = (val) => { |
| | | state.form.limitTime = null |
| | | if(val === 0) { |
| | | state.form.limitTime = 0 |
| | | } |
| | | |
| | | } |
| | | defineExpose({ |
| | | openDialog |
| | | }); |