|
|
|
@ -73,7 +73,12 @@ |
|
|
|
|
<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> |
|
|
|
|
<td class="scores" :rowspan="item.rowspan"> |
|
|
|
|
<p class="score">{{ item.teamScore }}</p> |
|
|
|
|
<p>{{ item.teamCalculationMethodName }}</p> |
|
|
|
|
<p>权重:</p> |
|
|
|
|
<p>{{ item.pointWeight }}%</p> |
|
|
|
|
</td> |
|
|
|
|
</template> |
|
|
|
|
<td>{{ i + 1 }}</td> |
|
|
|
|
<td>{{ item.userName }}</td> |
|
|
|
@ -90,7 +95,7 @@ |
|
|
|
|
</tr> |
|
|
|
|
<tr v-if="!active && teams.length"> |
|
|
|
|
<td>综合得分</td> |
|
|
|
|
<td>{{ totalScore }}</td> |
|
|
|
|
<td>{{ curRow.score }}</td> |
|
|
|
|
<td colspan="6">总排名:第{{ curRow.index }}名</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
@ -149,6 +154,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: sessionStorage.getItem("token") |
|
|
|
|
}, |
|
|
|
@ -279,46 +298,82 @@ 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 && data[0].stageTeamInformation.length) { |
|
|
|
|
const resultCalculationMethod = data[0].stageTeamInformation[0].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 |
|
|
|
|
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) |
|
|
|
|
}) |
|
|
|
|
console.log("🚀 ~ file: matchRank.vue:334 ~ this.$post ~ resultCalculationMethod", resultCalculationMethod, score) |
|
|
|
|
|
|
|
|
|
// 计算权重(权重为0则不计入总成绩) 团队得分*权重/100 总成绩计算方式选的是加权求和才需要计算 |
|
|
|
|
if (e.pointWeight && !resultCalculationMethod) totalScore += score * e.pointWeight / 100 |
|
|
|
|
result.push(...team) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 计算权重(权重为0则不计入总成绩) 团队得分*权重/100 总成绩计算方式选的是加权求和才需要计算 |
|
|
|
|
if (e.pointWeight && !resultCalculationMethod) totalScore += score * e.pointWeight / 100 |
|
|
|
|
result.push(...team) |
|
|
|
|
// 根据总成绩计算方式计算总分 |
|
|
|
|
const teamScores = data.map(e => e.teamScore) |
|
|
|
|
console.log("🚀 ~ file: matchRank.vue:339 ~ this.$post ~ teamScores", teamScores, totalScore) |
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 根据总成绩计算方式计算总分 |
|
|
|
|
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) |
|
|
|
@ -477,5 +532,13 @@ export default { |
|
|
|
|
text-align: center; |
|
|
|
|
background-color: #f8faff; |
|
|
|
|
} |
|
|
|
|
.scores { |
|
|
|
|
line-height: 1.6; |
|
|
|
|
} |
|
|
|
|
.score { |
|
|
|
|
font-size: 16px; |
|
|
|
|
font-weight: 600; |
|
|
|
|
color: #9076FF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |