|
|
|
@ -29,28 +29,30 @@ |
|
|
|
|
<!-- 理论系统选择试卷库,非理论则选择系统 --> |
|
|
|
|
<el-card shadow="hover" class="m-b-20"> |
|
|
|
|
<div> |
|
|
|
|
<el-radio-group class="m-b-20" v-model="courseSystem"> |
|
|
|
|
<el-radio-group class="m-b-20" v-model="courseSystem" @change="courseSystemChange"> |
|
|
|
|
<el-radio :label="0">从课程中选择</el-radio> |
|
|
|
|
<el-radio :label="1">从系统中选择</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
|
|
<div class="inline-input"> |
|
|
|
|
<!-- 理论 && 选择课程 --> |
|
|
|
|
<el-select v-if="isTheory && !courseSystem" v-model="libraryId" placeholder="请选择试卷库" @change="getProject"> |
|
|
|
|
<el-option v-for="(item, i) in paperLibraries" :key="i" :label="item.libraryName" :value="item.libraryId"> |
|
|
|
|
<!-- 选择系统 --> |
|
|
|
|
<el-select v-if="courseSystem" v-model="systemId" placeholder="请选择系统" @change="getProject"> |
|
|
|
|
<el-option v-for="(item, i) in services" :key="i" :label="item.systemName" :value="item.systemId"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
|
|
<!-- 实训 && 选择课程 --> |
|
|
|
|
<el-cascader v-else-if="!isTheory && !courseSystem" ref="cur" v-model="mallIds" :options="curs" |
|
|
|
|
:props="{ checkStrictly: true, value: 'id' }" popper-class="course-cas" @expand-change="curChange" |
|
|
|
|
@change="curChange"></el-cascader> |
|
|
|
|
<template v-else> |
|
|
|
|
<!-- 理论 && 选择课程 --> |
|
|
|
|
<el-select v-if="isTheory && !courseSystem" v-model="libraryId" placeholder="请选择试卷库" @change="getProject"> |
|
|
|
|
<el-option v-for="(item, i) in paperLibraries" :key="i" :label="item.libraryName" :value="item.libraryId"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
|
|
<!-- 实训 && 选择系统 --> |
|
|
|
|
<el-select v-else-if="!isTheory && courseSystem" v-model="systemId" placeholder="请选择系统" @change="getProject"> |
|
|
|
|
<el-option v-for="(item, i) in services" :key="i" :label="item.systemName" :value="item.systemId"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<!-- 实训 && 选择课程 --> |
|
|
|
|
<el-cascader v-else-if="!isTheory && !courseSystem" ref="cur" v-model="mallIds" :options="curs" |
|
|
|
|
:props="{ checkStrictly: true, value: 'id' }" popper-class="course-cas" @expand-change="curChange" |
|
|
|
|
@change="curChange"></el-cascader> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
@ -67,7 +69,7 @@ |
|
|
|
|
</div> |
|
|
|
|
<p v-if="form.paperName" style="margin-bottom: 20px"> |
|
|
|
|
已选试卷:{{ form.paperName }} |
|
|
|
|
<el-button type="primary" size="mini" @click="previewPaper(form)">预览</el-button> |
|
|
|
|
<!-- <el-button type="primary" size="mini" @click="previewPaper(form)">预览</el-button> --> |
|
|
|
|
</p> |
|
|
|
|
<el-table :data="projects" class="table" header-align="center"> |
|
|
|
|
<el-table-column width="60" label="选择" align="center"> |
|
|
|
@ -96,7 +98,7 @@ |
|
|
|
|
<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> |
|
|
|
|
<!-- <el-button type="text" @click="previewPaper(scope.row)">预览</el-button> --> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -202,12 +204,11 @@ export default { |
|
|
|
|
keyword: function (val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
this.initData() |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
// this.getCourse() |
|
|
|
|
this.getSystem() |
|
|
|
|
// this.isTheory ? this.getLibrary() : this.getCourse() |
|
|
|
|
}, |
|
|
|
@ -237,11 +238,23 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 获取系统 |
|
|
|
|
async getSystem () { |
|
|
|
|
const { data } = await this.$get(this.api.getSystemListOfMall) |
|
|
|
|
const { data } = await this.$get(this.api.getSystemListOfMall, { |
|
|
|
|
type: this.isTheory ? 3 : 1 |
|
|
|
|
}) |
|
|
|
|
this.services = data |
|
|
|
|
this.systemId = data[0].systemId |
|
|
|
|
this.loadIns = Loading.service() |
|
|
|
|
this.getProject() |
|
|
|
|
if (data.length) { |
|
|
|
|
this.systemId = this.form.systemId || data[0].systemId |
|
|
|
|
this.getProject() |
|
|
|
|
this.loadIns = Loading.service() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 课程系统切换 |
|
|
|
|
courseSystemChange (val) { |
|
|
|
|
if (val) { |
|
|
|
|
this.getSystem() |
|
|
|
|
} else { |
|
|
|
|
this.isTheory ? this.getLibrary() : this.getCourse() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 课程选择回调 |
|
|
|
|
curChange (val) { |
|
|
|
@ -280,27 +293,32 @@ export default { |
|
|
|
|
// 查询项目 |
|
|
|
|
async getProject () { |
|
|
|
|
try { |
|
|
|
|
// 理论查询试卷 |
|
|
|
|
if (this.isTheory) { |
|
|
|
|
const res = await this.$post(this.api.examPaperList, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
type: 1, |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
libraryId: this.libraryId, |
|
|
|
|
isDisable: 0, |
|
|
|
|
status: 1 |
|
|
|
|
// 根据系统查询项目 |
|
|
|
|
if (this.courseSystem) { |
|
|
|
|
const { data } = await this.$get(this.api.getProjectListOfSystem, { |
|
|
|
|
systemId: this.systemId |
|
|
|
|
}) |
|
|
|
|
this.projects = res.pageList.records |
|
|
|
|
this.total = res.pageList.total |
|
|
|
|
} else { // 实训 |
|
|
|
|
// 根据系统查询项目 |
|
|
|
|
if (this.courseSystem) { |
|
|
|
|
const res = await this.$get(this.api.getProjectListOfSystem, { |
|
|
|
|
systemId: this.systemId |
|
|
|
|
if (this.isTheory) { |
|
|
|
|
data.forEach(e => { |
|
|
|
|
e.name = e.projectName |
|
|
|
|
}) |
|
|
|
|
this.projects = res.data |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
this.projects = data |
|
|
|
|
} else { |
|
|
|
|
// 理论查询试卷 |
|
|
|
|
if (this.isTheory) { |
|
|
|
|
const res = await this.$post(this.api.examPaperList, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
type: 1, |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
libraryId: this.libraryId, |
|
|
|
|
isDisable: 0, |
|
|
|
|
status: 1 |
|
|
|
|
}) |
|
|
|
|
this.projects = res.pageList.records |
|
|
|
|
this.total = res.pageList.total |
|
|
|
|
} else { // 实训 |
|
|
|
|
const { data } = await this.$post(this.api.getProjectAssessmentByCompetition, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
@ -362,34 +380,61 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 预览试卷 |
|
|
|
|
previewPaper (row) { |
|
|
|
|
this.$parent.previewPaper(row) |
|
|
|
|
}, |
|
|
|
|
// 试卷选择回调 |
|
|
|
|
paperChange (id) { |
|
|
|
|
const item = this.projects.find(e => e.paperId === id) |
|
|
|
|
if (item) this.form.paperName = item.name |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
save () { |
|
|
|
|
const { form } = this |
|
|
|
|
const { form, courseSystem } = this |
|
|
|
|
if (!form.time.length) return Util.warningMsg('请选择比赛时间') |
|
|
|
|
const { playStartTime, playEndTime } = this.step1 |
|
|
|
|
if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return Util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') |
|
|
|
|
|
|
|
|
|
// 理论试卷存试卷库等 |
|
|
|
|
if (this.isTheory) { |
|
|
|
|
if (!this.libraryId) return Util.warningMsg('请选择试卷库') |
|
|
|
|
// if (!this.libraryId) return Util.warningMsg('请选择试卷库') |
|
|
|
|
if (!form.paperId) return Util.warningMsg('请选择试卷') |
|
|
|
|
|
|
|
|
|
form.libraryId = this.libraryId |
|
|
|
|
form.libraryId = courseSystem ? '' : this.libraryId |
|
|
|
|
form.systemId = courseSystem ? this.systemId : '' |
|
|
|
|
const curPaper = this.projects.find(e => e.paperId === form.paperId) |
|
|
|
|
if (curPaper) form.paperName = curPaper.name |
|
|
|
|
} else { |
|
|
|
|
if (!form.cid) return Util.warningMsg('请选择课程') |
|
|
|
|
// if (!form.cid) return Util.warningMsg('请选择课程') |
|
|
|
|
if (!form.projectId) return Util.warningMsg('请选择项目') |
|
|
|
|
const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId) |
|
|
|
|
if (systemId) form.systemId = systemId |
|
|
|
|
if (projectName) form.projectName = projectName |
|
|
|
|
if (systemName) form.systemName = systemName |
|
|
|
|
} |
|
|
|
|
console.log(11, form) |
|
|
|
|
if (courseSystem) { |
|
|
|
|
form.mallId = '' |
|
|
|
|
form.cid = '' |
|
|
|
|
} |
|
|
|
|
form.startTime = form.time[0] |
|
|
|
|
form.endTime = form.time[1] |
|
|
|
|
this.handlePaper() |
|
|
|
|
this.$emit('hideSet', this.form) |
|
|
|
|
}, |
|
|
|
|
// 复制试卷 |
|
|
|
|
async handlePaper () { |
|
|
|
|
const { form } = this |
|
|
|
|
// 老的试卷名称不等于新的试卷名称,则复制一份试卷,再把新的试卷id替换掉 |
|
|
|
|
if (this.isTheory && form.paperName !== form.originPaperName) { |
|
|
|
|
const res = await this.$post(this.api.copyExamPaper, { |
|
|
|
|
associatedID: form.stageId, |
|
|
|
|
paperId: form.paperId, |
|
|
|
|
typeId: 1 |
|
|
|
|
}) |
|
|
|
|
if (res.examPaper) form.paperId = res.examPaper.paperId |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 返回 |
|
|
|
|
back () { |
|
|
|
|
this.$emit('update:form', this.$parent.curOriginForm) |
|
|
|
|