|
|
@ -73,7 +73,12 @@ |
|
|
|
<tr v-for="(item, i) in teams" :key="i"> |
|
|
|
<tr v-for="(item, i) in teams" :key="i"> |
|
|
|
<template v-if="!active && item.rowspan"> |
|
|
|
<template v-if="!active && item.rowspan"> |
|
|
|
<td :rowspan="item.rowspan">{{ item.stageName }}</td> |
|
|
|
<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> |
|
|
|
</template> |
|
|
|
<td>{{ i + 1 }}</td> |
|
|
|
<td>{{ i + 1 }}</td> |
|
|
|
<td>{{ item.userName }}</td> |
|
|
|
<td>{{ item.userName }}</td> |
|
|
@ -90,7 +95,7 @@ |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
<tr v-if="!active && teams.length"> |
|
|
|
<tr v-if="!active && teams.length"> |
|
|
|
<td>综合得分</td> |
|
|
|
<td>综合得分</td> |
|
|
|
<td>{{ totalScore }}</td> |
|
|
|
<td>{{ curRow.score }}</td> |
|
|
|
<td colspan="6">总排名:第{{ curRow.index }}名</td> |
|
|
|
<td colspan="6">总排名:第{{ curRow.index }}名</td> |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
</table> |
|
|
@ -149,6 +154,20 @@ export default { |
|
|
|
method: this.$route.query.method, |
|
|
|
method: this.$route.query.method, |
|
|
|
competitionType: +this.$route.query.competitionType, |
|
|
|
competitionType: +this.$route.query.competitionType, |
|
|
|
rule: +this.$route.query.rule, |
|
|
|
rule: +this.$route.query.rule, |
|
|
|
|
|
|
|
teamCalculationMethods: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 0, |
|
|
|
|
|
|
|
name: '最高分' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 1, |
|
|
|
|
|
|
|
name: '平均分' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 2, |
|
|
|
|
|
|
|
name: '求和' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
token: sessionStorage.getItem("token") |
|
|
|
token: sessionStorage.getItem("token") |
|
|
|
}, |
|
|
|
}, |
|
|
@ -279,46 +298,82 @@ export default { |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
data.stageIds = ids.splice(0, ids.length - 1) |
|
|
|
ids.pop() |
|
|
|
this.$post(this.api.detailsOfTotalTeamScores, data).then(({ data, resultCalculationMethod }) => { |
|
|
|
data.stageIds = ids.splice(0, this.index + 1) |
|
|
|
const result = [] |
|
|
|
// 发布跟没发布调不同的接口 |
|
|
|
let totalScore = 0 |
|
|
|
// if (this.published) { |
|
|
|
// 合并数据 |
|
|
|
this.$post(this.api.totalRankingScoreDetails, data).then(({ data }) => { |
|
|
|
data.map(e => { |
|
|
|
if (data.length && data[0].stageTeamInformation.length) { |
|
|
|
const team = e.stageTeamInformation |
|
|
|
const resultCalculationMethod = data[0].stageTeamInformation[0].resultCalculationMethod |
|
|
|
if (team.length) { |
|
|
|
const result = [] |
|
|
|
// 第一条才赋值团队得分和合并行数 |
|
|
|
let totalScore = 0 |
|
|
|
const method = e.teamCalculationMethod |
|
|
|
// 合并数据 |
|
|
|
const scores = team.map(n => +n.score) |
|
|
|
data.map(e => { |
|
|
|
let score |
|
|
|
const team = e.stageTeamInformation |
|
|
|
// 根据团队规则计算方式计算团队得分 |
|
|
|
if (team.length) { |
|
|
|
if (method == 0) { // 最高分 |
|
|
|
// 第一条才赋值团队得分和合并行数 |
|
|
|
score = Math.max(scores) |
|
|
|
const method = e.teamCalculationMethod |
|
|
|
} else if (method == 1) { // 平均分 |
|
|
|
const scores = team.map(n => +n.score) |
|
|
|
score = scores.reduce((prev, next) => prev + next) / scores.length |
|
|
|
let score |
|
|
|
} else { // 求和 |
|
|
|
// 根据团队规则计算方式计算团队得分 |
|
|
|
score = scores.reduce((prev, next) => prev + next) |
|
|
|
if (method == 0) { // 最高分 |
|
|
|
} |
|
|
|
score = Math.max(scores) |
|
|
|
team[0].teamScore = score |
|
|
|
} else if (method == 1) { // 平均分 |
|
|
|
team[0].rowspan = team.length |
|
|
|
score = scores.reduce((prev, next) => prev + next) / scores.length |
|
|
|
team.map(n => { |
|
|
|
} else { // 求和 |
|
|
|
n = Object.assign(n, e) |
|
|
|
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 |
|
|
|
const teamScores = data.map(e => e.teamScore) |
|
|
|
result.push(...team) |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(res => {}) |
|
|
|
// 根据总成绩计算方式计算总分 |
|
|
|
// } else { // 没发布 |
|
|
|
const teamScores = data.map(e => e.teamScore) |
|
|
|
// this.$post(this.api.totalRankingScoreDetails, data).then(({ page }) => { |
|
|
|
if (resultCalculationMethod === 1) { // 求和 |
|
|
|
// const list = page.records |
|
|
|
totalScore = teamScores.reduce((prev, next) => prev + next) |
|
|
|
// page.records.map((e, i) => { |
|
|
|
} else if (resultCalculationMethod === 2) { // 平均分 |
|
|
|
// if (!list.find(n => n.stageId == e.stageId && n.rowspan)) { |
|
|
|
totalScore = teamScores.reduce((prev, next) => prev + next) / teamScores.length |
|
|
|
// e.rowspan = list.filter(n => n.stageId == e.stageId).length |
|
|
|
} |
|
|
|
// this.$post(this.api.stageTeamScoreDetails, { |
|
|
|
this.totalScore = totalScore |
|
|
|
// pageNum: 1, |
|
|
|
this.teams = result |
|
|
|
// pageSize: 100, |
|
|
|
}).catch(res => {}) |
|
|
|
// 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 { |
|
|
|
} else { |
|
|
|
this.toReport(row) |
|
|
|
this.toReport(row) |
|
|
@ -477,5 +532,13 @@ export default { |
|
|
|
text-align: center; |
|
|
|
text-align: center; |
|
|
|
background-color: #f8faff; |
|
|
|
background-color: #f8faff; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.scores { |
|
|
|
|
|
|
|
line-height: 1.6; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.score { |
|
|
|
|
|
|
|
font-size: 16px; |
|
|
|
|
|
|
|
font-weight: 600; |
|
|
|
|
|
|
|
color: #9076FF; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |