diff --git a/src/views/ebiz/sale/AttachmentManagement.vue b/src/views/ebiz/sale/AttachmentManagement.vue index ba1cd14e2..265af138e 100644 --- a/src/views/ebiz/sale/AttachmentManagement.vue +++ b/src/views/ebiz/sale/AttachmentManagement.vue @@ -580,22 +580,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') { @@ -604,8 +612,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) { @@ -615,7 +625,6 @@ export default { // } // }) } - this.deleteImg(file) }) }, test(type, id) { @@ -663,12 +672,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) } }) @@ -679,6 +691,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() }, @@ -708,8 +721,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) @@ -728,6 +739,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') { @@ -751,57 +763,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, @@ -811,8 +840,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' || @@ -825,40 +852,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, @@ -872,9 +916,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, @@ -980,6 +1026,9 @@ export default { // } // }) // delete that.list.fileName + that.list.map(i => { + delete i.name + }) let data = { orderDTO: { orderInfoDTO: {