大赛自动分配

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`,
copyCompetition: `competition/competition/management/copyCompetition`,
checkCustomerBySchool: `competition/competition/team/checkCustomerBySchool`,
automaticAllocationSave: `competition/competitionAutomaticAllocationRecord/updateEventAllocationRecord`,
updateEventAllocationRecord: `competition/competitionAutomaticAllocationRecord/updateEventAllocationRecord`,
editWhetherPopUpsAppear: `competition/competitionAutomaticAllocationRecord/editWhetherPopUpsAppear`,
automaticAllocation: `competition/competition/automaticAllocation/automaticAllocation`,
// 赛事内容
addCompetitionContent: `competition/competition/content/addCompetitionContent`,

@ -392,7 +392,8 @@ export default {
},
submiting: false,
updateTime: 0,
quillShow: true
quillShow: true,
originSignUpEndTime: '',
};
},
components: {
@ -488,6 +489,7 @@ export default {
})
this.rangeName = range.join(',')
}
this.originSignUpEndTime = competition.signUpEndTime
this.form = competition
this.$parent.resumeData()
this.$nextTick(() => {
@ -685,10 +687,11 @@ export default {
form.releaseType = releaseType
form.id = this.$route.query.id
if (form.id) {
this.$post(this.api.editCompetition, form).then(res => {
this.$post(this.api.editCompetition, form).then(async () => {
this.$parent.hideLoad()
this.updateTime && util.successMsg("修改成功");
this.updateTime = 0
await this.automaticAllocation()
this.$emit('next', next)
}).catch(err => {
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 () {
util.local.set('match', this.form)

@ -381,7 +381,7 @@ export default {
this.form.competitionStageList = stages.slice(0, val)
}
},
//
//
async automaticAllocation (next) {
//
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) {
const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.id}`)
if (res.popupState) {
this.$confirm('报名的团队将按照新设置的规则进行自动分配阶段参赛人员,当前已分配的阶段参赛人员是否需要保留?', '提示', {
cancelButtonText: '已分配的保留',
confirmButtonText: '全部重新分配',
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)
}
await this.$post(this.api.updateEventAllocationRecord, {
competitionId: +this.id,
whetherToModifyTheRule: 1,
})
this.$emit('next', next)
} else {
this.$emit('next', next)
}

@ -361,7 +361,7 @@ export default {
},
//
async automaticAllocation (assignOrNot, next) {
await this.$post(this.api.automaticAllocationSave, {
await this.$post(this.api.updateEventAllocationRecord, {
assignOrNot,
competitionId: this.competitionId,
})
@ -369,18 +369,40 @@ export default {
},
//
async autoAllocationConfirm (next) {
//
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)
});
if (this.form[0].contentId) {
//
const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.id}`)
if (res.popupState) {
this.$confirm('报名的团队将按照新设置的规则进行自动分配阶段参赛人员,当前已分配的阶段参赛人员是否需要保留?', '提示', {
cancelButtonText: '已分配的保留',
confirmButtonText: '全部重新分配',
type: 'success',
closeOnClickModal: false,
showClose: false,
}).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) {
@ -477,7 +499,8 @@ export default {
//
status && this.publish(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() //
} else {
this.$emit('next', next)

Loading…
Cancel
Save