多文件上传

This commit is contained in:
shenyanpei
2021-12-23 10:10:10 +08:00
parent 2307847426
commit 38c4ee4975
7 changed files with 76 additions and 4 deletions
+20 -2
View File
@@ -216,6 +216,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"
@@ -233,6 +234,8 @@
</div>
</el-drawer>
<!-- 编辑框内的人员的table上的编辑 -->
<el-drawer
title="编辑人员信息"
:visible.sync="editFlag"
@@ -281,8 +284,8 @@
</template>
<script>
import {meetingByMonth} from '@/api/unqualProcess.js'
import {updateMeet} from '@/api/process.js'
import { meetingByMonth } from '@/api/unqualProcess.js'
import { updateMeet, upFile} from '@/api/process.js'
export default {
name: "calendar",
@@ -517,6 +520,21 @@ export default {
this.meetFlag = 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) {
@@ -621,6 +621,7 @@ export default {
}
})
},
/** 覆盖默认的上传行为,实现多个文件一起上传 */
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式
@@ -193,6 +193,7 @@
name="file"
:file-list="fillFileList"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-success="handleOnsuccess"
@@ -320,6 +321,7 @@ import {
getBusStandFileByAttId,
saveinboundTask,
saveTaskForPub,
upFile
} from "@/api/process.js"
export default {
@@ -542,6 +544,21 @@ export default {
})
this.rh_pageData.fillFile = this.fillFileList
},
/** 覆盖默认的上传行为,实现多个文件一起上传 */
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) {
@@ -366,6 +366,7 @@
drag
:file-list="reData"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-success="handleOnsuccess"
@@ -405,7 +406,7 @@ import {
saveinboundTask,
getBusStandFileByAttId,
saveTaskForPub,
changeAssigneeNew
changeAssigneeNew,upFile
} from "@/api/process.js"
export default {
@@ -547,6 +548,21 @@ export default {
this.reData = this.fileListData.fillFile
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) {
@@ -389,6 +389,7 @@ export default {
this.reData = this.fileListData.material
this.upDialog = true
},
/** 覆盖默认的上传行为,实现多个文件一起上传 */
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式
@@ -477,6 +478,7 @@ export default {
this.upThemeDialog = true
},
/** 覆盖默认的上传行为,实现多个文件一起上传 */
httpRequestTheme(params) {
const file = params.file
// 根据后台需求数据格式
@@ -553,6 +555,7 @@ export default {
/** 其他资料上传 */
/** 覆盖默认的上传行为,实现多个文件一起上传 */
httpRequestOther(params) {
const file = params.file
// 根据后台需求数据格式
@@ -309,6 +309,7 @@
drag
:file-list="ch_pageData.fileTextList"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:http-request="httpRequest"
:before-upload="handleBeforeUpload"
:before-remove="handleBeforeRemove"
:on-success="handleOnsuccess"
@@ -352,7 +353,7 @@ import {
startProcess, queryTaskFirst,
saveTaskFirst, completeTask,
taskDel, workGroup, processBack,
getBusStandFileByAttId
getBusStandFileByAttId,upFile
} from '@/api/process.js'
export default {
@@ -546,6 +547,21 @@ 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) {
@@ -299,6 +299,7 @@ export default {
uploadFile (val) {
this.fileListData = val
},
/** 覆盖默认的上传行为,实现多个文件一起上传 */
httpRequest(params) {
const file = params.file
// 根据后台需求数据格式