大赛自动分配

dev_review
yujialong 6 months ago
parent 64d15ceab0
commit 56565ded13
  1. 3
      src/utils/api.js
  2. 22
      src/views/match/add/step1.vue
  3. 29
      src/views/match/add/step2.vue
  4. 51
      src/views/match/add/step3.vue

@ -329,8 +329,9 @@ export default {
getRedisCacheCompetition: `competition/competition/management/getRedisCache`, getRedisCacheCompetition: `competition/competition/management/getRedisCache`,
copyCompetition: `competition/competition/management/copyCompetition`, copyCompetition: `competition/competition/management/copyCompetition`,
checkCustomerBySchool: `competition/competition/team/checkCustomerBySchool`, checkCustomerBySchool: `competition/competition/team/checkCustomerBySchool`,
automaticAllocationSave: `competition/competitionAutomaticAllocationRecord/updateEventAllocationRecord`, updateEventAllocationRecord: `competition/competitionAutomaticAllocationRecord/updateEventAllocationRecord`,
editWhetherPopUpsAppear: `competition/competitionAutomaticAllocationRecord/editWhetherPopUpsAppear`, editWhetherPopUpsAppear: `competition/competitionAutomaticAllocationRecord/editWhetherPopUpsAppear`,
automaticAllocation: `competition/competition/automaticAllocation/automaticAllocation`,
// 赛事内容 // 赛事内容
addCompetitionContent: `competition/competition/content/addCompetitionContent`, addCompetitionContent: `competition/competition/content/addCompetitionContent`,

@ -392,7 +392,8 @@ export default {
}, },
submiting: false, submiting: false,
updateTime: 0, updateTime: 0,
quillShow: true quillShow: true,
originSignUpEndTime: '',
}; };
}, },
components: { components: {
@ -488,6 +489,7 @@ export default {
}) })
this.rangeName = range.join(',') this.rangeName = range.join(',')
} }
this.originSignUpEndTime = competition.signUpEndTime
this.form = competition this.form = competition
this.$parent.resumeData() this.$parent.resumeData()
this.$nextTick(() => { this.$nextTick(() => {
@ -685,10 +687,11 @@ export default {
form.releaseType = releaseType form.releaseType = releaseType
form.id = this.$route.query.id form.id = this.$route.query.id
if (form.id) { if (form.id) {
this.$post(this.api.editCompetition, form).then(res => { this.$post(this.api.editCompetition, form).then(async () => {
this.$parent.hideLoad() this.$parent.hideLoad()
this.updateTime && util.successMsg("修改成功"); this.updateTime && util.successMsg("修改成功");
this.updateTime = 0 this.updateTime = 0
await this.automaticAllocation()
this.$emit('next', next) this.$emit('next', next)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
@ -704,6 +707,21 @@ export default {
}); });
} }
}, },
//
async automaticAllocation () {
//
if (this.form.completeCompetitionSetup.competitionType) {
const { signUpEndTime, id } = this.form
//
if (signUpEndTime !== this.originSignUpEndTime && new Date(signUpEndTime) > Date.now()) {
await this.$post(this.api.updateEventAllocationRecord, {
competitionId: id,
whetherToModifyTheRule: 1,
})
}
}
},
// //
preview () { preview () {
util.local.set('match', this.form) util.local.set('match', this.form)

@ -381,7 +381,7 @@ export default {
this.form.competitionStageList = stages.slice(0, val) this.form.competitionStageList = stages.slice(0, val)
} }
}, },
// //
async automaticAllocation (next) { async automaticAllocation (next) {
// //
if (this.step1.completeCompetitionSetup.competitionType) { if (this.step1.completeCompetitionSetup.competitionType) {
@ -397,28 +397,11 @@ export default {
} }
} }
if (form.rule !== originForm.rule || form.stageNum !== originForm.stageNum || form.teamLimit !== originForm.teamLimit || changeLimit) { if (form.rule !== originForm.rule || form.stageNum !== originForm.stageNum || form.teamLimit !== originForm.teamLimit || changeLimit) {
const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.id}`) await this.$post(this.api.updateEventAllocationRecord, {
if (res.popupState) { competitionId: +this.id,
this.$confirm('报名的团队将按照新设置的规则进行自动分配阶段参赛人员,当前已分配的阶段参赛人员是否需要保留?', '提示', { whetherToModifyTheRule: 1,
cancelButtonText: '已分配的保留', })
confirmButtonText: '全部重新分配', this.$emit('next', next)
type: 'success',
closeOnClickModal: false,
}).then(() => {
// this.automaticAllocation(1, next)
}).catch(() => {
// this.automaticAllocation(0, next)
});
// await this.$post(this.api.automaticAllocationSave, {
// assignOrNot,
// competitionId: this.competitionId,
// whetherToModifyTheRule: whethwer,
// })
this.$emit('next', next)
} else {
this.$emit('next', next)
}
} else { } else {
this.$emit('next', next) this.$emit('next', next)
} }

@ -361,7 +361,7 @@ export default {
}, },
// //
async automaticAllocation (assignOrNot, next) { async automaticAllocation (assignOrNot, next) {
await this.$post(this.api.automaticAllocationSave, { await this.$post(this.api.updateEventAllocationRecord, {
assignOrNot, assignOrNot,
competitionId: this.competitionId, competitionId: this.competitionId,
}) })
@ -369,18 +369,40 @@ export default {
}, },
// //
async autoAllocationConfirm (next) { async autoAllocationConfirm (next) {
// if (this.form[0].contentId) {
this.$confirm('<p>团队赛已发布,是否要自动分配阶段人员?</p><p style="margin-top: 10px;color: #a9a9a9;">(点击“是”将会给报名的团队自动分配阶段参赛人员</p>', '提示', { //
confirmButtonText: '是', const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.id}`)
cancelButtonText: '否', if (res.popupState) {
type: 'success', this.$confirm('报名的团队将按照新设置的规则进行自动分配阶段参赛人员,当前已分配的阶段参赛人员是否需要保留?', '提示', {
closeOnClickModal: false, cancelButtonText: '已分配的保留',
dangerouslyUseHTMLString: true, confirmButtonText: '全部重新分配',
}).then(() => { type: 'success',
this.automaticAllocation(1, next) closeOnClickModal: false,
}).catch(() => { showClose: false,
this.automaticAllocation(0, next) }).then(async () => {
}); await this.$post(`${this.api.automaticAllocation}?competitionId=${this.id}`)
this.$emit('next', next)
}).catch(() => {
this.$emit('next', next)
// this.automaticAllocation(0, next)
});
} else {
this.$emit('next', next)
}
} else {
//
this.$confirm('<p>团队赛已发布,是否要自动分配阶段人员?</p><p style="margin-top: 10px;color: #a9a9a9;">(点击“是”将会在报名结束后给报名的团队自动分配阶段参赛人员</p>', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'success',
closeOnClickModal: false,
dangerouslyUseHTMLString: true,
}).then(() => {
this.automaticAllocation(1, next)
}).catch(() => {
this.automaticAllocation(0, next)
});
}
}, },
// //
save (status, next = 0) { save (status, next = 0) {
@ -477,7 +499,8 @@ export default {
// //
status && this.publish(status) status && this.publish(status)
util.successMsg((status ? '发布' : '保存') + '成功') util.successMsg((status ? '发布' : '保存') + '成功')
if (this.$parent.$refs.step1.form.completeCompetitionSetup.competitionType && !form[0].contentId) { this.updateTime = 0
if (this.$parent.$refs.step1.form.completeCompetitionSetup.competitionType) {
this.autoAllocationConfirm() // this.autoAllocationConfirm() //
} else { } else {
this.$emit('next', next) this.$emit('next', next)

Loading…
Cancel
Save