竞赛文件上传

dev_review
yujialong 1 year ago
parent e78aca3957
commit a6cec79bdc
  1. 4
      src/libs/aliyun/aliyun-oss-sdk-6.17.1.min.js
  2. 7
      src/libs/aliyun/aliyun-upload-sdk-1.5.6.min.js
  3. 8
      src/libs/util.js
  4. 2
      src/utils/api.js
  5. 48
      src/views/course/contentSettings.vue
  6. 99
      src/views/match/add/step3.vue
  7. 9
      src/views/match/manage/matchArch.vue
  8. 348
      src/views/match/manage/matchArchList.vue
  9. 2
      src/views/serve/projectAdd.vue

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -7,7 +7,8 @@ const exts = {
video: 'mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv', video: 'mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv',
audio: 'mp3,aac,ape,flac,wav,wma,amr,mid', audio: 'mp3,aac,ape,flac,wav,wma,amr,mid',
img: 'jpg,jpeg,png,gif,svg,psd', img: 'jpg,jpeg,png,gif,svg,psd',
doc: 'doc,docx,txt,xls,xlsx,csv,xml,ppt,pptx' doc: 'doc,docx,txt,xls,xlsx,csv,xml,ppt,pptx',
compress: 'zip,rar,7z,tar,gz,bz2',
} }
const util = { const util = {
cookies, cookies,
@ -86,6 +87,11 @@ const util = {
if (exts.doc.includes(ext)) return true; if (exts.doc.includes(ext)) return true;
return false; return false;
}, },
// 传入文件后缀判断是否是压缩包
isCompress(ext) {
if (exts.compress.includes(ext)) return true;
return false;
},
// 判断是否能够预览 // 判断是否能够预览
canPreview(ext) { canPreview(ext) {
if (!util.isVideo(ext) && !util.isAudio(ext) && !util.isImg(ext) && !util.isDoc(ext)) return false if (!util.isVideo(ext) && !util.isAudio(ext) && !util.isImg(ext) && !util.isDoc(ext)) return false

@ -412,6 +412,8 @@ export default {
cancelCompetitionStageRankingTime: `competition/competitionReleaseTime/cancelCompetitionStageRankingTime`, cancelCompetitionStageRankingTime: `competition/competitionReleaseTime/cancelCompetitionStageRankingTime`,
getCompetitionStageRankingTime: `competition/competitionReleaseTime/getCompetitionStageRankingTime`, getCompetitionStageRankingTime: `competition/competitionReleaseTime/getCompetitionStageRankingTime`,
frontOfficeCompetitionRanking: `competition/competition/rank/frontOfficeCompetitionRanking`, frontOfficeCompetitionRanking: `competition/competition/rank/frontOfficeCompetitionRanking`,
cCompetitionStageFileList: `competition/cCompetitionStageFile/listByEntity`,
derive: `${host}competition/cCompetitionStageFile/deriveAll`,
gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`, gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`,
rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`, rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`,
rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`, rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`,

@ -357,6 +357,11 @@
import { Loading } from "element-ui"; import { Loading } from "element-ui";
import pdf from "@/components/pdf"; import pdf from "@/components/pdf";
import axios from 'axios' import axios from 'axios'
import Util from '@/libs/util'
import OSS from '@/libs/aliyun/aliyun-oss-sdk-6.17.1.min'
window.OSS = OSS;
import '@/libs/aliyun/aliyun-upload-sdk-1.5.6.min'
export default { export default {
name: "contentSettings", name: "contentSettings",
data () { data () {
@ -539,6 +544,48 @@ export default {
}, },
// //
handleRequest (data) { handleRequest (data) {
console.log(33, Util.isVideo(this.fileType))
//
if (Util.isVideo(this.fileType)) {
console.log("🚀 ~ file: contentSettings.vue:587 ~ handleRequest ~ AliyunUpload:", AliyunUpload)
var uploader = new AliyunUpload.Vod({
// userID使访https://account.console.aliyun.com/ID
userId: "1686385620732064",
// 1 MB100 KB100*1024
partSize: 1048576,
// 5
parallel: 5,
// 3
retryCount: 3,
// 2
retryDuration: 2,
//
'onUploadstarted': function (uploadInfo) {
console.log("🚀 ~ file: contentSettings.vue:567 ~ handleRequest ~ uploadInfo:", uploadInfo)
debugger
},
//
'onUploadSucceed': function (uploadInfo) {
console.log("🚀 ~ file: contentSettings.vue:571 ~ handleRequest ~ uploadInfo:", uploadInfo)
},
//
'onUploadFailed': function (uploadInfo, code, message) {
console.log("🚀 ~ file: contentSettings.vue:576 ~ handleRequest ~ uploadInfo, code, message:", uploadInfo, code, message)
},
//
'onUploadProgress': function (uploadInfo, totalSize, loadedPercent) {
console.log("🚀 ~ file: contentSettings.vue:578 ~ handleRequest ~ uploadInfo, totalSize, loadedPercent:", uploadInfo, totalSize, loadedPercent)
},
// STS token
'onUploadTokenExpired': function (uploadInfo) {
},
//
'onUploadEnd': function (uploadInfo) {
}
});
} else {
const param = new FormData() const param = new FormData()
param.append('file', data.file) param.append('file', data.file)
const config = { const config = {
@ -564,6 +611,7 @@ export default {
this.fileUrl = fileUrl this.fileUrl = fileUrl
this.fileName = ossFileName this.fileName = ossFileName
}) })
}
}, },
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({

@ -46,6 +46,40 @@
<el-input v-model="item.offlineAddress" <el-input v-model="item.offlineAddress"
style="width: 80%"></el-input> style="width: 80%"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="系统链接">
<el-input v-model="item.competitionStageContentSetting.systemLink"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item label="是否支持上传文件">
<div>
<el-radio v-model="item.competitionStageContentSetting.whetherToUploadFiles"
:label="0"></el-radio>
</div>
<div class="flex a-center">
<el-radio v-model="item.competitionStageContentSetting.whetherToUploadFiles"
:label="1"></el-radio>
<template v-if="item.competitionStageContentSetting.whetherToUploadFiles">
<el-upload accept=".jpg,.png,.jpeg,.gif"
:on-remove="(file, fileList) => handleRemove(file, fileList, item)"
:on-error="uploadError"
:on-success="res => uploadSuccess(res, item)"
:before-remove="beforeRemove"
:action="api.fileUploadNakadai"
:headers="headers"
:file-list="item.competitionStageContentSetting.fileList"
name="file">
<el-button size="small"
type="primary">上传试卷</el-button>
</el-upload>
<span style="margin: 0 10px 0 30px;">说明</span>
<el-input maxlength="1000"
placeholder="请输入内容"
v-model="item.competitionStageContentSetting.stageExplain"
style="width: calc(80% - 216px);"></el-input>
</template>
</div>
</el-form-item>
<el-form-item class="req" <el-form-item class="req"
label="比赛内容"> label="比赛内容">
<el-input v-model="item.contentDescription" <el-input v-model="item.contentDescription"
@ -110,6 +144,9 @@ export default {
props: ['setupId', 'competitionId', 'editing'], props: ['setupId', 'competitionId', 'editing'],
data () { data () {
return { return {
headers: {
token: sessionStorage.getItem('token')
},
id: this.$route.query.id, id: this.$route.query.id,
updateTime: 0, updateTime: 0,
step1: this.$parent.$refs.step1.form, step1: this.$parent.$refs.step1.form,
@ -142,7 +179,7 @@ export default {
offlineButton: 0, offlineButton: 0,
onlineAddress: '', onlineAddress: '',
onlineButton: 0, onlineButton: 0,
time: [] time: [],
}, },
form: [], form: [],
setVisible: false, setVisible: false,
@ -185,6 +222,26 @@ export default {
} else { } else {
form.time = [] form.time = []
} }
// 线
if (e.method === 2) {
if (!form.competitionStageContentSetting) {
form.competitionStageContentSetting = {
whetherToUploadFiles: 0,
stageExplain: '',
fileUrl: '',
systemLink: '',
fileList: []
}
}
if (form.competitionStageContentSetting.fileUrl) {
form.competitionStageContentSetting.fileList = [{
name: form.competitionStageContentSetting.fileName,
url: form.competitionStageContentSetting.fileUrl,
}]
}
form.competitionStageContentSetting.competitionId = this.id
form.competitionStageContentSetting.stageId = e.stageId
}
if (!form.mallId) form.mallId = '' if (!form.mallId) form.mallId = ''
form.offlineButton = !!form.offlineButton form.offlineButton = !!form.offlineButton
form.onlineButton = !!form.onlineButton form.onlineButton = !!form.onlineButton
@ -232,6 +289,41 @@ export default {
} }
} }
}, },
//
beforeUpload (file) {
const isLt2M = file.size / 1024 / 1024 < 10
if (!isLt2M) util.warningMsg('请上传小于10MB的附件!')
if (isLt2M) {
this.fileName = file.name
return true
} else {
return false
}
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
})
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList, item) {
item.fileName = ''
item.fileUrl = ''
},
uploadSuccess (res, item) {
const { originalFileName, fileUrl } = res.filesResult
item.competitionStageContentSetting.fileUrl = fileUrl
item.competitionStageContentSetting.fileName = originalFileName
item.competitionStageContentSetting.fileList = [{
name: originalFileName,
url: fileUrl
}]
},
// //
publish () { publish () {
this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { }) this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { })
@ -283,6 +375,11 @@ export default {
util.errorMsg('请输入评分规则') util.errorMsg('请输入评分规则')
break break
} }
if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) {
invalid = 1
util.errorMsg('请输入说明')
break
}
} else { } else {
if (e.onlineButton && !e.onlineAddress) { if (e.onlineButton && !e.onlineAddress) {
invalid = 1 invalid = 1

@ -44,7 +44,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" <el-button type="primary"
@click="toRank(scope.row, scope.$index)">排名</el-button> @click="toRank(scope.row, scope.$index)">排名</el-button>
<el-button @click="toArch(scope.row)">成绩管理</el-button> <el-button @click="toArch(scope.row, scope.$index)">成绩管理</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -111,15 +111,16 @@ export default {
} }
} }
}) })
console.log("🚀 ~ file: matchArch.vue:87 ~ handleStatus ~ this.status", this.list)
}, },
// //
toRank (row, i) { 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(`/matchRank?id=${this.id}&stageId=${row.stageId}&index=${i}&method=${row.method}&competitionType=${row.competitionType}&rule=${row.rule}`)
}, },
// //
toArch (row) { toArch (row, i) {
this.$router.push(`/matchArchList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}`) const cur = this.form.competitionStage[i]
const showFile = !!(cur.method === 2 && cur.competitionStageContentSetting && cur.competitionStageContentSetting.whetherToUploadFiles)
this.$router.push(`/matchArchList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}&showFile=${showFile}`)
} }
} }
}; };

@ -1,13 +1,17 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20 head-card"> <el-card shadow="hover"
class="m-b-20 head-card">
<div class="flex-between m-b-20"> <div class="flex-between m-b-20">
<el-page-header @back="$router.back()" content="成绩管理"></el-page-header> <el-page-header @back="$router.back()"
content="成绩管理"></el-page-header>
</div> </div>
</el-card> </el-card>
<el-card v-if="method != 2" shadow="hover" class="m-b-20"> <el-card v-if="method != 2"
shadow="hover"
class="m-b-20">
<div class="stat"> <div class="stat">
<div class="nums"> <div class="nums">
<div class="item"> <div class="item">
@ -19,66 +23,204 @@
<p class="val">{{ avgScore }}</p> <p class="val">{{ avgScore }}</p>
</div> </div>
</div> </div>
<div class="chart" id="chart"></div> <div class="chart"
id="chart"></div>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
class="m-b-20">
<div v-if="showFile"
class="tabs m-b-20">
<a class="item"
v-for="(item, i) in tabs"
:key="i"
:class="{active: i === active}"
@click="tabChange(i)">{{ item }}</a>
</div>
<div class="flex-between m-b-20"> <div class="flex-between m-b-20">
<div> <div>
<el-input <el-input size="small"
size="small"
placeholder="请输入学校/学生姓名" placeholder="请输入学校/学生姓名"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
v-model="keyword" clearable v-model="keyword"
style="width: 300px" clearable
></el-input> style="width: 300px"></el-input>
</div> </div>
<div> <div v-if="!active">
<el-button v-if="method == 2" type="primary" @click="batchImport">上传成绩</el-button> <el-button v-if="method == 2"
<el-button type="primary" @click="delAllData">批量删除</el-button> type="primary"
<el-button type="primary" @click="exportData">导出</el-button> @click="batchImport">上传成绩</el-button>
<el-button type="primary"
@click="delAllData">批量删除</el-button>
<el-button type="primary"
@click="exportData">导出</el-button>
</div> </div>
<div v-else>
<el-button type="primary"
@click="exportData1">批量导出</el-button>
</div> </div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="reportId"> </div>
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <template v-if="!active">
<el-table-column type="index" width="60" label="序号" align="center"> <el-table :data="list"
class="table"
:key="1"
ref="table"
stripe
header-align="center"
@selection-change="handleSelectionChange"
row-key="reportId">
<el-table-column type="selection"
width="55"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index"
width="60"
label="序号"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + (page - 1) * pageSize + 1 }} {{ scope.$index + (page - 1) * pageSize + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="schoolName" label="学校" min-width="150" align="center"></el-table-column> <el-table-column prop="schoolName"
<el-table-column v-if="competitionType" prop="teamName" label="团队名称" min-width="100" align="center"></el-table-column> label="学校"
<el-table-column prop="userName" label="学生姓名" min-width="100" align="center"></el-table-column> min-width="150"
<el-table-column prop="workNumber" label="学号" min-width="100" align="center"></el-table-column> align="center"></el-table-column>
<el-table-column prop="score" label="分数" width="90" align="center"></el-table-column> <el-table-column v-if="competitionType"
<el-table-column prop="timeSum" label="耗时" width="90" align="center"> prop="teamName"
label="团队名称"
min-width="100"
align="center"></el-table-column>
<el-table-column prop="userName"
label="学生姓名"
min-width="100"
align="center"></el-table-column>
<el-table-column prop="workNumber"
label="学号"
min-width="100"
align="center"></el-table-column>
<el-table-column prop="score"
label="分数"
width="90"
align="center"></el-table-column>
<el-table-column prop="timeSum"
label="耗时"
width="90"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.timeSum }}min {{ scope.row.timeSum }}min
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="submitTime" label="提交时间" min-width="150" align="center"> <el-table-column prop="submitTime"
label="提交时间"
min-width="150"
align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="160"> <el-table-column label="操作"
align="center"
width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="scope.row.reportId" type="text" @click="show(scope.row)">查看成绩报告</el-button> <el-button v-if="scope.row.reportId"
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> type="text"
@click="show(scope.row)">查看成绩报告</el-button>
<el-button type="text"
@click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> <el-pagination background
layout="total, prev, pager, next"
:total="total"
@current-change="handleCurrentChange"
:current-page="page">
</el-pagination> </el-pagination>
</div> </div>
</template>
<template v-else>
<el-table :data="list1"
class="table"
:key="2"
stripe
header-align="center"
@selection-change="handleSelectionChange1"
row-key="reportId">
<el-table-column type="selection"
width="55"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index"
width="60"
label="序号"
align="center">
<template slot-scope="scope">
{{ scope.$index + (page1 - 1) * pageSize + 1 }}
</template>
</el-table-column>
<el-table-column prop="schoolName"
label="学校"
align="center"></el-table-column>
<el-table-column v-if="competitionType"
prop="teamName"
label="团队名称"
align="center"></el-table-column>
<el-table-column prop="userName"
label="学生姓名"
align="center"></el-table-column>
<el-table-column prop="workNumber"
label="学号"
align="center"></el-table-column>
<el-table-column prop="fileName"
label="文件名"
align="center"></el-table-column>
<el-table-column prop="fileSize"
label="文件大小"
align="center"></el-table-column>
<el-table-column prop="fileFormat"
label="文件类型"
align="center"></el-table-column>
<el-table-column prop="fileFormat"
label="文件格式"
align="center"></el-table-column>
<el-table-column prop="createTime"
label="提交时间"
width="150"
align="center">
</el-table-column>
<el-table-column label="操作"
align="center"
width="160">
<template slot-scope="scope">
<el-button v-if="!isCompress(scope.row.fileFormat)"
type="text"
@click="preview(scope.row)">预览文件</el-button>
<el-button type="text"
@click="exportFile(scope.row)">导出文件</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background
layout="total, prev, pager, next"
:total="total1"
@current-change="handleCurrentChange1"
:current-page="page1">
</el-pagination>
</div>
</template>
</el-card> </el-card>
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false"> <el-dialog title="批量导入"
:visible.sync="importVisible"
width="24%"
:close-on-click-modal="false">
<div style="text-align: center"> <div style="text-align: center">
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button> <el-button type="primary"
@click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div> </div>
<el-upload <el-upload ref="importStaff"
ref="importStaff"
name="file" name="file"
accept=".xls,.xlsx" accept=".xls,.xlsx"
:on-remove="handleRemove" :on-remove="handleRemove"
@ -94,15 +236,21 @@
competitionId: this.id, competitionId: this.id,
stageId: this.stageId, stageId: this.stageId,
systemId: 0 systemId: 0
}" }">
> <el-button type="primary"
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button> class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload> </el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link> <el-link v-if="uploadFaild"
type="primary"
@click="showFaild">部分数据导入失败查看失败原因</el-link>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer"
<el-button size="small" @click="importVisible = false"> </el-button> class="dialog-footer">
<el-button size="small" type="primary" @click="uploadSure"> </el-button> <el-button size="small"
@click="importVisible = false"> </el-button>
<el-button size="small"
type="primary"
@click="uploadSure"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -114,12 +262,14 @@ import util from "@/libs/util";
import * as echarts from "echarts"; import * as echarts from "echarts";
import axios from 'axios'; import axios from 'axios';
export default { export default {
data() { data () {
return { return {
id: +this.$route.query.id, id: +this.$route.query.id,
stageId: +this.$route.query.stageId, stageId: +this.$route.query.stageId,
method: +this.$route.query.method, method: +this.$route.query.method,
competitionType: +this.$route.query.competitionType, competitionType: +this.$route.query.competitionType,
showFile: this.$route.query.showFile === 'true',
isCompress: util.isCompress,
keyword: "", keyword: "",
searchTimer: null, searchTimer: null,
list: [], list: [],
@ -127,6 +277,12 @@ export default {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
list1: [],
multipleSelection1: [],
page1: 1,
total1: 0,
totalNumber: 0, // totalNumber: 0, //
avgScore: 0, // avgScore: 0, //
importVisible: false, importVisible: false,
@ -136,22 +292,37 @@ export default {
headers: { headers: {
token: sessionStorage.getItem("token") token: sessionStorage.getItem("token")
}, },
statData: {} statData: {},
tabs: ['成绩列表', '文件列表'],
active: 0
}; };
}, },
watch: { watch: {
keyword: function(val) { keyword: function (val) {
clearTimeout(this.searchTimer); clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => { this.searchTimer = setTimeout(() => {
this.initData(); this.initData();
}, 500); }, 500);
} }
}, },
mounted() { mounted () {
this.getData() this.getData()
}, },
methods: { methods: {
getData() { getData () {
//
if (this.active) {
this.$post(this.api.cCompetitionStageFileList, {
pageNum: this.page1,
pageSize: this.pageSize,
competitionId: this.id,
stageId: this.stageId,
keyWord: this.keyword,
}).then(({ data }) => {
this.list1 = data.records
this.total1 = data.total
}).catch(res => { })
} else { //
this.$post(this.api.stageGradeManagementList, { this.$post(this.api.stageGradeManagementList, {
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
@ -166,18 +337,19 @@ export default {
this.avgScore = (+data.avgScore).toFixed(2) this.avgScore = (+data.avgScore).toFixed(2)
this.totalNumber = data.totalNumber this.totalNumber = data.totalNumber
this.getChart() this.getChart()
}).catch(res => {}) }).catch(res => { })
}
}, },
initData() { initData () {
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
// //
show(row) { show (row) {
this.$router.push(`/matchReport?reportId=${row.reportId}`) this.$router.push(`/matchReport?reportId=${row.reportId}`)
}, },
// () // ()
exportData() { exportData () {
// id // id
if (this.multipleSelection.length) { if (this.multipleSelection.length) {
const ids = this.multipleSelection.map(e => e.reportId) const ids = this.multipleSelection.map(e => e.reportId)
@ -187,10 +359,32 @@ export default {
headers: this.headers, headers: this.headers,
responseType: 'blob' responseType: 'blob'
}).then((res) => { }).then((res) => {
util.downloadFileDirect(`赛事成绩.xls`,new Blob([res.data])) util.downloadFileDirect(`赛事成绩.xls`, new Blob([res.data]))
}).catch(res => {}) }).catch(res => { })
},
// ()
exportData1 () {
// id
let ids
if (this.multipleSelection1.length) {
ids = this.multipleSelection1.map(e => e.id)
}
const data = {
pageNum: 1,
pageSize: 1000,
competitionId: this.id,
stageId: this.stageId,
}
if (ids) data.ids = ids
axios.post(this.api.derive, data, {
headers: this.headers,
responseType: 'blob'
}).then((res) => {
console.log("🚀 ~ file: matchArchList.vue:378 ~ exportData1 ~ res:", res)
util.downloadFileDirect(`批量导出.zip`, new Blob([res.data]))
}).catch(res => { })
}, },
handleDelete(row) { // handleDelete (row) { //
this.$confirm("确定要删除吗?", "提示", { this.$confirm("确定要删除吗?", "提示", {
type: "warning" type: "warning"
}).then(() => { }).then(() => {
@ -206,7 +400,7 @@ export default {
}).catch(() => { }).catch(() => {
}); });
}, },
delAllData() { // delAllData () { //
if (this.multipleSelection.length) { if (this.multipleSelection.length) {
this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", { this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", {
type: "warning" type: "warning"
@ -231,14 +425,22 @@ export default {
util.errorMsg("请先选择数据 !"); util.errorMsg("请先选择数据 !");
} }
}, },
handleSelectionChange(val) { // handleSelectionChange (val) { //
this.multipleSelection = val; this.multipleSelection = val;
}, },
handleCurrentChange(val) { // handleCurrentChange (val) { //
this.page = val; this.page = val;
this.getData(); this.getData();
}, },
getChart() { // 线
handleSelectionChange1 (val) { //
this.multipleSelection1 = val;
},
handleCurrentChange1 (val) { //
this.page1 = val;
this.getData();
},
getChart () { // 线
const data = [] const data = []
const { statData } = this const { statData } = this
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
@ -269,31 +471,31 @@ export default {
}); });
}, },
// //
batchImport() { batchImport () {
this.importVisible = true this.importVisible = true
this.uploadList = [] this.uploadList = []
this.uploadFaild = false this.uploadFaild = false
}, },
// //
download() { download () {
location.href = this.api.gradeImport location.href = this.api.gradeImport
}, },
// //
handleExceed(files, fileList) { handleExceed (files, fileList) {
util.warningMsg( util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` `当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
) )
}, },
// //
showFaild() { showFaild () {
axios.get(`${this.api.performanceExportFailure}?exportCode=${this.exportCode}`, { axios.get(`${this.api.performanceExportFailure}?exportCode=${this.exportCode}`, {
headers: this.headers, headers: this.headers,
responseType: 'blob' responseType: 'blob'
}).then((res) => { }).then((res) => {
util.downloadFileDirect(`批量导入成绩管理失败数据导出.xls`, new Blob([res.data])) util.downloadFileDirect(`批量导入成绩管理失败数据导出.xls`, new Blob([res.data]))
}).catch(res => {}) }).catch(res => { })
}, },
uploadSuccess(res, file, fileList) { uploadSuccess (res, file, fileList) {
this.uploadFaild = false this.uploadFaild = false
if (res.status === 200) { if (res.status === 200) {
if (res.data.exportCode) { if (res.data.exportCode) {
@ -305,30 +507,42 @@ export default {
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据") res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据")
} }
}, },
uploadError(err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
type: "error", type: "error",
center: true center: true
}) })
}, },
beforeRemove(file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`) return this.$confirm(`确定移除 ${file.name}`)
}, },
handleRemove(file, fileList) { handleRemove (file, fileList) {
this.uploadList = fileList this.uploadList = fileList
this.uploadFaild = false this.uploadFaild = false
}, },
uploadSure() { uploadSure () {
this.importVisible = false this.importVisible = false
this.getData() this.getData()
} },
// tab
tabChange (i) {
this.active = i
this.getData()
},
//
preview (item) {
window.open((util.isDoc(item.fileFormat) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + item.filePath)
},
//
exportFile (item) {
util.downloadFile(item.userName + '-' + item.fileName, item.filePath)
},
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .head-card { /deep/ .head-card {
.el-card__body { .el-card__body {
padding-bottom: 0px; padding-bottom: 0px;

@ -248,7 +248,7 @@
:type.sync="projectManage.experimentHintType" :type.sync="projectManage.experimentHintType"
radio radio
:minHeight="150" :minHeight="150"
:height="150" /> :height="400" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>

Loading…
Cancel
Save