试卷试题联调

master
yujialong 4 months ago
parent df0b8172f2
commit 10b6532744
  1. 7
      src/api/index.js
  2. 29
      src/pages/ques/detail/index.vue
  3. 125
      src/pages/ques/list/index.vue
  4. 172
      src/pages/testPaper/detail/index.vue
  5. 39
      src/pages/testPaper/detail/manual.vue

@ -47,6 +47,7 @@ export default {
examPaperList: `/exam/exam/paper/examPaperList`, examPaperList: `/exam/exam/paper/examPaperList`,
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`,
deleteTemplate: `/exam/exam/paperTemplate/deleteTemplate`, deleteTemplate: `/exam/exam/paperTemplate/deleteTemplate`,
examPaperTemplateList: `/exam/exam/paperTemplate/examPaperTemplateList`, examPaperTemplateList: `/exam/exam/paperTemplate/examPaperTemplateList`,
@ -59,4 +60,10 @@ export default {
updateQuestion: `/exam/questions/updateQuestion`, updateQuestion: `/exam/questions/updateQuestion`,
batchImportQuestions: `${host}/exam/questions/batchImportQuestions`, batchImportQuestions: `${host}/exam/questions/batchImportQuestions`,
checkQuestion: `/exam/questions/checkQuestion`, checkQuestion: `/exam/questions/checkQuestion`,
delQuestion: `/exam/questions/batchDeletion`,
checkQuestionIsUse: `/exam/questions/checkQuestionIsUse`,
copyQuestion: `/exam/questions/copyQuestion`,
createNewVersion: `/exam/questions/createNewVersion`,
disableOrEnableQuestion: `/exam/questions/disableOrEnableQuestion`,
findAllByQuestionBank: `/exam/questions/findAllByQuestionBank`,
} }

@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<el-dialog :title="readonly ? '查看试题' : !form.questionId ? '新增试题' : '编辑试题'" :visible.sync="quesVisible" <el-dialog :title="(detailType ? detailTypes[detailType] : '新增') + '试题'" :visible.sync="quesVisible" width="1000px"
width="1000px" :close-on-click-modal="false" @closed="closeDia"> :close-on-click-modal="false" @closed="closeDia">
<el-form :model="form" :rules="rules" ref="form" label-width="110px" :disabled="readonly"> <el-form :model="form" :rules="rules" ref="form" label-width="110px" :disabled="detailType === 2">
<el-form-item label="题库分类"> <el-form-item label="题库分类">
<el-input v-model="questionBankCategory" disabled /> <el-input v-model="questionBankCategory" disabled />
</el-form-item> </el-form-item>
@ -139,12 +139,17 @@
<Ueditor ref="answerAnalysis" @ready="answerAnalysisReady" v-model="answerAnalysis" /> <Ueditor ref="answerAnalysis" @ready="answerAnalysisReady" v-model="answerAnalysis" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span v-if="detailType !== 2" slot="footer" class="dialog-footer">
<el-button type="primary" :loading="submiting && keep === 0" @click="submit(0)">{{ row.questionId ? '仅更新此题' : <el-button v-if="detailType === 1" type="primary" :loading="submiting && keep === 0"
'保存' @click="submit(1)">保存</el-button>
}}</el-button> <template v-else>
<el-button type="primary" :loading="submiting && keep === 1" @click="submit(1)">{{ row.questionId ? '同步更新相似题' : <el-button type="primary" :loading="submiting && keep === 0" @click="submit(0)">{{ row.questionId ? '仅更新此题' :
'保存并继续新增' }}</el-button> '保存'
}}</el-button>
<el-button type="primary" :loading="submiting && keep === 1" @click="submit(1)">{{ row.questionId ? '同步更新相似题'
:
'保存并继续新增' }}</el-button>
</template>
<el-button @click="quesVisible = false">取消</el-button> <el-button @click="quesVisible = false">取消</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -193,7 +198,7 @@ import dayjs from 'dayjs'
import _ from 'lodash' import _ from 'lodash'
import Const from '@/const/ques' import Const from '@/const/ques'
export default { export default {
props: ['visible', 'row', 'readonly'], props: ['visible', 'row', 'detailType'],
components: { Ueditor, Upload }, components: { Ueditor, Upload },
data () { data () {
return { return {
@ -201,7 +206,7 @@ export default {
questionBankName: this.$route.query.questionBankName, questionBankName: this.$route.query.questionBankName,
questionBankCategory: this.$route.query.questionBankCategory, questionBankCategory: this.$route.query.questionBankCategory,
numToLetter: Util.numToLetter, numToLetter: Util.numToLetter,
radio: '', detailTypes: ['', '复制', '查看', '编辑'],
types: [], types: [],
cascaderValue: [], cascaderValue: [],
cascaderProps: { cascaderProps: {
@ -588,7 +593,7 @@ export default {
// //
async saveQues () { async saveQues () {
const form = this.tempForm const form = this.tempForm
await this.$post(this.api[form.questionId ? 'updateQuestion' : 'addQuestion'], form) await this.$post(this.api[this.detailType === 1 || !form.questionId ? 'addQuestion' : 'updateQuestion'], form)
Util.successMsg('保存成功') Util.successMsg('保存成功')
this.submiting = false this.submiting = false
!form.questionId && this.keep ? this.init() : (this.quesVisible = false) !form.questionId && this.keep ? this.init() : (this.quesVisible = false)

@ -97,31 +97,33 @@
</div> </div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" <el-table :data="list" class="table" ref="table" stripe header-align="center"
@selection-change="handleSelectionChange" row-key="id"> @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange">
<el-table-column type="selection" width="45" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="45" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="50" label="序号" align="center"></el-table-column> <el-table-column type="index" width="50" label="序号" align="center"></el-table-column>
<el-table-column prop="stem" label="题干" align="center" min-width="120" <el-table-column prop="stem" label="题干" align="center" min-width="120"
show-overflow-tooltip></el-table-column> show-overflow-tooltip></el-table-column>
<el-table-column prop="account" label="题型" align="center" width="100"> <el-table-column prop="questionType" label="题型" align="center" width="70" sortable="custom">
<template slot-scope="scope">{{ questionTypes.find(e => e.id === scope.row.questionType) ? <template slot-scope="scope">{{ questionTypes.find(e => e.id === scope.row.questionType) ?
questionTypes.find(e => e.id === scope.row.questionType).name : '' }}</template> questionTypes.find(e => e.id === scope.row.questionType).name : '' }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="professionalName" label="专业" align="center" min-width="120"></el-table-column> <el-table-column prop="professionalName" label="专业" align="center" min-width="100"></el-table-column>
<el-table-column prop="knowledgePointName" label="知识点" align="center" min-width="120"></el-table-column> <el-table-column prop="knowledgePointName" label="知识点" align="center" min-width="100"></el-table-column>
<el-table-column prop="givenYear" label="年份" align="center" width="50"></el-table-column> <el-table-column prop="givenYear" label="年份" align="center" width="70" sortable="custom"></el-table-column>
<el-table-column prop="difficulty" label="难度" align="center" width="50"> <el-table-column prop="difficulty" label="难度" align="center" width="70" sortable="custom">
<template slot-scope="scope">{{ difficults.find(e => e.id === scope.row.difficulty) ? difficults.find(e => <template slot-scope="scope">{{ difficults.find(e => e.id === scope.row.difficulty) ? difficults.find(e =>
e.id === scope.row.difficulty).name : '' }}</template> e.id === scope.row.difficulty).name : '' }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="correctRate" label="正确率" align="center" width="60"></el-table-column> <el-table-column prop="correctRate" label="正确率" align="center" width="80" sortable="custom"></el-table-column>
<el-table-column prop="updateTime" label="更新时间" align="center" width="140"></el-table-column> <el-table-column prop="updateTime" label="更新时间" align="center" width="140"
sortable="custom"></el-table-column>
<el-table-column prop="lastEditor" label="最近编辑人" align="center" width="90"></el-table-column> <el-table-column prop="lastEditor" label="最近编辑人" align="center" width="90"></el-table-column>
<el-table-column prop="referenceCount" label="已引用试卷(套)" align="center" width="100"></el-table-column> <el-table-column prop="referenceCount" label="已引用试卷(套)" align="center" width="130"
sortable="custom"></el-table-column>
<el-table-column label="操作" align="center" width="300"> <el-table-column label="操作" align="center" width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="copy(scope.row)">复制</el-button> <el-button type="text" @click="toDetail(scope.row, 1)">复制</el-button>
<el-button type="text" @click="toDetail(scope.row, 1)">查看</el-button> <el-button type="text" @click="toDetail(scope.row, 2)">查看</el-button>
<el-button type="text" @click="toDetail(scope.row)">编辑</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"
@ -137,7 +139,21 @@
</div> </div>
</div> </div>
<Detail :visible.sync="quesVisible" :row.sync="curRow" :readonly.sync="readonly" /> <Detail :visible.sync="quesVisible" :row.sync="curRow" :detailType.sync="detailType" />
<el-dialog title="提示" :visible.sync="delVisible" width="400px" :close-on-click-modal="false" custom-class="del-dia">
<div class="del-wrap">
<div class="icon el-icon-warning"></div>
<div>
<p>该试题已被以下试卷引用确定删除</p>
<p class="tips">删除后此题库分类及其子分类将被删除已关联题库将无分类</p>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="delVisible = false">取消</el-button>
<el-button type="primary" @click="delSubmit">确定</el-button>
</span>
</el-dialog>
<el-dialog title="批量导入试题" :visible.sync="importVisible" width="520px" :close-on-click-modal="false" <el-dialog title="批量导入试题" :visible.sync="importVisible" width="520px" :close-on-click-modal="false"
:modal-append-to-body="false"> :modal-append-to-body="false">
@ -231,6 +247,12 @@ export default {
specialtyIds: [], specialtyIds: [],
status: '', status: '',
keyword: '', keyword: '',
questionTypeSort: '',
givenYearSort: '',
difficultySort: '',
correctRateSort: '',
updateTimeSort: '',
referenceCountSort: '',
}, },
list: [], list: [],
page: 1, page: 1,
@ -240,7 +262,10 @@ export default {
quesVisible: false, quesVisible: false,
curRow: {}, curRow: {},
readonly: false, detailType: '',
delVisible: false,
curUsePapers: [],
form: {}, form: {},
importVisible: false, importVisible: false,
@ -371,44 +396,74 @@ export default {
this.page = 1 this.page = 1
this.getList() this.getList()
}, },
//
sortChange (column) {
if (column.prop === 'questionType') this.filter.questionTypeSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
if (column.prop === 'givenYear') this.filter.givenYearSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
if (column.prop === 'difficulty') this.filter.difficultySort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
if (column.prop === 'correctRate') this.filter.correctRateSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
if (column.prop === 'updateTime') this.filter.updateTimeSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
if (column.prop === 'referenceCount') this.filter.referenceCountSort = column.order ? column.order === 'ascending' ? 'asc' : 'desc' : ''
this.getList()
},
// //
add () { add () {
this.quesVisible = true this.quesVisible = true
this.curRow = {} this.curRow = {}
this.readonly = false this.detailType = ''
}, },
// //
copy (row) { copy (row) {
}, },
// / // / type: 123
toDetail (row, readonly = false) { toDetail (row, type) {
this.quesVisible = true this.quesVisible = true
this.curRow = row this.curRow = row
this.readonly = readonly this.detailType = type
}, },
// //
del (row) { async del (row) {
this.$confirm("确定要删除吗?", "提示", { //
type: "warning" const { list } = await this.$post(this.api.checkQuestionIsUse, [row.questionId])
}).then(() => { if (list.length) {
this.$post(`${this.api.delPartnerAccount}?accountId=${row.accountId}`).then(res => { this.curUsePapers = list
Util.successMsg("删除成功") this.delVisible = true
} else {
try {
await this.$confirm(`确认要删除吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false,
})
await this.$post(this.api.delQuestion, [row.questionId])
Util.successMsg('删除成功')
this.getList() this.getList()
}).catch(res => { }) } catch (e) { }
}).catch(() => { }) }
}, },
//
async switchOff (val, row) { async switchOff (val, row) {
this.$post(this.api.disabledEventsCompetition, { try {
competitionId: row.id, row.status = val ? 0 : 1 //
isOpen: val, if (!val) {
type: 0 // (01) await this.$confirm(`<p>确认要禁用【${row.stem}】吗?</p><p style="color: #f56c6c;">禁用后已引用该试题的试卷将会变成草稿,再次启用后,试卷将自动发布</p>`, '提示', {
}).then(res => { confirmButtonText: '确定',
Util.successMsg(val == 1 ? '禁用成功' : '启用成功') cancelButtonText: '取消',
}).catch(err => { }) type: 'warning',
closeOnClickModal: false,
await this.$post(`${this.api.refreshPageNotification}?content=1`) dangerouslyUseHTMLString: true,
})
}
await this.$post(`${this.api.disableOrEnableQuestion}?questionId=${row.questionId}&status=${val}`)
row.status = val
Util.successMsg(val ? '启用成功' : '禁用成功')
this.getList()
} catch (e) {
row.status = val ? 0 : 1
}
}, },

@ -24,7 +24,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="suggestTime" label="估计用时"> <el-form-item prop="suggestTime" label="估计用时">
<el-input placeholder="请输入估计用时" v-model="form.suggestTime"> <el-input placeholder="请输入估计用时" v-model.number="form.suggestTime">
<template slot="append">分钟</template> <template slot="append">分钟</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -59,7 +59,7 @@
</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">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.questionType" placeholder="请选择题型"> <el-select v-model="scope.row.questionType" placeholder="请选择题型" @change="questionTypeChange(scope.row)">
<el-option v-for="(item, i) in questionTypes" :key="i" :label="item.name" :value="item.id"></el-option> <el-option v-for="(item, i) in questionTypes" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</template> </template>
@ -76,7 +76,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>
@ -88,7 +88,7 @@
<div class="flex j-between a-center"> <div class="flex j-between a-center">
<p>选择试题</p> <p>选择试题</p>
<div> <div>
<el-button type="primary">一键分配分值</el-button> <el-button type="primary" @click="allocationAll">一键分配分值</el-button>
<el-button type="primary">自动选题</el-button> <el-button type="primary">自动选题</el-button>
</div> </div>
</div> </div>
@ -104,32 +104,37 @@
<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="showQuesDia(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>
</div> </div>
</div> </div>
<p class="sum">本大题共{{ item.questionNum }}小题{{ item.targetScore }}</p> <p class="sum">本大题共{{ item.questionNum }}小题{{ item.targetScore }}</p>
<div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-wrap">
<el-checkbox v-model="ques.check"></el-checkbox> <div :class="['ques-wrap', { hide: item.shrink }]">
<div class="ques-info"> <div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-item">
<div class="top-line"> <el-checkbox v-model="ques.check"></el-checkbox>
<span class="label">{{ j + 1 }} / 10</span> <div class="ques-info">
<span class="label">{{ item.questionType }}</span> <div class="top-line">
<div v-html="ques.stem"></div>{{ ques.score }} <span class="label">{{ j + 1 }} / 10</span>
<p><el-input class="score" placeholder="请输入" v-model="ques.score" /></p> <span class="label">{{ questionTypes.find(e => e.id === item.questionType).name }}</span>
</div> <div v-html="ques.stem"></div>
<!-- <div v-for="(opt, j) in ques.examQuestions" :key="j" class="opts"> <p><el-input class="score" placeholder="请输入" v-model="ques.score" /></p>
</div>
<!-- <div v-for="(opt, j) in ques.examQuestions" :key="j" class="opts">
<div v-html=""></div> <div v-html=""></div>
</div> --> </div> -->
<div class="bottom-line"> <div class="bottom-line">
<div class="correct">正确答案A</div> <div class="correct">正确答案A</div>
<div class="actions"> <div class="actions">
<div class="sort"> <div class="sort">
<span>排序</span> <span>排序</span>
<el-input class="score" v-model="ques.sort" /> <el-input class="score" v-model="ques.sort" />
</div>
<el-button type="text">编辑试题</el-button>
<el-button type="text" @click="showQuesDia(item, j, ques)">更换试题</el-button>
<el-button type="text" @click="showQuesDia(item, j)">添加试题</el-button>
<el-button type="text" @click="delQues(item, j)">移除试题</el-button>
</div> </div>
<el-button type="text">编辑试题</el-button>
<el-button type="text">更换试题</el-button>
<el-button type="text" @click="showQuesDia(item, j)">添加试题</el-button>
<el-button type="text" @click="delQues(item, j)">移除试题</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -206,36 +211,41 @@ export default {
examQuestions: [], examQuestions: [],
outlineName: '单选题', outlineName: '单选题',
questionNum: '10', questionNum: '10',
questionType: '单选题', questionType: 'single_choice',
targetScore: '20.0', targetScore: '20.0',
shrink: false,
}, },
{ {
examQuestions: [], examQuestions: [],
outlineName: '多选题', outlineName: '多选题',
questionNum: '5', questionNum: '5',
questionType: '多选题', questionType: 'multiple_choice',
targetScore: '15.0', targetScore: '15.0',
shrink: false,
}, },
{ {
examQuestions: [], examQuestions: [],
outlineName: '判断题', outlineName: '判断题',
questionNum: '5', questionNum: '5',
questionType: '判断题', questionType: 'judgement',
targetScore: '10.0', targetScore: '10.0',
shrink: false,
}, },
{ {
examQuestions: [], examQuestions: [],
outlineName: '填空题', outlineName: '填空题',
questionNum: '5', questionNum: '5',
questionType: '填空题', questionType: 'fill_blank',
targetScore: '15.0', targetScore: '15.0',
shrink: false,
}, },
{ {
examQuestions: [], examQuestions: [],
outlineName: '问答题', outlineName: '问答题',
questionNum: '3', questionNum: '3',
questionType: '问答题', questionType: 'essay',
targetScore: '40.0', targetScore: '40.0',
shrink: false,
}, },
], ],
}, },
@ -260,6 +270,7 @@ export default {
quesVisible: false, quesVisible: false,
curType: {}, curType: {},
curQuesIndex: 0, curQuesIndex: 0,
curQues: null,
}; };
}, },
computed: { computed: {
@ -316,6 +327,12 @@ export default {
showTemplate () { showTemplate () {
this.templateVisible = true this.templateVisible = true
}, },
//
questionTypeChange (row) {
// 5
if (this.questionTypes.find(e => e.name === row.outlineName)) row.outlineName = this.questionTypes.find(e => e.id === row.questionType).name
},
// //
addLine (i) { addLine (i) {
this.form.paperOutline.splice(i + 1, 0, { this.form.paperOutline.splice(i + 1, 0, {
@ -324,17 +341,40 @@ export default {
questionNum: '', questionNum: '',
questionType: '', questionType: '',
targetScore: '', targetScore: '',
shrink: false,
}) })
}, },
// //
delLine (i) { delLine (i) {
this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1) this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1)
}, },
//
async allocationAll () {
const paper = this.form.paperOutline
const { data } = await this.$post(this.api.avgValues, {
avgValueList: paper.map(e => {
return {
questionNum: e.examQuestions.length,
targetScore: e.targetScore,
}
})
})
if (data && data.avgValueList && data.avgValueList.length) {
data.avgValueList.map((e, i) => {
// scores-1
e.scores.includes(-1) || e.scores.map((n, j) => {
paper[i].examQuestions[j].score = n
})
})
}
},
// //
showQuesDia (item, i) { showQuesDia (item, i, ques) {
// debugger
this.curType = item this.curType = item
this.curQuesIndex = i this.curQuesIndex = i
this.curQues = ques
this.quesVisible = true this.quesVisible = true
}, },
// //
@ -382,11 +422,51 @@ export default {
}, },
// //
async submit (status) { async submit (status) {
// this.form.paperOutline[0].examQuestions.reduce((prev, curr) => {
// console.log(111, prev, curr)
// // + prev.score + +curr.score
// }, 0)
// 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) => {
if (valid) { if (valid) {
const form = _.cloneDeep(this.form) const form = _.cloneDeep(this.form)
// if (!form.categoryIds.length) return Util.warningMsg('') if (isNaN(form.suggestTime) || form.suggestTime < 1 || form.suggestTime % 1) return Util.warningMsg('估计用时请输入正整数')
const paper = form.paperOutline
let invalid = 0
for (const i in paper) {
const e = paper[i]
if (!e.questionType) {
Util.warningMsg('请选择题型')
invalid = 1
break
}
if (!e.questionNum) {
Util.warningMsg('请输入目标题数')
invalid = 1
break
}
if (!e.targetScore) {
Util.warningMsg('请输入目标分值')
invalid = 1
break
}
//
if (+e.questionNum !== e.examQuestions.length) {
Util.warningMsg(`${this.arabicToChinese(i + 1)}大题的小题总数跟目标题数不一致,请重新修改`)
invalid = 1
break
}
//
// if (+e.targetScore !== e.examQuestions.length) {
// Util.warningMsg(`${this.arabicToChinese(i + 1)}`)
// invalid = 1
// break
// }
}
if (invalid) return false
this.submiting = true this.submiting = true
form.particularYear = +(dayjs(form.particularYear).format('YYYY')) form.particularYear = +(dayjs(form.particularYear).format('YYYY'))
form.libraryId = this.libraryId form.libraryId = this.libraryId
@ -394,7 +474,8 @@ export default {
form.remarks = this.$refs.remarks.getUEContent() form.remarks = this.$refs.remarks.getUEContent()
form.score = this.score form.score = this.score
form.status = status form.status = status
form.paperOutline.map(e => {
paper.map(e => {
e.targetScore = +e.targetScore e.targetScore = +e.targetScore
e.examQuestions = e.examQuestions.map(n => { e.examQuestions = e.examQuestions.map(n => {
return { return {
@ -403,9 +484,9 @@ export default {
} }
}) })
}) })
debugger
if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1] if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1]
form.questionType = [...new Set(form.paperOutline.map(e => e.questionType))].join('、') form.questionType = [...new Set(paper.map(e => e.questionType))].join('、')
form.createSource = 1 form.createSource = 1
try { try {
await this.$post(this.api.saveExamPaper, form) await this.$post(this.api.saveExamPaper, form)
@ -427,10 +508,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.action-icon {
margin-right: 10px;
}
.ques { .ques {
li { li {
padding: 15px; padding: 15px;
@ -449,6 +526,13 @@ export default {
font-size: 13px; font-size: 13px;
} }
.arrow {
margin-left: 10px;
font-size: 16px;
color: #a9a9a9;
cursor: pointer;
}
.sum { .sum {
margin: 15px 0; margin: 15px 0;
font-size: 13px; font-size: 13px;
@ -456,6 +540,16 @@ export default {
} }
.ques-wrap { .ques-wrap {
// transition: 2s;
transition-property: height;
transition-duration: .25s, 1s;
&.hide {
height: 0;
}
}
.ques-item {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;

@ -43,8 +43,14 @@
</div> </div>
<!-- 已选试题 --> <!-- 已选试题 -->
<div class="item"> <div class="item">
<div v-if="$parent.curQues" class="m-b-20">
<p class="total m-b-10">原试题共1道题</p>
<div v-html="$parent.curQues.stem"></div>
</div>
<div class="flex j-between a-center"> <div class="flex j-between a-center">
<p class="total">已选试题{{ checkedLen }}道题</p> <p v-if="$parent.curQues" class="total">更换试题{{ checked.length }}道题</p>
<p v-else class="total">已选试题{{ checkedLen }}道题</p>
<el-button type="text" @click="batchDelChecked">批量移除</el-button> <el-button type="text" @click="batchDelChecked">批量移除</el-button>
</div> </div>
<div class="ques"> <div class="ques">
@ -58,7 +64,7 @@
<div class="check-left"> <div class="check-left">
<el-checkbox v-model="item.check"></el-checkbox> <el-checkbox v-model="item.check"></el-checkbox>
<span class="serial">{{ i + 1 }}</span> <span class="serial">{{ i + 1 }}</span>
<span>{{ item.stem }}</span> <div v-html="item.stem"></div>
</div> </div>
<i class="el-icon-delete action-icon" @click="delChecked(item)"></i> <i class="el-icon-delete action-icon" @click="delChecked(item)"></i>
</div> </div>
@ -67,7 +73,8 @@
</div> </div>
<div class="flex j-between"> <div class="flex j-between">
<p>未找到试题<a class="link" @click="toAddQues">去新增</a></p> <p>未找到试题<a class="link" @click="toAddQues">去新增</a></p>
<p>已选题数/目标题数0/10&emsp;&emsp;<a class="link" @click="toEditQues">修改目标</a></p> <p>已选题数/目标题数{{ checkedLen }}/{{ $parent.curType.questionNum }}&emsp;&emsp;<a class="link"
@click="toEditQues">修改目标</a></p>
</div> </div>
@ -138,6 +145,7 @@ export default {
this.quesBankKeyword = '' this.quesBankKeyword = ''
this.knowledgeKeyword = '' this.knowledgeKeyword = ''
//
const parent = this.$parent.curType const parent = this.$parent.curType
this.curCheckQues = parent.examQuestions this.curCheckQues = parent.examQuestions
@ -172,19 +180,15 @@ export default {
let k = this.$refs.knowledge.getCurrentNode() // let k = this.$refs.knowledge.getCurrentNode() //
// //
if (k && k.type) { if (k && k.type) {
let { questionType } = this const { list } = await this.$post(this.api.findAllByQuestionBank, {
if (questionType) questionType = QuesConst.questionTypes.find(e => e.name === questionType).id
const { message } = await this.$post(this.api.listQuestion, {
pageNum: 1,
pageSize: 1000,
status: 1, status: 1,
// questionBankId: this.$refs.quesBank.getCurrentKey(), // questionBankId: this.$refs.quesBank.getCurrentKey(),
// knowledgePointIds: [k.id], // knowledgePointIds: [k.id],
questionTypes: questionType ? [questionType] : [], questionTypes: this.questionType ? [this.questionType] : [],
questionBankId: 26, questionBankId: 26,
knowledgePointIds: [18], knowledgePointIds: [18],
}) })
const data = message.records const data = list
const checked = this.curCheckQues const checked = this.curCheckQues
data.map(e => { data.map(e => {
const el = document.createElement('div') const el = document.createElement('div')
@ -194,7 +198,6 @@ export default {
e.disabled = !!checked.find(n => n.questionVersionId === e.questionId) e.disabled = !!checked.find(n => n.questionVersionId === e.questionId)
}) })
this.ques = data this.ques = data
console.log("🚀 ~ getQues ~ data:", data, checked)
} }
}, },
// //
@ -293,7 +296,7 @@ export default {
const checked = _.cloneDeep(this.checked) const checked = _.cloneDeep(this.checked)
if (!checked.length) return Util.warningMsg('请选择试题') if (!checked.length) return Util.warningMsg('请选择试题')
const { curType, curQuesIndex } = this.$parent const { curType, curQuesIndex, curQues } = this.$parent
if (this.checkedLen > +curType.questionNum) return Util.warningMsg(`目标题数为${curType.questionNum},已选题数不得大于目标题数`) if (this.checkedLen > +curType.questionNum) return Util.warningMsg(`目标题数为${curType.questionNum},已选题数不得大于目标题数`)
try { try {
@ -304,7 +307,17 @@ export default {
this.$set(e, 'questionVersionId', e.questionId) this.$set(e, 'questionVersionId', e.questionId)
}) })
// debugger // debugger
typeof curQuesIndex === 'number' ? curType.examQuestions.splice(curQuesIndex + 1, 0, ...checked) : curType.examQuestions.push(...checked)
if (curQues) {
// curQues
this.curCheckQues.splice(curQuesIndex, 1, ...checked)
} else {
// curQuesIndex
typeof curQuesIndex === 'number' ?
this.curCheckQues.splice(curQuesIndex + 1, 0, ...checked) :
this.curCheckQues.push(...checked)
}
this.quesVisible = false this.quesVisible = false
this.submiting = false this.submiting = false
} catch (e) { } catch (e) {

Loading…
Cancel
Save