fix: 征求意见填写意见页面加载文件机制更新

This commit is contained in:
zyd
2022-09-22 22:20:07 +08:00
parent 264901734d
commit 63098c8fcf
@@ -91,27 +91,51 @@
previewShow(attId) { previewShow(attId) {
this.iframeLoading = true this.iframeLoading = true
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getBusStandFileByAttId({ this.$http.get('lawss/sarStandFile/queryConvertAtt', {
attId attId: attId
}).then(res => { }, {
if(res){ _this: this
const history = res; }, res => {
const editFileInfo = res.data if (res.data) {
if(editFileInfo.fileSuffix.toLowerCase() === 'pdg'){ let fileObj = {}
this.iframeUrl = 'book://ssreader/e0?url='+editFileInfo.downLoadUrl fileObj.fileId = res.data.attId
}else if(editFileInfo.fileSuffix.toLowerCase() === 'pdf'){ fileObj.fileName = res.data.fileOldName
this.iframeUrl = './static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id) let fileList = []
}else { let repeatData = 0
const nowTime = new Date().getTime() if (sessionStorage.getItem('fileInfo')) {
// 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) fileList = JSON.parse(sessionStorage.getItem('fileInfo'))
this.iframeUrl = kkFileViewUrl+'/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)); 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.iframeUrl = './static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId)
this.$forceUpdate() } else {
resolve(history) 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); console.log(this.iframeUrl);
}, },