赛事相关

dev_202412
yujialong 2 months ago
parent e467d90550
commit 89abb11569
  1. 1
      src/utils/api.js
  2. 121
      src/views/match/add/set.vue
  3. 4
      src/views/match/add/step3.vue

@ -355,6 +355,7 @@ export default {
exportExamPaperReport: `exam/exam/paper/exportExamPaperReport`, exportExamPaperReport: `exam/exam/paper/exportExamPaperReport`,
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`, exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
exportBankExperimentReport: `occupationlab/occupationlab/achievement/exportBankExperimentReport`, exportBankExperimentReport: `occupationlab/occupationlab/achievement/exportBankExperimentReport`,
getServiceOfType: `nakadai/nakadai/serviceConfiguration/getServiceOfType`,
// 赛事内容 // 赛事内容
addCompetitionContent: `competition/competition/content/addCompetitionContent`, addCompetitionContent: `competition/competition/content/addCompetitionContent`,

@ -28,28 +28,30 @@
<!-- 理论系统选择试卷库非理论则选择系统 --> <!-- 理论系统选择试卷库非理论则选择系统 -->
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover" class="m-b-20">
<div> <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="0">从课程中选择</el-radio>
<el-radio :label="1">从系统中选择</el-radio> <el-radio :label="1">从系统中选择</el-radio>
</el-radio-group> </el-radio-group>
<div class="inline-input"> <div class="inline-input">
<!-- 理论 && 选择课程 --> <!-- 选择系统 -->
<el-select v-if="isTheory && !courseSystem" v-model="libraryId" placeholder="请选择试卷库" @change="getProject"> <el-select v-if="courseSystem" v-model="systemId" placeholder="请选择系统" @change="getProject">
<el-option v-for="(item, i) in paperLibraries" :key="i" :label="item.libraryName" :value="item.libraryId"> <el-option v-for="(item, i) in services" :key="i" :label="item.systemName" :value="item.systemId">
</el-option> </el-option>
</el-select> </el-select>
<!-- 实训 && 选择课程 --> <template v-else>
<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" <el-select v-if="isTheory && !courseSystem" v-model="libraryId" placeholder="请选择试卷库" @change="getProject">
@change="curChange"></el-cascader> <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-cascader v-else-if="!isTheory && !courseSystem" ref="cur" v-model="mallIds" :options="curs"
<el-option v-for="(item, i) in services" :key="i" :label="item.systemName" :value="item.systemId"> :props="{ checkStrictly: true, value: 'id' }" popper-class="course-cas" @expand-change="curChange"
</el-option> @change="curChange"></el-cascader>
</el-select> </template>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -154,7 +156,6 @@
</template> </template>
<script> <script>
import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import { Loading } from 'element-ui' import { Loading } from 'element-ui'
import TestPaperConst from '@/const/testPaper' import TestPaperConst from '@/const/testPaper'
@ -201,12 +202,13 @@ export default {
keyword: function (val) { keyword: function (val) {
clearTimeout(this.searchTimer); clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => { this.searchTimer = setTimeout(() => {
this.initData(); this.initData()
}, 500); }, 500)
} }
}, },
mounted () { mounted () {
this.isTheory ? this.getLibrary() : this.getCourse() // this.isTheory ? this.getLibrary() : this.getCourse()
this.getSystem()
}, },
methods: { methods: {
// //
@ -219,8 +221,6 @@ export default {
supplierId: sid ? sid.supplierId : '' supplierId: sid ? sid.supplierId : ''
}) })
const services = res.serviceList.records const services = res.serviceList.records
this.services = services
this.systemId = services[0].systemId
// //
const { page } = await this.$post(this.api.listOfGoods, { const { page } = await this.$post(this.api.listOfGoods, {
@ -256,6 +256,25 @@ export default {
this.getProject() this.getProject()
} }
}, },
//
async getSystem () {
const res = await this.$get(this.api.getServiceOfType, {
type: this.isTheory ? 3 : 1
})
res.serviceList.forEach(e => e.systemId = +e.systemId)
this.services = res.serviceList
this.systemId = this.form.systemId || this.services[0].systemId
this.loadIns = Loading.service()
this.getProject()
},
//
courseSystemChange (val) {
if (val) {
this.getSystem()
} else {
this.isTheory ? this.getLibrary() : this.getCourse()
}
},
// //
curChange (val) { curChange (val) {
const id = val[0] const id = val[0]
@ -293,25 +312,31 @@ export default {
// / // /
async getProject () { async getProject () {
try { try {
// //
if (this.isTheory) { if (this.courseSystem) {
const res = await this.$post(this.api.examPaperList, { const res = await this.$get(`${this.api.getInternalProjectBySystemId}?permissions=2&systemId=${this.systemId}&keyword=${this.keyword}`)
pageNum: this.page, if (this.isTheory) {
pageSize: this.pageSize, res.forEach(e => {
type: 1, e.name = e.paperName
keyWord: this.keyword, })
libraryId: this.libraryId, }
isDisable: 0, this.projects = res
status: 1 }
}) else {
this.projects = res.pageList.records if (this.isTheory) {
this.total = res.pageList.total //
} else { // const res = await this.$post(this.api.examPaperList, {
// pageNum: this.page,
if (this.courseSystem) { pageSize: this.pageSize,
const res = await this.$get(`${this.api.getInternalProjectBySystemId}?permissions=2&systemId=${this.systemId}&keyword=${this.keyword}`) type: 1,
this.projects = res keyWord: this.keyword,
} else { 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, { const { data } = await this.$post(this.api.getProjectAssessmentByCompetition, {
pageNum: this.page, pageNum: this.page,
@ -383,29 +408,33 @@ export default {
}, },
// //
save () { save () {
const { form } = this const { form, courseSystem } = this
if (!form.time.length) return Util.warningMsg('请选择比赛时间') if (!form.time.length) return Util.warningMsg('请选择比赛时间')
const { playStartTime, playEndTime } = this.step1 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 (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return Util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
// //
if (this.isTheory) { if (this.isTheory) {
if (!this.libraryId) return Util.warningMsg('请选择试卷库') // if (!this.libraryId) return Util.warningMsg('')
if (!form.paperId) 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) const curPaper = this.projects.find(e => e.paperId === form.paperId)
if (curPaper) form.paperName = curPaper.name if (curPaper) form.paperName = curPaper.name
} else { } else {
if (!form.cid) return Util.warningMsg('请选择课程') // if (!form.cid) return Util.warningMsg('')
if (!form.projectId) return Util.warningMsg('请选择项目') if (!form.projectId) return Util.warningMsg('请选择项目')
const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId) const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId)
if (systemId) form.systemId = systemId if (systemId) form.systemId = systemId
if (projectName) form.projectName = projectName if (projectName) form.projectName = projectName
if (systemName) form.systemName = systemName if (systemName) form.systemName = systemName
} }
if (courseSystem) {
form.mallId = ''
form.cid = ''
}
form.startTime = form.time[0] form.startTime = form.time[0]
form.endTime = form.time[1] form.endTime = form.time[1]
this.handlePaper() this.handlePaper()
this.$emit('hideSet', this.form) this.$emit('hideSet', this.form)
}, },
@ -413,15 +442,13 @@ export default {
async handlePaper () { async handlePaper () {
const { form } = this const { form } = this
// id // id
if (form.paperName !== form.originPaperName) { if (this.isTheory && form.paperName !== form.originPaperName) {
const res = await this.$post(this.api.copyExamPaper, { const res = await this.$post(this.api.copyExamPaper, {
associatedID: form.stageId, associatedID: form.stageId,
paperId: form.paperId, paperId: form.paperId,
typeId: 1 typeId: 1
}) })
if (res.examPaper) { if (res.examPaper) form.paperId = res.examPaper.paperId
form.paperId = res.examPaper.paperId
}
} }
}, },
// //

@ -433,9 +433,9 @@ export default {
Util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') Util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
break break
} }
if (e.method === 0 && !e.cid) { if (e.method === 0 && !e.projectId) {
invalid = 1 invalid = 1
Util.errorMsg('请选择课程') Util.errorMsg('请选择项目')
break break
} }
if (e.method === 1 && !e.paperId) { if (e.method === 1 && !e.paperId) {

Loading…
Cancel
Save