试卷自动分配试题等

master
yujialong 4 months ago
parent 10b6532744
commit 9ded1da513
  1. 3
      src/api/index.js
  2. 2
      src/pages/ques/detail/index.vue
  3. 67
      src/pages/ques/list/index.vue
  4. 443
      src/pages/testPaper/detail/auto.vue
  5. 68
      src/pages/testPaper/detail/index.vue
  6. 19
      src/pages/testPaper/detail/manual.vue
  7. 11
      src/pages/testPaper/detail/template.vue
  8. 30
      src/pages/testPaper/list/index.vue
  9. 4
      src/pages/testPaperLibrary/index.vue

@ -16,6 +16,7 @@ export default {
questionBankSave: `/exam/questionBank/saveOrUpdate`, questionBankSave: `/exam/questionBank/saveOrUpdate`,
questionBankDisable: `/exam/questionBank/updateStatus`, questionBankDisable: `/exam/questionBank/updateStatus`,
copyQuestionBank: `/exam/questionBank/copyQuestionBank`, copyQuestionBank: `/exam/questionBank/copyQuestionBank`,
questionBankStructureLevel: `/exam/question/bank/categories/questionBankStructureLevel`,
TreeStructure: `/exam/knowledgeHierarchy/TreeStructure`, TreeStructure: `/exam/knowledgeHierarchy/TreeStructure`,
classificationTreeStructure: `/exam/knowledgeHierarchy/classificationTreeStructure`, classificationTreeStructure: `/exam/knowledgeHierarchy/classificationTreeStructure`,
@ -48,6 +49,7 @@ export default {
saveExamPaper: `/exam/exam/paper/saveExamPaper`, saveExamPaper: `/exam/exam/paper/saveExamPaper`,
paperDisable: `/exam/exam/paper/updateStatus`, paperDisable: `/exam/exam/paper/updateStatus`,
avgValues: `/exam/exam/paper/avgValues`, avgValues: `/exam/exam/paper/avgValues`,
examPaperDetails: `/exam/exam/paper/examPaperDetails`,
deleteTemplate: `/exam/exam/paperTemplate/deleteTemplate`, deleteTemplate: `/exam/exam/paperTemplate/deleteTemplate`,
examPaperTemplateList: `/exam/exam/paperTemplate/examPaperTemplateList`, examPaperTemplateList: `/exam/exam/paperTemplate/examPaperTemplateList`,
@ -66,4 +68,5 @@ export default {
createNewVersion: `/exam/questions/createNewVersion`, createNewVersion: `/exam/questions/createNewVersion`,
disableOrEnableQuestion: `/exam/questions/disableOrEnableQuestion`, disableOrEnableQuestion: `/exam/questions/disableOrEnableQuestion`,
findAllByQuestionBank: `/exam/questions/findAllByQuestionBank`, findAllByQuestionBank: `/exam/questions/findAllByQuestionBank`,
selectQuestionsByTypeAndDifficulty: `/exam/questions/selectQuestionsByTypeAndDifficulty`,
} }

@ -551,7 +551,7 @@ export default {
form.knowledgePointIds = form.knowledgePointIds.map(e => { form.knowledgePointIds = form.knowledgePointIds.map(e => {
return e[e.length - 1] return e[e.length - 1]
}) })
form.givenYear = dayjs(form.givenYear).format('YYYY') form.givenYear = form.givenYear ? dayjs(form.givenYear).format('YYYY') : ''
form.questionAnswerVersions[0].answerAnalysis = answerAnalysis // form.questionAnswerVersions[0].answerAnalysis = answerAnalysis //
if (this.$refs.uploadInstructions) form.uploadInstructions = this.$refs.uploadInstructions.getUEContent() if (this.$refs.uploadInstructions) form.uploadInstructions = this.$refs.uploadInstructions.getUEContent()
if (form.questionType === 'essay' && this.$refs.referenceAnswer) form.questionAnswerVersions[0].referenceAnswer = this.$refs.referenceAnswer.getUEContent() // () if (form.questionType === 'essay' && this.$refs.referenceAnswer) form.questionAnswerVersions[0].referenceAnswer = this.$refs.referenceAnswer.getUEContent() // ()

@ -91,7 +91,7 @@
<el-button type="primary" @click="batchImport">批量导入</el-button> <el-button type="primary" @click="batchImport">批量导入</el-button>
<!-- <el-button type="primary" @click="add">批量转移</el-button> --> <!-- <el-button type="primary" @click="add">批量转移</el-button> -->
<el-button type="primary" @click="add">批量移除 </el-button> <el-button type="primary" @click="add">批量移除 </el-button>
<el-button type="primary" @click="add">批量删除</el-button> <el-button type="primary" @click="delAllSelection">批量删除</el-button>
</div> </div>
</ul> </ul>
</div> </div>
@ -125,7 +125,7 @@
<el-button type="text" @click="toDetail(scope.row, 2)">查看</el-button> <el-button type="text" @click="toDetail(scope.row, 2)">查看</el-button>
<el-button type="text" @click="toDetail(scope.row, 3)">编辑</el-button> <el-button type="text" @click="toDetail(scope.row, 3)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">移除</el-button> <el-button type="text" @click="del(scope.row)">移除</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button> <el-button type="text" @click="del([scope.row])">删除</el-button>
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px"
:active-text="scope.row.status ? '开' : '关'" :active-text="scope.row.status ? '开' : '关'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch> @change="switchOff($event, scope.row, scope.$index)"></el-switch>
@ -144,9 +144,24 @@
<el-dialog title="提示" :visible.sync="delVisible" width="400px" :close-on-click-modal="false" custom-class="del-dia"> <el-dialog title="提示" :visible.sync="delVisible" width="400px" :close-on-click-modal="false" custom-class="del-dia">
<div class="del-wrap"> <div class="del-wrap">
<div class="icon el-icon-warning"></div> <div class="icon el-icon-warning"></div>
<div> <div class="flex-1">
<p>该试题已被以下试卷引用确定删除</p> <p>该试题已被以下试卷引用确定删除</p>
<p class="tips">删除后此题库分类及其子分类将被删除已关联题库将无分类</p> <ul class="papers">
<li v-for="(item, i) in curUsePapers" :key="i">
<p>{{ item.name }}</p>
<i class="el-icon-edit m-l-10"></i>
</li>
</ul>
<!-- <ul class="papers">
<li>题干</li>
<li>试卷</li>
</ul>
<ul class="papers">
<li v-for="(item, i) in curUsePapers" :key="i">
<p></p>
<p></p>
</li>
</ul> -->
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -266,6 +281,7 @@ export default {
delVisible: false, delVisible: false,
curUsePapers: [], curUsePapers: [],
curRow: {},
form: {}, form: {},
importVisible: false, importVisible: false,
@ -412,10 +428,6 @@ export default {
this.quesVisible = true this.quesVisible = true
this.curRow = {} this.curRow = {}
this.detailType = '' this.detailType = ''
},
//
copy (row) {
}, },
// / type: 123 // / type: 123
toDetail (row, type) { toDetail (row, type) {
@ -424,10 +436,12 @@ export default {
this.detailType = type this.detailType = type
}, },
// //
async del (row) { async del (rows) {
const ids = rows.map(e => e.questionId)
// //
const { list } = await this.$post(this.api.checkQuestionIsUse, [row.questionId]) const { list } = await this.$post(this.api.checkQuestionIsUse, ids)
if (list.length) { if (list.length) {
this.curRow = rows
this.curUsePapers = list this.curUsePapers = list
this.delVisible = true this.delVisible = true
} else { } else {
@ -438,12 +452,26 @@ export default {
type: 'warning', type: 'warning',
closeOnClickModal: false, closeOnClickModal: false,
}) })
await this.$post(this.api.delQuestion, [row.questionId]) await this.$post(this.api.delQuestion, ids)
Util.successMsg('删除成功') Util.successMsg('删除成功')
this.getList() this.getList()
} catch (e) { } } catch (e) { }
} }
}, },
//
async delAllSelection () {
const list = this.multipleSelection
list.length ? this.del(list) : Util.warningMsg('请选择数据')
},
//
async delSubmit () {
await this.$post(this.api.delQuestion, this.curRow.map(e => e.questionId))
Util.successMsg('删除成功')
this.multipleSelection = []
this.$refs.table.clearSelection()
this.delVisible = false
this.getData()
},
// //
async switchOff (val, row) { async switchOff (val, row) {
try { try {
@ -626,4 +654,21 @@ export default {
} }
} }
} }
.papers {
margin-top: 10px;
li {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
i {
font-size: 14px;
color: #7a7a7a;
cursor: pointer;
}
}
</style> </style>

@ -0,0 +1,443 @@
<template>
<div>
<el-dialog title="自动选题" :visible.sync="quesVisible" width="1200px" :close-on-click-modal="false" @closed="closeDia">
<h6 class="page-name">难度设置</h6>
<div class="tool">
<ul class="filter">
<li>
<label>试卷难度</label>
<el-select v-model="difficult" placeholder="请选择试卷难度" @change="difficultData">
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
</ul>
</div>
<el-table :data="list" stripe header-align="center" row-key="libraryId">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column label="大题" align="center" min-width="100">
<template slot-scope="scope">{{ arabicToChinese(scope.$index + 1) }}大题</template>
</el-table-column>
<el-table-column prop="name" label="题型" align="center" min-width="90">
<template slot-scope="scope">
<p v-if="scope.row.questionType">{{ questionTypes.find(e => e.id === scope.row.questionType).name }}</p>
</template>
</el-table-column>
<el-table-column prop="questionNum" label="目标题数" align="center" min-width="80"></el-table-column>
<el-table-column label="基础(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.basicDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="普通(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.normalDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="较难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.hardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难(道题)" align="center" width="90">
<template slot-scope="scope">
<el-input v-model.number="scope.row.veryHardDifficulty" type="number" />
</template>
</el-table-column>
<el-table-column label="难度随机(道题)" align="center" width="100">
<template slot-scope="scope">
<el-input v-model.number="scope.row.randomDifficulty" type="number" />
</template>
</el-table-column>
</el-table>
<h6 class="page-name m-t-20">知识点设置</h6>
<div class="wrap">
<!-- 题库 -->
<div class="item">
<p class="total m-b-10">题库</p>
<el-input class="m-b-10" placeholder="请输入题库分类/题库名称" prefix-icon="el-icon-search" v-model="quesBankKeyword"
clearable />
<el-tree :key="key" node-key="id" default-expand-all highlight-current ref="quesBank" :data="quesBanks"
:props="{ label: 'name' }" @node-click="getKnowledge" @check-change="quesBankCheck"></el-tree>
</div>
<!-- 知识点 -->
<div class="item">
<p class="total m-b-10">知识点框架</p>
<el-input class="m-b-10" placeholder="请输入知识点分类/知识点名称" prefix-icon="el-icon-search" v-model="knowledgeKeyword"
clearable />
<el-tree :data="knowledges" default-expand-all ref="knowledge" node-key="id" highlight-current
:expand-on-click-node="false" show-checkbox @check-change="knowledgeCheck" :props="{ label: 'name' }">
<span class="custom-tree-node" slot-scope="{ node, data }">
<img v-if="data.type" class="m-r-5" src="@/assets/images/knowledge.svg" alt="">
<span class="org-name">{{ data.name }}</span>
</span>
</el-tree>
</div>
<!-- 已选知识点 -->
<div class="item">
<div class="flex j-between a-center m-b-20">
<p class="total m-b-10">已选知识点{{ allKnowledges.length }}</p>
<p class="clear" @click="clearChecked">
<i class="el-icon-delete m-r-5"></i>
清空
</p>
</div>
<div v-for="(item, i) in checked" :key="i" class="line j-between">
<div class="flex a-center">
题库{{ item.quesBank.name }}
<i class="el-icon-delete action-icon m-l-10" @click="delQuesBank(i)"></i>
</div>
<div class="knowledges">
<el-tag v-for="(tag, j) in item.knowledges" :key="tag.name" class="m-r-10" closable
@close="delKnowledge(i, j, item)">
{{ tag.name }}
</el-tag>
</div>
</div>
</div>
</div>
<h6 class="page-name m-t-20">年份设置</h6>
<div class="years flex">
<el-checkbox style="margin-right: 20px" v-model="yearAll" @change="yearAllChange">全选</el-checkbox>
<el-checkbox-group v-model="yearCheck" @change="yearChange">
<el-checkbox v-for="(item, i) in years" :key="i" :label="item"></el-checkbox>
</el-checkbox-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="quesVisible = false">取消</el-button>
<el-button type="primary" :loading="submiting" @click="submit">自动选题</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper'
import _ from 'lodash'
// import Decimal from 'decimal.js'
export default {
props: ['visible'],
data () {
return {
arabicToChinese: Util.arabicToChinese,
difficults: TestPaperConst.difficults,
questionTypes: QuesConst.questionTypes,
quesVisible: false,
difficult: '',
quesBankKeyword: '',
knowledgeKeyword: '',
searchTimer: null,
key: 1,
quesBanks: [],
knowledges: [],
checked: [],
list: [],
years: ['暂无年份', '2024', '2023', '2022', '2021', '2020', '2019', '2018', '2017', '2016', '更早'],
yearAll: true,
yearCheck: [],
submiting: false,
};
},
computed: {
allKnowledges () {
const result = []
this.checked.map(e => {
result.push(...e.knowledges)
})
return result
},
},
watch: {
'quesBankKeyword': function (val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(this.getQuesBank, 500)
},
'knowledgeKeyword': function (val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(this.getKnowledge, 500)
},
visible () {
this.quesVisible = this.visible
this.visible && this.init()
}
},
mounted () {
},
methods: {
//
init () {
this.yearCheck = this.years
this.handleQuesList()
this.getQuesBank()
},
//
async getQuesBank () {
try {
const { list } = await this.$post(this.api.questionBankStructureLevel, {
keyword: this.quesBankKeyword,
createSource: 1,
})
this.quesBanks = list
} catch (e) { }
},
//
async getKnowledge () {
try {
const id = this.$refs.quesBank.getCurrentKey()
if (id) {
const { data } = await this.$post(this.api.TreeStructure, {
createSource: 1,
questionBankId: id,
keyword: this.knowledgeKeyword,
})
this.knowledges = data
}
} catch (e) { }
},
//
quesBankCheck (data, checked) {
// debugger
if (checked) {
// this.$refs.quesBank.setCurrentKey(data.id)
this.getKnowledge()
}
this.$refs.knowledge.setCheckedNodes(checked ? this.knowledges : [])
},
//
knowledgeCheck (data, checked) {
//
if (data.type) {
const checkQues = this.$refs.quesBank.getCurrentNode()
const ques = this.checked.find(e => e.quesBank.id === checkQues.id)
//
if (ques) {
const i = ques.knowledges.findIndex(e => e === data.id)
if (checked && i === -1) {
ques.knowledges.push(data)
} else if (!checked && i >= 0) {
ques.knowledges.splice(i, 1)
}
} else {
this.checked.push({
quesBank: checkQues,
knowledges: [data]
})
}
}
},
//
handleQuesList () {
const list = _.cloneDeep(this.$parent.form.paperOutline)
this.list = list
},
//
async clearChecked () {
try {
await this.$confirm(`确认要清空吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false,
})
this.checked = []
} catch (e) { }
},
//
delQuesBank (i) {
this.checked.splice(i, 1)
},
//
delKnowledge (i, j, item) {
item.knowledges.splice(j, 1)
item.knowledges.length || this.checked.splice(i, 1) //
},
//
async getList () {
try {
const res = await this.$post(this.api.examPaperTemplateList, {
pageNum: this.page,
pageSize: this.pageSize,
...this.filter
})
this.list = res.pageList.records
this.total = res.pageList.total
} catch (e) { }
},
calculateQuestionNumbers (list, target) {
// Decimal(e.score).add(Decimal(score))
const difficultyWeights = [0.2, 0.4, 0.6, 0.8]
const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty']
//
list.forEach(e => {
const total = e.questionNum
const nums = {
basicDifficulty: 0,
normalDifficulty: 0,
hardDifficulty: 0,
veryHardDifficulty: 0,
}
//
for (let i = 0; i < 4; i++) {
nums[names[i]] = 0
}
//
let totalWeight = total * target
const maxCount = Math.ceil(total / 4)
for (let i = 0; i < 4; i++) {
console.log("🚀 ~ calculateQuestionNumbers ~ totalWeight:", totalWeight)
if (totalWeight > 0) {
const random = Math.floor(Math.random() * (maxCount)) + 1
const weight = difficultyWeights[i]
totalWeight -= weight * random
e[names[i]] = totalWeight > 0 ? random : 0
}
}
// e.nums = nums
});
return list
},
//
difficultData (val) {
// debugger
console.log(111, this.calculateQuestionNumbers(this.list, 0.3))
},
//
yearAllChange (val) {
this.yearCheck = val ? this.years : []
},
//
yearChange (val) {
this.yearAll = val.length === 11
},
//
async submit () {
if (this.submiting) return false
const { list } = this
// let invalid = 0
// for (const e of list) {
// if (!e.questionType) {
// Util.warningMsg('')
// invalid = 1
// break
// }
// }
// if (invalid) return false
this.submiting = true
const k = this.allKnowledges.map(e => e.id)
const years = []
this.yearCheck.map(e => {
if (e === '暂无年份') {
years.push('')
} else if (e === '更早') {
// 1990~2005
for (let i = 1990; i < 2006; i++) {
years.push(i)
}
} else {
years.push(+e)
}
})
list.map(e => {
e.randomDifficulty = 0
e.givenYears = years
e.knowledgePointsIds = k
})
try {
const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list)
let invalid = 0
let hasQues = 0
list.map((e, i) => {
console.log("🚀 ~ submit ~ e:", e)
if (e.questionNum !== res.list[i].questions.length) invalid = 1
if (e.examQuestions.length) hasQues = 1
})
// 3
const tips = invalid && hasQues ?
'此操作会清空当前试卷已添加的试题,并且满足自动选题设置的试题数量不足,确定要继续自动选题吗?' :
invalid && !hasQues ?
'满足自动选题设置的试题数量不足,确认要继续自动选题吗?' :
!invalid && hasQues ? '此操作会清空当前试卷已添加的试题,是否确定要继续自动选题吗?' :
''
if (tips) {
await this.$confirm(tips, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false,
})
}
list.map((e, i) => {
this.$parent.form.paperOutline[i].examQuestions = res.list[i].questions
})
this.quesVisible = false
this.submiting = false
} catch (e) {
this.submiting = false
}
},
//
closeDia () {
this.$emit('update:visible', false)
}
}
};
</script>
<style lang="scss" scoped>
.wrap {
display: flex;
margin-top: 20px;
border: 1px solid #eee;
.item {
width: 30%;
max-height: calc(100vh - 190px);
padding: 15px;
border-right: 1px solid #eee;
overflow: auto;
&:last-child {
width: 40%;
border-right: 0;
}
}
.total {
font-size: 16px;
color: #333;
}
.clear {
display: inline-flex;
align-items: center;
font-size: 14px;
color: #8b8b8b;
cursor: pointer;
}
.knowledges {
padding-left: 44px;
margin-top: 10px;
}
}
</style>

@ -8,7 +8,8 @@
</el-form-item> </el-form-item>
<div class="item-line"> <div class="item-line">
<el-form-item prop="particularYear" label="年份"> <el-form-item prop="particularYear" label="年份">
<el-date-picker v-model="form.particularYear" type="year" placeholder="请选择年份"> <el-date-picker v-model="form.particularYear" type="year" placeholder="请选择年份" format="yyyy"
value-format="yyyy">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item required label="所属试卷分类"> <el-form-item required label="所属试卷分类">
@ -54,7 +55,7 @@
</div> </div>
<el-table :data="form.paperOutline" stripe header-align="center" row-key="id"> <el-table :data="form.paperOutline" stripe header-align="center" row-key="id">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> <el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="outlineName" label="大题" align="center" min-width="120"> <el-table-column label="大题" align="center" min-width="120">
<template slot-scope="scope">{{ arabicToChinese(scope.$index + 1) }}大题</template> <template slot-scope="scope">{{ arabicToChinese(scope.$index + 1) }}大题</template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="题型" align="center" min-width="120"> <el-table-column prop="name" label="题型" align="center" min-width="120">
@ -86,10 +87,10 @@
<div class="line"></div> <div class="line"></div>
<div class="flex j-between a-center"> <div class="flex j-between a-center">
<p>选择试题</p> <h6 class="page-name" style="margin-bottom: 0">选择试题</h6>
<div> <div>
<el-button type="primary" @click="allocationAll">一键分配分值</el-button> <el-button type="primary" @click="allocationAll">一键分配分值</el-button>
<el-button type="primary">自动选题</el-button> <el-button type="primary" @click="showAuto">自动选题</el-button>
</div> </div>
</div> </div>
@ -102,9 +103,8 @@
</div> </div>
<div> <div>
<el-button type="primary" @click="allocation(item)">一键分配分值</el-button> <el-button type="primary" @click="allocation(item)">一键分配分值</el-button>
<el-button type="primary" @click="showQuesDia(item)">批量添加</el-button> <el-button type="primary" @click="showManualDia(item)">批量添加</el-button>
<el-button type="danger" @click="batchDelQues(item)">批量删除试题</el-button> <el-button type="danger" @click="batchDelQues(item)">批量删除试题</el-button>
{{ item.shrink }}
<i class="arrow el-icon-arrow-down" @click="item.shrink = !item.shrink"></i> <i class="arrow el-icon-arrow-down" @click="item.shrink = !item.shrink"></i>
</div> </div>
</div> </div>
@ -131,8 +131,8 @@
<el-input class="score" v-model="ques.sort" /> <el-input class="score" v-model="ques.sort" />
</div> </div>
<el-button type="text">编辑试题</el-button> <el-button type="text">编辑试题</el-button>
<el-button type="text" @click="showQuesDia(item, j, ques)">更换试题</el-button> <el-button type="text" @click="showManualDia(item, j, ques)">更换试题</el-button>
<el-button type="text" @click="showQuesDia(item, j)">添加试题</el-button> <el-button type="text" @click="showManualDia(item, j)">添加试题</el-button>
<el-button type="text" @click="delQues(item, j)">移除试题</el-button> <el-button type="text" @click="delQues(item, j)">移除试题</el-button>
</div> </div>
</div> </div>
@ -151,7 +151,8 @@
</div> </div>
<Template :visible.sync="templateVisible" /> <Template :visible.sync="templateVisible" />
<Manual :visible.sync="quesVisible" :questionType.sync="curType.questionType" /> <Manual :visible.sync="manualVisible" :questionType.sync="curType.questionType" />
<Auto :visible.sync="autoVisible" />
</div> </div>
</template> </template>
<script> <script>
@ -162,10 +163,11 @@ import Ueditor from '@/components/ueditor'
import Breadcrumb from '@/components/breadcrumb' import Breadcrumb from '@/components/breadcrumb'
import Template from './template' import Template from './template'
import Manual from './manual' import Manual from './manual'
import Auto from './auto'
import QuesConst from '@/const/ques' import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper' import TestPaperConst from '@/const/testPaper'
export default { export default {
components: { Ueditor, Breadcrumb, Template, Manual }, components: { Ueditor, Breadcrumb, Template, Manual, Auto },
data () { data () {
return { return {
crumbs: [ crumbs: [
@ -181,6 +183,7 @@ export default {
difficults: TestPaperConst.difficults, difficults: TestPaperConst.difficults,
paperTypes: TestPaperConst.paperTypes, paperTypes: TestPaperConst.paperTypes,
arabicToChinese: Util.arabicToChinese, arabicToChinese: Util.arabicToChinese,
paperId: this.$route.query.paperId,
libraryId: this.$route.query.libraryId, libraryId: this.$route.query.libraryId,
headers: { headers: {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
@ -267,10 +270,12 @@ export default {
], ],
}, },
templateVisible: false, templateVisible: false,
quesVisible: false, manualVisible: false,
curType: {}, curType: {},
curQuesIndex: 0, curQuesIndex: 0,
curQues: null, curQues: null,
autoVisible: false,
}; };
}, },
computed: { computed: {
@ -284,10 +289,28 @@ export default {
} }
}, },
mounted () { mounted () {
this.getDetail()
this.getType() this.getType()
this.getProfessional() this.getProfessional()
}, },
methods: { methods: {
//
async getDetail () {
try {
const { paperId } = this
if (paperId) {
const res = await this.$get(this.api.examPaperDetails, {
id: paperId
})
const r = res.examPaper
const paper = r.paperOutline
if (r.particularYear) r.particularYear = r.particularYear + ''
this.form = r
// this.answerAnalysis = opts[0].answerAnalysis
}
} catch (e) { }
},
// //
async getType () { async getType () {
try { try {
@ -370,12 +393,16 @@ export default {
}) })
} }
}, },
//
showAuto () {
this.autoVisible = true
},
// //
showQuesDia (item, i, ques) { showManualDia (item, i, ques) {
this.curType = item this.curType = item
this.curQuesIndex = i this.curQuesIndex = i
this.curQues = ques this.curQues = ques
this.quesVisible = true this.manualVisible = true
}, },
// //
async batchDelQues (item) { async batchDelQues (item) {
@ -422,10 +449,7 @@ export default {
}, },
// //
async submit (status) { async submit (status) {
// this.form.paperOutline[0].examQuestions.reduce((prev, curr) => { // this.form.paperOutline[0].examQuestions.reduce((e, j) => (e += +j.score), 0)
// console.log(111, prev, curr)
// // + prev.score + +curr.score
// }, 0)
// return console.log(44,) // return console.log(44,)
if (this.submiting) return false if (this.submiting) return false
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
@ -459,11 +483,11 @@ export default {
} }
// //
// if (+e.targetScore !== e.examQuestions.length) { if (+e.targetScore !== e.examQuestions.reduce((e, j) => (e += +j.score), 0)) {
// Util.warningMsg(`${this.arabicToChinese(i + 1)}`) Util.warningMsg(`${this.arabicToChinese(i + 1)}大题的小题总分跟目标分值不一致,请重新修改`)
// invalid = 1 invalid = 1
// break break
// } }
} }
if (invalid) return false if (invalid) return false

@ -5,17 +5,19 @@
<div class="wrap"> <div class="wrap">
<!-- 题库 --> <!-- 题库 -->
<div class="item"> <div class="item">
<p class="total m-b-10">题库</p>
<el-input class="m-b-10" placeholder="请输入题库分类/题库名称" prefix-icon="el-icon-search" v-model="quesBankKeyword" <el-input class="m-b-10" placeholder="请输入题库分类/题库名称" prefix-icon="el-icon-search" v-model="quesBankKeyword"
clearable /> clearable />
<el-tree :key="key" node-key="id" default-expand-all ref="quesBank" :data="quesBanks" <el-tree :key="key" node-key="id" default-expand-all ref="quesBank" :data="quesBanks"
:props="{ label: 'name' }" show-checkbox @node-click="getKnowledge" @check-change="quesBankCheck"></el-tree> :props="{ label: 'name' }" @node-click="getKnowledge" @check-change="quesBankCheck"></el-tree>
</div> </div>
<!-- 知识点 --> <!-- 知识点 -->
<div class="item"> <div class="item">
<p class="total m-b-10">知识点框架</p>
<el-input class="m-b-10" placeholder="请输入知识点分类/知识点名称" prefix-icon="el-icon-search" v-model="knowledgeKeyword" <el-input class="m-b-10" placeholder="请输入知识点分类/知识点名称" prefix-icon="el-icon-search" v-model="knowledgeKeyword"
clearable /> clearable />
<el-tree :data="knowledges" default-expand-all ref="knowledge" node-key="id" highlight-current <el-tree :data="knowledges" default-expand-all ref="knowledge" node-key="id" highlight-current
:expand-on-click-node="false" show-checkbox @node-click="getQues" @check-change="knowledgeCheck" :expand-on-click-node="false" @node-click="getQues" @check-change="knowledgeCheck"
:props="{ label: 'name' }"> :props="{ label: 'name' }">
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<img v-if="data.type" class="m-r-5" src="@/assets/images/knowledge.svg" alt=""> <img v-if="data.type" class="m-r-5" src="@/assets/images/knowledge.svg" alt="">
@ -154,11 +156,11 @@ export default {
// //
async getQuesBank () { async getQuesBank () {
try { try {
const { data } = await this.$post(this.api.getAllQuestionBankCategories, { const { list } = await this.$post(this.api.questionBankStructureLevel, {
keyword: this.quesBankKeyword, keyword: this.quesBankKeyword,
createSource: 1, createSource: 1,
}) })
this.quesBanks = data this.quesBanks = list
} catch (e) { } } catch (e) { }
}, },
// //
@ -178,15 +180,16 @@ export default {
// //
async getQues () { async getQues () {
let k = this.$refs.knowledge.getCurrentNode() // let k = this.$refs.knowledge.getCurrentNode() //
// debugger
// //
if (k && k.type) { if (k && k.type) {
const { list } = await this.$post(this.api.findAllByQuestionBank, { const { list } = await this.$post(this.api.findAllByQuestionBank, {
status: 1, status: 1,
// questionBankId: this.$refs.quesBank.getCurrentKey(), questionBankId: this.$refs.quesBank.getCurrentKey(),
// knowledgePointIds: [k.id], knowledgePointIds: [k.id],
questionTypes: this.questionType ? [this.questionType] : [], questionTypes: this.questionType ? [this.questionType] : [],
questionBankId: 26, // questionBankId: 26,
knowledgePointIds: [18], // knowledgePointIds: [18],
}) })
const data = list const data = list
const checked = this.curCheckQues const checked = this.curCheckQues

@ -78,7 +78,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-circle-plus-outline action-icon" @click="addLine(scope.$index)"></i> <i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i>
<i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i> <i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i>
</template> </template>
</el-table-column> </el-table-column>
@ -325,11 +325,4 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
.action-icon {
margin-right: 10px;
font-size: 18px;
color: $main-color;
cursor: pointer;
}
</style>

@ -193,6 +193,15 @@ export default {
components: { Breadcrumb }, components: { Breadcrumb },
data () { data () {
return { return {
crumbs: [
{
name: this.$route.query.name || '中台试卷库',
route: '/testPaperLibrary'
},
{
name: '试卷管理'
},
],
questionTypes: QuesConst.questionTypes, questionTypes: QuesConst.questionTypes,
difficults: TestPaperConst.difficults, difficults: TestPaperConst.difficults,
paperTypes: TestPaperConst.paperTypes, paperTypes: TestPaperConst.paperTypes,
@ -269,16 +278,7 @@ export default {
}, },
}, },
mounted () { mounted () {
this.crumbs = [ this.getType()
{
name: this.$route.query.name || '中台试卷库',
route: '/testPaperLibrary'
},
{
name: '试卷管理'
},
],
this.getType()
this.getProfessional() this.getProfessional()
}, },
methods: { methods: {
@ -474,15 +474,7 @@ export default {
}, },
// //
async edit (row) { async edit (row) {
const { data } = await this.$post(`${this.api.knowledgeHierarchyFind}?id=${row.id}`) this.$router.push(`detail?paperId=${row.paperId}&libraryId=${this.typeId}&classificationId=${this.$refs.typeTree.getCurrentKey() || ''}`)
this.knowledgeVisible = true
const path = data.path.split('/').map(e => +e)
this.form = {
id: row.id,
name: row.name,
parentId: path.slice(0, path.length - 1),
}
console.log(11, this.form)
}, },
async delAllSelection () { async delAllSelection () {
const list = this.multipleSelection const list = this.multipleSelection

@ -93,8 +93,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="quesBankVisible = false"> </el-button> <el-button @click="quesBankVisible = false">取消</el-button>
<el-button type="primary" :loading="submiting" @click="quesBankSubmit"> </el-button> <el-button type="primary" :loading="submiting" @click="quesBankSubmit">确定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>

Loading…
Cancel
Save