bug: 文件预览
This commit is contained in:
@@ -209,76 +209,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
openFileInPdf (attId, fileName) {
|
openFileInPdf (attId, fileName) {
|
||||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
this.$preview(attId)
|
||||||
let index1 = fileName.lastIndexOf('.')
|
|
||||||
let index2 = fileName.length
|
|
||||||
let fileSuffix = fileName.substring(index1, index2)
|
|
||||||
//把后缀转大写
|
|
||||||
if(fileSuffix !== undefined && fileSuffix !== null){
|
|
||||||
fileSuffix = fileSuffix.toUpperCase()
|
|
||||||
}
|
|
||||||
// 判断上传文件格式
|
|
||||||
if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') {
|
|
||||||
this.downloadFile(attId)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// 缺少文件
|
|
||||||
if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) {
|
|
||||||
if (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
|
|
||||||
this.getBusStandFileByAttId(attId)
|
|
||||||
.then(res => {
|
|
||||||
if(res){
|
|
||||||
const editFileInfo = res
|
|
||||||
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
|
|
||||||
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
this.$message.warning('文件不存在,预览失败')
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.$http.get('att/attFile/getBusStandFileByAttId', {
|
|
||||||
attId: attId
|
|
||||||
}, {
|
|
||||||
_this: this
|
|
||||||
}, res => {
|
|
||||||
if (res.data) {
|
|
||||||
let fileObj = {}
|
|
||||||
fileObj.fileId = res.data.attId
|
|
||||||
fileObj.fileName = fileName
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
|
|
||||||
} else {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
}
|
|
||||||
}, e => {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$message.error('没有在线预览文档权限!')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,76 +365,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
openFileInPdf (attId, fileName) {
|
openFileInPdf (attId, fileName) {
|
||||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
this.$preview(attId)
|
||||||
let index1 = fileName.lastIndexOf('.')
|
|
||||||
let index2 = fileName.length
|
|
||||||
let fileSuffix = fileName.substring(index1, index2)
|
|
||||||
//把后缀转大写
|
|
||||||
if(fileSuffix !== undefined && fileSuffix !== null){
|
|
||||||
fileSuffix = fileSuffix.toUpperCase()
|
|
||||||
}
|
|
||||||
// 判断上传文件格式
|
|
||||||
if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') {
|
|
||||||
this.downloadFile(attId)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// 缺少文件
|
|
||||||
if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) {
|
|
||||||
if (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
|
|
||||||
this.getBusStandFileByAttId(attId)
|
|
||||||
.then(res => {
|
|
||||||
if(res){
|
|
||||||
const editFileInfo = res
|
|
||||||
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
|
|
||||||
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
this.$message.warning('文件不存在,预览失败')
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.$http.get('att/attFile/getBusStandFileByAttId', {
|
|
||||||
attId: attId
|
|
||||||
}, {
|
|
||||||
_this: this
|
|
||||||
}, res => {
|
|
||||||
if (res.data) {
|
|
||||||
let fileObj = {}
|
|
||||||
fileObj.fileId = res.data.attId
|
|
||||||
fileObj.fileName = fileName
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
|
|
||||||
} else {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
}
|
|
||||||
}, e => {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$message.error('没有在线预览文档权限!')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,76 +249,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
openFileInPdf (attId, fileName) {
|
openFileInPdf (attId, fileName) {
|
||||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
this.$preview(attId)
|
||||||
let index1 = fileName.lastIndexOf('.')
|
|
||||||
let index2 = fileName.length
|
|
||||||
let fileSuffix = fileName.substring(index1, index2)
|
|
||||||
//把后缀转大写
|
|
||||||
if(fileSuffix !== undefined && fileSuffix !== null){
|
|
||||||
fileSuffix = fileSuffix.toUpperCase()
|
|
||||||
}
|
|
||||||
// 判断上传文件格式
|
|
||||||
if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') {
|
|
||||||
this.downloadFile(attId)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// 缺少文件
|
|
||||||
if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) {
|
|
||||||
if (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
|
|
||||||
this.getBusStandFileByAttId(attId)
|
|
||||||
.then(res => {
|
|
||||||
if(res){
|
|
||||||
const editFileInfo = res
|
|
||||||
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
|
|
||||||
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
this.$message.warning('文件不存在,预览失败')
|
|
||||||
})
|
|
||||||
}else {
|
|
||||||
this.$http.get('att/attFile/getBusStandFileByAttId', {
|
|
||||||
attId: attId
|
|
||||||
}, {
|
|
||||||
_this: this
|
|
||||||
}, res => {
|
|
||||||
if (res.data) {
|
|
||||||
let fileObj = {}
|
|
||||||
fileObj.fileId = res.data.attId
|
|
||||||
fileObj.fileName = fileName
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
|
|
||||||
} else {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
}
|
|
||||||
}, e => {
|
|
||||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$message.error('没有在线预览文档权限!')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user