多文件上传

This commit is contained in:
shenyanpei
2021-12-23 09:57:13 +08:00
parent 984b0dc2b1
commit 13813bae99
4 changed files with 80 additions and 3 deletions
+1
View File
@@ -731,6 +731,7 @@ export function updateMeet(data) {
})
}
// 上传接口
export function upFile(data) {
return axios({
url: '/api/att/attFile/upload',
@@ -375,6 +375,7 @@
drag
:file-list="rh_pageData.infoSources"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-success="handleOnsuccess"
@@ -426,7 +427,7 @@ import {
startProcess, saveTaskFirst,
completeTask, queryTaskFirst,
taskDel, workGroup, processBack,
getBusStandFileByAttId
getBusStandFileByAttId,upFile
} from '@/api/process.js'
export default {
@@ -620,6 +621,20 @@ export default {
}
})
},
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式
const form = new FormData()
// 文件对象
form.append("file", file)
upFile(form).then(res=>{
if (res.ok) {
this.handleOnsuccess(res)
} else {
this.$message.warning('上传失败')
}
})
},
// 文件上传成功
handleOnsuccess(res, file, fileList) {
if (res.ok) {
@@ -128,6 +128,7 @@
name="file"
:file-list="upOtherData"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequestOther"
:before-upload="beforeUploadOther"
:before-remove="beforeRemoveOther"
:on-success="onsuccessOther"
@@ -203,6 +204,7 @@
name="file"
:file-list="reData"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-success="handleOnsuccess"
@@ -224,6 +226,7 @@
name="file"
:file-list="themeData"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequestTheme"
:before-upload="beforeUploadTheme"
:before-remove="beforeRemoveTheme"
:on-success="onsuccessTheme"
@@ -239,7 +242,7 @@
import ProcessHeader from '../../components/ProcessHeader'
import ProcessFooter from '../../components/ProcessFooter'
import ProcessTitle from '../../components/ProcessTitle'
import { saveTaskFirst, completeTask, inboundLiaisonDetail} from '@/api/process.js'
import { saveTaskFirst, completeTask, inboundLiaisonDetail,upFile} from '@/api/process.js'
export default {
components: {
@@ -386,6 +389,20 @@ export default {
this.reData = this.fileListData.material
this.upDialog = true
},
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式
const form = new FormData()
// 文件对象
form.append("file", file)
upFile(form).then(res=>{
if (res.ok) {
this.handleOnsuccess(res)
} else {
this.$message.warning('上传失败')
}
})
},
// 文件上传成功
handleOnsuccess(res, file, fileList) {
if (res.ok) {
@@ -460,6 +477,20 @@ export default {
this.upThemeDialog = true
},
httpRequestTheme(params) {
const file = params.file
// 根据后台需求数据格式
const form = new FormData()
// 文件对象
form.append("file", file)
upFile(form).then(res=>{
if (res.ok) {
this.onsuccessTheme(res)
} else {
this.$message.warning('上传失败')
}
})
},
// 文件上传成功
onsuccessTheme(res, file, fileList) {
if (res.ok) {
@@ -521,6 +552,21 @@ export default {
},
/** 其他资料上传 */
httpRequestOther(params) {
const file = params.file
// 根据后台需求数据格式
const form = new FormData()
// 文件对象
form.append("file", file)
upFile(form).then(res=>{
if (res.ok) {
this.onsuccessOther(res)
} else {
this.$message.warning('上传失败')
}
})
},
// 文件上传成功
onsuccessOther(res, file, fileList) {
if (res.ok) {
@@ -51,6 +51,7 @@
name="file"
:file-list="fileTextList"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-remove="handleONRemove"
@@ -178,7 +179,7 @@
import ProcessHeader from '../../components/ProcessHeader'
import ProcessFooter from '../../components/ProcessFooter'
import ProcessTitle from '../../components/ProcessTitle'
import {inboundLiaisonDetail, completeTask, saveTaskForPub, changeAssigneeNew,execTask} from "@/api/process"
import {inboundLiaisonDetail, completeTask, saveTaskForPub, changeAssigneeNew,execTask,upFile} from "@/api/process"
export default {
name: "wfhxzgStep4",
@@ -298,6 +299,20 @@ export default {
uploadFile (val) {
this.fileListData = val
},
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式
const form = new FormData()
// 文件对象
form.append("file", file)
upFile(form).then(res=>{
if (res.ok) {
this.handleOnsuccess(res)
} else {
this.$message.warning('上传失败')
}
})
},
// 文件上传成功
handleOnsuccess(res, file, fileList) {
if (res.ok) {