|
|
@ -20,8 +20,9 @@ |
|
|
|
<el-button type="primary" :disabled="type === 0" class="ml20" @click="batchImport">上传文件</el-button> |
|
|
|
<el-button type="primary" :disabled="type === 0" class="ml20" @click="batchImport">上传文件</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button v-if="(type && uploadData.length) || (!type && !published) || (!type && sourceType == 1)" type="primary" @click="cancelPublish(1)">发布排名</el-button> |
|
|
|
<!-- <el-button v-if="(type && uploadData.length) || (!type && !published) || (!type && sourceType == 1)" type="primary" @click="cancelPublish(1)">发布排名</el-button> --> |
|
|
|
<el-button v-if="published && ((!type && sourceType === '0') || (type && sourceType == 1))" type="primary" @click="cancelPublish(0)">取消发布</el-button> |
|
|
|
<el-button v-if="!published" type="primary" @click="cancelPublish(1)">发布排名</el-button> |
|
|
|
|
|
|
|
<el-button v-else type="primary" @click="cancelPublish(0)">取消发布</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center"> |
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center"> |
|
|
@ -204,33 +205,58 @@ export default { |
|
|
|
// 获排名 |
|
|
|
// 获排名 |
|
|
|
getData() { |
|
|
|
getData() { |
|
|
|
// 查询是否已经发布排名 |
|
|
|
// 查询是否已经发布排名 |
|
|
|
this.$post(`${this.api.whetherToPublish}?competitionId=${this.id}&stageId=${this.active || this.stageId}&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) |
|
|
|
// const ids = this.grades.map(e => e.stageId) |
|
|
|
ids.pop() |
|
|
|
// ids.pop() |
|
|
|
// 如果已发布,查询发布上一次排名的来源——>默认顺序或者手动发布(返回数据:是否手动发布(1为是,0不是)) |
|
|
|
// // 如果已发布,查询发布上一次排名的来源——>默认顺序或者手动发布(返回数据:是否手动发布(1为是,0不是)) |
|
|
|
whetherToPublish && this.$post(`${this.api.queryPublicationSource}?competitionId=${this.id}&stageId=${this.active || this.stageId}&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.sourceType = source |
|
|
|
this.type = source == 1 ? 1 : 0 |
|
|
|
// this.type = source == 1 ? 1 : 0 |
|
|
|
}).catch(res => {}) |
|
|
|
// }).catch(res => {}) |
|
|
|
this.published = whetherToPublish |
|
|
|
// this.published = whetherToPublish |
|
|
|
this.getRank(whetherToPublish) |
|
|
|
// this.getRank(whetherToPublish) |
|
|
|
|
|
|
|
// }).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 }) => { |
|
|
|
|
|
|
|
// const ids = this.grades.map(e => e.stageId) |
|
|
|
|
|
|
|
// ids.pop() |
|
|
|
|
|
|
|
// // 如果已发布,查询发布上一次排名的来源——>默认顺序或者手动发布(返回数据:是否手动发布(1为是,0不是)) |
|
|
|
|
|
|
|
// whetherToPublish ? |
|
|
|
|
|
|
|
// this.$post(`${this.api.selectTheLastSortStatus}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
|
|
|
// this.sourceType = source |
|
|
|
|
|
|
|
// this.type = source == 1 ? 1 : 0 |
|
|
|
|
|
|
|
// this.getRank(whetherToPublish) |
|
|
|
|
|
|
|
// }).catch(res => {}) : |
|
|
|
|
|
|
|
// this.getRank() |
|
|
|
|
|
|
|
// this.published = whetherToPublish |
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$post(`${this.api.selectTheLastSortStatus}?competitionId=${this.id}&stageId=${this.active || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
|
|
|
this.sourceType = source |
|
|
|
|
|
|
|
this.type = source == 1 ? 1 : 0 |
|
|
|
|
|
|
|
this.getRank() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 查询排名 |
|
|
|
// 查询排名 |
|
|
|
getRank(whetherToPublish) { |
|
|
|
getRank() { |
|
|
|
// 已发布,则调已发布的排名接口 |
|
|
|
// 手动上传的排名接口 |
|
|
|
if (whetherToPublish) { |
|
|
|
if (this.type) { |
|
|
|
this.$post(this.api.manuallyRankTheUploadList, { |
|
|
|
this.$post(this.api.manuallyUploadedRankings, { |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: this.pageSize, |
|
|
|
competitionId: this.id, |
|
|
|
competitionId: this.id, |
|
|
|
isOverallRanking: this.active ? 0 : 1, |
|
|
|
isOverallRanking: this.active ? 0 : 1, |
|
|
|
stageId: this.active || '' |
|
|
|
stageId: this.active || this.stageId |
|
|
|
}).then(({ message }) => { |
|
|
|
}).then(({ message, publishStatus }) => { |
|
|
|
|
|
|
|
// isRelease 0未发布,1已发布 |
|
|
|
|
|
|
|
this.published = publishStatus |
|
|
|
|
|
|
|
this.sourceType = message.total ? message.records[0].isRelease : 0 |
|
|
|
this.list = message.records |
|
|
|
this.list = message.records |
|
|
|
this.total = message.total |
|
|
|
this.total = message.total |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
} else { // 未发布的排名接口 |
|
|
|
} else { // 默认排名接口 |
|
|
|
if (!this.active) { |
|
|
|
if (!this.active) { |
|
|
|
// 总分排名 |
|
|
|
// 总分排名 |
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
@ -238,13 +264,16 @@ export default { |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: this.pageSize, |
|
|
|
competitionId: this.id, |
|
|
|
competitionId: this.id, |
|
|
|
|
|
|
|
publicationType: this.type, |
|
|
|
stageIds: ids.splice(0, ids.length - 1) |
|
|
|
stageIds: ids.splice(0, ids.length - 1) |
|
|
|
}).then(({ page }) => { |
|
|
|
}).then(({ page, publishStatus }) => { |
|
|
|
|
|
|
|
this.published = publishStatus |
|
|
|
this.list = page |
|
|
|
this.list = page |
|
|
|
this.total = total |
|
|
|
this.total = total |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
} else { // 阶段排名 |
|
|
|
} else { // 阶段排名 |
|
|
|
this.$post(`${this.api.stageRaceRanking}?competitionId=${this.id}&stageId=${this.active}&pageNum=${this.page}&pageSize=${this.pageSize}`).then(({ page, total }) => { |
|
|
|
this.$post(`${this.api.stageRaceRanking}?competitionId=${this.id}&stageId=${this.active}&pageNum=${this.page}&pageSize=${this.pageSize}&publicationType=${this.type}`).then(({ page, total, publishStatus }) => { |
|
|
|
|
|
|
|
this.published = publishStatus |
|
|
|
this.list = page |
|
|
|
this.list = page |
|
|
|
this.total = total |
|
|
|
this.total = total |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -270,7 +299,14 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 排序类型切换回调 |
|
|
|
// 排序类型切换回调 |
|
|
|
typeChange(val) { |
|
|
|
typeChange(val) { |
|
|
|
this.getRank(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.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.published = whetherToPublish |
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData() { |
|
|
|
initData() { |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
@ -278,6 +314,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// tab回调 |
|
|
|
// tab回调 |
|
|
|
tabChange(i) { |
|
|
|
tabChange(i) { |
|
|
|
|
|
|
|
this.type = 0 |
|
|
|
this.active = i |
|
|
|
this.active = i |
|
|
|
this.initData() |
|
|
|
this.initData() |
|
|
|
}, |
|
|
|
}, |
|
|
@ -370,47 +407,68 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 发布排名 |
|
|
|
// 发布排名 |
|
|
|
publishSubmit() { |
|
|
|
publishSubmit() { |
|
|
|
let data = this.uploadData // 手动上传后发布排名,数据直接取批量上传后返回的data |
|
|
|
if (this.type) { // 手动发布 |
|
|
|
if (!this.type) { // 默认排序 |
|
|
|
this.$post(this.api.batchRelease, this.list.map(e => e.id)).then(res => { |
|
|
|
// 处理默认排序的数据 |
|
|
|
|
|
|
|
const { list, id } = this |
|
|
|
|
|
|
|
const isOverall = this.active ? 0 : 1 |
|
|
|
|
|
|
|
if (list.length) { |
|
|
|
|
|
|
|
const isPerson = this.competitionType == 0 |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
e.competitionId = id |
|
|
|
|
|
|
|
e.isOverallRanking = isOverall |
|
|
|
|
|
|
|
// 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 || this.stageId}&isOverallRanking=${this.active ? 0 : 1}&whetherToManuallyPublish=${this.type}`).then(res => { |
|
|
|
|
|
|
|
this.$post(this.api.publishRanking, data).then(res => { |
|
|
|
|
|
|
|
this.uploadData = [] |
|
|
|
|
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
util.successMsg('发布成功!') |
|
|
|
util.successMsg('发布成功!') |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
} else { |
|
|
|
|
|
|
|
let data = [] // 手动上传后发布排名,数据直接取批量上传后返回的data |
|
|
|
|
|
|
|
if (!this.type) { // 默认排序 |
|
|
|
|
|
|
|
// 处理默认排序的数据 |
|
|
|
|
|
|
|
const { list, id } = this |
|
|
|
|
|
|
|
const isOverall = this.active ? 0 : 1 |
|
|
|
|
|
|
|
if (list.length) { |
|
|
|
|
|
|
|
const isPerson = this.competitionType == 0 |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
e.competitionId = id |
|
|
|
|
|
|
|
e.isOverallRanking = isOverall |
|
|
|
|
|
|
|
// if (isOverall) delete e.stageId |
|
|
|
|
|
|
|
if (isPerson) e.teamId = null // 个人赛则teamId传null |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
data = list |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
data.forEach(e => { |
|
|
|
|
|
|
|
e.publicationType = this.type |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
|
|
|
|
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.uploadData = [] |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
util.successMsg('发布成功!') |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 发布排名确认 |
|
|
|
// 发布排名确认 |
|
|
|
publish() { |
|
|
|
publish() { |
|
|
|
// 如果已发布,并且上次发布的类型跟这次发布的类型不一致,则要提示确认 |
|
|
|
// 如果已发布,并且上次发布的类型跟这次发布的类型不一致,则要提示确认 |
|
|
|
if (this.published && this.sourceType != this.type) { |
|
|
|
// if (this.published && this.sourceType != this.type) { |
|
|
|
this.$confirm(this.sourceType == 1 && !this.type ? |
|
|
|
// this.$confirm(this.sourceType == 1 && !this.type ? |
|
|
|
'手动排名已发布,是否要取消手动排名的内容,改为系统排名的内容?' : |
|
|
|
// '手动排名已发布,是否要取消手动排名的内容,改为系统排名的内容?' : |
|
|
|
'默认系统排名已发布,是否要取消系统排名的内容,改为手动发布的内容?', '提示', { |
|
|
|
// '默认系统排名已发布,是否要取消系统排名的内容,改为手动发布的内容?', '提示', { |
|
|
|
type: 'success' |
|
|
|
// type: 'success' |
|
|
|
}).then(() => { |
|
|
|
// }).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 }) => { |
|
|
|
|
|
|
|
whetherToPublish ? |
|
|
|
|
|
|
|
this.$confirm('排名已经发布,是否直接覆盖?', '提示', { |
|
|
|
|
|
|
|
type: 'success' |
|
|
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
this.publishSubmit() |
|
|
|
|
|
|
|
}).catch(() => {}) : |
|
|
|
this.publishSubmit() |
|
|
|
this.publishSubmit() |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
} else { |
|
|
|
// this.publishSubmit() |
|
|
|
this.publishSubmit() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 取消发布排名 |
|
|
|
// 取消发布排名 |
|
|
|
cancelPublish(publish) { |
|
|
|
cancelPublish(publish) { |
|
|
@ -423,16 +481,19 @@ export default { |
|
|
|
// 如果是发布排名,则先删除已发布的排名,再调发布排名的接口 |
|
|
|
// 如果是发布排名,则先删除已发布的排名,再调发布排名的接口 |
|
|
|
// 如果是取消发布,则直接调取消发布的接口 |
|
|
|
// 如果是取消发布,则直接调取消发布的接口 |
|
|
|
if (publish) { |
|
|
|
if (publish) { |
|
|
|
this.$post(this.api.deleteLastPublication, { |
|
|
|
// this.type ? |
|
|
|
competitionId: this.id, |
|
|
|
|
|
|
|
isOverallRanking: this.active ? 0 : 1, |
|
|
|
|
|
|
|
stageIds: this.active ? [this.active] : stageIds |
|
|
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
|
|
this.publish() |
|
|
|
this.publish() |
|
|
|
}).catch(res => {}) |
|
|
|
// this.$post(this.api.deleteLastPublication, { |
|
|
|
|
|
|
|
// competitionId: this.id, |
|
|
|
|
|
|
|
// isOverallRanking: this.active ? 0 : 1, |
|
|
|
|
|
|
|
// stageIds: this.active ? [this.active] : stageIds |
|
|
|
|
|
|
|
// }).then(res => { |
|
|
|
|
|
|
|
// this.publish() |
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$post(`${this.api.cancelRanking}?competitionId=${this.id}&isOverallRanking=${this.active ? 0 : 1}&${this.active ? 'stageIds=' + this.active : query.join('&')}`).then(res => { |
|
|
|
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.sourceType = '' |
|
|
|
|
|
|
|
this.type = 0 |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
util.successMsg('取消发布成功!') |
|
|
|
util.successMsg('取消发布成功!') |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -493,7 +554,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSure() { |
|
|
|
uploadSure() { |
|
|
|
this.importVisible = false |
|
|
|
this.importVisible = false |
|
|
|
this.list = this.uploadData |
|
|
|
// this.list = this.uploadData |
|
|
|
|
|
|
|
this.getRank() |
|
|
|
this.uploadData.length && util.successMsg('请检查数据后,点击发布排名以发布数据!') |
|
|
|
this.uploadData.length && util.successMsg('请检查数据后,点击发布排名以发布数据!') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|