|
|
@ -5,6 +5,31 @@ |
|
|
|
@closed="closeDia"> |
|
|
|
@closed="closeDia"> |
|
|
|
<div class="tool"> |
|
|
|
<div class="tool"> |
|
|
|
<ul class="filter"> |
|
|
|
<ul class="filter"> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<label>试卷库</label> |
|
|
|
|
|
|
|
<el-select v-model="filter.libraryId" placeholder="请选择试卷库" @change="initData"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in paperLibraries" :key="i" :label="item.libraryName" :value="item.libraryId"> |
|
|
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<label>建议用途</label> |
|
|
|
|
|
|
|
<el-select v-model="filter.paperType" clearable placeholder="请选择状态" @change="initData"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in paperTypes" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<label>试卷难度</label> |
|
|
|
|
|
|
|
<el-select v-model="filter.difficult" clearable multiple placeholder="请选择试卷难度" @change="initData"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<label>题目类型</label> |
|
|
|
|
|
|
|
<el-select v-model="questionType" clearable multiple placeholder="请选择题目类型" @change="initData"> |
|
|
|
|
|
|
|
<el-option v-for="(item, i) in questionTypes" :key="i" :label="item.name" :value="item.name"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</li> |
|
|
|
<li> |
|
|
|
<li> |
|
|
|
<label>搜索</label> |
|
|
|
<label>搜索</label> |
|
|
|
<el-input style="width: 250px;" placeholder="请输入试卷名称" prefix-icon="el-icon-search" v-model="filter.keyWord" |
|
|
|
<el-input style="width: 250px;" placeholder="请输入试卷名称" prefix-icon="el-icon-search" v-model="filter.keyWord" |
|
|
@ -12,14 +37,14 @@ |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" @click="add">自定义理论试卷</el-button> |
|
|
|
<!-- <el-button type="primary" @click="add">自定义理论试卷</el-button> --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="projects" class="table" stripe header-align="center"> |
|
|
|
<el-table :data="papers" class="table" stripe header-align="center" @sort-change="sortChange"> |
|
|
|
<el-table-column width="60" label="选择" align="center"> |
|
|
|
<el-table-column width="60" label="选择" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-radio v-model="scope.row.paperId" :label="scope.row.paperId"> </el-radio> |
|
|
|
<el-radio v-model="form.paperId" :label="scope.row.paperId"> </el-radio> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<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> |
|
|
@ -41,15 +66,21 @@ |
|
|
|
<template slot-scope="scope">{{ paperTypes.find(e => e.id === scope.row.paperType) ? paperTypes.find(e => |
|
|
|
<template slot-scope="scope">{{ paperTypes.find(e => e.id === scope.row.paperType) ? paperTypes.find(e => |
|
|
|
e.id === scope.row.paperType).name : '' }}</template> |
|
|
|
e.id === scope.row.paperType).name : '' }}</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="updateTime" label="最近编辑时间" align="center" width="170"></el-table-column> |
|
|
|
<el-table-column prop="updateTime" label="最近编辑时间" align="center" width="170" |
|
|
|
|
|
|
|
sortable="custom"></el-table-column> |
|
|
|
<el-table-column prop="createUser" label="最近编辑人" align="center" width="110"></el-table-column> |
|
|
|
<el-table-column prop="createUser" label="最近编辑人" align="center" width="110"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="操作" align="center" width="80"> |
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<el-button type="text" @click="previewPaper(scope.row)">预览</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
|
<div class="pagination"> |
|
|
|
<div class="pagination"> |
|
|
|
<el-pagination background :page-size="pageSize" @current-change="handleCurrentChange" |
|
|
|
<el-pagination background :page-size="pageSize" @current-change="handleCurrentChange" |
|
|
|
layout="total,prev, pager, next" :total="total"></el-pagination> |
|
|
|
layout="total,prev, pager, next" :total="total"></el-pagination> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="selectQuesVisible = false">取消</el-button> |
|
|
|
<el-button @click="listVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" :loading="submiting" @click="submit">确定</el-button> |
|
|
|
<el-button type="primary" :loading="submiting" @click="submit">确定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
@ -59,38 +90,32 @@ |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
|
|
|
|
|
import QuesConst from '@/const/ques' |
|
|
|
|
|
|
|
import TestPaperConst from '@/const/testPaper' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
props: ['visible'], |
|
|
|
props: ['visible', 'form'], |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
arabicToChinese: Util.arabicToChinese, |
|
|
|
arabicToChinese: Util.arabicToChinese, |
|
|
|
|
|
|
|
questionTypes: QuesConst.questionTypes, |
|
|
|
|
|
|
|
difficults: TestPaperConst.difficults, |
|
|
|
|
|
|
|
paperTypes: TestPaperConst.paperTypes, |
|
|
|
listVisible: false, |
|
|
|
listVisible: false, |
|
|
|
searchTimer: null, |
|
|
|
searchTimer: null, |
|
|
|
questionTypes: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: '单选题' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: '多选题' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: '判断题' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: '填空题' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: '问答题' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
questionType: [], |
|
|
|
|
|
|
|
paperLibraries: [], |
|
|
|
filter: { |
|
|
|
filter: { |
|
|
|
|
|
|
|
libraryId: '', |
|
|
|
|
|
|
|
paperType: '', |
|
|
|
|
|
|
|
difficult: [], |
|
|
|
keyWord: '', |
|
|
|
keyWord: '', |
|
|
|
}, |
|
|
|
}, |
|
|
|
list: [], |
|
|
|
list: [], |
|
|
|
page: 1, |
|
|
|
page: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
total: 0, |
|
|
|
total: 0, |
|
|
|
|
|
|
|
paperId: '', |
|
|
|
submiting: false, |
|
|
|
submiting: false, |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
@ -113,13 +138,14 @@ export default { |
|
|
|
async getList () { |
|
|
|
async getList () { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const res = await this.$post(this.api.examPaperList, { |
|
|
|
const res = await this.$post(this.api.examPaperList, { |
|
|
|
|
|
|
|
...this.filter, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: this.pageSize, |
|
|
|
type: 1, |
|
|
|
type: 1, |
|
|
|
keyWord: this.keyword, |
|
|
|
keyWord: this.keyword, |
|
|
|
libraryId: this.systemId |
|
|
|
libraryId: this.systemId |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.projects = res.pageList.records |
|
|
|
this.papers = res.pageList.records |
|
|
|
this.total = res.pageList.total |
|
|
|
this.total = res.pageList.total |
|
|
|
} catch (e) { } |
|
|
|
} catch (e) { } |
|
|
|
}, |
|
|
|
}, |
|
|
@ -128,102 +154,50 @@ export default { |
|
|
|
this.page = val |
|
|
|
this.page = val |
|
|
|
this.getList() |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
handleCurrentChange (val) { |
|
|
|
|
|
|
|
this.page = val |
|
|
|
|
|
|
|
this.getList() |
|
|
|
|
|
|
|
}, |
|
|
|
initData () { |
|
|
|
initData () { |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getList() |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 排序回调 |
|
|
|
|
|
|
|
sortChange (column) { |
|
|
|
|
|
|
|
if (column.prop === 'updateTime') this.filter.updateTimeOrder = column.order ? column.order === 'ascending' ? 1 : 2 : '' |
|
|
|
|
|
|
|
this.getList() |
|
|
|
|
|
|
|
}, |
|
|
|
// 新增 |
|
|
|
// 新增 |
|
|
|
add () { |
|
|
|
add () { |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
this.detailVisible = true |
|
|
|
this.detailVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 试卷大纲添加行 |
|
|
|
// 预览试卷 |
|
|
|
addLine (i) { |
|
|
|
previewPaper (row) { |
|
|
|
this.form.paperOutline.splice(i + 1, 0, { |
|
|
|
this.$parent.previewPaper(row) |
|
|
|
examQuestions: [], |
|
|
|
|
|
|
|
outlineName: '', |
|
|
|
|
|
|
|
questionNum: '', |
|
|
|
|
|
|
|
questionType: '', |
|
|
|
|
|
|
|
targetScore: '', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 试卷大纲移除行 |
|
|
|
|
|
|
|
delLine (i) { |
|
|
|
|
|
|
|
this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 使用模板 |
|
|
|
|
|
|
|
async useTemplate (row) { |
|
|
|
|
|
|
|
const data = await this.getDetail(row.templateId) |
|
|
|
|
|
|
|
this.$parent.form.paperOutline = data.paperOutline |
|
|
|
|
|
|
|
this.listVisible = false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 获取详情 |
|
|
|
|
|
|
|
async getDetail (id) { |
|
|
|
|
|
|
|
const res = await this.$get(this.api.templateDetails, { |
|
|
|
|
|
|
|
id |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return res.template |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 编辑 |
|
|
|
|
|
|
|
async edit (row) { |
|
|
|
|
|
|
|
this.detailVisible = true |
|
|
|
|
|
|
|
const data = await this.getDetail(row.templateId) |
|
|
|
|
|
|
|
this.form = data |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 删除 |
|
|
|
|
|
|
|
async del (row) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
await this.$confirm(`确认要删除【${row.templateName}】吗?`, '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
await this.$post(this.api.deleteTemplate, { |
|
|
|
|
|
|
|
ids: [row.templateId] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
|
|
|
this.getList() |
|
|
|
|
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
async submit () { |
|
|
|
async submit () { |
|
|
|
if (this.submiting) return false |
|
|
|
const { paperId } = this.form |
|
|
|
|
|
|
|
if (!paperId) return Util.warningMsg('请选择试卷') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const curPaper = this.papers.find(e => e.paperId === paperId) |
|
|
|
|
|
|
|
if (curPaper) this.form.paperName = curPaper.name |
|
|
|
|
|
|
|
this.handlePaper() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 复制试卷 |
|
|
|
|
|
|
|
async handlePaper () { |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
|
if (!form.templateName) return Util.warningMsg('请输入模板名称') |
|
|
|
// 老的试卷名称不等于新的试卷名称,则复制一份试卷,再把新的试卷id替换掉 |
|
|
|
let invalid = 0 |
|
|
|
if (form.paperName !== form.originPaperName) { |
|
|
|
for (const e of form.paperOutline) { |
|
|
|
const res = await this.$post(this.api.copyExamPaper, { |
|
|
|
if (!e.questionType) { |
|
|
|
associatedID: form.stageId, |
|
|
|
Util.warningMsg('请选择题型') |
|
|
|
paperId: form.paperId, |
|
|
|
invalid = 1 |
|
|
|
typeId: 1 |
|
|
|
break |
|
|
|
}) |
|
|
|
} |
|
|
|
if (res.examPaper) { |
|
|
|
if (!e.questionNum) { |
|
|
|
form.paperId = res.examPaper.paperId |
|
|
|
Util.warningMsg('请输入目标题数') |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!e.targetScore) { |
|
|
|
|
|
|
|
Util.warningMsg('请输入目标分值') |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (invalid) return false |
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
|
|
|
|
form.createSource = 1 |
|
|
|
|
|
|
|
form.questionNum = this.questionNum |
|
|
|
|
|
|
|
form.totalScore = this.totalScore |
|
|
|
|
|
|
|
form.outlineNum = form.paperOutline.length |
|
|
|
|
|
|
|
form.questionType = [...new Set(form.paperOutline.map(e => e.questionType))].join('、') |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
await this.$post(this.api.saveExamPaperTemplate, form) |
|
|
|
|
|
|
|
Util.successMsg('保存成功') |
|
|
|
|
|
|
|
this.detailVisible = false |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
this.getList() |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 弹框关闭回调 |
|
|
|
// 弹框关闭回调 |
|
|
|