diff --git a/src/api/index.js b/src/api/index.js index ae526fc..14420d8 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -76,7 +76,7 @@ export default { // 成绩管理 deleteExperimentalReport: `occupationlab/occupationlab/achievement/deleteExperimentalReport`, // 单个、批量删除实验报告 exportAssessmentInfo: `${host}occupationlab/occupationlab/achievement/exportAssessmentInfo`, // 批量导出考核成绩 - exportPracticeInfo: `${host}occupationlab/occupationlab/achievement/exportPracticeInfo`, // 批量导出练习成绩 + exportPracticeInfo: `${host2}occupationlab/occupationlab/achievement/exportPracticeInfo`, // 批量导出练习成绩 getAchievementInfo: `occupationlab/occupationlab/achievement/getAchievementInfo`, // 管理端成绩管理 getAssessmentDetail: `occupationlab/occupationlab/achievement/getAssessmentDetail`, // 管理端考核成绩详情 getPracticeDetail: `occupationlab/occupationlab/achievement/getPracticeDetail`, // 管理端练习成绩详情 @@ -122,7 +122,7 @@ export default { getCompetition: `competition/competition/management/getCompetition`, getProjectAssessmentByCompetition: `occupationlab/occupationlab/projectManage/getProjectAssessmentByCompetition`, publishCompetition: `competition/competition/management/publishCompetition`, - detailsOfCompetitionStage: `${host1}competition/competition/management/detailsOfCompetitionStage`, + detailsOfCompetitionStage: `competition/competition/management/detailsOfCompetitionStage`, entryInformation: `competition/competition/team/entryInformation`, getCustomerOrder: `nakadai/nakadai/valueModuleManagement/getCustomerOrder`, curriculumList: `nakadai/nakadai/curriculum/schoolCourse`, @@ -133,6 +133,10 @@ export default { editCompetitionContent: `competition/competition/content/editCompetitionContent`, getCompetitionContent: `competition/competition/content/getCompetitionContent`, // 赛事附件 + delComAnnex: `competition/competition/annex/delete`, + saveComAnnex: `competition/competition/annex/save`, + updateComAnnex: `competition/competition/annex/update`, + // 赛事公告附件 delAnnex: `competition/competition/announcementAnnex/delete`, saveAnnex: `competition/competition/announcementAnnex/save`, updateAnnex: `competition/competition/announcementAnnex/update`, @@ -168,6 +172,7 @@ export default { stageSelectParticipants: `competition/competition/teamParticipant/stageSelectParticipants`, updateUser: `users/users/userInfo/updateUser`, enquireAboutSchoolStudents: `users/users/userAccount/enquireAboutSchoolStudents`, + cancelParticipant: `competition/competition/teamParticipant/cancelParticipant`, // 赛事公告 addAnnouncement: `competition/competition/announcement/addAnnouncement`, amendmentAnnouncement: `competition/competition/announcement/amendmentAnnouncement`, @@ -177,26 +182,26 @@ export default { queryAnnouncementDetails: `competition/competition/announcement/queryAnnouncementDetails`, saveAnnouncementAnnex: `competition/competition/announcementAnnex/save`, // 赛事成绩 - batchDeleteContestGrade: `${host1}competition/competition/performance/batchDeleteContestGrade`, - batchImportGrades: `${host1}competition/competition/performance/batchImportGrades`, - exportExperimentalResultsInBatch: `${host1}competition/competition/performance/exportExperimentalResultsInBatch`, - performanceExportFailure: `${host1}competition/competition/performance/exportFailure`, - rankExportFailure: `${host1}competition/competition/rank/exportFailure`, - stageGradeManagementList: `${host1}competition/competition/performance/stageGradeManagementList`, - stageRaceRanking: `${host1}competition/competition/rank/stageRaceRanking`, - overallStandingsInThePointsRace: `${host1}competition/competition/rank/overallStandingsInThePointsRace`, - batchImportRanking: `${host1}competition/competition/rank/batchImportRanking`, - publishRanking: `${host1}competition/competition/rank/publishRanking`, - stageTeamScoreDetails: `${host1}competition/competition/rank/stageTeamScoreDetails`, - multipleStageTeamScoreDetails: `${host1}competition/competition/rank/multipleStageTeamScoreDetails`, - detailsOfTotalTeamScores: `${host1}competition/competition/rank/detailsOfTotalTeamScores`, - cancelRanking: `${host1}competition/competition/rank/cancelRanking`, - reportDetail: `${host1}occupationlab/occupationlab/achievement/reportDetail`, - deleteLastPublication: `${host1}competition/competition/rank/deleteLastPublication`, - whetherToPublish: `${host1}competition/competition/rank/whetherToPublish`, - manuallyRankTheUploadList: `${host1}competition/competition/rank/manuallyRankTheUploadList`, - queryPublicationSource: `${host1}competition/competition/rank/queryPublicationSource`, - releaseVerification: `${host1}competition/competition/rank/releaseVerification`, + batchDeleteContestGrade: `competition/competition/performance/batchDeleteContestGrade`, + batchImportGrades: `competition/competition/performance/batchImportGrades`, + exportExperimentalResultsInBatch: `competition/competition/performance/exportExperimentalResultsInBatch`, + performanceExportFailure: `competition/competition/performance/exportFailure`, + rankExportFailure: `competition/competition/rank/exportFailure`, + stageGradeManagementList: `competition/competition/performance/stageGradeManagementList`, + stageRaceRanking: `competition/competition/rank/stageRaceRanking`, + overallStandingsInThePointsRace: `competition/competition/rank/overallStandingsInThePointsRace`, + batchImportRanking: `competition/competition/rank/batchImportRanking`, + publishRanking: `competition/competition/rank/publishRanking`, + stageTeamScoreDetails: `competition/competition/rank/stageTeamScoreDetails`, + multipleStageTeamScoreDetails: `competition/competition/rank/multipleStageTeamScoreDetails`, + detailsOfTotalTeamScores: `competition/competition/rank/detailsOfTotalTeamScores`, + cancelRanking: `competition/competition/rank/cancelRanking`, + reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, + deleteLastPublication: `competition/competition/rank/deleteLastPublication`, + whetherToPublish: `competition/competition/rank/whetherToPublish`, + manuallyRankTheUploadList: `competition/competition/rank/manuallyRankTheUploadList`, + queryPublicationSource: `competition/competition/rank/queryPublicationSource`, + releaseVerification: `competition/competition/rank/releaseVerification`, gradeImport: `${host2}template/赛事成绩导入模板.xlsx`, rankImportTeam: `${host2}template/赛事排名导入模板(团队赛).xlsx`, rankImportPerson: `${host2}template/赛事排名导入模板(个人赛).xlsx`, @@ -329,8 +334,8 @@ export default { querySubject: `kdSys/querySubject`, queryItem: `kdSys/queryItem`, // 川大 - firstLevel: `${host1}sichuan/point/firstLevel`, - secondaryLevel: `${host1}sichuan/point/secondaryLevel`, - thirdLevel: `${host1}sichuan/point/thirdLevel` + firstLevel: `sichuan/point/firstLevel`, + secondaryLevel: `sichuan/point/secondaryLevel`, + thirdLevel: `sichuan/point/thirdLevel` }; \ No newline at end of file diff --git a/src/const/match.js b/src/const/match.js index c6c17e1..928ad4d 100644 --- a/src/const/match.js +++ b/src/const/match.js @@ -34,15 +34,15 @@ teamCalculationMethods: [ { id: 0, - name: '最高分' + name: '取最高分' }, { id: 1, - name: '平均分' + name: '取平均分' }, { id: 2, - name: '总分' + name: '求和' } ], } \ No newline at end of file diff --git a/src/pages/match/add/index.vue b/src/pages/match/add/index.vue index 39bdbb4..6c38e69 100644 --- a/src/pages/match/add/index.vue +++ b/src/pages/match/add/index.vue @@ -5,38 +5,40 @@ - - - - + + + + 编辑
@@ -46,14 +48,14 @@
- - 预览 - 取消 +
+ 预览 + {{ editing ? '取消' : '返回' }}
@@ -73,6 +75,17 @@ export default { data() { return { id: this.$route.query.id || '', + hasPer: false, + releaseTypes: [ + { + id: 0, + name: '仅发布信息' + }, + { + id: 1, + name: '设置完整比赛' + } + ], publishStatus: 0, competitionId: '', step: 1, @@ -93,9 +106,20 @@ export default { step4 }, mounted() { - + this.getPer() }, methods: { + // 查询客户增值模块(如果返回了true,则显示设置完整比赛选项) + getPer() { + this.$get(this.api.isClient).then(({ customerId }) => { + customerId && this.$get(this.api.getCustomerOrder, { + customerId + }).then(({ show }) => { + this.hasPer = show + show || this.$parent.hideArch() + }).catch(err => {}) + }).catch(res => {}) + }, // 展示loading showLoad() { this.loadIns = Loading.service() @@ -112,12 +136,11 @@ export default { prev() { // 更改了信息才需要提示 const { updateTime } = this.$refs['step' + this.step] - console.log("🚀 ~ file: index.vue:142 ~ back ~ updateTime", updateTime) if (updateTime) { this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { type: 'warning' }).then(() => { - this.save(0) + this.save(0, 1) }).catch(() => { this.step-- }) @@ -137,6 +160,8 @@ export default { this.competitionId = competitionId } this.step++ + } else if (next === 1) { + this.step-- } }, // 点击步骤条跳转 @@ -148,6 +173,27 @@ export default { util.local.set('match', this.$refs.step1.form) window.open(this.$router.resolve('/matchPreview').href) }, + // 取消 + cancel() { + // 当前是编辑赛事,并且表单处于编辑状态,则返回到查看状态;查看状态,则返回到列表 + if (this.editing && this.$route.query.name) { + // 更改了信息才需要提示 + const { updateTime } = this.$refs['step' + this.step] + if (this.step < 4 && updateTime) { + this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(0, 3) + }).catch(() => { + this.editing = false + }) + } else { + this.editing = false + } + } else { + this.$router.push(`/match?page=${this.$store.state.match.page}`) + } + }, back() { // 更改了信息才需要提示 const { updateTime } = this.$refs['step' + this.step] @@ -165,13 +211,21 @@ export default { } }, backPage() { - this.$router.push(`/match?page=${this.$store.state.matchPage}&platformSource=${this.$store.state.platformSource}`) + this.$router.push(`/match?page=${this.$store.state.match.page}`) } } }; \ No newline at end of file diff --git a/src/pages/match/add/step1.vue b/src/pages/match/add/step1.vue index ba86d19..b9e2639 100644 --- a/src/pages/match/add/step1.vue +++ b/src/pages/match/add/step1.vue @@ -369,6 +369,7 @@ export default { id && this.$post(`${this.api.getCompetition}?competitionId=${id}`).then(({ competition }) => { this.$parent.publishStatus = competition.publishStatus this.$parent.releaseType = competition.releaseType + if (!competition.releaseType) this.$parent.editing = 1 // 仅发布信息默认可以编辑 this.$parent.setupId = competition.completeCompetitionSetup.setupId if (competition.signUpStartTime) this.signupTime = [competition.signUpStartTime, competition.signUpEndTime] if (competition.playStartTime) this.playTime = [competition.playStartTime, competition.playEndTime] @@ -522,13 +523,13 @@ export default { const file = res.data.filesResult const { id } = this.form const data = { - contestId: id || '', + competitionId: id || '', fileName: this.fileName, filePath: file.fileUrl || file.fileId } this.form.competitionAnnexList.push(data) // 编辑的时候需要调新增附件接口 - id && this.$post(this.api.saveAnnex, data).then(res => {}).catch(res => {}) + id && this.$post(this.api.saveComAnnex, data).then(res => {}).catch(res => {}) }, // 附件上传前 beforeUpload(file) { @@ -565,7 +566,7 @@ export default { const { url, name } = file url && this.$del(`${this.api.fileDeletion}?keys=${url}`).then(res => {}).catch(res => {}) const id = this.form.competitionAnnexList.find(e => e.fileName === name).id - id && this.$post(`${this.api.deleteAnnex}?id=${id}`).then(res => {}).catch(res => {}) + id && this.$post(`${this.api.delComAnnex}?id=${id}`).then(res => {}).catch(res => {}) }, // 随机邀请码 randomInv() { @@ -586,8 +587,8 @@ export default { form.sponsor = this.sponsorList.filter(d => d).join(); form.undertaker = this.undertakerList.filter(d => d).join(); if (!form.name) return util.warningMsg("请填写竞赛名称"); - // 发布才需要校验 - // if (status) { + // 下一步需要校验 + if (next === 2) { if (form.competitionScope == 2 && !form.competitionRangeList.length) return util.warningMsg('请选择区域、院校') if (!form.sponsor) return util.warningMsg("请填写主办方"); if (!form.signUpStartTime) return util.warningMsg("请选择报名时间"); @@ -613,14 +614,16 @@ export default { } if (isNeedCode && (!invitationCode || invitationCode.length !== 4)) return util.warningMsg('请填写四位数邀请码') if (!form.description) return util.warningMsg("请填写竞赛详情"); - // } + } this.$parent.showLoad() form.publishStatus = status form.ztOpen = status ? 0 : 1 // 保存则禁用,发布则启用 form.releaseType = releaseType + form.id = this.$route.query.id if (form.id) { this.$post(this.api.editCompetition, form).then(res => { + this.updateTime = 0 this.$parent.hideLoad() util.successMsg("修改成功"); this.$emit('next', next) @@ -629,6 +632,7 @@ export default { }); } else { this.$post(this.api.addCompetition, form).then(({ competitionId, setupId }) => { + this.updateTime = 0 this.$parent.hideLoad() util.successMsg("创建成功"); this.$emit('next', next, setupId, competitionId) diff --git a/src/pages/match/add/step2.vue b/src/pages/match/add/step2.vue index e511612..e88b11f 100644 --- a/src/pages/match/add/step2.vue +++ b/src/pages/match/add/step2.vue @@ -92,7 +92,7 @@ * 成绩公布时间: (阶段)比赛结束后 - + 小时,公布(阶段)比赛成绩。
@@ -124,7 +124,7 @@ (阶段)比赛结束后 - + 小时,公布(阶段)比赛成绩。 @@ -290,62 +290,83 @@ export default { }, // 提交 save(status, next = 0) { - const { form } = this + let { form } = this const { rule } = form let invalid = 0 let pointWeight = 0 const { step1 } = this - for (const e of form.competitionStageList) { - if (rule !== 2 && !e.stageName) { - invalid = 1 - util.errorMsg('请输入阶段名称') - break - } - const { competitionType, maxTeamSize } = step1.completeCompetitionSetup // 0为个人赛,1为团队赛 - // rule: 0为积分赛,1为淘汰赛,2为单项赛 - // 积分赛 - if (!rule) { - // 个人 - if (form.resultCalculationMethod == 0 && e.pointWeight === '') { + // 下一步需要校验 + if (next === 2) { + const stages = form.competitionStageList + for (const i in stages) { + const e = stages[i] + if (rule !== 2 && !e.stageName) { invalid = 1 - util.errorMsg('请输入权重') + util.errorMsg('请输入阶段名称') break } - pointWeight += e.pointWeight // 权重求和 - } else if (rule === 1) { // 淘汰赛 - if (e.score !== '') e.scoreLimit = e.operator + e.score - } - if (rule !== 2 && competitionType && e.teamNumLimitOpt) { - if (e.teamNumLimit === '') { - invalid = 1 - util.errorMsg('请输入团队参数人数限制') - break - } else if (e.teamNumLimit < 0) { - invalid = 1 - util.errorMsg('团队参数人数不得小于0') - break - } else if (maxTeamSize !== '' && e.teamNumLimit > maxTeamSize) { - invalid = 1 - util.errorMsg('团队参数人数不得大于团队人数上限') - break + const { competitionType, maxTeamSize } = step1.completeCompetitionSetup // 0为个人赛,1为团队赛 + // rule: 0为积分赛,1为淘汰赛,2为单项赛 + // 积分赛 + if (!rule) { + // 个人 + if (form.resultCalculationMethod == 0 && e.pointWeight === '') { + invalid = 1 + util.errorMsg('请输入权重') + break + } + pointWeight += e.pointWeight // 权重求和 + } else if (rule === 1) { // 淘汰赛 + // 晋级规则必须至少填一个(最后一个阶段不用填写) + if (i != stages.length - 1 && e.peopleLimit === '' && e.percentageLimit === '' && e.score === '') { + invalid = 1 + util.errorMsg('请至少填写一条晋级规则') + break + } + if (e.score !== '') e.scoreLimit = e.operator + e.score } - } - if (!e.resultsDetails) { - e.resultAnnouncementTime = +e.resultAnnouncementTime - if (e.resultAnnouncementTime === '') { - invalid = 1 - util.errorMsg('请填写成绩公布时间') - break + if (rule !== 2 && competitionType && e.teamNumLimitOpt) { + if (e.teamNumLimit === '') { + invalid = 1 + util.errorMsg('请输入团队参数人数限制') + break + } else if (e.teamNumLimit < 0) { + invalid = 1 + util.errorMsg('团队参数人数不得小于0') + break + } else if (maxTeamSize !== '' && e.teamNumLimit > maxTeamSize) { + invalid = 1 + util.errorMsg('团队参数人数不得大于团队人数上限') + break + } } - if (e.resultAnnouncementTime < 0) { - invalid = 1 - util.errorMsg('成绩公布时间不得小于0') - break + if (!e.resultsDetails) { + if (e.resultAnnouncementTime === '') { + invalid = 1 + util.errorMsg('请填写成绩公布时间') + break + } + if (e.resultAnnouncementTime < 0) { + invalid = 1 + util.errorMsg('成绩公布时间不得小于0') + break + } + if (e.resultAnnouncementTime % 1) { + invalid = 1 + util.errorMsg('成绩公布时间须为整数') + break + } + e.resultAnnouncementTime = +e.resultAnnouncementTime } } + if (invalid) return + if (form.resultCalculationMethod == 0 && !rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入') + } else { // 保存草稿的情况下,只保存输入了阶段名称的阶段 + form.competitionStageList = form.competitionStageList.filter(e => e.stageName) + } + for (const e of form.competitionStageList) { + if (!e.teamNumLimitOpt) e.teamNumLimit = 0 } - if (invalid) return - if (form.resultCalculationMethod == 0 && !rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入') this.$parent.showLoad() if (form.ruleId) { this.$post(this.api.editCompetitionRule, form).then(res => { diff --git a/src/pages/match/add/step3.vue b/src/pages/match/add/step3.vue index f660698..fd94b8c 100644 --- a/src/pages/match/add/step3.vue +++ b/src/pages/match/add/step3.vue @@ -136,7 +136,11 @@ export default { this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => { res.competitionStages.map(e => { const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm)) - if (form.startTime) form.time = [form.startTime, form.endTime] + if (form.startTime) { + form.time = [form.startTime, form.endTime] + } else { + form.time = [] + } form.offlineButton = !!form.offlineButton form.onlineButton = !!form.onlineButton form.method = e.method @@ -193,51 +197,60 @@ export default { // 提交 save(status, next = 0) { const { form } = this - let invalid = 0 - if (this.timeInvalid) return util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') - for (const e of form) { - if (!e.time.length) { - invalid = 1 - util.errorMsg('请选择比赛时间') - break - } - e.startTime = e.time[0] - e.endTime = e.time[1] - if (e.method !== 2 && !e.cid) { - invalid = 1 - util.errorMsg('请选择课程') - break - } - if (e.method === 2) { // 线下 - if (!e.offlineAddress) { - invalid = 1 - util.errorMsg('请输入比赛地点') - break - } - if (!e.contentDescription) { - invalid = 1 - util.errorMsg('请输入比赛内容') - break - } - if (!e.scoreRule) { + if (!form.length) { + this.$parent.hideLoad() + util.successMsg('保存成功') + this.$emit('next', next) + return + } + // 发布才需要判断必填 + if (status) { + let invalid = 0 + if (this.timeInvalid) return util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') + for (const e of form) { + if (!e.time.length) { invalid = 1 - util.errorMsg('请输入评分规则') + util.errorMsg('请选择比赛时间') break } - } else { - if (e.onlineButton && !e.onlineAddress) { + e.startTime = e.time[0] + e.endTime = e.time[1] + if (e.method !== 2 && !e.cid) { invalid = 1 - util.errorMsg('请输入线上地点') + util.errorMsg('请选择课程') break } - if (e.offlineButton && !e.offlineAddress) { - invalid = 1 - util.errorMsg('请输入线下地点') - break + if (e.method === 2) { // 线下 + if (!e.offlineAddress) { + invalid = 1 + util.errorMsg('请输入比赛地点') + break + } + if (!e.contentDescription) { + invalid = 1 + util.errorMsg('请输入比赛内容') + break + } + if (!e.scoreRule) { + invalid = 1 + util.errorMsg('请输入评分规则') + break + } + } else { + if (e.onlineButton && !e.onlineAddress) { + invalid = 1 + util.errorMsg('请输入线上地点') + break + } + if (e.offlineButton && !e.offlineAddress) { + invalid = 1 + util.errorMsg('请输入线下地点') + break + } } } + if (invalid) return } - if (invalid) return // 处理单选框 for (const e of form) { e.offlineButton = e.offlineButton ? 1 : 0 @@ -247,9 +260,9 @@ export default { this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], { competitionContents: form }).then(res => { + this.$parent.hideLoad() // 新增赛事,并且点的是发布按钮,则发布该赛事 !form[0].contentId && status && this.publish(status) - this.$parent.hideLoad() util.successMsg((status ? '发布' : '保存') + '成功') this.$emit('next', next) }).catch(err => { diff --git a/src/pages/match/list/index.vue b/src/pages/match/list/index.vue index 0c70f85..28a2ffa 100644 --- a/src/pages/match/list/index.vue +++ b/src/pages/match/list/index.vue @@ -39,8 +39,8 @@
- 创建竞赛 - 批量删除 + 创建竞赛 + 批量删除
@@ -71,11 +71,13 @@ @@ -149,7 +177,20 @@ export default { page: +this.$route.query.page || 1, pageSize: 10, total: 0, - transferPublishStatus: [ "未发布", "已发布"] + transferPublishStatus: [ "未发布", "已发布"], + modifyVisible: false, + curRow: { + playingStages: [] + }, + timer: null, + pickerOptions: { + shortcuts: [{ + text: '此刻', + onClick(picker) { + picker.$emit('pick', new Date(Date.now() + 5000)) + } + }] + } }; }, watch: { @@ -200,11 +241,34 @@ export default { startTime: form.startTime || null, publishStatus: form.publishStatus === '' ? null : form.publishStatus }).then(({ data }) => { - const { records } = data - records.map(e => { + const list = data.records + // 定时处理是否要显示修改结束时间按钮 + this.timer = setInterval(() => { + const now = new Date() + list.map(e => { + if (!e.playingStages) { + this.$set(e, 'playingStages', []) + } else { + e.playingStages = [] + } + // 如果当前时间在竞赛开始结束时间之间 + if (now >= new Date(e.playStartTime) && now <= new Date(e.playEndTime)) { + // 遍历赛事阶段 + if (e.competitionStageList) { + for (const n of e.competitionStageList) { + // 判断是否有开始了的阶段 + if (now >= new Date(n.startTime) && now <= new Date(n.endTime)) { + e.playingStages.push(n) + } + } + } + } + }) + }, 1000) + list.map(e => { if (e.ztOpen) e.isOpen = 1 }) - this.matchData = records + this.matchData = list this.total = data.total this.$refs.table.clearSelection() if (!this.matchData.length && this.total) { @@ -215,10 +279,6 @@ export default { }, getData() { this.getList() - // if (!Setting.isDev) { - // clearInterval(this.timer) - // this.timer = setInterval(this.getList, 1000 * 60) - // } }, initData() { this.page = 1; @@ -227,6 +287,29 @@ export default { add() { this.$router.push("/match/add"); }, + // 修改结束时间 + editEndTime(row) { + this.modifyVisible = true + row.newEndTime = '' + this.curRow = row + }, + // 修改结束时间提交 + modifySubmit() { + const row = this.curRow + const data = [] + row.competitionStageList.map(e => { + const stage = row.playingStages.find(n => n.contentId === e.contentId && n.newEndTime) + if (stage && stage.newEndTime) stage.endTime = this.formatDate('yyyy-MM-dd hh:mm:ss', stage.newEndTime) + data.push(stage || e) + }) + this.$post(this.api.editCompetitionContent, { + competitionContents: data + }).then(res => { + util.successMsg('修改成功') + this.modifyVisible = false + this.getData() + }).catch(err => {}) + }, manage(row) { this.$router.push(`/match/manage?id=${row.id}&name=${row.competitionName}`) }, @@ -281,40 +364,15 @@ export default { if (date == "0000-00-00 00:00:00") return "---"; return date; }, - disable(val, row) { + switchOff(val, row) { this.$post(this.api.disabledEventsCompetition, { competitionId: row.id, isOpen: val, type: 1 // 禁用平台来源(0中台,1职站) }).then(res => { - val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功') + util.successMsg(val == 1 ? '禁用成功' : '启用成功') }).catch(err => {}) }, - switchOff(val, row, index) { - if (val) { - this.disable(val, row) - } else if (!row.publishStatus) { - this.$confirm('是否发布该大赛?', '提示', { - type: 'success' - }).then(() => { - this.$post(this.api.disabledEventsCompetition, { - competitionId: row.id, - isOpen: val, - type: 1 // 禁用平台来源(0中台,1职站) - }).then(res => { - row.publishStatus = 1 - this.$post(this.api.editContest, row).then(res => { - this.getData() - val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功') - }).catch(err => {}) - }).catch(err => {}) - }).catch(() => { - row.isOpen = 1 - }) - } else { - this.disable(val, row) - } - } } }; diff --git a/src/pages/match/manage/index.vue b/src/pages/match/manage/index.vue index ed9764b..006ce81 100644 --- a/src/pages/match/manage/index.vue +++ b/src/pages/match/manage/index.vue @@ -27,6 +27,7 @@ import MatchArch from "./matchArch"; import MatchProgress from "./matchProgress"; import notice from "./notice"; import MatchSignup from "./matchSignup"; +import { mapState } from "vuex"; export default { name: "matchManage", data() { @@ -39,7 +40,7 @@ export default { tab3: "竞赛进展", tab4: "公告通知", tab5: "报名人员" - } + }, }; }, components: { @@ -49,25 +50,40 @@ export default { notice, MatchSignup }, + computed: { + ...mapState("user", [ + 'page' + ]), + ...mapState('auth', [ + 'btns' + ]) + }, mounted() { Setting.dynamicRoute && this.initTabs() }, methods: { initTabs() { - const btns = this.$store.state.btns - const tab1 = btns.includes('/match:管理:大赛详情') - const tab2 = btns.includes('/match:管理:竞赛进展') - const tab3 = btns.includes('/match:管理:公告通知') - const tab4 = btns.includes('/match:管理:报名人员') + const { btns } = this + console.log("🚀 ~ file: index.vue:67 ~ initTabs ~ btns", btns) + const tab1 = btns.includes('/match/list:管理:大赛详情') + const tab2 = btns.includes('/match/list:管理:大赛成绩管理') + const tab3 = btns.includes('/match/list:管理:竞赛进展') + const tab4 = btns.includes('/match/list:管理:公告通知') + const tab5 = btns.includes('/match/list:管理:报名人员') - tab1 || delete this.tabs.tab1 - tab2 || delete this.tabs.tab2 - tab3 || delete this.tabs.tab3 - tab4 || delete this.tabs.tab4 + tab1 || this.$delete(this.tabs, 'tab1') + tab2 || this.$delete(this.tabs, 'tab2') + tab3 || this.$delete(this.tabs, 'tab3') + tab4 || this.$delete(this.tabs, 'tab4') + tab5 || this.$delete(this.tabs, 'tab5') const type = this.$route.query.tab const keys = Object.keys(this.tabs) this.active = keys.includes(type) ? type : keys[0] }, + // 移除成绩管理 + hideArch() { + this.$delete(this.tabs, 'tab2') + }, back() { this.handleSave(0) && this.backPage() }, @@ -95,7 +111,8 @@ export default { }, // 返回列表 backPage(){ - this.$router.push(`/match?page=${this.$store.state.matchPage}&platformSource=${this.$store.state.platformSource}`) + console.log(444, this.$store.state) + this.$router.push(`/match?page=${this.$store.state.match.page}`) }, // tab切换 tabSwitch(i) { diff --git a/src/pages/match/manage/matchArch.vue b/src/pages/match/manage/matchArch.vue index f3f9030..542ab20 100644 --- a/src/pages/match/manage/matchArch.vue +++ b/src/pages/match/manage/matchArch.vue @@ -79,15 +79,14 @@ export default { } } }) - console.log("🚀 ~ file: matchArch.vue:87 ~ handleStatus ~ this.status", this.list) }, // 排名 toRank(row, i) { - this.$router.push(`/matchRank?id=${this.id}&stageId=${row.stageId}&index=${i}&method=${row.method}&competitionType=${row.competitionType}&rule=${row.rule}`) + this.$router.push(`rank?id=${this.id}&stageId=${row.stageId}&index=${i}&method=${row.method}&competitionType=${row.competitionType}&rule=${row.rule}`) }, // 成绩管理 toArch(row) { - this.$router.push(`/matchArchList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}`) + this.$router.push(`archList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}`) } } }; diff --git a/src/pages/match/manage/matchArchList.vue b/src/pages/match/manage/matchArchList.vue index c7c0e8c..37b01ad 100644 --- a/src/pages/match/manage/matchArchList.vue +++ b/src/pages/match/manage/matchArchList.vue @@ -61,7 +61,7 @@ @@ -87,9 +87,13 @@ :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" - :action="this.api.importStaff" + :action="this.api.batchImportGrades" :file-list="uploadList" :headers="headers" + :data="{ + competitionId: this.id, + stageId: this.stageId, + }" > 上传文件 @@ -206,9 +210,13 @@ export default { type: "warning" }).then(() => { let ids = this.multipleSelection.map(item => { - return item.reportId; + return this.method == 2 ? item.scoreId : item.reportId }); - this.$post(this.api.deleteExperimentalReport, ids).then(res => { + this.$post(this.api.batchDeleteContestGrade, { + ids, + competitionId: this.id, + stageId: this.stageId + }).then(res => { this.multipleSelection = []; this.$refs.table.clearSelection(); util.successMsg("删除成功"); @@ -276,7 +284,12 @@ export default { }, // 下载失败文件 showFaild() { - location.href = `${this.api.performanceExportFailure}?exportCode=${this.exportCode}` + axios.get(`${this.api.performanceExportFailure}?exportCode=${this.exportCode}`, { + headers: this.headers, + responseType: 'blob' + }).then((res) => { + util.downloadFileDirect(`批量导入成绩管理失败数据导出.xls`, new Blob([res.data])) + }).catch(res => {}) }, uploadSuccess(res, file, fileList) { this.uploadFaild = false @@ -306,10 +319,7 @@ export default { }, uploadSure() { this.importVisible = false - this.studentType = 1 - this.keyWord = '' - this.$refs.orgTree.setCurrentKey(null) - this.getOrg() + this.getData() } } }; diff --git a/src/pages/match/manage/matchInfo.vue b/src/pages/match/manage/matchInfo.vue index 9c4f688..2f681ba 100644 --- a/src/pages/match/manage/matchInfo.vue +++ b/src/pages/match/manage/matchInfo.vue @@ -1,5 +1,5 @@