更新部分提案提交

This commit is contained in:
Sky_ID 2022-06-29 22:03:47 +08:00
parent eecaefa377
commit 4573a89bdd
1 changed files with 21 additions and 15 deletions

View File

@ -6,15 +6,14 @@
<div class="card"> <div class="card">
<el-upload <el-upload
drag drag
name="importSubmitFile"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:action="uploadActionUrl" :action="uploadActionUrl"
:data="uploadData"
accept=".zip,.rar,.csv" accept=".zip,.rar,.csv"
:before-upload="onBeforeUpload" :before-upload="onBeforeUpload"
:on-progress="onUpload" :on-progress="onUpload"
:on-success="(res)=>{importSuccess(res)}" :on-success="(res)=>{importSuccess(res)}"
:before-remove="beforeRemove"
:file-list="fileList" :file-list="fileList"
:disabled="uploadStatus" :disabled="uploadStatus"
class="import-submit-file" class="import-submit-file"
@ -69,7 +68,13 @@ export default {
data() { data() {
return { return {
fileList: [], fileList: [],
uploadActionUrl:"/api/comp/uploadImg",
uploadData: {
fileName : this.$route.params.compId + '-submit-',
type: 'submit'
},
downloadActionUrl: "", downloadActionUrl: "",
applyTime: [], applyTime: [],
@ -77,7 +82,8 @@ export default {
onlineScript: false, onlineScript: false,
onlineInter: '', onlineInter: '',
uploadStatus: false, uploadStatus: false,
loading: true loading: true,
file: ''
}; };
}, },
@ -92,12 +98,12 @@ export default {
onBeforeUpload(file) { onBeforeUpload(file) {
const isIMAGE = file.type === "rar" || "zip"||"csv"; const isIMAGE = file.type === "rar" || "zip"||"csv";
const isLt1M = file.size / 1024 / 1024 < 1; const isLt1M = file.size / 1024 / 1024 < 50;
if (!isIMAGE) { if (!isIMAGE) {
this.$message.error("上传文件只能是rar/zip压缩包格式!"); this.$message.error("上传文件只能是rar/zip/csv压缩包格式!");
} }
if (!isLt1M) { if (!isLt1M) {
this.$message.error("上传文件大小不能超过 1MB!"); this.$message.error("上传文件大小不能超过 50MB!");
} }
// false // false
return isIMAGE && isLt1M; return isIMAGE && isLt1M;
@ -113,14 +119,14 @@ export default {
// //
importSuccess(res) { importSuccess(res) {
if (res.code == "0") { if(res.status == 0){
if (res.data == 0) {
this.$message({ this.$message({
showClose: true, showClose: true,
message: '上传报名表成功', message: '上传报名表成功',
type: 'success', type: 'success'
}); });
} this.file=res.url
//TODO:
}else{ }else{
this.$message({ this.$message({
showClose: true, showClose: true,