|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<div style="padding: 0 100px;"> |
|
|
|
|
<el-card shadow="hover" class="m-b-20 head-card"> |
|
|
|
|
<div class="flex-between"> |
|
|
|
|
<el-page-header @back="$router.back()" content="参赛信息与成绩"></el-page-header> |
|
|
|
@ -7,20 +7,22 @@ |
|
|
|
|
</el-card> |
|
|
|
|
|
|
|
|
|
<el-card shadow="hover" class="m-b-20"> |
|
|
|
|
<table v-if="form.completeCompetitionSetup.competitionType" class="table m-b-20"> |
|
|
|
|
<tr> |
|
|
|
|
<th width="150">团队名称:</th> |
|
|
|
|
<td> |
|
|
|
|
<el-input :disabled="!editing" v-model="info.team.teamName"></el-input> |
|
|
|
|
</td> |
|
|
|
|
<th width="150">团队邀请码:</th> |
|
|
|
|
<td> |
|
|
|
|
<el-input :disabled="!editing" v-model="info.team.invitationCode"></el-input> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
|
<div v-if="form.completeCompetitionSetup.competitionType && status < 4" class="m-b-20 text-center"> |
|
|
|
|
<el-button type="primary" @click="edit(1)">{{ editing ? '保存' : '编辑' }}</el-button> |
|
|
|
|
<div style="display: flex;align-items: center"> |
|
|
|
|
<table v-if="form.completeCompetitionSetup.competitionType" class="table m-b-20 m-r-10"> |
|
|
|
|
<tr> |
|
|
|
|
<th width="150">团队名称:</th> |
|
|
|
|
<td> |
|
|
|
|
<el-input :disabled="!editing" v-model="info.team.teamName"></el-input> |
|
|
|
|
</td> |
|
|
|
|
<th width="150">团队邀请码:</th> |
|
|
|
|
<td> |
|
|
|
|
<el-input :disabled="!editing" v-model="info.team.invitationCode"></el-input> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
|
<div v-if="form.completeCompetitionSetup.competitionType && status < 4" class="m-b-20 text-center"> |
|
|
|
|
<el-button type="primary" @click="edit(1)">{{ editing ? '保存' : '编辑' }}</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<table class="table"> |
|
|
|
|
<tr> |
|
|
|
@ -77,7 +79,7 @@ |
|
|
|
|
<template v-if="form.completeCompetitionSetup.competitionType"> |
|
|
|
|
<th width="110">参赛人数限制</th> |
|
|
|
|
<th>允许参赛人员</th> |
|
|
|
|
<th v-if="info.team.captain === 0 && form.rule === 0">总分</th> |
|
|
|
|
<th v-if="form.rule === 0">总分</th> |
|
|
|
|
</template> |
|
|
|
|
<th>竞赛成绩</th> |
|
|
|
|
</tr> |
|
|
|
@ -87,11 +89,24 @@ |
|
|
|
|
<td>{{ item.stageName }}</td> |
|
|
|
|
<template v-if="form.completeCompetitionSetup.competitionType"> |
|
|
|
|
<td>{{ item.teamNumLimit || '不限制' }}</td> |
|
|
|
|
<td>{{ item.teamParticipantIds || '无' }}</td> |
|
|
|
|
<td v-if="info.team.captain === 0 && form.rule === 0 && !i" :rowspan="info.stages.length">{{ info.totalScore }}</td> |
|
|
|
|
<td> |
|
|
|
|
<template v-if="item.participants"> |
|
|
|
|
<el-tag |
|
|
|
|
v-for="tag in item.participants" |
|
|
|
|
:key="tag.name" |
|
|
|
|
class="m-r-5" |
|
|
|
|
closable |
|
|
|
|
@close="removePar(tag, item)"> |
|
|
|
|
{{tag.name}} |
|
|
|
|
</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<span v-else class="m-r-5">无</span> |
|
|
|
|
<i class="el-icon-edit icon" @click="selectPar(item)"></i> |
|
|
|
|
</td> |
|
|
|
|
<td v-if="form.rule === 0 && !i" :rowspan="info.stages.length">{{ info.totalScore }}</td> |
|
|
|
|
</template> |
|
|
|
|
<td> |
|
|
|
|
<span v-if="item.score" class="m-r-10">分数{{item.score}}</span> |
|
|
|
|
<span v-if="item.score > 0" class="m-r-10">分数{{item.score}}</span> |
|
|
|
|
<el-button type="text" :disabled="item.resultsDetails === 1 || (form.completeCompetitionSetup.competitionType && !item.reportId) || (form.completeCompetitionSetup.competitionType === 0 && !item.reportId)" @click="show(item)">查看成绩详情</el-button> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
@ -144,7 +159,7 @@ |
|
|
|
|
<el-checkbox-group v-model="checkedMembers"> |
|
|
|
|
<el-checkbox v-for="(item, i) in chooses" :key="i" :label="item.accountId">{{ item.userName }}</el-checkbox> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
<p v-if="info.teamLimit" style="margin-top: 15px;font-size: 12px;">注:当前阶段限制1人参赛,且此竞赛每个成员只能参加一个阶段赛项。</p> |
|
|
|
|
<p v-if="info.teamLimit && curRow.teamNumLimit" style="margin-top: 15px;font-size: 12px;">注:当前阶段限制{{ curRow.teamNumLimit }}人参赛,且此竞赛每个成员只能参加一个阶段赛项。</p> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" type="primary" @click="chooseSubmit">确定</el-button> |
|
|
|
|
<el-button size="small" @click="chooseVisible = false">取消</el-button> |
|
|
|
@ -280,6 +295,21 @@ export default { |
|
|
|
|
info.caption = caption ? caption : {} |
|
|
|
|
info.person = info.personalDetail || info.teamDetail.find(e => e.accountId == info.team.accountId) |
|
|
|
|
this.originInfo = JSON.parse(JSON.stringify(info)) |
|
|
|
|
// 把参赛人员的名字和accountId处理成一个数组 |
|
|
|
|
info.stages && info.stages.map(e => { |
|
|
|
|
if (e.participantAccountIds && e.teamParticipantIds) { |
|
|
|
|
const accountIds = e.participantAccountIds.split(',').map(n => +n) |
|
|
|
|
const names = e.teamParticipantIds.split(',') |
|
|
|
|
const participants = [] |
|
|
|
|
accountIds.map((n, i) => { |
|
|
|
|
participants.push({ |
|
|
|
|
id: n, |
|
|
|
|
name: names[i] |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
e.participants = participants |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 设置定时器,阶段比赛结束后公布成绩,到时间后调本接口 |
|
|
|
|
const now = Date.now() |
|
|
|
|
this.form.competitionStage.map(e => { |
|
|
|
@ -329,8 +359,9 @@ export default { |
|
|
|
|
teamId, |
|
|
|
|
teamName, |
|
|
|
|
invitationCode, |
|
|
|
|
whetherSignUp: 1 |
|
|
|
|
whetherSignUp: 0 |
|
|
|
|
}).then(res => { |
|
|
|
|
this.editing = false |
|
|
|
|
this.getInfo() |
|
|
|
|
showMsg && util.successMsg('保存成功') |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -419,55 +450,81 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!start) { |
|
|
|
|
this.$confirm('确定要踢出该成员吗?', '提示', { |
|
|
|
|
let include |
|
|
|
|
for (const e of this.info.stages) { |
|
|
|
|
if (e.participantAccountIds) { |
|
|
|
|
const ids = e.participantAccountIds.split(',').map(n => +n) |
|
|
|
|
if (ids.includes(row.accountId)) { |
|
|
|
|
include = e.stageName |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$confirm(include ? `该成员已被指定参加${include},踢出后需重新指定成员参加,是否确认踢出团队?` : '确定要踢出该成员吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.removeTheLine}?teamId=${this.info.teamId}&competitionId=${this.id}&accountId=${row.accountId}`).then(res => { |
|
|
|
|
util.successMsg('移除成功') |
|
|
|
|
this.getInfo() |
|
|
|
|
if (row.accountId == this.accountId) this.$router.back() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 选择参赛人员 |
|
|
|
|
selectPar(row) { |
|
|
|
|
const item = this.form.competitionStage.find(e => e.stageId == row.stageId) |
|
|
|
|
if (item) { |
|
|
|
|
// 该阶段已经开始比赛则不能修改 |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) { |
|
|
|
|
return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!') |
|
|
|
|
} else { |
|
|
|
|
const { teamLimit, stages, teamDetail } = this.info |
|
|
|
|
// teamLimit=true,则每个成员只能参加一个阶段的比赛,要获取stages里返回的所有participantAccountIds(参赛人员的accountId),然后不显示这些参赛人员 |
|
|
|
|
if (teamLimit) { |
|
|
|
|
const chooses = [] |
|
|
|
|
let ids = [] |
|
|
|
|
// 获取已经允许参赛的人员accountId |
|
|
|
|
stages.map(e => { |
|
|
|
|
const id = e.participantAccountIds |
|
|
|
|
id && ids.push(...id.split(',').map(n => +n)) |
|
|
|
|
}) |
|
|
|
|
ids = [...new Set(ids)] |
|
|
|
|
teamDetail.map(e => { |
|
|
|
|
ids.includes(e.accountId) || chooses.push(e) // 没有参赛的人员则显示出来 |
|
|
|
|
}) |
|
|
|
|
this.chooses = chooses |
|
|
|
|
// 移除参赛人员 |
|
|
|
|
removePar(e, stage) { |
|
|
|
|
this.$confirm('确定要移除该成员吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.cancelParticipant, { |
|
|
|
|
accountId: e.id, |
|
|
|
|
competitionId: this.id, |
|
|
|
|
stageId: stage.stageId, |
|
|
|
|
teamId: this.info.teamId |
|
|
|
|
}).then(res => { |
|
|
|
|
util.successMsg('移除成功') |
|
|
|
|
this.getInfo() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
// 选择参赛人员 |
|
|
|
|
selectPar(row) { |
|
|
|
|
const item = this.form.competitionStage.find(e => e.stageId == row.stageId) |
|
|
|
|
if (item) { |
|
|
|
|
// 该阶段已经开始比赛则不能修改 |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) { |
|
|
|
|
return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!') |
|
|
|
|
} else { |
|
|
|
|
this.chooses = this.info.teamDetail |
|
|
|
|
const { teamLimit, stages, teamDetail } = this.info |
|
|
|
|
// teamLimit=true,则每个成员只能参加一个阶段的比赛,要获取stages里返回的所有participantAccountIds(参赛人员的accountId),然后不显示这些参赛人员 |
|
|
|
|
if (teamLimit) { |
|
|
|
|
const chooses = [] |
|
|
|
|
let ids = [] |
|
|
|
|
// 获取已经允许参赛的人员accountId |
|
|
|
|
stages.map(e => { |
|
|
|
|
let id = e.participantAccountIds |
|
|
|
|
if (e.stageId != row.stageId && id) ids.push(...id.split(',').map(n => +n)) |
|
|
|
|
}) |
|
|
|
|
ids = [...new Set(ids)] |
|
|
|
|
teamDetail.map(e => { |
|
|
|
|
ids.includes(e.accountId) || chooses.push(e) // 没有参赛的人员则显示出来 |
|
|
|
|
}) |
|
|
|
|
this.chooses = chooses |
|
|
|
|
} else { |
|
|
|
|
this.chooses = this.info.teamDetail |
|
|
|
|
} |
|
|
|
|
this.curRow = row |
|
|
|
|
this.checkedMembers = [] |
|
|
|
|
this.chooseVisible = true |
|
|
|
|
} |
|
|
|
|
this.curRow = row |
|
|
|
|
this.chooseVisible = true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
// 选择参赛人员提交 |
|
|
|
|
chooseSubmit() { |
|
|
|
|
const accountIds = this.checkedMembers |
|
|
|
|
if (!accountIds.length) return util.errorMsg('请选择参赛成员!') |
|
|
|
|
const limit = this.curRow.teamNumLimit // 参赛人数限制 |
|
|
|
|
if (accountIds.length > limit) return util.errorMsg(`请选择${limit}个以下参赛成员!`) // 选择的参赛人员个数不能大于参赛人数限制 |
|
|
|
|
if (limit && accountIds.length > limit) return util.errorMsg(`请选择${limit}个以下参赛成员!`) // 选择的参赛人员个数不能大于参赛人数限制 |
|
|
|
|
this.$post(this.api.stageSelectParticipants, { |
|
|
|
|
accountIds, |
|
|
|
|
competitionId: this.id, |
|
|
|
@ -483,7 +540,7 @@ export default { |
|
|
|
|
// 查看成绩详情 |
|
|
|
|
show(row) { |
|
|
|
|
// 团队展示弹框,个人跳转实验报告 |
|
|
|
|
if (this.form.completeCompetitionSetup.competitionType && this.info.team.captain === 0) { // 团队比赛并且是队长,则展示团队成员成绩详情 |
|
|
|
|
if (this.form.completeCompetitionSetup.competitionType) { // 团队比赛并且是队长,则展示团队成员成绩详情 |
|
|
|
|
this.curRow = row |
|
|
|
|
this.memberVisible = true |
|
|
|
|
const teamId = this.form.competitionRegistration.teamId |
|
|
|
@ -513,6 +570,9 @@ export default { |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.m-r-5 { |
|
|
|
|
margin-right: 5px; |
|
|
|
|
} |
|
|
|
|
.l-title { |
|
|
|
|
margin-top: 20px; |
|
|
|
|
font-size: 18px; |
|
|
|
@ -536,6 +596,9 @@ export default { |
|
|
|
|
font-size: 16px; |
|
|
|
|
color: #7a7a7a; |
|
|
|
|
cursor: pointer; |
|
|
|
|
&:hover { |
|
|
|
|
color: #007EFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.plus { |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|