Commit 13ebe374 by 张立顺

Merge branch 'SAAS+V4.53.0-0528' of http://192.168.3.233:8090/saas_plus/dj-car-l…

…ife-system into SAAS+V4.53.0-0528
2 parents 3ce97d57 76886a30
......@@ -59,13 +59,14 @@
accept=".xlsx,.xls,.doc,.pdf,.docx,.jpg,.png"
class="upload-file"
:show-file-list="false"
:file-list="item.uploadFileList"
:file-list.sync="item.uploadFileList"
:limit="6"
:auto-upload="false"
:on-remove="importFileChange"
:on-change="(file, fileList) => handleFileChange(file, fileList, item)
"
:on-exceed="hanldeOnExceed">
:on-exceed="hanldeOnExceed"
:key="uploadKey">
<div class="upload-txt">+ 上传文件</div>
</el-upload>
<div class="upload-tips">注:请上传{{ item.title }}。</div>
......@@ -257,7 +258,7 @@ export default {
editChildRef: "editChildRef",
editFormData: [],
formRules: {},
uploadFileList: [],
uploadKey: 0,
baseData: {
merchantOpt: [] // 流量方信息
},
......@@ -447,17 +448,13 @@ export default {
// 获取文件
importFileChange(file, fileList) {
console.log("fileList111", fileList)
this.uploadFileList = fileList
this.infoForm.attachmentList = deepClone(fileList)
console.log(fileList, "fileList")
console.log('delete', file, fileList)
},
handleFileChange(file, fileList, targetItem) {
console.log("file", file)
console.log("fileList", fileList)
console.log("targetItem", targetItem)
// return false
// setTimeout(() => {
targetItem.uploadFileList = fileList
var reader = new FileReader()
var fileInfo = file.raw
if (
......@@ -473,6 +470,7 @@ export default {
message: "文件格式不支持上传",
type: "error"
})
targetItem.uploadFileList.pop() // 手动删除数组最后一项,更新绑定的数组
return false
}
// 默认10MB
......@@ -483,16 +481,14 @@ export default {
message: "上传文件大小不能超过" + limitSize + "MB!",
type: "error"
})
// this.uploadFileList = this.uploadFileList.filter((item) => {
targetItem.uploadFileList = targetItem.uploadFileList.filter((item) => {
return item.size / 1024 / 1024 < 10
return item.size / 1024 / 1024 < limitSize
})
console.log('targetItem.uploadFileList', targetItem.uploadFileList)
return false
}
reader.readAsDataURL(fileInfo)
reader.onload = (e) => {
const _formData = this.infoForm
// _formData[targetItem.name].push({
targetItem.files.push({
fileUrl: "",
uploadProgress: 0,
......@@ -501,14 +497,12 @@ export default {
fileType: 1, // 文件类型(1.申请附件,2.结算凭证)
cancelAxios: {}
})
// const index = _formData[targetItem.name].length - 1
const index = targetItem.files.length - 1
const fileData = e.target.result
const base64 =
fileInfo.name.split(".")[fileInfo.name.split(".").length - 1] +
"@" +
fileData.split(",")[1]
// const requestEvent = fileInfo.type == 'application/pdf' ? uploadPDF : uploadExcel
const fileTypeKey = {
"application/pdf": "pdf",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
......@@ -552,12 +546,12 @@ export default {
// this.btnLoding = false
this.clearItem(targetItem, index) // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
})
// console.log("_formData[targetItem.name]", _formData[targetItem.name])
console.log("targetItem.files", targetItem.files)
console.log("handleFileChange end targetItem", targetItem)
}
// }, 50)
},
hanldeOnExceed(files, fileList) {
console.log("hanldeOnExceed", files, fileList)
this.$message({
message: "最多可上传6个文件",
type: "error"
......@@ -566,8 +560,6 @@ export default {
// 删除文件
handleFileDelete(targetItem, subIndex) {
this.clearItem(targetItem, subIndex)
// console.log(subIndex)
// this.infoForm.attachmentList.splice(subIndex, 1)
},
// 预览文件
handleFileView(item) { },
......@@ -590,6 +582,8 @@ export default {
// this.$set(targetItem.files[subIndex], "uploadProgress", "")
targetItem.files.splice(subIndex, 1)
targetItem.uploadFileList.splice(subIndex, 1)
this.uploadKey++ // 改变 key 值,触发重新渲染
console.log('clearItem targetItem', targetItem)
},
// 上传文件,转码为base64
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!