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) {
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);
},