From 64d15ceab008d4f0ab570ac74b208c58f0c3ceb2 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 15 May 2024 14:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E5=88=86=E9=85=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/api.js | 2 + src/views/customer/AddCustomer.vue | 10 +- src/views/match/add/index.vue | 15 +- src/views/match/add/step2.vue | 51 +- src/views/match/add/step3.vue | 35 +- src/views/match/manage/abnormalTeam.vue | 751 +++++++++++ src/views/match/manage/index.vue | 17 +- src/views/match/manage/matchInfo.vue | 8 +- src/views/system/staff.vue | 1569 ++++++++++++----------- 9 files changed, 1697 insertions(+), 761 deletions(-) create mode 100644 src/views/match/manage/abnormalTeam.vue diff --git a/src/utils/api.js b/src/utils/api.js index aaa9f12..271b686 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -329,6 +329,8 @@ export default { getRedisCacheCompetition: `competition/competition/management/getRedisCache`, copyCompetition: `competition/competition/management/copyCompetition`, checkCustomerBySchool: `competition/competition/team/checkCustomerBySchool`, + automaticAllocationSave: `competition/competitionAutomaticAllocationRecord/updateEventAllocationRecord`, + editWhetherPopUpsAppear: `competition/competitionAutomaticAllocationRecord/editWhetherPopUpsAppear`, // 赛事内容 addCompetitionContent: `competition/competition/content/addCompetitionContent`, diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index 19ee2e5..f8055a2 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -97,11 +97,11 @@ + v-model.trim="form.account"> @@ -152,18 +152,18 @@ + v-model.trim="form.name"> + v-model.trim="form.email"> diff --git a/src/views/match/add/index.vue b/src/views/match/add/index.vue index 061b862..e3b6a10 100644 --- a/src/views/match/add/index.vue +++ b/src/views/match/add/index.vue @@ -179,7 +179,14 @@ export default { // 发布后的逻辑 next (next, setupId, competitionId) { if (!next) { - this.$router.push(`/match`) + if (this.step === 3 && this.$refs['step' + this.step].form[0].contentId) { + // 处于第三步 && 编辑 + this.editing = 0 + this.step = 1 + } else { + // 新增 + this.$router.push(`/match`) + } } else if (next === 2) { if (setupId) this.setupId = setupId if (competitionId) { @@ -190,6 +197,12 @@ export default { this.step++ } else if (next === 1) { this.step-- + } else { + if (typeof setupId === 'function') { + setupId() + } else if (typeof type === 'function') { + type() + } } }, // 点击步骤条跳转 diff --git a/src/views/match/add/step2.vue b/src/views/match/add/step2.vue index 90b4022..ff46428 100644 --- a/src/views/match/add/step2.vue +++ b/src/views/match/add/step2.vue @@ -306,6 +306,7 @@ export default { { required: true, trigger: 'change' } ], }, + originForm: null, ruleForm: {}, rules: Const.rules, methods: Const.methods, @@ -348,6 +349,7 @@ export default { if (!e.percentageLimit) e.percentageLimit = '' e.teamCalculationMethod = +e.teamCalculationMethod }) + this.originForm = _.cloneDeep(rule) this.form = rule } this.$nextTick(() => { @@ -379,6 +381,51 @@ export default { this.form.competitionStageList = stages.slice(0, val) } }, + // 自动分配人员 + async automaticAllocation (next) { + // 团队赛 + if (this.step1.completeCompetitionSetup.competitionType) { + const { form, originForm } = this + + // 赛制、阶段数量、是否限制成员只参加一个阶段、参赛人数限制。这些字段有改一个,则调接口查询其他3个条件;一共4个条件都满足后,才需要弹框;否则直接进入下一步 + let changeLimit = 0 + for (const i in form.competitionStageList) { + const e = form.competitionStageList[i] + if (e.teamNumLimit !== originForm.competitionStageList[i].teamNumLimit || e.customNumber !== originForm.competitionStageList[i].customNumber) { + changeLimit = 1 + break + } + } + 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) + } + } else { + this.$emit('next', next) + } + } else { + this.$emit('next', next) + } + }, // 提交 save (status, next = 0) { const form = _.cloneDeep(this.form) @@ -470,14 +517,14 @@ export default { if (form.resultCalculationMethod == 0 && !rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入') } } else { // 保存草稿的情况下,只保存输入了阶段名称的阶段 - form.competitionStageList = form.competitionStageList.filter(e => e.stageName) + form.competitionStageList = form.competitionStageList.filter(e => e.stageName) } this.$parent.showLoad() if (form.ruleId) { this.$post(this.api.editCompetitionRule, form).then(res => { this.$parent.hideLoad() this.updateTime && util.successMsg("修改成功"); - this.$emit('next', next) + this.automaticAllocation(next) }).catch(err => { this.$parent.hideLoad() }) diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index 8be98fe..d74054f 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -360,18 +360,30 @@ export default { this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { }) }, // 自动分配人员 - autoAllocation () { - this.$confirm('团队赛已发布,是否要自动分配阶段人员?', '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - type: 'success' + async automaticAllocation (assignOrNot, next) { + await this.$post(this.api.automaticAllocationSave, { + assignOrNot, + competitionId: this.competitionId, + }) + this.$emit('next', next) + }, + // 自动分配人员弹框 + async autoAllocationConfirm (next) { + // 新增 + this.$confirm('

团队赛已发布,是否要自动分配阶段人员?

(点击“是”将会给报名的团队自动分配阶段参赛人员

', '提示', { + confirmButtonText: '是', + cancelButtonText: '否', + type: 'success', + closeOnClickModal: false, + dangerouslyUseHTMLString: true, }).then(() => { - - }).catch(() => { }); + this.automaticAllocation(1, next) + }).catch(() => { + this.automaticAllocation(0, next) + }); }, // 提交 save (status, next = 0) { - // return console.log(this.$parent.$refs.step1.form.completeCompetitionSetup.competitionType) const { form } = this if (!form.length) { this.$parent.hideLoad() @@ -464,9 +476,12 @@ export default { this.$parent.hideLoad() // 新增赛事,并且点的是发布按钮,则发布该赛事 status && this.publish(status) - // this.$parent.$refs.step1.form.completeCompetitionSetup.competitionType && this.autoAllocation() // 团队并且第一次发布才需要弹框询问是否自动分配人员 util.successMsg((status ? '发布' : '保存') + '成功') - this.$emit('next', next) + if (this.$parent.$refs.step1.form.completeCompetitionSetup.competitionType && !form[0].contentId) { + this.autoAllocationConfirm() // 团队并且第一次发布才需要弹框询问是否自动分配人员 + } else { + this.$emit('next', next) + } }).catch(err => { this.$parent.hideLoad() }) diff --git a/src/views/match/manage/abnormalTeam.vue b/src/views/match/manage/abnormalTeam.vue new file mode 100644 index 0000000..a7ba057 --- /dev/null +++ b/src/views/match/manage/abnormalTeam.vue @@ -0,0 +1,751 @@ + + + + + \ No newline at end of file diff --git a/src/views/match/manage/index.vue b/src/views/match/manage/index.vue index ea7a773..6dafce5 100644 --- a/src/views/match/manage/index.vue +++ b/src/views/match/manage/index.vue @@ -21,8 +21,9 @@ ref="detail" /> - + + @@ -33,8 +34,9 @@ import Setting from "@/setting"; import MatchDetail from "../add"; import MatchArch from "./matchArch"; import MatchProgress from "./matchProgress"; -import notice from "./notice"; -import MatchSignup from "./matchSignup"; +import Notice from "./notice"; +import MatchSignup from './matchSignup' +import AbnormalTeam from './abnormalTeam' export default { name: "matchManage", data () { @@ -46,7 +48,8 @@ export default { tab2: "大赛成绩管理", tab3: "竞赛进展", tab4: "公告通知", - tab5: "报名人员" + tab5: "报名人员", + tab6: '查看异常团队' } }; }, @@ -54,8 +57,9 @@ export default { MatchDetail, MatchArch, MatchProgress, - notice, - MatchSignup + Notice, + MatchSignup, + AbnormalTeam }, mounted () { Setting.dynamicRoute && this.initTabs() @@ -76,6 +80,7 @@ export default { tab3 || this.$delete(this.tabs, 'tab3') tab4 || this.$delete(this.tabs, 'tab4') tab5 || this.$delete(this.tabs, 'tab5') + res.competition.completeCompetitionSetup.competitionType || this.$delete(this.tabs, 'tab6') const type = this.$route.query.tab const keys = Object.keys(this.tabs) diff --git a/src/views/match/manage/matchInfo.vue b/src/views/match/manage/matchInfo.vue index 5d0ccf5..b82c090 100644 --- a/src/views/match/manage/matchInfo.vue +++ b/src/views/match/manage/matchInfo.vue @@ -124,7 +124,7 @@ {{ i + 1 }} {{ item.stageName }}