diff --git a/src/views/match/manage/matchRank.vue b/src/views/match/manage/matchRank.vue index e09d934..e202a41 100644 --- a/src/views/match/manage/matchRank.vue +++ b/src/views/match/manage/matchRank.vue @@ -311,7 +311,8 @@ export default { let second = data.getSeconds(); return [`${hour}:${minute}:${second} - 23:59:59`] })(), - } + }, + uploaded: 0 }; }, mounted () { @@ -320,35 +321,6 @@ export default { methods: { // 获排名 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) - // }).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 @@ -605,6 +577,10 @@ export default { this.published = true this.timeId = res.releaseTime.id this.publishTime = res.releaseTime.releaseTime + } else { + this.published = false + this.timeId = '' + this.publishTime = '' } }, // 定时发布排名 @@ -618,6 +594,7 @@ export default { }) util.successMsg('发布成功') this.getData() + this.uploaded = 0 this.publishVisible = false }, // 取消发布排名 @@ -631,8 +608,13 @@ export default { // 如果是发布排名,则先删除已发布的排名,再调发布排名的接口 // 如果是取消发布,则直接调取消发布的接口 if (publish) { - this.publishTime = new Date() - this.publishVisible = true + // 如果是手动发布,并且没有上传排名,则提示 + if (this.type && !this.uploaded) { + return util.errorMsg('请先上传数据!') + } else { + this.publishTime = new Date() + this.publishVisible = true + } } else { try { // 取消定时发布的接口跟取消普通发布的接口不一样 @@ -675,6 +657,7 @@ export default { }, uploadSuccess (res, file, fileList) { this.uploadFaild = false + this.uploaded = 0 if (res.status === 200) { const { exportCode } = res.data if (exportCode) { @@ -682,6 +665,7 @@ export default { this.uploadFaild = true util.errorMsg(`本次上传有${res.data.failureNum}个错误信息录入`) } else { + this.uploaded = 1 this.importVisible = false this.getRank() util.successMsg('请检查数据后,点击发布排名以发布数据!') diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 88452ee..26d8b7b 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -1682,7 +1682,7 @@ trigger="click">