-
实验平均分
-
{{ avgScore }}
+
+
+
+
+
+
已参加/应参加人数
+
{{ isNaN(statData.totalNumber) ? '' : statData.attendance + '/' + statData.totalNumber }}
+
+
+
实验平均分
+
{{ avgScore }}
+
+
-
-
-
-
-
-
+
-
-
-
-
-
- 上传成绩
- 批量删除
- 导出
-
-
-
{{ loading ? '正在导出' : '批量导出' }}
+
+
-
-
-
-
-
-
- {{ scope.$index + (page - 1) * pageSize + 1 }}
-
-
-
-
-
-
-
-
- {{ scope.row.submitTime ? scope.row.score : '--' }}
-
-
-
-
- {{ scope.row.timeSum ? scope.row.timeSum + 'min' : '--' }}
-
-
-
-
- {{ scope.row.submitTime || '--' }}
-
-
-
-
- {{ scope.row.reportId ? '查看成绩报告' : '未参加' }}
- 删除
-
-
-
-
-
-
-
-
-
-
- {{ scope.$index + (page1 - 1) * pageSize + 1 }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 预览文件
- 导出文件
-
-
-
-
-
- 模板下载
-
-
+
+ 模板下载
+
+
- 上传文件
-
- 部分数据导入失败,查看失败原因
+ 上传文件
+
+
+
+ {{ faildData.tip }}
+ 部分数据导入失败,查看失败原因
+
-
@@ -299,14 +316,17 @@ export default {
importVisible: false,
uploadList: [],
uploadFaild: false,
- exportCode: '',
+ uploading: false,
+ faildData: null,
headers: {
token: util.local.get(Setting.tokenKey)
},
statData: {},
tabs: ['成绩列表', '文件列表'],
active: 0,
- loading: false
+ loading: false,
+ exporting: false,
+ exporting1: false,
};
},
watch: {
@@ -321,51 +341,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,50 +398,42 @@ export default {
this.$router.push(`/match/report?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 {
+ 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
+ }
}
-
- // let { list } = this
- // if (this.multipleSelection.length) {
- // list = this.multipleSelection
- // }
- // axios.post(this.api.exportExperimentalResultsInBatch, list, {
- // headers: this.headers,
- // responseType: 'blob'
- // }).then((res) => {
- // util.downloadFileDirect(`赛事成绩.xls`, new Blob([res.data]))
- // }).catch(res => { })
},
// 导出(有勾选:就导勾选中的;没有勾选:就导全部)
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) { // 删除
@@ -443,21 +456,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 {
@@ -517,7 +531,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) {
@@ -527,23 +546,27 @@ 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) {
@@ -553,6 +576,9 @@ export default {
center: true
})
},
+ beforeUpload (file) {
+ this.uploading = true
+ },
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`)
},
@@ -560,9 +586,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回调
@@ -658,4 +687,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/pages/match/manage/matchInfo.vue b/src/pages/match/manage/matchInfo.vue
index bac3def..3094bc6 100644
--- a/src/pages/match/manage/matchInfo.vue
+++ b/src/pages/match/manage/matchInfo.vue
@@ -288,7 +288,7 @@