diff --git a/src/pages/processCenter/pages/creatProcess/bzzqyj/ZQYJAddFileDetails.vue b/src/pages/processCenter/pages/creatProcess/bzzqyj/ZQYJAddFileDetails.vue index c5702479f..cf88d25e8 100644 --- a/src/pages/processCenter/pages/creatProcess/bzzqyj/ZQYJAddFileDetails.vue +++ b/src/pages/processCenter/pages/creatProcess/bzzqyj/ZQYJAddFileDetails.vue @@ -91,27 +91,51 @@ previewShow(attId) { this.iframeLoading = true return new Promise((resolve, reject) => { - getBusStandFileByAttId({ - attId - }).then(res => { - if(res){ - const history = res; - const editFileInfo = res.data - if(editFileInfo.fileSuffix.toLowerCase() === 'pdg'){ - this.iframeUrl = 'book://ssreader/e0?url='+editFileInfo.downLoadUrl - }else if(editFileInfo.fileSuffix.toLowerCase() === 'pdf'){ - this.iframeUrl = './static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id) - }else { - const nowTime = new Date().getTime() - // window.open(onlyOfficeUrl+'/onlyOffice?oldFileName=' + editFileInfo.oldFileName + '&fileType=' + editFileInfo.fileSuffix + '&attId=' + editFileInfo.id + '&fileUrl=' + editFileInfo.downLoadUrl + '&key=' + editFileInfo.id + nowTime+'&filePath='+editFileInfo.filePath+'&fileName='+editFileInfo.fileName) - this.iframeUrl = kkFileViewUrl+'/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)); + this.$http.get('lawss/sarStandFile/queryConvertAtt', { + attId: attId + }, { + _this: this + }, res => { + if (res.data) { + let fileObj = {} + fileObj.fileId = res.data.attId + fileObj.fileName = res.data.fileOldName + let fileList = [] + let repeatData = 0 + if (sessionStorage.getItem('fileInfo')) { + fileList = JSON.parse(sessionStorage.getItem('fileInfo')) + if (fileList != null && fileList.length > 0) { + for (let i = 0; i < fileList.length; i++) { + if (fileList[i].fileId === res.data.attId) { + repeatData = 1 + break + } + } + if (repeatData === 0) { + fileList.push(fileObj) + fileList = JSON.stringify(fileList) + sessionStorage.setItem('fileInfo', fileList) + } + } + } else { + fileList.push(fileObj) + fileList = JSON.stringify(fileList) + sessionStorage.setItem('fileInfo', fileList) } - this.iframeLoading = false - this.$forceUpdate() - resolve(history) + this.iframeUrl = './static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId) + } else { + this.$message.error('文档未转换成功或该文档无法读取') } - }).catch(e => { + this.iframeLoading = false + this.$forceUpdate() + resolve(history) + }, e => { + this.iframeLoading = false + this.$forceUpdate() + resolve(history) + this.$message.error('文档未转换成功或该文档无法读取') }) + }) console.log(this.iframeUrl); },