diff --git a/src/setting.js b/src/setting.js index 45e82cc..783f5be 100644 --- a/src/setting.js +++ b/src/setting.js @@ -14,7 +14,7 @@ if (isDev) { sandPath = `http://${location.hostname}:9520` host = 'http://121.37.12.51/' // host = 'https://huorantech.cn/' - host = 'http://192.168.31.51:9000/' + host = 'http://192.168.31.217:9000/' } else if (isPro) { jumpPath = 'https://judgment.huorantech.cn/' } diff --git a/src/utils/api.js b/src/utils/api.js index 2b85723..7526c68 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -420,6 +420,7 @@ export default { allExperimentalResultsAreDerived: `${host}competition/competition/performance/allExperimentalResultsAreDerived`, derivedRanking: `${host}competition/competition/rank/derivedRanking`, individualDerivedRanking: `${host}competition/competition/rank/individualDerivedRanking`, + gradeDownloadExcel: `${host}competition/competition/performance/downloadExcel`, gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`, rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`, rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`, diff --git a/src/views/match/add/step1.vue b/src/views/match/add/step1.vue index 041a3d6..57858a1 100644 --- a/src/views/match/add/step1.vue +++ b/src/views/match/add/step1.vue @@ -147,11 +147,12 @@
指定区域、院校 - 选择院校 - {{ rangeName }} +
-
- -
- -
- -
- - -
-
-
-

已参加/应参加人数

-

{{ isNaN(statData.totalNumber) ? '' : statData.attendance + '/' + statData.totalNumber }}

-
-
-

实验平均分

-

{{ avgScore }}

-
-
-
-
-
- - - - -
-
- -
-
- 上传成绩 - 批量删除 - 导出 -
-
- {{ loading ? '正在导出' : '批量导出' }} -
-
- - -
- - -
-
- 模板下载 -
- - 上传文件 - - 部分数据导入失败,查看失败原因 -
- - 取 消 - 确 定 - -
-
- - - - - \ No newline at end of file diff --git a/src/views/match/manage/matchArchList.vue b/src/views/match/manage/matchArchList.vue index ea1d716..a584fd1 100644 --- a/src/views/match/manage/matchArchList.vue +++ b/src/views/match/manage/matchArchList.vue @@ -9,259 +9,282 @@ - -
-
-
-

已参加/应参加人数

-

{{ isNaN(statData.totalNumber) ? '' : statData.attendance + '/' + statData.totalNumber }}

-
-
-

实验平均分

-

{{ avgScore }}

+
+ +
+
+
+

已参加/应参加人数

+

{{ isNaN(statData.totalNumber) ? '' : statData.attendance + '/' + statData.totalNumber }}

+
+
+

实验平均分

+

{{ avgScore }}

+
+
-
-
- - - - + -
-
- -
-
- 上传成绩 - 批量删除 - 导出 -
-
- {{ loading ? '正在导出' : '批量导出' }} -
-
- - - +
+
+ +
+
+ 上传成绩 + 批量删除 + {{ exporting ? '正在导出' : '批量导出' }} +
+
+ {{ exporting1 ? '正在导出' : '批量导出' }} +
+
+ + + +
+ :close-on-click-modal="false" + @close="cancelUpload">
-
- 模板下载 -
- +
+ 模板下载 +
+ - 上传文件 - - 部分数据导入失败,查看失败原因 + 上传文件 +
+ +
- - 取 消 - 确 定 + 停止导入
@@ -299,14 +322,17 @@ export default { importVisible: false, uploadList: [], uploadFaild: false, - exportCode: '', + uploading: false, + faildData: null, headers: { token: sessionStorage.getItem("token") }, statData: {}, tabs: ['成绩列表', '文件列表'], active: 0, - loading: false + loading: false, + exporting: false, + exporting1: false, }; }, watch: { @@ -321,51 +347,52 @@ export default { this.getData() }, methods: { - getData () { + async getData () { + this.loading = true // 文件列表 if (this.active) { - this.$post(this.api.cCompetitionStageFileList, { + const { data } = await this.$post(this.api.cCompetitionStageFileList, { pageNum: this.page1, pageSize: this.pageSize, competitionId: this.id, stageId: this.stageId, keyWord: this.keyword, - }).then(({ data }) => { - data.records.forEach(e => { - e.loading = false - e.fileType = '其他' - if (util.isVideo(e.fileFormat)) { - e.fileType = '视频' - } else if (util.isAudio(e.fileFormat)) { - e.fileType = '音频' - } else if (util.isImg(e.fileFormat)) { - e.fileType = '图片' - } else if (util.isDoc(e.fileFormat)) { - e.fileType = '文档' - } else if (util.isCompress(e.fileFormat)) { - e.fileType = '压缩包' - } else if (e.fileType === 'pdf') { - e.fileType = 'pdf' - } - }) - this.list1 = data.records - this.total1 = data.total - }).catch(res => { }) + }) + data.records.forEach(e => { + e.loading = false + e.fileType = '其他' + if (util.isVideo(e.fileFormat)) { + e.fileType = '视频' + } else if (util.isAudio(e.fileFormat)) { + e.fileType = '音频' + } else if (util.isImg(e.fileFormat)) { + e.fileType = '图片' + } else if (util.isDoc(e.fileFormat)) { + e.fileType = '文档' + } else if (util.isCompress(e.fileFormat)) { + e.fileType = '压缩包' + } else if (e.fileType === 'pdf') { + e.fileType = 'pdf' + } + }) + this.list1 = data.records + this.total1 = data.total + this.loading = false } else { // 成绩列表 - this.$post(this.api.stageGradeManagementList, { + const { data, page } = await this.$post(this.api.stageGradeManagementList, { pageNum: this.page, pageSize: this.pageSize, competitionId: this.id, keyWord: this.keyword, stageId: this.stageId, isNakadai: 1 - }).then(({ data, page }) => { - this.total = page.total - this.list = page.records - this.statData = data - this.avgScore = (+data.avgScore).toFixed(2) - this.getChart() - }).catch(res => { }) + }) + this.total = page.total + this.list = page.records + this.statData = data + this.avgScore = (+data.avgScore).toFixed(2) + this.getChart() + this.loading = false } }, initData () { @@ -377,39 +404,42 @@ export default { this.$router.push(`/matchReport?reportId=${row.reportId}`) }, // 导出(有勾选:就导勾选中的;没有勾选:就导全部) - exportData () { - // 有选择数据,则导出已选择的,否则导出全部 - if (this.multipleSelection.length) { - axios.post(this.api.exportExperimentalResultsInBatch, this.multipleSelection, { - headers: this.headers, - responseType: 'blob' - }).then((res) => { + async exportData () { + if (this.list.length) { + this.exporting = true + // 有选择数据,则导出已选择的,否则导出全部 + if (this.multipleSelection.length) { + const res = await axios.post(this.api.exportExperimentalResultsInBatch, this.multipleSelection, { + headers: this.headers, + responseType: 'blob' + }) util.downloadFileDirect(`赛事成绩.xls`, new Blob([res.data])) - }).catch(res => { }) - } else if (this.list.length) { - axios.post(this.api.allExperimentalResultsAreDerived, { - pageNum: 1, - pageSize: 10000, - competitionId: this.id, - isNakadai: 1, - stageId: this.stageId, - }, { - headers: this.headers, - responseType: 'blob' - }).then((res) => { + this.exporting = false + } else if (this.list.length) { + const res = await axios.post(this.api.allExperimentalResultsAreDerived, { + pageNum: 1, + pageSize: 10000, + competitionId: this.id, + isNakadai: 1, + stageId: this.stageId, + }, { + headers: this.headers, + responseType: 'blob' + }) util.downloadFileDirect(`赛事成绩.xls`, new Blob([res.data])) - }).catch(res => { }) + this.exporting = false + } } }, // 导出(有勾选:就导勾选中的;没有勾选:就导全部) exportData1 () { - this.loading = true + this.exporting1 = true let list = this.list1 if (this.multipleSelection1.length) { list = this.multipleSelection1 } Zip('批量导出', list, () => { - this.loading = false + this.exporting1 = false }) }, handleDelete (row) { // 删除 @@ -432,21 +462,22 @@ export default { if (this.multipleSelection.length) { this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", { type: "warning" - }).then(() => { + }).then(async () => { let ids = this.multipleSelection.map(item => { return this.method == 2 ? item.scoreId : item.reportId }); - this.$post(this.api.batchDeleteContestGrade, { - ids, - competitionId: this.id, - stageId: this.stageId - }).then(res => { + ids = ids.filter(e => e) + if (ids.length) { + await this.$post(this.api.batchDeleteContestGrade, { + ids, + competitionId: this.id, + stageId: this.stageId + }) this.multipleSelection = []; this.$refs.table.clearSelection(); util.successMsg("删除成功"); this.getData(); - }).catch(res => { - }); + } }).catch(() => { }); } else { @@ -506,7 +537,12 @@ export default { }, // 模板下载 download () { - location.href = this.api.gradeImport + axios.get(`${this.api.gradeDownloadExcel}?competitionId=${this.id}&stageId=${this.stageId}`, { + headers: this.headers, + responseType: 'blob' + }).then((res) => { + util.downloadFileDirect('赛事成绩导入模板.xlsx', new Blob([res.data])) + }).catch(res => { }) }, // 上传文件 handleExceed (files, fileList) { @@ -516,32 +552,40 @@ export default { }, // 下载失败文件 showFaild () { - axios.get(`${this.api.performanceExportFailure}?exportCode=${this.exportCode}`, { + axios.get(`${this.api.performanceExportFailure}?exportCode=${this.faildData.exportCode}&competitionType=${this.faildData.competitionType}`, { headers: this.headers, responseType: 'blob' }).then((res) => { util.downloadFileDirect(`批量导入成绩管理失败数据导出.xls`, new Blob([res.data])) }).catch(res => { }) }, - uploadSuccess (res, file, fileList) { + uploadSuccess (res) { + this.uploading = false this.uploadFaild = false if (res.status === 200) { - if (res.data.exportCode) { - this.exportCode = res.data.exportCode + const { data } = res + if (data.exportCode) { + this.faildData = data this.uploadFaild = true - util.errorMsg(`本次上传有${res.data.failureNum}个错误信息录入`) + } else { + util.successMsg(data.tip, 3000) + this.importVisible = false } } else { - res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据") + util.errorMsg(res.message || '上传失败,请检查数据') } }, uploadError (err, file, fileList) { + this.uploading = false this.$message({ message: "上传出错,请重试!", type: "error", center: true }) }, + beforeUpload (file) { + this.uploading = true + }, beforeRemove (file, fileList) { return this.$confirm(`确定移除 ${file.name}?`) }, @@ -549,9 +593,12 @@ export default { this.uploadList = fileList this.uploadFaild = false }, - uploadSure () { + cancelUpload () { + this.uploading = false + this.$refs.upload.abort() + this.keyword = '' + this.initData() this.importVisible = false - this.getData() }, // tab回调 tabChange (i) { @@ -646,4 +693,11 @@ export default { height: 300px; } } +/deep/.import-file { + .el-progress__text, + .el-progress, + .el-upload-list__item-status-label { + display: none !important; + } +} \ No newline at end of file diff --git a/src/views/match/manage/matchInfo.vue b/src/views/match/manage/matchInfo.vue index 78007bc..a1eb598 100644 --- a/src/views/match/manage/matchInfo.vue +++ b/src/views/match/manage/matchInfo.vue @@ -288,7 +288,7 @@ @@ -795,4 +823,11 @@ export default { color: #9076ff; } } +/deep/.import-file { + .el-progress__text, + .el-progress, + .el-upload-list__item-status-label { + display: none !important; + } +} \ No newline at end of file diff --git a/src/views/match/manage/matchSignup.vue b/src/views/match/manage/matchSignup.vue index c09513c..e9f1677 100644 --- a/src/views/match/manage/matchSignup.vue +++ b/src/views/match/manage/matchSignup.vue @@ -37,6 +37,7 @@ v-auth="'/match:管理:报名人员:新增'">新增 批量导出 - { if (valid) { if (this.submiting) return false - this.submiting = true const { form } = this const team = this.teams.find(e => e.teamId == form.teamId) if (team && team.invitationCode) form.invitationCode = team.invitationCode // 平台id-端id-schoolId-workNumber组成账号 form.account = `${Setting.platformId}-3-${form.schoolId}-${form.workNumber}` - const { phone } = form + const { phone, email } = form if (phone && !/^1[3456789]\d{9}$/.test(phone)) { - return util.errorMsg("请输入正确的手机号/邮箱") + return util.errorMsg("请输入正确的手机号") + } else if (email && !/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email)) { + return util.errorMsg("请输入正确的邮箱") + } else if (this.notExit) { + return util.errorMsg('学生不存在,无法添加!') + } else if (this.exitMember) { + return util.errorMsg('学生已存在') } else { + this.submiting = true this.submitForm() } } @@ -809,28 +807,37 @@ export default { this.$router.push(`/matchInfo?id=${this.id}&accountId=${row.accountId}`) }, exportAll () { - const data = this.multipleSelection - if (data.length) { - data.map((e, i) => e.id = i + 1) - axios.post(this.api.exportDataInBatches, data, { - headers: { - token: this.token - }, - responseType: 'blob' - }).then((res) => { - const name = res.headers['content-disposition'] - util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) - }).catch(res => { }) - } else { - axios.get(`${this.api.excelExport}?competitionId=${this.id}`, { - headers: { - token: this.token - }, - responseType: 'blob' - }).then((res) => { - const name = res.headers['content-disposition'] - util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) - }).catch(res => { }) + if (this.listData.length) { + this.exporting = true + const data = this.multipleSelection + if (data.length) { + data.map((e, i) => e.id = i + 1) + axios.post(this.api.exportDataInBatches, data, { + headers: { + token: this.token + }, + responseType: 'blob' + }).then((res) => { + const name = res.headers['content-disposition'] + util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) + this.exporting = false + }).catch(res => { + this.exporting = false + }) + } else { + axios.get(`${this.api.excelExport}?competitionId=${this.id}`, { + headers: { + token: this.token + }, + responseType: 'blob' + }).then((res) => { + const name = res.headers['content-disposition'] + util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) + this.exporting = false + }).catch(res => { + this.exporting = false + }) + } } }, // 批量删除 diff --git a/src/views/serve/projectAdd.vue b/src/views/serve/projectAdd.vue index cdcffe3..4b60aba 100644 --- a/src/views/serve/projectAdd.vue +++ b/src/views/serve/projectAdd.vue @@ -206,10 +206,13 @@ align="center" width="120"> { - score = Decimal(e.score).add(Decimal(score)) + if (e.score && !isNaN(e.score)) score = Decimal(e.score).add(Decimal(score)) }); if (isNaN(score)) { return 0;