实验报告、赛事

Branch_d40a2540
yujialong 1 year ago
parent 559a044844
commit 055566f7d9
  1. 1
      src/api/index.js
  2. 571
      src/pages/achievement/show/index.vue
  3. 2
      src/pages/achievement/teach/index.vue
  4. 2
      src/pages/assessment/list/index.vue
  5. 2
      src/pages/expSystem/backstage/model.vue
  6. 462
      src/pages/match/add/set.vue
  7. 590
      src/pages/match/add/step3.vue
  8. 271
      src/pages/match/manage/index.vue
  9. 46
      src/pages/match/manage/matchRank.vue

@ -242,6 +242,7 @@ export default {
addCompetitionStageRankingTime: `competition/competitionReleaseTime/addCompetitionStageRankingTime`, addCompetitionStageRankingTime: `competition/competitionReleaseTime/addCompetitionStageRankingTime`,
cancelCompetitionStageRankingTime: `competition/competitionReleaseTime/cancelCompetitionStageRankingTime`, cancelCompetitionStageRankingTime: `competition/competitionReleaseTime/cancelCompetitionStageRankingTime`,
getCompetitionStageRankingTime: `competition/competitionReleaseTime/getCompetitionStageRankingTime`, getCompetitionStageRankingTime: `competition/competitionReleaseTime/getCompetitionStageRankingTime`,
frontOfficeCompetitionRanking: `competition/competition/rank/frontOfficeCompetitionRanking`,
gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`, gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`,
rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`, rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`,
rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`, rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`,

@ -1,244 +1,320 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<el-page-header @back="$router.back()" content="查看报告"></el-page-header> class="m-b-20">
</el-card> <el-page-header @back="$router.back()"
content="查看报告"></el-page-header>
</el-card>
<div class="content"> <div class="content">
<div class="text-right"> <div class="text-right">
<el-button type="primary" @click="exportPage">导出报告</el-button> <el-button type="primary"
@click="exportPage">导出报告</el-button>
</div>
<h6 class="r-title">标准实验报告</h6>
<div class="info">
<h6 class="l-title">
<img src="@/assets/img/info1.png"
alt="">
基本信息
</h6>
<ul :class="['info-list', {edit: editing}]">
<li>
<label>学生姓名</label>
<el-input v-if="editing"
v-model="infoData.userName"
disabled></el-input>
<span v-else>{{ infoData.userName }}</span>
</li>
<li>
<label>学生学号</label>
<el-input v-if="editing"
v-model="infoData.workNumber"
disabled></el-input>
<span v-else>{{ infoData.workNumber }}</span>
</li>
<li>
<label>实验时间</label>
<el-input v-if="editing"
v-model="infoData.submitTime"
disabled></el-input>
<span v-else>{{ infoData.submitTime }}</span>
</li>
<li>
<label>实验成绩</label>
<el-input v-if="editing"
v-model="infoData.score"
disabled></el-input>
<div v-else
class="score-wrap">
<em>{{ infoData.score }}</em>
<img src="@/assets/img/point.png"
alt="">
</div> </div>
<h6 class="r-title">标准实验报告</h6> </li>
<div class="info"> <li>
<h6 class="l-title"> <label>学生班级</label>
<img src="@/assets/img/info1.png" alt=""> <el-input v-if="editing"
基本信息 v-model="infoData.workNumber"></el-input>
</h6> <span v-else>{{ infoData.workNumber }}</span>
<ul :class="['info-list', {edit: editing}]"> </li>
<li> <li>
<label>学生姓名</label> <label>指导老师</label>
<el-input v-if="editing" v-model="infoData.userName" disabled></el-input> <el-input v-if="editing"
<span v-else>{{ infoData.userName }}</span> v-model="infoData.instructor"></el-input>
</li> <span v-else>{{ infoData.instructor }}</span>
<li> </li>
<label>学生学号</label> <li>
<el-input v-if="editing" v-model="infoData.workNumber" disabled></el-input> <label>实验学时</label>
<span v-else>{{ infoData.workNumber }}</span> <el-input v-if="editing"
</li> v-model="infoData.period"></el-input>
<li> <span v-else>{{ infoData.period }}</span>
<label>实验时间</label> </li>
<el-input v-if="editing" v-model="infoData.submitTime" disabled></el-input> </ul>
<span v-else>{{ infoData.submitTime }}</span> <div class="m-b-20">
</li> <h6 class="l-title">
<li> <img src="@/assets/img/report2.png"
<label>实验成绩</label> alt="">
<el-input v-if="editing" v-model="infoData.score" disabled></el-input> 实验项目名称
<div v-else class="score-wrap"> </h6>
<em>{{ infoData.score }}</em> <el-input v-if="editing"
<img src="@/assets/img/point.png" alt=""> v-model="form.projectName"
</div> type="textarea"></el-input>
</li> <div v-else
<li> class="pre-wrap"
<label>学生班级</label> v-html="form.projectName"></div>
<el-input v-if="editing" v-model="infoData.workNumber"></el-input> </div>
<span v-else>{{ infoData.workNumber }}</span> <div class="m-b-20">
</li> <h6 class="l-title">
<li> <img src="@/assets/img/report3.png"
<label>指导老师</label> alt="">
<el-input v-if="editing" v-model="infoData.instructor"></el-input> 实验目的
<span v-else>{{ infoData.instructor }}</span> </h6>
</li> <div :class="['pre-wrap', {edit: editing}]"
<li> v-html="form.purpose"></div>
<label>实验学时</label> </div>
<el-input v-if="editing" v-model="infoData.period"></el-input> <div class="m-b-20">
<span v-else>{{ infoData.period }}</span> <h6 class="l-title">
</li> <img src="@/assets/img/report4.png"
</ul> alt="">
<div class="m-b-20"> 实验数据
<h6 class="l-title"> </h6>
<img src="@/assets/img/report2.png" alt=""> <el-table :data="expData"
实验项目名称 class="table"
</h6> border
<el-input v-if="editing" v-model="form.projectName" type="textarea"></el-input> stripe
<div v-else class="pre-wrap" v-html="form.projectName"></div> header-align="center">
</div> <el-table-column type="index"
<div class="m-b-20"> label="序号"
<h6 class="l-title"> align="center"
<img src="@/assets/img/report3.png" alt=""> width="60">
实验目的 <template slot-scope="scope">
</h6> {{ scope.$index + 1 }}
<div :class="['pre-wrap', {edit: editing}]" v-html="form.purpose"></div> </template>
</el-table-column>
<el-table-column prop="judgmentName"
label="判分点"
width="270"
align="center"></el-table-column>
<el-table-column v-if='project'
prop="judgmentName"
label="考核点"
align="center"
width="150">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords"
:key="index">
<span>
<span>{{index+1}}. </span>{{item.name}}
</span>
</div> </div>
<div class="m-b-20"> </template>
<h6 class="l-title"> </el-table-column>
<img src="@/assets/img/report4.png" alt=""> <el-table-column prop="ruleAnswer"
实验数据 label="参考答案"
</h6> style='word-wrap: break-word'>
<el-table :data="expData" class="table" border stripe header-align="center"> <template slot-scope="scope">
<el-table-column type="index" label="序号" align="center" width="60"> <div v-if='scope.row.lcRuleRecords'>
<template slot-scope="scope"> <div v-for="(item, index) in scope.row.lcRuleRecords"
{{ scope.$index + 1 }} :key="index">
</template> <span>
</el-table-column> <span>{{index+1}}. </span>{{item.ruleAnswer}}
<el-table-column prop="judgmentName" label="判分点" width="270" align="center"></el-table-column> </span>
<el-table-column v-if='project' prop="judgmentName" label="考核点" align="center" width="150"> </div>
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<span>
<span>{{index+1}}. </span>{{item.name}}
</span>
</div>
</template>
</el-table-column>
<el-table-column prop="ruleAnswer" label="参考答案" style='word-wrap: break-word'>
<template slot-scope="scope">
<div v-if='scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<span>
<span>{{index+1}}. </span>{{item.ruleAnswer}}
</span>
</div>
</div>
<div v-else v-html="scope.row.referenceAnswer"></div>
</template>
</el-table-column>
<el-table-column prop="userAnswer" label="学生答案">
<template slot-scope="scope">
<div v-if='scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<span v-if='item.userAnswer'>
<span>{{index+1}}. </span>{{item.userAnswer}}
</span>
<span v-else>
<span>{{index+1}}. </span>未填写
</span>
</div>
</div>
<div v-else v-html='scope.row.answer' style='white-space: pre-wrap'></div>
<template v-if="scope.row.runThePictureList">
<img v-for="(img, i) in scope.row.runThePictureList" :key="i" width="200" class="result-pic" :src="img" alt="">
</template>
</template>
</el-table-column>
<el-table-column prop="score" label="得分" width="80" align="center"></el-table-column>
</el-table>
</div> </div>
<div class="m-b-20"> <div v-else
<h6 class="l-title"> v-html="scope.row.referenceAnswer"></div>
<img src="@/assets/img/report5.png" alt=""> </template>
实验总结与体会 </el-table-column>
</h6> <el-table-column prop="userAnswer"
<quill v-if="editing" :border="true" v-model="form.summarize" :minHeight="150" :height="150" :index="1" /> label="学生答案">
<div v-else class="pre-wrap" v-html="form.summarize"></div> <template slot-scope="scope">
<div v-if='scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords"
:key="index">
<span v-if='item.userAnswer'>
<span>{{index+1}}. </span>{{item.userAnswer}}
</span>
<span v-else>
<span>{{index+1}}. </span>未填写
</span>
</div>
</div> </div>
</div> <div v-else
v-html='scope.row.answer'
style='white-space: pre-wrap'></div>
</template>
</el-table-column>
<el-table-column prop="runResult"
label="学生运行结果"
align="center">
<template slot-scope="scope">
<div class="m-b-20"
v-html='scope.row.runResult'
style='white-space: pre-wrap'></div>
<template v-if="scope.row.runThePictureList">
<img v-for="(img, i) in scope.row.runThePictureList"
:key="i"
width="200"
class="result-pic"
:src="img"
alt="">
</template>
</template>
</el-table-column>
<el-table-column prop="score"
label="得分"
width="80"
align="center"></el-table-column>
</el-table>
</div>
<div class="m-b-20">
<h6 class="l-title">
<img src="@/assets/img/report5.png"
alt="">
实验总结与体会
</h6>
<quill v-if="editing"
:border="true"
v-model="form.summarize"
:minHeight="150"
:height="150"
:index="1" />
<div v-else
class="pre-wrap"
v-html="form.summarize"></div>
</div> </div>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
data() { data () {
return { return {
reportId: this.$route.query.reportId, reportId: this.$route.query.reportId,
title: "实验报告", title: "实验报告",
form: { form: {
className: "", className: "",
instructor: "", instructor: "",
period: "", period: "",
projectName: "", projectName: "",
summarize: "", summarize: "",
}, },
infoData: {}, infoData: {},
expData: [], expData: [],
editing: false, editing: false,
loadIns: null, loadIns: null,
loading: false, loading: false,
project:false, project: false,
userScores: [] userScores: []
}; };
}, },
mounted() { mounted () {
this.getData() this.getData()
},
methods: {
getData () { //
this.$get(`${this.api.reportDetail}?reportId=${this.reportId}`).then(({ report, userScores }) => {
this.form = report
this.expData = userScores
this.project = this.expData.find(e => e.lcRuleRecords) // lcRuleRecords
let form = this.form;
this.infoData = {
workNumber: form.workNumber,
experimentalClassName: form.experimentalClassName,
instructor: form.instructor,
period: form.period,
laboratory: form.laboratory,
submitTime: form.submitTime,
score: form.score,
userName: form.userName
}
const data = report.data
this.userScores = userScores
// data使
if (!data) {
this.handleList(userScores)
this.$post(this.api.editExperimentalData, {
reportId,
data: JSON.stringify(userScores)
}).then(res => { }).catch(err => { })
} else {
this.handleList(userScores.find(e => e.lcRuleRecords) ? userScores : JSON.parse(data))
}
}).catch(res => { })
}, },
methods: { //
getData() { // handleList (list) {
this.$get(`${this.api.reportDetail}?reportId=${this.reportId}`).then(({ report, userScores }) => { this.project = list.find(e => e.lcRuleRecords) // lcRuleRecords
this.form = report if (this.project) {
this.expData = userScores list.map(e => {
this.project = this.expData.find(e => e.lcRuleRecords) // lcRuleRecords e.assessmentPoint = ''
let form = this.form; e.referenceAnswer = ''
this.infoData = { e.answer = ''
workNumber: form.workNumber, e.lcRuleRecords.map((n, i) => {
experimentalClassName: form.experimentalClassName, e.assessmentPoint += `${i + 1}.${n.name}`
instructor: form.instructor, e.referenceAnswer += `${i + 1}.${n.ruleAnswer}`
period: form.period, e.answer += `${i + 1}.${n.userAnswer}`
laboratory: form.laboratory,
submitTime: form.submitTime,
score: form.score,
userName: form.userName
}
const data = report.data
this.userScores = userScores
// data使
if (!data) {
this.handleList(userScores)
this.$post(this.api.editExperimentalData, {
reportId,
data: JSON.stringify(userScores)
}).then(res => {}).catch(err => {})
} else {
this.handleList(userScores.find(e => e.lcRuleRecords) ? userScores : JSON.parse(data))
}
}).catch(res => {})
},
//
handleList(list) {
this.project = list.find(e => e.lcRuleRecords) // lcRuleRecords
if (this.project) {
list.map(e => {
e.assessmentPoint = ''
e.referenceAnswer = ''
e.answer = ''
e.lcRuleRecords.map((n, i) => {
e.assessmentPoint += `${i + 1}.${n.name}`
e.referenceAnswer += `${i + 1}.${n.ruleAnswer}`
e.answer += `${i + 1}.${n.userAnswer}`
})
})
} else { // pythonuserScores
list.forEach(e => {
const item = this.userScores.find(n => n.judgmentId == e.judgmentId)
if (item && item.runThePictureList) e.runThePictureList = item.runThePictureList
})
}
this.expData = list
},
exportPage() {
const form = Object.assign(this.form, this.infoData)
const list = JSON.parse(JSON.stringify(this.expData))
list.map((e, i) => {
const item = this.userScores.find(n => n.judgmentId == e.judgmentId)
if (item && item.runThePicture) e.runThePicture = item.runThePicture
if (item && item.runThePictureList) e.runThePictureList = item.runThePictureList
e.id = i + 1
// if (e.referenceAnswer && typeof e.referenceAnswer === 'string') e.referenceAnswer = e.referenceAnswer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
if (e.answer && typeof e.answer === 'string') e.answer = e.answer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
}) })
for (const i in form) { })
if (form[i] && typeof form[i] === 'string') form[i] = form[i].replace(/<[^>]+>/g, '') } else { // pythonuserScores
list.forEach(e => {
const item = this.userScores.find(n => n.judgmentId == e.judgmentId)
if (item) {
if (item.runThePictureList) e.runThePictureList = item.runThePictureList
if (item.runResult) e.runResult = item.runResult
} }
form.purpose = form.purpose.replace(/<[^>]+>/g, '') })
this.$post(this.project ? this.api.exportBankExperimentReport : this.api.exportLabReport, { }
...form, this.expData = list
experimentalData: list },
}).then(res => { exportPage () {
console.log(res) const form = Object.assign(this.form, this.infoData)
util.downloadFileDirect(`实验报告.docx`,new Blob([res])) const list = JSON.parse(JSON.stringify(this.expData))
}).catch(res => {}) list.map((e, i) => {
}, const item = this.userScores.find(n => n.judgmentId == e.judgmentId)
} if (item && item.runThePicture) e.runThePicture = item.runThePicture
if (item && item.runThePictureList) e.runThePictureList = item.runThePictureList
e.id = i + 1
// if (e.referenceAnswer && typeof e.referenceAnswer === 'string') e.referenceAnswer = e.referenceAnswer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
if (e.answer && typeof e.answer === 'string') e.answer = e.answer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
})
for (const i in form) {
if (form[i] && typeof form[i] === 'string') form[i] = form[i].replace(/<[^>]+>/g, '')
}
form.purpose = form.purpose.replace(/<[^>]+>/g, '')
this.$post(this.project ? this.api.exportBankExperimentReport : this.api.exportLabReport, {
...form,
experimentalData: list
}).then(res => {
console.log(res)
util.downloadFileDirect(`实验报告.docx`, new Blob([res]))
}).catch(res => { })
},
}
}; };
</script> </script>
@ -246,22 +322,24 @@ export default {
.wrap { .wrap {
padding: 12px 300px 20px; padding: 12px 300px 20px;
} }
code, kbd, samp{ code,
font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif; kbd,
samp {
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei', arial, STHeiTi, sans-serif;
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;
} }
/deep/ pre{ /deep/ pre {
white-space: pre-wrap; /* css-3 */ white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: pre-wrap; /* Opera 4-6 */ white-space: pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */ white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */ word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break:break-all; word-break: break-all;
overflow:hidden; overflow: hidden;
font-size: 12px; font-size: 12px;
font-weight:400; font-weight: 400;
font-family:'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei', arial, STHeiTi, sans-serif;
} }
.content { .content {
padding: 16px 40px; padding: 16px 40px;
@ -277,7 +355,7 @@ code, kbd, samp{
} }
.info { .info {
padding: 20px 16px; padding: 20px 16px;
border: 1px solid #E1E6F2; border: 1px solid #e1e6f2;
} }
.l-title { .l-title {
display: flex; display: flex;
@ -311,7 +389,7 @@ code, kbd, samp{
span { span {
min-width: 150px; min-width: 150px;
padding: 0 10px 3px; padding: 0 10px 3px;
border-bottom: 1px solid #E1E6F2; border-bottom: 1px solid #e1e6f2;
} }
/deep/.el-input { /deep/.el-input {
width: 174px; width: 174px;
@ -320,7 +398,7 @@ code, kbd, samp{
.score-wrap { .score-wrap {
position: relative; position: relative;
min-width: 150px; min-width: 150px;
border-bottom: 1px solid #E1E6F2; border-bottom: 1px solid #e1e6f2;
em { em {
position: absolute; position: absolute;
top: -12px; top: -12px;
@ -328,7 +406,7 @@ code, kbd, samp{
font-family: din; font-family: din;
font-size: 30px; font-size: 30px;
font-weight: 600; font-weight: 600;
color: #0B1D30; color: #0b1d30;
} }
img { img {
position: absolute; position: absolute;
@ -336,16 +414,17 @@ code, kbd, samp{
left: 0; left: 0;
} }
} }
/deep/.el-textarea .el-textarea__inner, .pre-wrap { /deep/.el-textarea .el-textarea__inner,
.pre-wrap {
min-height: 72px; min-height: 72px;
padding: 10px 16px; padding: 10px 16px;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
&.edit { &.edit {
color: #ABB3C6; color: #abb3c6;
border: 1px solid #CACFDB; border: 1px solid #cacfdb;
border-radius: 4px; border-radius: 4px;
background-color: #F6F7F9; background-color: #f6f7f9;
} }
} }
/deep/ .table th { /deep/ .table th {
@ -357,7 +436,7 @@ code, kbd, samp{
} }
} }
.result-pic { .result-pic {
margin: 10px 0; margin: 10px 0;
} }
@media (max-width: 1650px) { @media (max-width: 1650px) {
.wrap { .wrap {

@ -358,7 +358,7 @@ export default {
// //
const { message } = await this.$post(`${this.api.practiceActivity}?pageNum=${this.pageActivation}&pageSize=${this.pageSizeActivation}&projectId=${this.id}`) const { message } = await this.$post(`${this.api.practiceActivity}?pageNum=${this.pageActivation}&pageSize=${this.pageSizeActivation}&projectId=${this.id}`)
this.activations = message.records this.activations = message.records
this.total = message.total this.totalActivation = message.total
}, },
initData () { initData () {
this.$refs.table.clearSelection(); this.$refs.table.clearSelection();

@ -448,7 +448,7 @@ export default {
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(async res => { this.$post(`${this.api.collectPaper}?id=${row.id}`).then(async res => {
util.successMsg("提前结束成功!"); util.successMsg("提前结束成功!");
this.getData(); this.getData();
// await this.$post(`${this.api.refreshPageNotification}?content=3-${row.id}`) await this.$post(`${this.api.refreshPageNotification}?content=3-${row.id}`)
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -56,7 +56,7 @@
<el-table-column label="状态" <el-table-column label="状态"
align="center"> align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isOpen ? '禁用' : '启用' }} {{ scope.row.isOpen || scope.row.ztOpen ? '禁用' : '启用' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"

@ -1,247 +1,275 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<div> class="m-b-20">
<p class="m-b-20">比赛名称</p> <div>
{{ form.stageName }} <p class="m-b-20">比赛名称</p>
</div> {{ form.stageName }}
</el-card> </div>
<el-card shadow="hover" class="m-b-20"> </el-card>
<div> <el-card shadow="hover"
<p class="m-b-20">比赛时间</p> class="m-b-20">
<div class="date-inputs"> <div>
起止时间 <p class="m-b-20">比赛时间</p>
<div style="display: inline-flex;align-items: center;"> <div class="date-inputs">
<el-date-picker 起止时间
v-model="form.time" <div style="display: inline-flex;align-items: center;">
type="datetimerange" <el-date-picker v-model="form.time"
range-separator="~" type="datetimerange"
start-placeholder="开始日期" range-separator="~"
end-placeholder="结束日期" start-placeholder="开始日期"
format="yyyy-MM-dd HH:mm:ss" end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
@change="timeChange"> value-format="yyyy-MM-dd HH:mm:ss"
</el-date-picker> @change="timeChange">
<el-alert </el-date-picker>
style="width: auto;padding: 4px 16px;margin-left: 10px;" <el-alert style="width: auto;padding: 4px 16px;margin-left: 10px;"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'" :title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
type="error" type="error"
:closable="false" :closable="false"
effect="dark"> effect="dark">
</el-alert> </el-alert>
</div>
</div>
</div> </div>
</el-card> </div>
<el-card shadow="hover" class="mgr20 m-b-20"> </div>
</el-card>
<el-card shadow="hover"
class="mgr20 m-b-20">
<div>
<p class="m-b-20">课程</p>
<div class="inline-input">
<el-select v-model="form.cid"
@change="courseChange">
<el-option v-for="item in curriculumList"
:key="item.associatedProduct"
:label="item.productName"
:value="item.associatedProduct
">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div> <div>
<p class="m-b-20">课程</p> <el-input placeholder="请输入项目名称"
<div class="inline-input"> prefix-icon="el-icon-search"
<el-select v-model="form.cid" @change="courseChange"> v-model.trim="keyword"
<el-option clearable></el-input>
v-for="item in curriculumList"
:key="item.cid"
:label="item.curriculumName"
:value="item.cid">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div>
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</div>
<el-button style="margin-left: 5px" type="primary" round @click="toProject">自定义实验项目</el-button>
</div>
</div> </div>
<!-- 实训项目表格 --> <el-button style="margin-left: 5px"
<el-table :data="projects" class="table" stripe header-align="center"> type="primary"
<el-table-column width="60" label="选择" align="center"> round
<template slot-scope="scope"> @click="toProject">自定义实验项目</el-button>
<el-radio v-model="form.projectId" :label="scope.row.projectId">&nbsp;</el-radio> </div>
</template> </div>
</el-table-column> <!-- 实训项目表格 -->
<el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> <el-table :data="projects"
<el-table-column prop="auth" label="项目权限" align="center"> class="table"
<template slot-scope="scope"> stripe
{{ permissionsKeys[scope.row.permissions] }} header-align="center">
</template> <el-table-column width="60"
</el-table-column> label="选择"
<el-table-column prop="founder" label="创建人" align="center"> align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.founder ? '老师创建' : '系统内置' }} <el-radio v-model="form.projectId"
</template> :label="scope.row.projectId">&nbsp;</el-radio>
</el-table-column> </template>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> </el-table-column>
<!-- <el-table-column label="操作" align="center"> <el-table-column prop="projectName"
label="项目名称"
align="center"></el-table-column>
<el-table-column prop="auth"
label="项目权限"
align="center">
<template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }}
</template>
</el-table-column>
<el-table-column prop="founder"
label="创建人"
align="center">
<template slot-scope="scope">
{{ scope.row.founder ? '老师创建' : '系统内置' }}
</template>
</el-table-column>
<el-table-column prop="createTime"
label="创建时间"
align="center"></el-table-column>
<!-- <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showProject(scope.row)">查看</el-button> <el-button type="text" @click="showProject(scope.row)">查看</el-button>
</template> </template>
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination <el-pagination background
background :page-size="pageSize"
:page-size="pageSize" @current-change="handleCurrentChange"
@current-change="handleCurrentChange" layout="total,prev, pager, next"
layout="total,prev, pager, next" :total="total"></el-pagination>
:total="total"
></el-pagination>
</div>
</el-card>
<div style="text-align: center">
<el-button @click="back">返回</el-button>
<el-button type="primary" @click="save">保存</el-button>
</div> </div>
</el-card>
<div style="text-align: center">
<el-button @click="back">返回</el-button>
<el-button type="primary"
@click="save">保存</el-button>
</div> </div>
</div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import { Loading } from 'element-ui' import { Loading } from 'element-ui'
export default { export default {
props: ['form', 'step1'], props: ['form', 'step1'],
data() { data () {
return { return {
loadIns: null, loadIns: null,
curriculumList: [], curriculumList: [],
keyword: '', keyword: '',
projects: [], projects: [],
page: 1, page: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
sysId: '', sysId: '',
permissionsKeys: ['练习', '考核', '竞赛'], permissionsKeys: ['练习', '考核', '竞赛'],
timeInvalid: false timeInvalid: false
}; };
},
watch: {
// ,
form: {
handler () {
this.updateTime++
},
deep: true
}, },
watch: { keyword: function (val) {
// , clearTimeout(this.searchTimer);
form: { this.searchTimer = setTimeout(() => {
handler(){ this.initData();
this.updateTime++ }, 500);
}, }
deep:true },
}, mounted () {
keyword: function(val) { this.getCourse()
clearTimeout(this.searchTimer); },
this.searchTimer = setTimeout(() => { methods: {
this.initData(); //
}, 500); getCourse () {
} this.loadIns = Loading.service()
this.$post(this.api.listOfGoods, {
hotTag: 1,
isShelves: 0,
sort: 0,
pageNum: 1,
pageSize: 1000
}).then(({ page }) => {
const list = page.records
this.curriculumList = list
if (!this.form.cid && list.length) this.form.cid = list[0].associatedProduct
this.courseChange()
}).catch(err => {
this.loadIns.close()
});
}, },
mounted() { //
this.getCourse() courseChange (val) {
const { systemId } = this.curriculumList.find(e => e.cid == this.form.cid)
this.sysId = systemId
if (val) this.loadIns = Loading.service()
this.getProject()
}, },
methods: { //
// getProject () {
getCourse() { this.$post(this.api.getProjectAssessmentByCompetition, {
this.loadIns = Loading.service() pageNum: this.page,
this.$get(this.api.curriculumList).then(({ data }) => { pageSize: this.pageSize,
const list = data cid: this.form.cid,
this.curriculumList = data projectName: this.keyword,
if (!this.form.cid && list.length) this.form.cid = list[0].cid systemId: this.sysId,
this.courseChange() permissions: 2
}).catch(err => { }).then(({ data }) => {
this.loadIns.close() this.projects = data.records
}); this.total = data.total
}, this.loadIns.close()
// }).catch(err => {
courseChange(val) { this.loadIns.close()
const { systemId } = this.curriculumList.find(e => e.cid == this.form.cid) });
this.sysId = systemId },
if (val) this.loadIns = Loading.service() initData () {
this.getProject() this.page = 1;
}, this.getProject();
// },
getProject() { handleCurrentChange (val) {
this.$post(this.api.getProjectAssessmentByCompetition, { this.page = val;
pageNum: this.page, this.getProject();
pageSize: this.pageSize, },
cid: this.form.cid, //
projectName: this.keyword, toProject () {
systemId: this.sysId, const { form, curStep } = this.$parent
permissions: 2 form[curStep] = this.form
}).then(({ data }) => { this.$store.commit('match/setCache', {
this.projects = data.records form,
this.total = data.total curStep
this.loadIns.close() })
}).catch(err => { this.$parent.pass = 1
this.loadIns.close() this.$router.push(`/project/list?show=1`)
}); },
}, //
initData() { timeChange (val) {
this.page = 1; if (val.length) {
this.getProject(); const startTime = new Date(val[0])
}, const endTime = new Date(val[1])
handleCurrentChange(val) { const { playStartTime, playEndTime } = this.step1
this.page = val; if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) {
this.getProject(); this.timeInvalid = true
}, return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
// }
toProject() { this.timeInvalid = false
const { form, curStep } = this.$parent const { form, curStep } = this.$parent
form[curStep] = this.form for (const i in form) {
this.$store.commit('match/setCache', { //
form, if (i !== curStep) {
curStep const time1 = new Date(form[i].startTime)
}) const time2 = new Date(form[i].endTime)
this.$router.push(`/project/list?show=1`) if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
}, util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
// break
timeChange(val) {
if (val.length) {
const startTime = new Date(val[0])
const endTime = new Date(val[1])
const { playStartTime, playEndTime } = this.step1
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) {
this.timeInvalid = true
return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
}
this.timeInvalid = false
const { form, curStep } = this.$parent
for (const i in form) {
//
if (i !== curStep) {
const time1 = new Date(form[i].startTime)
const time2 = new Date(form[i].endTime)
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
break
}
} }
} }
} }
},
//
save() {
const { form } = 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 (!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
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
},
//
back() {
this.$emit('hideSet')
} }
},
//
save () {
const { form } = 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 (!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
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
},
//
back () {
this.$emit('hideSet')
} }
}
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>

@ -1,319 +1,355 @@
<template> <template>
<div> <div>
<div v-show="!setVisible" class="page"> <div v-show="!setVisible"
<div class="page-content"> class="page">
<div class="p-title">比赛内容设置</div> <div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small" :disabled="!editing && id"> <div class="p-title">比赛内容设置</div>
<div v-for="(item, i) in form" :key="i" class="step"> <el-form label-width="170px"
<div class="title"> label-suffix=":"
<span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span> size="small"
<el-button v-if="item.method !== 2" type="primary" @click="toSet(i)">设置</el-button> :disabled="!editing && id">
</div> <div v-for="(item, i) in form"
<el-form-item class="req" prop="time" label="比赛时间"> :key="i"
<span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span> class="step">
<div style="display: flex;align-items: center;" v-if="item.method === 2"> <div class="title">
<el-date-picker <span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span>
v-model="item.time" <el-button v-if="item.method !== 2"
type="datetimerange" type="primary"
range-separator="~" @click="toSet(i)">设置</el-button>
start-placeholder="开始日期" </div>
end-placeholder="结束日期" <el-form-item class="req"
format="yyyy-MM-dd HH:mm:ss" prop="time"
value-format="yyyy-MM-dd HH:mm:ss" label="比赛时间">
@change="timeChange"> <span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span>
</el-date-picker> <div style="display: flex;align-items: center;"
<el-alert v-if="item.method === 2">
style="width: auto;padding: 0px 16px;margin-left: 10px;" <el-date-picker v-model="item.time"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'" type="datetimerange"
type="error" range-separator="~"
:closable="false" start-placeholder="开始日期"
effect="dark"> end-placeholder="结束日期"
</el-alert> format="yyyy-MM-dd HH:mm:ss"
</div> value-format="yyyy-MM-dd HH:mm:ss"
</el-form-item> @change="timeChange">
<template v-if="item.method === 2"> </el-date-picker>
<el-form-item class="req" label="比赛地点"> <el-alert style="width: auto;padding: 0px 16px;margin-left: 10px;"
<el-input v-model="item.offlineAddress" style="width: 80%"></el-input> :title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
</el-form-item> type="error"
<el-form-item class="req" label="比赛内容"> :closable="false"
<el-input v-model="item.contentDescription" type="textarea" style="width: 80%"></el-input> effect="dark">
</el-form-item> </el-alert>
<el-form-item class="req" label="评分规则">
<el-input v-model="item.scoreRule" type="textarea" style="width: 80%"></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item class="req" prop="cid" label="课程系统">
{{ item.systemName }}
</el-form-item>
<el-form-item class="req" prop="assessmentId" label="已选择考核">
{{ item.projectName }}
</el-form-item>
<el-form-item class="req" prop="resultAnnouncementTime" label="比赛地点">
<div class="line">
<el-checkbox v-model="item.onlineButton">线上</el-checkbox>
<el-input v-model="item.onlineAddress" clearable placeholder="请输入比赛网址" :disabled="!item.onlineButton" style="width: 400px;margin-left: 10px"></el-input>
</div>
<div class="line">
<el-checkbox v-model="item.offlineButton">线下</el-checkbox>
<el-input v-model="item.offlineAddress" clearable placeholder="请输入地址" :disabled="!item.offlineButton" style="width: 400px;margin-left: 10px"></el-input>
</div>
</el-form-item>
</template>
</div> </div>
</el-form> </el-form-item>
<template v-if="item.method === 2">
<el-form-item class="req"
label="比赛地点">
<el-input v-model="item.offlineAddress"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item class="req"
label="比赛内容">
<el-input v-model="item.contentDescription"
type="textarea"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item class="req"
label="评分规则">
<el-input v-model="item.scoreRule"
type="textarea"
style="width: 80%"></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item class="req"
prop="cid"
label="课程系统">
{{ item.systemName }}
</el-form-item>
<el-form-item class="req"
prop="assessmentId"
label="已选择考核">
{{ item.projectName }}
</el-form-item>
<el-form-item class="req"
prop="resultAnnouncementTime"
label="比赛地点">
<div class="line">
<el-checkbox v-model="item.onlineButton">线上</el-checkbox>
<el-input v-model="item.onlineAddress"
clearable
placeholder="请输入比赛网址"
:disabled="!item.onlineButton"
style="width: 400px;margin-left: 10px"></el-input>
</div>
<div class="line">
<el-checkbox v-model="item.offlineButton">线下</el-checkbox>
<el-input v-model="item.offlineAddress"
clearable
placeholder="请输入地址"
:disabled="!item.offlineButton"
style="width: 400px;margin-left: 10px"></el-input>
</div>
</el-form-item>
</template>
</div> </div>
</div> </el-form>
</div>
<set v-if="setVisible" :form.sync="form[curStep]" :step1.sync="step1" @hideSet="hideSet" />
</div> </div>
<set v-if="setVisible"
:form.sync="form[curStep]"
:step1.sync="step1"
@hideSet="hideSet" />
</div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import set from './set' import set from './set'
export default { export default {
props: ['setupId', 'competitionId', 'editing'], props: ['setupId', 'competitionId', 'editing'],
data() { data () {
return { return {
id: this.$route.query.id, id: this.$route.query.id,
updateTime: 0, updateTime: 0,
step1: this.$parent.$refs.step1.form, step1: this.$parent.$refs.step1.form,
cache: this.$store.state.match.cache, cache: this.$store.state.match.cache,
nums: ['一', '二', '三'], nums: ['一', '二', '三'],
methods: [ methods: [
{ {
id: 0, id: 0,
name: '实操' name: '实操'
},
{
id: 1,
name: '理论'
},
{
id: 2,
name: '线下'
}
],
originForm: {
cid: '',
contentDescription: '',
endTime: '',
scoreRule: '',
stageId: '',
startTime: '',
systemId: '',
offlineAddress: '',
offlineButton: 0,
onlineAddress: '',
onlineButton: 0,
time: []
},
form: [],
setVisible: false,
curStep: 0,
};
},
components: {
set
},
watch: {
// ,
form: {
handler(){
this.updateTime++
}, },
deep:true {
}, id: 1,
}, name: '理论'
mounted() { },
this.handleForm() {
}, id: 2,
methods: { name: '线下'
//
resumeData() {
if (this.cache) {
this.curStep = this.cache.curStep
if (this.cache.form) this.form = this.cache.form
this.setVisible = true
this.$store.commit('match/setCache', null)
} }
],
originForm: {
cid: '',
mallId: '',
contentDescription: '',
endTime: '',
scoreRule: '',
stageId: '',
startTime: '',
systemId: '',
offlineAddress: '',
offlineButton: 0,
onlineAddress: '',
onlineButton: 0,
time: []
}, },
// form form: [],
handleForm() { setVisible: false,
// id curStep: 0,
this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => { pass: 0
res.competitionStages.map(e => { };
const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm)) },
if (form.startTime) { components: {
form.time = [form.startTime, form.endTime] set
} else { },
form.time = [] watch: {
} // ,
form.offlineButton = !!form.offlineButton form: {
form.onlineButton = !!form.onlineButton handler () {
form.method = e.method this.updateTime++
form.stageId = e.stageId
form.stageName = e.stageName
this.form.push(form)
})
this.resumeData()
this.$nextTick(() => {
this.updateTime = 0
})
}).catch(res => {})
}, },
// deep: true
toSet(i) { },
this.curStep = i },
this.$parent.showBtns = false mounted () {
this.handleForm()
},
methods: {
//
resumeData () {
if (this.cache) {
this.curStep = this.cache.curStep
if (this.cache.form) this.form = this.cache.form
this.setVisible = true this.setVisible = true
}, this.$store.commit('match/setCache', null)
// }
hideSet(form) { },
if (form) this.form[this.curStep] = form // form
this.setVisible = false handleForm () {
this.$parent.showBtns = true // id
}, this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => {
// res.competitionStages.map(e => {
timeChange(val) { const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm))
if (val.length) { if (form.startTime) {
const startTime = new Date(val[0]) form.time = [form.startTime, form.endTime]
const endTime = new Date(val[1]) } else {
const { playStartTime, playEndTime } = this.step1 form.time = []
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') }
const { form, curStep } = this form.offlineButton = !!form.offlineButton
for (const i in form) { form.onlineButton = !!form.onlineButton
// form.method = e.method
if (i !== curStep) { form.stageId = e.stageId
const time1 = new Date(form[i].startTime) form.stageName = e.stageName
const time2 = new Date(form[i].endTime) this.form.push(form)
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) { })
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。') this.resumeData()
break this.$nextTick(() => {
} this.updateTime = 0
})
}).catch(res => { })
},
//
toSet (i) {
this.curStep = i
this.$parent.showBtns = false
this.setVisible = true
},
//
hideSet (form) {
if (form) this.form[this.curStep] = form
this.setVisible = false
this.$parent.showBtns = true
},
//
timeChange (val) {
if (val.length) {
const startTime = new Date(val[0])
const endTime = new Date(val[1])
const { playStartTime, playEndTime } = this.step1
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
const { form, curStep } = this
for (const i in form) {
//
if (i !== curStep) {
const time1 = new Date(form[i].startTime)
const time2 = new Date(form[i].endTime)
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
break
} }
} }
} }
}, }
// },
publish() { //
this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {}) publish () {
}, this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { })
// },
save(status, next = 0,releaseType,cb) { //
const { form } = this save (status, next = 0, releaseType, cb) {
if (!form.length) { const { form } = this
this.$parent.hideLoad() if (!form.length) {
util.successMsg('保存成功') this.$parent.hideLoad()
this.$emit('next', next) util.successMsg('保存成功')
return this.$emit('next', next)
} return
// }
if (status) { //
let invalid = 0 if (status) {
const { playStartTime, playEndTime } = this.step1 let invalid = 0
for (const e of form) { const { playStartTime, playEndTime } = this.step1
if (!e.time.length) { for (const e of form) {
if (!e.time.length) {
invalid = 1
util.errorMsg('请选择比赛时间')
break
}
if (new Date(e.time[0]) < new Date(playStartTime) || new Date(e.time[1]) > new Date(playEndTime)) {
invalid = 1
util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
break
}
e.startTime = e.time[0]
e.endTime = e.time[1]
if (e.method !== 2 && !e.cid) {
invalid = 1
util.errorMsg('请选择课程')
break
}
if (e.method === 2) { // 线
if (!e.offlineAddress) {
invalid = 1
util.errorMsg('请输入比赛地点')
break
}
if (!e.contentDescription) {
invalid = 1 invalid = 1
util.errorMsg('请选择比赛时间') util.errorMsg('请输入比赛内容')
break break
} }
if (new Date(e.time[0]) < new Date(playStartTime) || new Date(e.time[1]) > new Date(playEndTime)) { if (!e.scoreRule) {
invalid = 1 invalid = 1
util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') util.errorMsg('请输入评分规则')
break break
} }
e.startTime = e.time[0] } else {
e.endTime = e.time[1] if (e.onlineButton && !e.onlineAddress) {
if (e.method !== 2 && !e.cid) {
invalid = 1 invalid = 1
util.errorMsg('请选择课程') util.errorMsg('请输入线上地点')
break break
} }
if (e.method === 2) { // 线 if (e.offlineButton && !e.offlineAddress) {
if (!e.offlineAddress) { invalid = 1
invalid = 1 util.errorMsg('请输入线下地点')
util.errorMsg('请输入比赛地点') break
break }
} if (!e.onlineAddress && !e.offlineAddress) {
if (!e.contentDescription) { invalid = 1
invalid = 1 util.errorMsg('请输入比赛地点')
util.errorMsg('请输入比赛内容') break
break
}
if (!e.scoreRule) {
invalid = 1
util.errorMsg('请输入评分规则')
break
}
} else {
if (e.onlineButton && !e.onlineAddress) {
invalid = 1
util.errorMsg('请输入线上地点')
break
}
if (e.offlineButton && !e.offlineAddress) {
invalid = 1
util.errorMsg('请输入线下地点')
break
}
if (!e.onlineAddress && !e.offlineAddress) {
invalid = 1
util.errorMsg('请输入比赛地点')
break
}
} }
} }
if (invalid) return
} }
// if (invalid) return
for (const e of form) { }
e.offlineButton = e.offlineButton ? 1 : 0 //
e.onlineButton = e.onlineButton ? 1 : 0 for (const e of form) {
} e.offlineButton = e.offlineButton ? 1 : 0
this.$parent.showLoad() e.onlineButton = e.onlineButton ? 1 : 0
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], { }
competitionContents: form this.$parent.showLoad()
}).then(res => { this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {
this.$parent.hideLoad() competitionContents: form
// }).then(res => {
status && this.publish(status) this.$parent.hideLoad()
util.successMsg((status ? '发布' : '保存') + '成功') //
this.$emit('next', next,cb) status && this.publish(status)
}).catch(err => { util.successMsg((status ? '发布' : '保存') + '成功')
this.$parent.hideLoad() this.$emit('next', next, cb)
}) }).catch(err => {
}, this.$parent.hideLoad()
} })
},
}
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.step { .step {
padding-bottom: 10px; padding-bottom: 10px;
background-color: #f9f9f9; background-color: #f9f9f9;
.title { .title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px 15px; padding: 10px 15px;
margin-bottom: 10px; margin-bottom: 10px;
background-color: #ededed; background-color: #ededed;
} }
} }
.line { .line {
margin-bottom: 10px; margin-bottom: 10px;
} }
/deep/.req { /deep/.req {
.el-form-item__label { .el-form-item__label {
&:before { &:before {
content: '*'; content: '*';
margin-right: 5px; margin-right: 5px;
font-size: 18px; font-size: 18px;
vertical-align: middle; vertical-align: middle;
color: #f00; color: #f00;
}
} }
}
} }
</style> </style>

@ -1,22 +1,30 @@
<template> <template>
<!-- 赛事管理 --> <!-- 赛事管理 -->
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<div class="flex-between"> class="m-b-20">
<el-page-header @back="back" :content="name + '/管理'"></el-page-header> <div class="flex-between">
</div> <el-page-header @back="back"
</el-card> :content="name + '/管理'"></el-page-header>
<div class="page" style="margin-bottom: 24px"> </div>
<div class="tabs"> </el-card>
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a> <div class="page"
</div> style="margin-bottom: 24px">
<MatchDetail v-if="active == 'tab1'" ref="detail" /> <div class="tabs">
<MatchArch v-if="active == 'tab2'" /> <a class="item"
<MatchProgress v-else-if="active == 'tab3'" /> v-for="(item,index) in tabs"
<notice v-else-if="active == 'tab4'" /> :key="index"
<MatchSignup v-else-if="active == 'tab5'" /> :class="{active: index == active}"
</div> @click="tabChange(index)">{{ item }}</a>
</div>
<MatchDetail v-if="active == 'tab1'"
ref="detail" />
<MatchArch v-if="active == 'tab2'" />
<MatchProgress v-else-if="active == 'tab3'" />
<notice v-else-if="active == 'tab4'" />
<MatchSignup v-else-if="active == 'tab5'" />
</div> </div>
</div>
</template> </template>
@ -29,132 +37,133 @@ import notice from "./notice";
import MatchSignup from "./matchSignup"; import MatchSignup from "./matchSignup";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "matchManage", name: "matchManage",
data() { data () {
return { return {
name: this.$route.query.name, name: this.$route.query.name,
active: this.$route.query.tab || "tab1", active: this.$route.query.tab || "tab1",
tabs: { tabs: {
tab1: "大赛详情", tab1: "大赛详情",
tab2: "大赛成绩管理", tab2: "大赛成绩管理",
tab3: "竞赛进展", tab3: "竞赛进展",
tab4: "公告通知", tab4: "公告通知",
tab5: "报名人员" tab5: "报名人员"
}, },
}; pass: 0
}, };
components: { },
MatchDetail, components: {
MatchArch, MatchDetail,
MatchProgress, MatchArch,
notice, MatchProgress,
MatchSignup notice,
}, MatchSignup
computed: { },
...mapState("user", [ computed: {
'page' ...mapState("user", [
]), 'page'
...mapState('auth', [ ]),
'btns' ...mapState('auth', [
]) 'btns'
}, ])
mounted() { },
Setting.dynamicRoute && this.initTabs() mounted () {
}, Setting.dynamicRoute && this.initTabs()
beforeRouteLeave(to, from, next) { },
const { detail } = this.$refs beforeRouteLeave (to, from, next) {
if (detail) { const { detail } = this.$refs
const step = detail.$refs['step' + detail.step] if (detail) {
if (detail.step < 4 && step && step.updateTime) { const step = detail.$refs['step' + detail.step]
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示.......', { if (detail.step < 4 && step && step.updateTime && !step.pass && !this.pass) {
type: 'warning' this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示.......', {
}).then(() => { type: 'warning'
detail.save(1,to.path,next) }).then(() => {
}).catch(() => { detail.save(1, to.path, next)
next() }).catch(() => {
})
} else {
next() next()
} })
} else { } else {
next() next()
} }
}, } else {
methods: { next()
initTabs() { }
const { btns } = this },
console.log("🚀 ~ file: index.vue:67 ~ initTabs ~ btns", btns) methods: {
const tab1 = btns.includes('/match/list:管理:大赛详情') initTabs () {
const tab2 = btns.includes('/match/list:管理:大赛成绩管理') const { btns } = this
const tab3 = btns.includes('/match/list:管理:竞赛进展') console.log("🚀 ~ file: index.vue:67 ~ initTabs ~ btns", btns)
const tab4 = btns.includes('/match/list:管理:公告通知') const tab1 = btns.includes('/match/list:管理:大赛详情')
const tab5 = btns.includes('/match/list:管理:报名人员') const tab2 = btns.includes('/match/list:管理:大赛成绩管理')
const tab3 = btns.includes('/match/list:管理:竞赛进展')
const tab4 = btns.includes('/match/list:管理:公告通知')
const tab5 = btns.includes('/match/list:管理:报名人员')
tab1 || this.$delete(this.tabs, 'tab1') tab1 || this.$delete(this.tabs, 'tab1')
tab2 || this.$delete(this.tabs, 'tab2') tab2 || this.$delete(this.tabs, 'tab2')
tab3 || this.$delete(this.tabs, 'tab3') tab3 || this.$delete(this.tabs, 'tab3')
tab4 || this.$delete(this.tabs, 'tab4') tab4 || this.$delete(this.tabs, 'tab4')
tab5 || this.$delete(this.tabs, 'tab5') tab5 || this.$delete(this.tabs, 'tab5')
const type = this.$route.query.tab const type = this.$route.query.tab
const keys = Object.keys(this.tabs) const keys = Object.keys(this.tabs)
this.active = keys.includes(type) ? type : keys[0] this.active = keys.includes(type) ? type : keys[0]
}, },
// //
hideArch() { hideArch () {
this.$delete(this.tabs, 'tab2') this.$delete(this.tabs, 'tab2')
}, },
back() { back () {
this.handleSave(0) && this.backPage() this.handleSave(0) && this.backPage()
}, },
// confirm // confirm
handleSave(i) { handleSave (i) {
// //
if (this.active === 'tab1') { if (this.active === 'tab1') {
const { detail } = this.$refs const { detail } = this.$refs
if (detail) { if (detail) {
const step = detail.$refs['step' + detail.step] const step = detail.$refs['step' + detail.step]
if (detail.step < 4 && step && step.updateTime) { if (detail.step < 4 && step && step.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', { this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
detail.save(1, 1) detail.save(1, 1)
this.backOrTab(i) this.backOrTab(i)
}).catch(() => { }).catch(() => {
this.backOrTab(i)
})
} else {
this.backOrTab(i)
}
} else {
this.backOrTab(i) this.backOrTab(i)
} })
return false
} else { } else {
return true this.backOrTab(i)
} }
}, } else {
// this.backOrTab(i)
backPage(){
console.log(444, this.$store.state)
this.$router.push(`/match?page=${this.$store.state.match.page}`)
},
// tab
tabSwitch(i) {
this.active = i
this.$router.push(`/match/manage?id=${this.$route.query.id}&tab=${i}&name=${this.name}`)
},
// tab
backOrTab(i) {
i ? this.tabSwitch(i) : this.backPage()
},
// tab
tabChange(i) {
this.handleSave(i) && this.tabSwitch(i)
} }
return false
} else {
return true
}
},
//
backPage () {
console.log(444, this.$store.state)
this.pass = 1
this.$router.push(`/match?page=${this.$store.state.match.page}`)
},
// tab
tabSwitch (i) {
this.active = i
this.$router.push(`/match/manage?id=${this.$route.query.id}&tab=${i}&name=${this.name}`)
},
// tab
backOrTab (i) {
i ? this.tabSwitch(i) : this.backPage()
},
// tab
tabChange (i) {
this.handleSave(i) && this.tabSwitch(i)
} }
}
}; };
</script> </script>
<style scoped> <style scoped>
</style> </style>

@ -356,7 +356,7 @@ export default {
publicationType: this.type, publicationType: this.type,
locationStageId: this.stageId, locationStageId: this.stageId,
stageIds: ids.splice(0, ids.length - 1) stageIds: ids.splice(0, ids.length - 1)
}).then(({ page, publishStatus }) => { }).then(({ page, publishStatus, total }) => {
this.published = publishStatus this.published = publishStatus
this.list = page this.list = page
this.total = total this.total = total
@ -392,12 +392,7 @@ export default {
// //
typeChange (val) { typeChange (val) {
this.$post(`${this.api.toggleTheSortingMode}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&whetherToManuallyPublish=${this.type}`).then(res => { }).catch(res => { }) this.$post(`${this.api.toggleTheSortingMode}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&whetherToManuallyPublish=${this.type}`).then(res => { }).catch(res => { })
// this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&publicationType=${this.type}`).then(({ whetherToPublish }) => {
// if (whetherToPublish && !val) this.sourceType = '0'
this.getRank() this.getRank()
// this.published = whetherToPublish
// }).catch(res => {})
}, },
initData () { initData () {
this.page = 1 this.page = 1
@ -498,12 +493,10 @@ export default {
}, },
// //
publishSubmit () { publishSubmit () {
const { startTime, endTime } = this.grades[this.index]
if (Date.now() <= new Date(endTime)) return util.errorMsg('当前阶段还在进行中,请在本阶段结束后再发布!')
if (this.type) { // if (this.type) { //
this.$post(this.api.batchRelease, this.list.map(e => e.id)).then(res => { this.$post(this.api.batchRelease, this.list.map(e => e.id)).then(res => {
this.getData() // this.getData()
util.successMsg('发布成功!') // util.successMsg('')
}).catch(res => { }) }).catch(res => { })
} else { } else {
let data = [] // data let data = [] // data
@ -529,30 +522,15 @@ export default {
const ids = this.grades.map(e => e.stageId) const ids = this.grades.map(e => e.stageId)
ids.pop() ids.pop()
// //
// this.$post(`${this.api.releaseVerification}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&whetherToManuallyPublish=${this.type}`).then(res => {
this.$post(this.api.publishRanking, data).then(res => { this.$post(this.api.publishRanking, data).then(res => {
this.uploadData = [] this.uploadData = []
this.getData() // this.getData()
util.successMsg('发布成功!') // util.successMsg('')
}).catch(res => { }) }).catch(res => { })
// }).catch(res => {})
} }
}, },
// //
publish () { publish () {
//
// if (this.published && this.sourceType != this.type) {
// this.$confirm(this.sourceType == 1 && !this.type ?
// '' :
// '', '', {
// type: 'success'
// }).then(() => {
// this.publishSubmit()
// }).catch(() => {})
// } else {
// this.publishSubmit()
// }
this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&publicationType=${this.type}`).then(({ whetherToPublish }) => { this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&publicationType=${this.type}`).then(({ whetherToPublish }) => {
whetherToPublish ? whetherToPublish ?
this.$confirm('排名已经发布,是否直接覆盖?', '提示', { this.$confirm('排名已经发布,是否直接覆盖?', '提示', {
@ -562,7 +540,6 @@ export default {
}).catch(() => { }) : }).catch(() => { }) :
this.publishSubmit() this.publishSubmit()
}).catch(res => { }) }).catch(res => { })
// this.publishSubmit()
}, },
// //
async getPublishTime () { async getPublishTime () {
@ -584,13 +561,18 @@ export default {
}, },
// //
async publishTimeSubmit () { async publishTimeSubmit () {
this.$post(this.api.addCompetitionStageRankingTime, { const { startTime, endTime } = this.grades[this.index]
if (Date.now() <= new Date(endTime)) return util.errorMsg('当前阶段还在进行中,请在本阶段结束后再发布!')
this.publishSubmit()
await this.$post(this.api.addCompetitionStageRankingTime, {
competitionId: this.id, competitionId: this.id,
isOverallRanking: this.active ? 0 : 1, isOverallRanking: this.active ? 0 : 1,
publicationType: this.type, publicationType: this.type,
stageId: this.active || this.stageId, stageId: this.active || this.stageId,
releaseTime: util.formatDate("yyyy-MM-dd hh:mm:ss", this.publishTime) releaseTime: util.formatDate("yyyy-MM-dd hh:mm:ss", this.publishTime)
}) })
util.successMsg('发布成功') util.successMsg('发布成功')
this.getData() this.getData()
this.uploaded = 0 this.uploaded = 0
@ -608,7 +590,7 @@ export default {
// //
if (publish) { if (publish) {
// //
if (this.type && !this.uploaded) { if (this.type && !this.uploaded && !this.list.length) {
return util.errorMsg('请先上传数据!') return util.errorMsg('请先上传数据!')
} else { } else {
this.publishTime = new Date() this.publishTime = new Date()
@ -618,9 +600,9 @@ export default {
try { try {
// //
// if (this.timeId) { // if (this.timeId) {
await this.$post(`${this.api.cancelCompetitionStageRankingTime}?competitionId=${this.id}&releaseId=${this.timeId}&isOverallRanking=${this.active ? 0 : 1}&stageId=${this.active || this.stageId}`) // await this.$post(`${this.api.cancelCompetitionStageRankingTime}?competitionId=${this.id}&releaseId=${this.timeId}&isOverallRanking=${this.active ? 0 : 1}&stageId=${this.active || this.stageId}`)
// } else { // } else {
await this.$post(`${this.api.cancelRanking}?competitionId=${this.id}&isOverallRanking=${this.active ? 0 : 1}&${this.active ? 'stageIds=' + this.active : query.join('&')}`) await this.$post(`${this.api.cancelRanking}?competitionId=${this.id}&isOverallRanking=${this.active ? 0 : 1}&${this.active ? 'stageIds=' + this.active : query.join('&')}&releaseId=${this.timeId}`)
// } // }
this.publishTime = '' this.publishTime = ''
this.sourceType = '' this.sourceType = ''

Loading…
Cancel
Save