parent
5c564366c4
commit
60d11eb362
5 changed files with 201 additions and 57 deletions
@ -0,0 +1,103 @@ |
||||
<template> |
||||
<div> |
||||
<h6 class="page-name m-t-20" style="margin-bottom: 10px;">评阅范围</h6> |
||||
<div v-if="!dia" class="m-b-10"> |
||||
<el-input style="width: 300px;" placeholder="请输入题干" prefix-icon="el-icon-search" v-model="outlineKeyword" |
||||
clearable /> |
||||
</div> |
||||
<!-- <el-checkbox class="m-b-5" style="margin-left: 24px;" v-model="checkAllQues" |
||||
@change="checkAllQuesChange">全选</el-checkbox> --> |
||||
<div :class="['scopes', { dia }]"> |
||||
<el-tree ref="outline" :data="outlines" :show-checkbox="false" default-expand-all node-key="id"> |
||||
</el-tree> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import Setting from '@/setting' |
||||
import Util from '@/libs/util' |
||||
import _ from 'lodash' |
||||
export default { |
||||
props: ['outlines', 'dia'], |
||||
data () { |
||||
return { |
||||
searchTimer: null, |
||||
outlineKeyword: '', |
||||
checkAllQues: true, |
||||
submiting: false, |
||||
}; |
||||
}, |
||||
watch: { |
||||
outlineKeyword: function (val) { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(this.getOutline, 500) |
||||
}, |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
methods: { |
||||
// 获取中台部门 |
||||
async getNakadaiDep () { |
||||
const res = await this.$post(this.api.treeListArch) |
||||
const list = res.treeList |
||||
this.handleList(list) |
||||
this.nakadais = list |
||||
}, |
||||
// 试题全选回调 |
||||
checkAllQuesChange (val) { |
||||
this.$refs.outline.setCheckedKeys(val ? this.allQuesIds : this.disabledQuesIds) // 全选选中则整个树形选中,否则只取消选中启用的试题 |
||||
}, |
||||
|
||||
|
||||
// 提交 |
||||
async submit () { |
||||
if (this.submiting) return false |
||||
|
||||
this.submiting = true |
||||
|
||||
try { |
||||
const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list) |
||||
|
||||
let invalid = 0 |
||||
let hasQues = 0 |
||||
list.map((e, i) => { |
||||
if (+e.count !== res.list[i].questions.length) invalid = 1 |
||||
if (e.examQuestions.length) hasQues = 1 |
||||
e.score = 0 |
||||
}) |
||||
|
||||
list.map((e, i) => { |
||||
res.list[i].questions.map((e, i) => { |
||||
e.questionId = e.id |
||||
e.serialNumber = i + 1 |
||||
e.originSort = i + 1 |
||||
this.$parent.handleQuesInfo(e) |
||||
}) |
||||
this.$parent.form.paperOutline[i].examQuestions = res.list[i].questions |
||||
}) |
||||
this.allocationVisible = false |
||||
this.$parent.calcDifficult() |
||||
this.submiting = false |
||||
} catch (e) { |
||||
this.submiting = false |
||||
} |
||||
}, |
||||
// 弹框关闭回调 |
||||
closeDia () { |
||||
this.$emit('update:visible', false) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.scopes { |
||||
max-height: 400px; |
||||
overflow: auto; |
||||
|
||||
&.dia { |
||||
max-height: calc(100vh - 135px); |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue