Commit 5d844dc1 by 前端

修复第一轮测试BUG

1 parent e89cba20
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<input type="file" <input type="file"
id="fileUpload-receipt" id="fileUpload-receipt"
class="import-input" class="import-input"
accept="application/zip,application/rar,application/pdf" accept="application/zip,.rar,application/pdf"
@change="importReceiptFile($event)" /> @change="importReceiptFile($event)" />
</el-button> </el-button>
<div class="file-box" <div class="file-box"
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
}, },
formRules: { formRules: {
detailFileName: [ detailFileName: [
{ required: true, message: "请上传明细表", trigger: "change" } { required: true, message: "请上传银行流水明细", trigger: "change" }
] ]
}, },
baseData: {}, baseData: {},
...@@ -198,21 +198,32 @@ export default { ...@@ -198,21 +198,32 @@ export default {
// 上传银行流水明细文件,转码为base64 // 上传银行流水明细文件,转码为base64
importDetailFile(e) { importDetailFile(e) {
const fileName = e.target.files[0].name
if (
!fileName.includes(".xlsx") &&
!fileName.includes(".xls")
) {
this.$message({
message: "文件格式不支持上传",
type: "error"
})
return false
}
const size = e.target.files[0].size / 1024 / 1024 const size = e.target.files[0].size / 1024 / 1024
if (size < 10) { if (size < 100) {
this.$set(this.infoForm, "detailFileName", e.target.files[0].name) this.$set(this.infoForm, "detailFileName", fileName)
// // 转码base64 // // 转码base64
const reader = new FileReader() const reader = new FileReader()
reader.readAsDataURL(e.target.files[0]) reader.readAsDataURL(e.target.files[0])
reader.onload = (event) => { reader.onload = (event) => {
const imgFile = event.target.result const imgFile = event.target.result
const arrBase64 = imgFile.split(",") const arrBase64 = imgFile.split(",")
// this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1] // this.fileInfo = fileName.split('.')[fileName.split('.')?.length - 1] + '@' + arrBase64[1]
this.$set( this.$set(
this.infoForm, this.infoForm,
"detailFileInfo", "detailFileInfo",
e.target.files[0].name.split(".")[ fileName.split(".")[
e.target.files[0].name.split(".")?.length - 1 fileName.split(".")?.length - 1
] + ] +
"@" + "@" +
arrBase64[1] arrBase64[1]
...@@ -222,6 +233,7 @@ export default { ...@@ -222,6 +233,7 @@ export default {
} }
} else { } else {
this.notice.errorTips("上传文件不可超过10M") this.notice.errorTips("上传文件不可超过10M")
document.getElementById("fileUpload-detail").value = ""
} }
}, },
...@@ -251,9 +263,21 @@ export default { ...@@ -251,9 +263,21 @@ export default {
// 上传回单文件,转码为base64 // 上传回单文件,转码为base64
importReceiptFile(e) { importReceiptFile(e) {
const fileName = e.target.files[0].name
if (
!fileName.includes(".rar") &&
!fileName.includes(".zip") &&
!fileName.includes(".pdf")
) {
this.$message({
message: "文件格式不支持上传",
type: "error"
})
return false
}
const size = e.target.files[0].size / 1024 / 1024 const size = e.target.files[0].size / 1024 / 1024
if (size < 10) { if (size < 100) {
this.$set(this.infoForm, "receiptFileName", e.target.files[0].name) this.$set(this.infoForm, "receiptFileName", fileName)
// // 转码base64 // // 转码base64
const reader = new FileReader() const reader = new FileReader()
reader.readAsDataURL(e.target.files[0]) reader.readAsDataURL(e.target.files[0])
...@@ -264,17 +288,18 @@ export default { ...@@ -264,17 +288,18 @@ export default {
this.$set( this.$set(
this.infoForm, this.infoForm,
"receiptFileInfo", "receiptFileInfo",
e.target.files[0].name.split(".")[ fileName.split(".")[
e.target.files[0].name.split(".")?.length - 1 fileName.split(".")?.length - 1
] + ] +
"@" + "@" +
arrBase64[1] arrBase64[1]
) )
document.getElementById("fileUpload-detail").value = "" document.getElementById("fileUpload-receipt").value = ""
this.handleReceiptImport() this.handleReceiptImport()
} }
} else { } else {
this.notice.errorTips("上传文件不可超过10M") this.notice.errorTips("上传文件不可超过10M")
document.getElementById("fileUpload-receipt").value = ""
} }
}, },
......
...@@ -189,9 +189,9 @@ export default { ...@@ -189,9 +189,9 @@ export default {
// console.log("this.tableData_filter", this.tableData_filter) // console.log("this.tableData_filter", this.tableData_filter)
console.log("this.allData", this.allData) console.log("this.allData", this.allData)
if (value == 0) { if (value == 0) {
this.tableData = this.this.allData.filter(item => !item.receipt) this.tableData = this.allData.filter(item => !item.receipt)
} else if (value == 1) { } else if (value == 1) {
this.tableData = this.this.allData.filter(item => item.receipt) this.tableData = this.allData.filter(item => item.receipt)
} }
this.total = this.tableData.length this.total = this.tableData.length
} }
...@@ -500,7 +500,7 @@ export default { ...@@ -500,7 +500,7 @@ export default {
}, },
routerBack() { routerBack() {
this.$confirm('请确认是否要执行当前操作?', '提示', { this.$confirm('当前操作会删除已导入数据,是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
...@@ -525,6 +525,14 @@ export default { ...@@ -525,6 +525,14 @@ export default {
params.associationData = this.allData params.associationData = this.allData
console.log('params', params) console.log('params', params)
if (params.associationData.length == 0) {
this.$message({
message: "暂无数据,请重新导入",
type: "warning",
showClose: true
})
return false
}
for (const key in params.associationData) { for (const key in params.associationData) {
console.log('params.associationData[key]', params.associationData[key]) console.log('params.associationData[key]', params.associationData[key])
const detail = params.associationData[key].detail const detail = params.associationData[key].detail
...@@ -535,11 +543,15 @@ export default { ...@@ -535,11 +543,15 @@ export default {
delete detail[key] delete detail[key]
} }
} }
if (receipt) {
for (const key in receipt) { for (const key in receipt) {
if (receipt[key] === null || receipt[key] === '' || receipt[key].length == 0) { if (receipt[key] === null || receipt[key] === '' || receipt[key].length == 0) {
delete receipt[key] delete receipt[key]
} }
} }
} else {
delete params.associationData[key].receipt
}
} }
saveAssociation(params).then(res => { saveAssociation(params).then(res => {
this.setTaskIdRefesh('')// 任务完成,清空taskId,销毁任务 this.setTaskIdRefesh('')// 任务完成,清空taskId,销毁任务
...@@ -634,4 +646,20 @@ export default { ...@@ -634,4 +646,20 @@ export default {
text-align: center; text-align: center;
/* margin-bottom: 40px; */ /* margin-bottom: 40px; */
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
</style> </style>
...@@ -802,22 +802,26 @@ export default { ...@@ -802,22 +802,26 @@ export default {
if (this.$refs.recordTable.mutiSelectArr.transferAccounts) { if (this.$refs.recordTable.mutiSelectArr.transferAccounts) {
selectedData = this.$refs.recordTable.mutiSelectArr.transferAccounts selectedData = this.$refs.recordTable.mutiSelectArr.transferAccounts
} }
if (!selectedData?.length) { // if (!selectedData?.length) {
this.$message({ // this.$message({
message: "请选择要打印的明细", // message: "请选择要打印的明细",
type: "warning", // type: "warning",
showClose: true // showClose: true
}) // })
return false // return false
} // }
this.printIds = selectedData.map((item) => { this.printIds = selectedData.map((item) => {
return item.id return item.id
}) })
this.batchPrintVisible = true this.batchPrintVisible = true
}, },
handlePrintConfirm() { handlePrintConfirm() {
const params = deepClone(this.printForm) let params = deepClone(this.printForm)
params.detailIds = this.printIds params.detailIds = this.printIds
if (this.printIds.length == 0) {
params = { ...params, ...deepClone(this.searchFormSearch) }
}
// return console.log('params', params)
batchPrinting(params).then(res => { batchPrinting(params).then(res => {
if (res) { if (res) {
window.open(res) window.open(res)
...@@ -862,7 +866,7 @@ export default { ...@@ -862,7 +866,7 @@ export default {
gotoImportTwo() { gotoImportTwo() {
const query = {} const query = {}
const taskInfo = deepClone(this.taskInfo) const taskInfo = deepClone(this.taskInfo)
taskInfo.detailResultSuccessCount = taskInfo.detailResult.successList.length taskInfo.detailResultSuccessCount = taskInfo.detailResult.successList?.length || 0
taskInfo.detailResultFailCount = taskInfo.detailResult.failList?.length || 0 taskInfo.detailResultFailCount = taskInfo.detailResult.failList?.length || 0
taskInfo.detailResultTotalCount = taskInfo.detailResultSuccessCount + taskInfo.detailResultFailCount taskInfo.detailResultTotalCount = taskInfo.detailResultSuccessCount + taskInfo.detailResultFailCount
taskInfo.detailResultFailUrl = taskInfo.detailResult.failListUrl taskInfo.detailResultFailUrl = taskInfo.detailResult.failListUrl
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!