|
|
|
@ -20,8 +20,9 @@ |
|
|
|
|
<el-button type="primary" :disabled="type === 0" class="ml20" @click="batchImport">上传文件</el-button> |
|
|
|
|
</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="published && ((!type && sourceType === '0') || (type && sourceType == 1))" type="primary" @click="cancelPublish(0)">取消发布</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="primary" @click="cancelPublish(1)">发布排名</el-button> |
|
|
|
|
<el-button v-else type="primary" @click="cancelPublish(0)">取消发布</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center"> |
|
|
|
@ -38,13 +39,13 @@ |
|
|
|
|
<el-table-column prop="schoolName" label="学校" min-width="100" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="timeSum" label="用时" width="90" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.timeSum }}min |
|
|
|
|
{{ scope.row.timeSum + (scope.row.timeSum === '—' ? '' : 'min') }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="score" label="分数" width="90" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="得分详情" align="center" width="160"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="show(scope.row, scope.$index)">查看</el-button> |
|
|
|
|
<el-button v-if="(!competitionType && scope.row.reportId) || competitionType" type="text" @click="show(scope.row, scope.$index)">查看</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -113,7 +114,7 @@ |
|
|
|
|
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button> |
|
|
|
|
</div> |
|
|
|
|
<el-upload |
|
|
|
|
ref="importStaff" |
|
|
|
|
ref="upload" |
|
|
|
|
name="file" |
|
|
|
|
accept=".xls,.xlsx" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
@ -128,8 +129,10 @@ |
|
|
|
|
:data="{ |
|
|
|
|
competitionId: this.id, |
|
|
|
|
stageId: this.stageId, |
|
|
|
|
isOverallRanking: active ? 0 : 1 |
|
|
|
|
isOverallRanking: active ? 0 : 1, |
|
|
|
|
schoolId: this.$store.state.user.schoolId |
|
|
|
|
}" |
|
|
|
|
:auto-upload="false" |
|
|
|
|
> |
|
|
|
|
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button> |
|
|
|
|
</el-upload> |
|
|
|
@ -204,33 +207,58 @@ export default { |
|
|
|
|
// 获排名 |
|
|
|
|
getData() { |
|
|
|
|
// 查询是否已经发布排名 |
|
|
|
|
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 || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
this.sourceType = source |
|
|
|
|
this.type = source == 1 ? 1 : 0 |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.published = whetherToPublish |
|
|
|
|
this.getRank(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 || this.stageId}&isOverallRanking=${this.active ? 0 : 1}`).then(({ source }) => { |
|
|
|
|
// this.sourceType = source |
|
|
|
|
// this.type = source == 1 ? 1 : 0 |
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
// this.published = 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 => {}) |
|
|
|
|
}, |
|
|
|
|
// 查询排名 |
|
|
|
|
getRank(whetherToPublish) { |
|
|
|
|
// 已发布,则调已发布的排名接口 |
|
|
|
|
if (whetherToPublish) { |
|
|
|
|
this.$post(this.api.manuallyRankTheUploadList, { |
|
|
|
|
getRank() { |
|
|
|
|
// 手动上传的排名接口 |
|
|
|
|
if (this.type) { |
|
|
|
|
this.$post(this.api.manuallyUploadedRankings, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
competitionId: this.id, |
|
|
|
|
isOverallRanking: this.active ? 0 : 1, |
|
|
|
|
stageId: this.active || '' |
|
|
|
|
}).then(({ message }) => { |
|
|
|
|
stageId: this.active || this.stageId |
|
|
|
|
}).then(({ message, publishStatus }) => { |
|
|
|
|
// isRelease 0未发布,1已发布 |
|
|
|
|
this.published = publishStatus |
|
|
|
|
this.sourceType = message.total ? message.records[0].isRelease : 0 |
|
|
|
|
this.list = message.records |
|
|
|
|
this.total = message.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} else { // 未发布的排名接口 |
|
|
|
|
} else { // 默认排名接口 |
|
|
|
|
if (!this.active) { |
|
|
|
|
// 总分排名 |
|
|
|
|
const ids = this.grades.map(e => e.stageId) |
|
|
|
@ -238,13 +266,17 @@ export default { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
competitionId: this.id, |
|
|
|
|
publicationType: this.type, |
|
|
|
|
locationStageId: this.stageId, |
|
|
|
|
stageIds: ids.splice(0, ids.length - 1) |
|
|
|
|
}).then(({ page }) => { |
|
|
|
|
}).then(({ page, publishStatus }) => { |
|
|
|
|
this.published = publishStatus |
|
|
|
|
this.list = page |
|
|
|
|
this.total = total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} 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.total = total |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -270,7 +302,14 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 排序类型切换回调 |
|
|
|
|
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() { |
|
|
|
|
this.page = 1 |
|
|
|
@ -363,7 +402,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 跳转实验报告 |
|
|
|
|
toReport(row) { |
|
|
|
|
this.$router.push(`/matchReport?reportId=${row.reportId}`) |
|
|
|
|
this.$router.push(`/match/report?reportId=${row.reportId}`) |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { // 切换分页 |
|
|
|
|
this.page = val; |
|
|
|
@ -371,47 +410,71 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 发布排名 |
|
|
|
|
publishSubmit() { |
|
|
|
|
let data = this.uploadData // 手动上传后发布排名,数据直接取批量上传后返回的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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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 = [] |
|
|
|
|
const { startTime, endTime } = this.grades[this.index] |
|
|
|
|
if (Date.now() <= new Date(endTime)) return util.errorMsg('当前阶段还在进行中,请在本阶段结束后再发布!') |
|
|
|
|
if (this.type) { // 手动发布 |
|
|
|
|
this.$post(this.api.batchRelease, this.list.map(e => e.id)).then(res => { |
|
|
|
|
this.getData() |
|
|
|
|
util.successMsg('发布成功!') |
|
|
|
|
}).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 |
|
|
|
|
e.stageId = this.stageId |
|
|
|
|
// 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() { |
|
|
|
|
// 如果已发布,并且上次发布的类型跟这次发布的类型不一致,则要提示确认 |
|
|
|
|
if (this.published && this.sourceType != this.type) { |
|
|
|
|
this.$confirm(this.sourceType == 1 && !this.type ? |
|
|
|
|
'手动排名已发布,是否要取消手动排名的内容,改为系统排名的内容?' : |
|
|
|
|
'默认系统排名已发布,是否要取消系统排名的内容,改为手动发布的内容?', '提示', { |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
// if (this.published && this.sourceType != this.type) { |
|
|
|
|
// this.$confirm(this.sourceType == 1 && !this.type ? |
|
|
|
|
// '手动排名已发布,是否要取消手动排名的内容,改为系统排名的内容?' : |
|
|
|
|
// '默认系统排名已发布,是否要取消系统排名的内容,改为手动发布的内容?', '提示', { |
|
|
|
|
// type: 'success' |
|
|
|
|
// }).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() |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} else { |
|
|
|
|
this.publishSubmit() |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
// this.publishSubmit() |
|
|
|
|
}, |
|
|
|
|
// 取消发布排名 |
|
|
|
|
cancelPublish(publish) { |
|
|
|
@ -424,13 +487,15 @@ export default { |
|
|
|
|
// 如果是发布排名,则先删除已发布的排名,再调发布排名的接口 |
|
|
|
|
// 如果是取消发布,则直接调取消发布的接口 |
|
|
|
|
if (publish) { |
|
|
|
|
this.$post(this.api.deleteLastPublication, { |
|
|
|
|
competitionId: this.id, |
|
|
|
|
isOverallRanking: this.active ? 0 : 1, |
|
|
|
|
stageIds: this.active ? [this.active] : stageIds |
|
|
|
|
}).then(res => { |
|
|
|
|
// this.type ? |
|
|
|
|
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 { |
|
|
|
|
this.$post(`${this.api.cancelRanking}?competitionId=${this.id}&isOverallRanking=${this.active ? 0 : 1}&${this.active ? 'stageIds=' + this.active : query.join('&')}`).then(res => { |
|
|
|
|
this.sourceType = '' |
|
|
|
@ -473,10 +538,13 @@ export default { |
|
|
|
|
this.exportCode = exportCode |
|
|
|
|
this.uploadFaild = true |
|
|
|
|
util.errorMsg(`本次上传有${res.data.failureNum}个错误信息录入`) |
|
|
|
|
} else { |
|
|
|
|
this.importVisible = false |
|
|
|
|
this.getRank() |
|
|
|
|
util.successMsg('请检查数据后,点击发布排名以发布数据!') |
|
|
|
|
} |
|
|
|
|
this.uploadData = res.data.data |
|
|
|
|
} else { |
|
|
|
|
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据") |
|
|
|
|
util.errorMsg(res.message || "上传失败,请检查数据") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
@ -494,9 +562,11 @@ export default { |
|
|
|
|
this.uploadFaild = false |
|
|
|
|
}, |
|
|
|
|
uploadSure() { |
|
|
|
|
this.importVisible = false |
|
|
|
|
this.list = this.uploadData |
|
|
|
|
this.uploadData.length && util.successMsg('请检查数据后,点击发布排名以发布数据!') |
|
|
|
|
this.list.length ? |
|
|
|
|
this.$post(this.api.cancelImport, this.list.map(e => e.id)).then(res => { |
|
|
|
|
this.$refs.upload.submit() |
|
|
|
|
}).catch(res => {}) : |
|
|
|
|
this.$refs.upload.submit() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|