|
|
@@ -67,6 +67,52 @@
|
|
|
> -->
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <template slot="label">
|
|
|
+ 随机抽题
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="是否开启从题库中随机抽题。"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i class="el-icon-question question-icon">:</i>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ <el-radio-group v-model="form.sui_ji_chou_ti_">
|
|
|
+ <el-radio label="0">关闭</el-radio>
|
|
|
+ <el-radio label="1" :disabled="!(!!form.ti_ku_id_)">开启</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="form.sui_ji_chou_ti_ === '1'" class="handrand">
|
|
|
+ <template slot="label">
|
|
|
+ 抽题规则
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="设置每类题型的抽题数量,相同题型相同分值可以自由选择抽题数量,相同题型不同分值只能全抽或不抽。"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i class="el-icon-question question-icon">:</i>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ <div v-for="item in handList" :key="item.itemType" class="hand-item">
|
|
|
+ <template v-if="item.list.length>0">
|
|
|
+ <span>{{ item.itemType }}:</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="item.questionNumber"
|
|
|
+ style="width:120px"
|
|
|
+ :min="0"
|
|
|
+ :max="item.list.length"
|
|
|
+ :precision="0"
|
|
|
+ :disabled="form.sui_ji_chou_ti_ === '0'"
|
|
|
+ placeholder="请输入抽题数量"
|
|
|
+ :step="item.step"
|
|
|
+ step-strictly
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="xian_kao_shi_jian">
|
|
|
<template slot="label">
|
|
|
限考时间
|
|
|
@@ -308,6 +354,13 @@ export default {
|
|
|
level
|
|
|
} = this.$store.getters || {}
|
|
|
return {
|
|
|
+ handList: [
|
|
|
+ { itemType: '单选题', questionNumber: 0, list: [], step: 1 },
|
|
|
+ { itemType: '多选题', questionNumber: 0, list: [], step: 1 },
|
|
|
+ { itemType: '判断题', questionNumber: 0, list: [], step: 1 },
|
|
|
+ { itemType: '填空题', questionNumber: 0, list: [], step: 1 },
|
|
|
+ { itemType: '简答题', questionNumber: 0, list: [], step: 1 }
|
|
|
+ ],
|
|
|
userList,
|
|
|
examTypeOptions,
|
|
|
deptList: deptList.filter((i) => i.depth === 4),
|
|
|
@@ -316,6 +369,7 @@ export default {
|
|
|
dialogVisible: this.visible,
|
|
|
dialogLoading: false,
|
|
|
randButtonDisabled: false,
|
|
|
+ isFirst: true,
|
|
|
form: {
|
|
|
di_dian_: level.second || level.first,
|
|
|
chuang_jian_shi_j: '',
|
|
|
@@ -335,6 +389,10 @@ export default {
|
|
|
isCountLimit: '0',
|
|
|
isTimeLimit: '0',
|
|
|
isDateLimit: '0',
|
|
|
+ sui_ji_chou_ti_: '0',
|
|
|
+ chou_ti_zong_fen_: 0,
|
|
|
+ ti_mu_zong_shu_: 0,
|
|
|
+ sui_ji_ti_shu_: [],
|
|
|
hours: 2,
|
|
|
minutes: 30
|
|
|
},
|
|
|
@@ -385,12 +443,53 @@ export default {
|
|
|
this.dialogVisible = this.visible
|
|
|
}
|
|
|
// immediate: true
|
|
|
+ },
|
|
|
+ 'form.ti_ku_id_': {
|
|
|
+ handler (val) {
|
|
|
+ if (val) {
|
|
|
+ const sql = `select * from t_questions where parent_id_ = '${val}' and zhuang_tai_ = '启用' order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
|
|
|
+ this.$common.request('sql', sql).then((res) => {
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
+ this.getHandList(data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
this.getExamData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 题型分类
|
|
|
+ getHandList (data) {
|
|
|
+ // 确定每种类型的题目
|
|
|
+ this.handList.forEach(hand => {
|
|
|
+ hand.list = data.filter(item => item.ti_xing_ === hand.itemType)
|
|
|
+ })
|
|
|
+
|
|
|
+ if (this.$utils.isEmpty(this.id)) {
|
|
|
+ // 设置每种类型题目的默认题数
|
|
|
+ this.handList.forEach(hand => {
|
|
|
+ hand.questionNumber = hand.list.length
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (!this.isFirst) {
|
|
|
+ this.handList.forEach(hand => {
|
|
|
+ hand.questionNumber = hand.list.length
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.isFirst = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置每种类型题目的步数
|
|
|
+ this.handList.forEach(hand => {
|
|
|
+ if (hand.list.length > 0) {
|
|
|
+ const isSame = hand.list.every(item => item.fen_zhi_ === hand.list[0].fen_zhi_)
|
|
|
+ hand.step = isSame ? 1 : hand.list.length
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
changeLimit (e, type, defaultValue) {
|
|
|
this.form[type] = e === '1' ? defaultValue : '不限'
|
|
|
},
|
|
|
@@ -415,7 +514,7 @@ export default {
|
|
|
this.randButtonDisabled = true
|
|
|
this.$message.info('非未发布状态的考试仅可修改限考时间!')
|
|
|
}
|
|
|
- const sql = `select id_, create_by_, ti_ku_id_, guan_lian_id_, kao_shi_ming_chen, kao_shi_lei_xing_, chuang_jian_shi_j, fa_bu_shi_jian_, fa_bu_ren_, xian_kao_shi_jian, xian_kao_ci_shu_, kao_shi_shi_chang, can_kao_ren_yuan_, zhuang_tai_, da_biao_zhan_bi_, ji_fen_fang_shi_, kao_shi_miao_shu_, yun_xu_bao_ming_ from t_exams where id_ = '${this.id}'`
|
|
|
+ const sql = `select id_, create_by_, ti_ku_id_, guan_lian_id_, kao_shi_ming_chen, kao_shi_lei_xing_, chuang_jian_shi_j, fa_bu_shi_jian_, fa_bu_ren_, xian_kao_shi_jian, xian_kao_ci_shu_, kao_shi_shi_chang, can_kao_ren_yuan_, zhuang_tai_, da_biao_zhan_bi_, ji_fen_fang_shi_, kao_shi_miao_shu_, yun_xu_bao_ming_, sui_ji_chou_ti_, sui_ji_ti_shu_,chou_ti_zong_fen_,ti_mu_zong_shu_ from t_exams where id_ = '${this.id}'`
|
|
|
this.$common.request('sql', sql).then((res) => {
|
|
|
const { data = [] } = res.variables || {}
|
|
|
if (!data.length) {
|
|
|
@@ -437,9 +536,15 @@ export default {
|
|
|
(data[0].kao_shi_shi_chang % (1000 * 60 * 60)) / (60 * 1000)
|
|
|
}
|
|
|
this.form = data[0]
|
|
|
+ if (this.form.sui_ji_chou_ti_ === '1') {
|
|
|
+ this.form.sui_ji_ti_shu_ = this.form.sui_ji_ti_shu_.split(',')
|
|
|
+ this.form.sui_ji_ti_shu_.forEach((item, index) => {
|
|
|
+ this.handList[index].questionNumber = item
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- // 随机题库
|
|
|
+ // 随机题库 弃用
|
|
|
randTiku () {
|
|
|
this.randButtonDisabled = true
|
|
|
const sql = `select id_ from t_question_bank where ti_ku_zhuang_tai_='可用'`
|
|
|
@@ -453,6 +558,31 @@ export default {
|
|
|
handleSubmit () {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ this.form.sui_ji_ti_shu_ = []
|
|
|
+ this.form.chou_ti_zong_fen_ = 0
|
|
|
+ this.form.ti_mu_zong_shu_ = 0
|
|
|
+ if (this.form.sui_ji_chou_ti_ === '1') {
|
|
|
+ // 计算总分 总数量
|
|
|
+ this.handList.forEach(item => {
|
|
|
+ if (item.list.length > 0) {
|
|
|
+ this.form.sui_ji_ti_shu_.push(item.questionNumber)
|
|
|
+ this.form.ti_mu_zong_shu_ += item.questionNumber
|
|
|
+ this.form.chou_ti_zong_fen_ += item.list.slice(0, item.questionNumber).reduce((pre, cur) => {
|
|
|
+ return pre + +cur.fen_zhi_
|
|
|
+ }, 0)
|
|
|
+ } else {
|
|
|
+ this.form.sui_ji_ti_shu_.push(0)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (this.form.ti_mu_zong_shu_ === 0) {
|
|
|
+ return this.$message.warning('请填写需要抽取的题目数量!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.chou_ti_zong_fen_ += ''
|
|
|
+ this.form.ti_mu_zong_shu_ += ''
|
|
|
+ this.form.sui_ji_ti_shu_ = this.form.sui_ji_ti_shu_.join(',')
|
|
|
+
|
|
|
const { isTimeLimit, xian_kao_shi_jian = '' } = this.form || {}
|
|
|
// 转换考试时长
|
|
|
if (isTimeLimit === '0') {
|
|
|
@@ -510,12 +640,12 @@ export default {
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.exam-dialog {
|
|
|
- ::v-deep {
|
|
|
- .el-dialog {
|
|
|
- max-width: 1080px;
|
|
|
- }
|
|
|
- .el-dialog__body {
|
|
|
- height: calc(88vh - 200px);
|
|
|
+ ::v-deep {
|
|
|
+ .el-dialog {
|
|
|
+ max-width: 1080px;
|
|
|
+ }
|
|
|
+ .el-dialog__body {
|
|
|
+ height: calc(88vh - 150px);
|
|
|
}
|
|
|
.el-form-item {
|
|
|
margin-bottom: 14px !important;
|
|
|
@@ -561,10 +691,21 @@ export default {
|
|
|
display: inline-block;
|
|
|
margin: 0 20px 0 5px;
|
|
|
}
|
|
|
+ .handrand{
|
|
|
+ ::v-deep .el-form-item__content{
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ .hand-item{
|
|
|
+ display: flex;
|
|
|
+ margin-right: 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
.tiku {
|
|
|
- .el-button {
|
|
|
- margin-left: 20px;
|
|
|
- }
|
|
|
+ .el-button {
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|