From 42a288776d96bd2eb0b8c02417b0e4843a7d0bad Mon Sep 17 00:00:00 2001 From: yuweiqi Date: Mon, 30 Mar 2020 12:07:53 +0800 Subject: [PATCH] =?UTF-8?q?[FIX]=E7=94=B5=E6=8A=95-=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0-=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=EF=BC=8C=E5=88=A0=E9=99=A4=E5=85=B6=E4=B8=AD?= =?UTF-8?q?=E4=B8=80=E5=BC=A0=E5=AF=BC=E8=87=B4=E6=8F=90=E4=BA=A4=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/sale/AttachmentManagement.vue | 69 +++++++++++++++++--- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/src/views/ebiz/sale/AttachmentManagement.vue b/src/views/ebiz/sale/AttachmentManagement.vue index 90adf60ab..8b0a364ad 100644 --- a/src/views/ebiz/sale/AttachmentManagement.vue +++ b/src/views/ebiz/sale/AttachmentManagement.vue @@ -528,22 +528,30 @@ export default { }).then(() => { if (detail.name == 'fileListIdFront') { this.fileListIdFront = [] + this.deleteImg(file, 'fileListIdFront') } else if (detail.name == 'fileListIdBack') { this.fileListIdBack = [] + this.deleteImg(file, 'fileListIdBack') } else if (detail.name == 'fileLIstImg') { this.fileLIstImg = [] + this.deleteImg(file, 'fileLIstImg') } else if (detail.name == 'fileListBank') { this.fileListBank = [] + this.deleteImg(file, 'fileListBank') // } else if (detail.name == 'fileListBankBack') { // this.fileListBankBack = [] } else if (detail.name == 'fileListIdFrontInsured') { this.fileListIdFrontInsured = [] + this.deleteImg(file, 'fileListIdFrontInsured') } else if (detail.name == 'fileListIdBackInsured') { this.fileListIdBackInsured = [] + this.deleteImg(file, 'fileListIdBackInsured') } else if (detail.name == 'fileListBankInsured') { this.fileListBankInsured = [] + this.deleteImg(file, 'fileListBankInsured') } else if (detail.name == 'fileLIstImgInsured') { this.fileLIstImgInsured = [] + this.deleteImg(file, 'fileLIstImgInsured') // } else if (detail.name == 'fileListOtherOne') { // this.fileListOtherOne = [] // } else if (detail.name == 'fileListOtherTwo') { @@ -552,8 +560,10 @@ export default { // this.fileListOtherThree = [] } else if (detail.name == 'saleInsuredInfoOther') { this.saleInsuredInfoOther = [] + this.deleteImg(file, 'saleInsuredInfoOther') } else if (detail.name == 'saleInsuredPersonInfoOther') { this.saleInsuredPersonInfoOther = [] + this.deleteImg(file, 'saleInsuredPersonInfoOther') // } else if (detail.name == 'fileListtypebeneficiary') { // that.fileListtypebeneficiary.map((item, index, array) => { // if (item.content == file.content) { @@ -563,7 +573,6 @@ export default { // } // }) } - this.deleteImg(file) }) }, test(type, id) { @@ -611,12 +620,15 @@ export default { } }, // 删除图片 - deleteImg(file) { + deleteImg(file, nameList) { let that = this that.list.map((item, index, array) => { - if (item.fileName.indexOf(file.file.name) == -1) { - return - } else { + // if (item.fileName.indexOf(file.file.name) == -1) { + // return + // } else { + // array.splice(index, 1) + // } + if (item.fileName == file.name && nameList == item.name) { array.splice(index, 1) } }) @@ -627,6 +639,7 @@ export default { // 此时可以自行将文件上传至服务器 that.file = file.content that.imgName = Math.floor(Math.random() * 100).toString() + new Date().getTime() + file.file.name //为图片名加随机数 与时间戳 + file.name = that.imgName that.uploadImg() }, @@ -656,8 +669,6 @@ export default { message: '加载中……' }) let formdata = new FormData() - console.log('file-----------------', that.file) - console.log('name-----------------', that.imgName) formdata.append('imgPath', that.dataURLtoFile(that.file, that.imgName)) uploadImg(formdata).then(res => { // console.log(res) @@ -676,6 +687,7 @@ export default { // console.log(that.file) // 证件类型 let imageInfoType = '' + let name = '' // if (that.type == 'fileListIdFront' && that.id == '1') { // imageInfoType = '1' // } else if (that.type == 'fileListIdBack' && that.id == '1') { @@ -699,57 +711,74 @@ export default { // } if (that.type == 'fileListIdFront' && that.id == '1') { //身份证正面 + name = 'fileListIdFront' imageInfoType = '1' } else if (that.type == 'fileListIdBack' && that.id == '1') { //身份证反面 + name = 'fileListIdBack' imageInfoType = '2' } else if (that.type == 'fileListIdFront' && that.id == '2') { //户口本正面 + name = 'fileListIdFront' imageInfoType = '5' } else if (that.type == 'fileListIdBack' && that.id == '2') { //户口本反面 + name = 'fileListIdBack' imageInfoType = '6' } else if (that.type == 'fileListIdFront' && that.id == '3') { //出生证正面 + name = 'fileListIdFront' imageInfoType = '7' } else if (that.type == 'fileListIdBack' && that.id == '3') { //出生证反面 + name = 'fileListIdBack' imageInfoType = '12' } else if (that.type == 'fileLIstImg' && that.id == '4') { //护照面 + name = 'fileLIstImg' imageInfoType = '8' } else if (that.type == 'fileListIdFront' && that.id == '5') { //港澳居民来往内地通行证正面 + name = 'fileListIdFront' imageInfoType = '9' } else if (that.type == 'fileListIdBack' && that.id == '5') { //港澳居民来往内地通行证反面 + name = 'fileListIdBack' imageInfoType = '13' } else if (that.type == 'fileListIdFront' && that.id == '6') { //台湾居民来往大陆通行证正面 + name = 'fileListIdFront' imageInfoType = '10' } else if (that.type == 'fileListIdBack' && that.id == '6') { //台湾居民来往大陆通行证反面 + name = 'fileListIdBack' imageInfoType = '14' } else if (that.type == 'fileListIdFront' && that.id == '8') { //外国人永久居留身份证正面 + name = 'fileListIdFront' imageInfoType = '15' } else if (that.type == 'fileListIdBack' && that.id == '8') { //外国人永久居留身份证反面 + name = 'fileListIdBack' imageInfoType = '16' } else if (that.type == 'fileListIdFront' && that.id == '9') { //港澳台居民居住证正面 + name = 'fileListIdFront' imageInfoType = '17' } else if (that.type == 'fileListIdBack' && that.id == '9') { //港澳台居民居住证反面 + name = 'fileListIdBack' imageInfoType = '18' } else if (that.type == 'fileListBank') { //银行卡正面 + name = 'fileListBank' imageInfoType = '3' // } else if (that.type == 'fileListBankBack') { // //银行卡反面 // imageInfoType = '19' } let obj = { + name: name, businessNo: that.orderNo, businessType: '', imageInfoType: imageInfoType, @@ -759,8 +788,6 @@ export default { subBusinessNo: that.saleInsuredInfo.appntId, fileName: that.imgName } - // window.localStorage.setItem('obj', JSON.stringify(obj)) - // that.list.push(JSON.parse(window.localStorage.getItem('obj'))) that.list.push(obj) } else if ( that.type == 'fileListIdFrontInsured' || @@ -773,40 +800,57 @@ export default { // 证件类型 let imageInfoType = '' + let name = '' if (that.type == 'fileListIdFrontInsured' && that.id == '1') { + name = 'fileListIdFrontInsured' imageInfoType = '1' } else if (that.type == 'fileListIdBackInsured' && that.id == '1') { + name = 'fileListIdBackInsured' imageInfoType = '2' } else if (that.type == 'fileListIdFrontInsured' && that.id == '2') { + name = 'fileListIdFrontInsured' imageInfoType = '5' } else if (that.type == 'fileListIdBackInsured' && that.id == '2') { + name = 'fileListIdBackInsured' imageInfoType = '6' } else if (that.type == 'fileListIdFrontInsured' && that.id == '3') { + name = 'fileListIdFrontInsured' imageInfoType = '7' } else if (that.type == 'fileListIdBackInsured' && that.id == '3') { + name = 'fileListIdBackInsured' imageInfoType = '12' } else if (that.type == 'fileLIstImgInsured' && that.id == '4') { + name = 'fileLIstImgInsured' imageInfoType = '8' } else if (that.type == 'fileListIdFrontInsured' && that.id == '5') { + name = 'fileListIdFrontInsured' imageInfoType = '9' } else if (that.type == 'fileListIdBackInsured' && that.id == '5') { + name = 'fileListIdBackInsured' imageInfoType = '13' } else if (that.type == 'fileListIdFrontInsured' && that.id == '6') { + name = 'fileListIdFrontInsured' imageInfoType = '10' } else if (that.type == 'fileListIdBackInsured' && that.id == '6') { + name = 'fileListIdBackInsured' imageInfoType = '14' } else if (that.type == 'fileListIdFrontInsured' && that.id == '8') { + name = 'fileListIdFrontInsured' imageInfoType = '15' } else if (that.type == 'fileListIdBackInsured' && that.id == '8') { + name = 'fileListIdBackInsured' imageInfoType = '16' } else if (that.type == 'fileListIdFrontInsured' && that.id == '9') { + name = 'fileListIdFrontInsured' imageInfoType = '17' } else if (that.type == 'fileListIdBackInsured' && that.id == '9') { + name = 'fileListIdBackInsured' imageInfoType = '18' } let obj = { + name: name, businessNo: that.orderNo, businessType: '', imageInfoType: imageInfoType, @@ -820,9 +864,11 @@ export default { } else if (that.type == 'fileListOther') { // 是其他 let type = '2' + let name = 'fileListOther' let obj = { + name: name, businessNo: that.orderNo, - businessType: '', + businessType: name, imageInfoType: '11', rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'), subBusinessType: type, @@ -923,6 +969,9 @@ export default { // } // }) // delete that.list.fileName + that.list.map(i => { + delete i.name + }) let data = { orderDTO: { orderInfoDTO: {