|
|
|
@ -69,23 +69,36 @@ |
|
|
|
|
<th width="100">分数</th> |
|
|
|
|
<th width="100">得分详情</th> |
|
|
|
|
</tr> |
|
|
|
|
<tr v-for="(item, i) in teams" :key="i"> |
|
|
|
|
<template v-if="!active && item.rowspan"> |
|
|
|
|
<td :rowspan="item.rowspan">{{ item.stageName }}</td> |
|
|
|
|
<td :rowspan="item.rowspan">{{ item.teamScore }}</td> |
|
|
|
|
</template> |
|
|
|
|
<td>{{ i + 1 }}</td> |
|
|
|
|
<td>{{ item.userName }}</td> |
|
|
|
|
<td>{{ item.schoolName }}</td> |
|
|
|
|
<td>{{ item.timeSum }}min</td> |
|
|
|
|
<td>{{ item.score }}</td> |
|
|
|
|
<td> |
|
|
|
|
<el-button type="text" @click="toReport(item)">查看</el-button> |
|
|
|
|
</td> |
|
|
|
|
<template v-if="teams.length"> |
|
|
|
|
<tr v-for="(item, i) in teams" :key="i"> |
|
|
|
|
<template v-if="!active && item.rowspan"> |
|
|
|
|
<td :rowspan="item.rowspan">{{ item.stageName }}</td> |
|
|
|
|
<td class="scores" :rowspan="item.rowspan"> |
|
|
|
|
<p class="score">{{ item.teamScore }}</p> |
|
|
|
|
<p>{{ item.teamCalculationMethodName }}</p> |
|
|
|
|
<p>权重:</p> |
|
|
|
|
<p>{{ item.pointWeight }}%</p> |
|
|
|
|
</td> |
|
|
|
|
</template> |
|
|
|
|
<template v-if="item.accountId"> |
|
|
|
|
<td>{{ i + 1 }}</td> |
|
|
|
|
<td>{{ item.userName }}</td> |
|
|
|
|
<td>{{ item.schoolName }}</td> |
|
|
|
|
<td>{{ item.timeSum }}min</td> |
|
|
|
|
<td>{{ item.score }}</td> |
|
|
|
|
<td> |
|
|
|
|
<el-button v-if="item.reportId" type="text" @click="toReport(item)">查看</el-button> |
|
|
|
|
</td> |
|
|
|
|
</template> |
|
|
|
|
<td v-else colspan="6"></td> |
|
|
|
|
</tr> |
|
|
|
|
</template> |
|
|
|
|
<tr v-else> |
|
|
|
|
<td colspan="99">暂无数据</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr v-if="!active"> |
|
|
|
|
<tr v-if="!active && teams.length"> |
|
|
|
|
<td>综合得分</td> |
|
|
|
|
<td>{{ totalScore }}</td> |
|
|
|
|
<td>{{ curRow.score }}</td> |
|
|
|
|
<td colspan="6">总排名:第{{ curRow.index }}名</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
@ -144,6 +157,20 @@ export default { |
|
|
|
|
method: this.$route.query.method, |
|
|
|
|
competitionType: +this.$route.query.competitionType, |
|
|
|
|
rule: +this.$route.query.rule, |
|
|
|
|
teamCalculationMethods: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '最高分' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '平均分' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '求和' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
headers: { |
|
|
|
|
token: util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
@ -177,9 +204,11 @@ export default { |
|
|
|
|
// 获排名 |
|
|
|
|
getData() { |
|
|
|
|
// 查询是否已经发布排名 |
|
|
|
|
this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || ''}&isOverallRanking=${this.active ? 0 : 1}`).then(({ whetherToPublish }) => { |
|
|
|
|
this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ whetherToPublish }) => { |
|
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
|
ids.pop() |
|
|
|
|
// 如果已发布,查询发布上一次排名的来源——>默认顺序或者手动发布(返回数据:是否手动发布(1为是,0不是)) |
|
|
|
|
whetherToPublish && this.$post(`${this.api.queryPublicationSource}?competitionId=${this.id}&stageId=${this.active || ''}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
whetherToPublish && this.$post(`${this.api.queryPublicationSource}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
this.sourceType = source |
|
|
|
|
this.type = source == 1 ? 1 : 0 |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -191,7 +220,6 @@ export default { |
|
|
|
|
getRank(whetherToPublish) { |
|
|
|
|
// 已发布,则调已发布的排名接口 |
|
|
|
|
if (whetherToPublish) { |
|
|
|
|
console.log(44, this.active) |
|
|
|
|
this.$post(this.api.manuallyRankTheUploadList, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
@ -250,11 +278,13 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// tab回调 |
|
|
|
|
tabChange(i) { |
|
|
|
|
this.type = 0 |
|
|
|
|
this.active = i |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
// 查看详情 |
|
|
|
|
show(row, i) { |
|
|
|
|
this.teams = [] |
|
|
|
|
// 个人:跳转实验报告,团队:弹框显示成员列表 |
|
|
|
|
if (this.competitionType == 1) { |
|
|
|
|
row.index = i + 1 |
|
|
|
@ -275,46 +305,57 @@ export default { |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} else { |
|
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
|
data.stageIds = ids.splice(0, ids.length - 1) |
|
|
|
|
this.$post(this.api.detailsOfTotalTeamScores, data).then(({ data, resultCalculationMethod }) => { |
|
|
|
|
const result = [] |
|
|
|
|
let totalScore = 0 |
|
|
|
|
// 合并数据 |
|
|
|
|
data.map(e => { |
|
|
|
|
const team = e.stageTeamInformation |
|
|
|
|
if (team.length) { |
|
|
|
|
// 第一条才赋值团队得分和合并行数 |
|
|
|
|
const method = e.teamCalculationMethod |
|
|
|
|
const scores = team.map(n => +n.score) |
|
|
|
|
let score |
|
|
|
|
// 根据团队规则计算方式计算团队得分 |
|
|
|
|
if (method == 0) { // 最高分 |
|
|
|
|
score = Math.max(scores) |
|
|
|
|
} else if (method == 1) { // 平均分 |
|
|
|
|
score = scores.reduce((prev, next) => prev + next) / scores.length |
|
|
|
|
} else { // 求和 |
|
|
|
|
score = scores.reduce((prev, next) => prev + next) |
|
|
|
|
} |
|
|
|
|
team[0].teamScore = score |
|
|
|
|
team[0].rowspan = team.length |
|
|
|
|
team.map(n => { |
|
|
|
|
n = Object.assign(n, e) |
|
|
|
|
ids.pop() |
|
|
|
|
data.stageIds = ids.splice(0, this.index + 1) |
|
|
|
|
// 发布跟没发布调不同的接口 |
|
|
|
|
// if (this.published) { |
|
|
|
|
this.$post(this.api.totalRankingScoreDetails, data).then(({ data }) => { |
|
|
|
|
if (data.length) { |
|
|
|
|
const result = [] |
|
|
|
|
// 合并数据 |
|
|
|
|
data.map(e => { |
|
|
|
|
const team = e.stageTeamInformation |
|
|
|
|
if (team.length) { |
|
|
|
|
const teamCItem = this.teamCalculationMethods.find(n => n.id == e.teamCalculationMethod) |
|
|
|
|
if (teamCItem) team[0].teamCalculationMethodName = teamCItem.name |
|
|
|
|
team[0].rowspan = team.length |
|
|
|
|
team.map(n => { |
|
|
|
|
n = Object.assign(n, e) |
|
|
|
|
}) |
|
|
|
|
result.push(...team) |
|
|
|
|
} else { |
|
|
|
|
e.rowspan = 1 |
|
|
|
|
result.push(e) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 计算权重(权重为0则不计入总成绩) 团队得分*权重/100 总成绩计算方式选的是加权求和才需要计算 |
|
|
|
|
if (e.pointWeight && !resultCalculationMethod) totalScore += score * e.pointWeight / 100 |
|
|
|
|
result.push(...team) |
|
|
|
|
this.teams = result |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 根据总成绩计算方式计算总分 |
|
|
|
|
const teamScores = data.map(e => e.teamScore) |
|
|
|
|
if (resultCalculationMethod === 1) { // 求和 |
|
|
|
|
totalScore = teamScores.reduce((prev, next) => prev + next) |
|
|
|
|
} else if (resultCalculationMethod === 2) { // 平均分 |
|
|
|
|
totalScore = teamScores.reduce((prev, next) => prev + next) / teamScores.length |
|
|
|
|
} |
|
|
|
|
this.totalScore = totalScore |
|
|
|
|
this.teams = result |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
// } else { // 没发布 |
|
|
|
|
// this.$post(this.api.totalRankingScoreDetails, data).then(({ page }) => { |
|
|
|
|
// const list = page.records |
|
|
|
|
// page.records.map((e, i) => { |
|
|
|
|
// if (!list.find(n => n.stageId == e.stageId && n.rowspan)) { |
|
|
|
|
// e.rowspan = list.filter(n => n.stageId == e.stageId).length |
|
|
|
|
// this.$post(this.api.stageTeamScoreDetails, { |
|
|
|
|
// pageNum: 1, |
|
|
|
|
// pageSize: 100, |
|
|
|
|
// competitionId: this.id, |
|
|
|
|
// teamId: row.teamId, |
|
|
|
|
// stageId: e.stageId |
|
|
|
|
// }).then(({ page }) => { |
|
|
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// let totalScore = 0 |
|
|
|
|
// this.totalScore = totalScore |
|
|
|
|
// this.teams = list |
|
|
|
|
// console.log("🚀 ~ file: matchRank.vue:346 ~ this.$post ~ list", list) |
|
|
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.toReport(row) |
|
|
|
@ -340,14 +381,16 @@ export default { |
|
|
|
|
list.map(e => { |
|
|
|
|
e.competitionId = id |
|
|
|
|
e.isOverallRanking = isOverall |
|
|
|
|
if (isOverall) delete e.stageId |
|
|
|
|
// if (isOverall) delete e.stageId |
|
|
|
|
if (isPerson) e.teamId = null // 个人赛则teamId传null |
|
|
|
|
}) |
|
|
|
|
data = list |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
|
ids.pop() |
|
|
|
|
// 发布前校验 |
|
|
|
|
this.$post(`${this.api.releaseVerification}?competitionId=${this.id}&stageId=${this.active || ''}&isOverallRanking=${this.active ? 0 : 1}&whetherToManuallyPublish=${this.type}`).then(res => { |
|
|
|
|
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.uploadData = [] |
|
|
|
|
this.getData() |
|
|
|
@ -391,6 +434,7 @@ export default { |
|
|
|
|
} else { |
|
|
|
|
this.$post(`${this.api.cancelRanking}?competitionId=${this.id}&isOverallRanking=${this.active ? 0 : 1}&${this.active ? 'stageIds=' + this.active : query.join('&')}`).then(res => { |
|
|
|
|
this.sourceType = '' |
|
|
|
|
this.type = 0 |
|
|
|
|
this.getData() |
|
|
|
|
util.successMsg('取消发布成功!') |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -473,5 +517,13 @@ export default { |
|
|
|
|
text-align: center; |
|
|
|
|
background-color: #f8faff; |
|
|
|
|
} |
|
|
|
|
.scores { |
|
|
|
|
line-height: 1.6; |
|
|
|
|
} |
|
|
|
|
.score { |
|
|
|
|
font-size: 16px; |
|
|
|
|
font-weight: 600; |
|
|
|
|
color: #9076FF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |