feat: There is no way the,

This commit is contained in:
Superman_Main
2021-11-29 22:20:47 +08:00
parent 1064e572be
commit 8bc370ad3c
3 changed files with 250 additions and 98 deletions
@@ -967,6 +967,8 @@
<script>
import PutQuestionButton from '@/components/PutQuestionButton'
import {dateFormat} from '../../../common/date'
import { getBusStandFileByAttId } from 'api/process'
const sarType = 'BUSS'
export default {
@@ -1552,6 +1554,21 @@ export default {
}, e => {
})
},
getBusStandFileByAttId(attId) {
return new Promise((resolve, reject) => {
getBusStandFileByAttId({
attId
}).then(res => {
if (res.ok) {
resolve(res.data)
} else {
reject()
}
}).catch(e => {
reject(e)
})
})
},
openFileInPdf (attId, oldFileName) {
// 判断是否是图片格式,图片格式不预览,直接下载
let index1 = oldFileName.lastIndexOf('.')
@@ -1568,44 +1585,78 @@ export default {
}
// 缺少文件
if (this.$hasPermission('43ae63abc1b64e6bd5cf3bb75b423bc2')) {
this.$http.get('lawss/sarBussStandFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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 (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
this.getBusStandFileByAttId(attId)
.then(res => {
if(res){
const editFileInfo = res
console.log(editFileInfo)
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
}else {
const nowTime = new Date().getTime()
// window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)));
// window.open('/static/onlyOffice/onlinePreview.html?oldFileName=' + editFileInfo.oldFileName + '&fileType=' + editFileInfo.fileSuffix + '&attId=' + editFileInfo.id + '&fileUrl=' + editFileInfo.downLoadUrl + '&key=' + editFileInfo.id + nowTime+'&filePath='+editFileInfo.filePath+'&fileName='+editFileInfo.fileName)
}
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
}
// switch (res.convertState) {
// case 'ERROR':
// this.$message.warning('文档转换失败')
// break
// case 'LODING':
// this.$message.info('文档转换中,请稍后查看')
// break
// case 'SUCCESS':
// const { convertFileInfo } = res
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + convertFileInfo.id))
// break
// }
}).catch(e => {
console.log(e)
this.$message.warning('文件不存在,预览失败')
})
}else {
this.$http.get('lawss/sarBussStandFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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)
}
}
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 {
fileList.push(fileObj)
fileList = JSON.stringify(fileList)
sessionStorage.setItem('fileInfo', fileList)
this.$message.error('文档未转换成功或本地读取不到该文档')
}
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
} else {
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
}
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
})
})
}
} else {
this.$message.error('没有在线预览文档权限!')
}
@@ -894,6 +894,8 @@
<script>
import PutQuestionButton from '@/components/PutQuestionButton'
import {dateFormat} from '../../../common/date'
import { getBusStandFileByAttId } from 'api/process'
const sarType = 'LAWS_STAND'
export default {
@@ -1471,6 +1473,21 @@ export default {
}, e => {
})
},
getBusStandFileByAttId(attId) {
return new Promise((resolve, reject) => {
getBusStandFileByAttId({
attId
}).then(res => {
if (res.ok) {
resolve(res.data)
} else {
reject()
}
}).catch(e => {
reject(e)
})
})
},
openFileInPdf (attId, oldFileName) {
// 判断是否是图片格式,图片格式不预览,直接下载
let index1 = oldFileName.lastIndexOf('.')
@@ -1487,44 +1504,78 @@ export default {
}
// 缺少文件
if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) {
this.$http.get('lawss/sarLawsFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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 (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
this.getBusStandFileByAttId(attId)
.then(res => {
if(res){
const editFileInfo = res
console.log(editFileInfo)
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
}else {
const nowTime = new Date().getTime()
// window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)));
// window.open('/static/onlyOffice/onlinePreview.html?oldFileName=' + editFileInfo.oldFileName + '&fileType=' + editFileInfo.fileSuffix + '&attId=' + editFileInfo.id + '&fileUrl=' + editFileInfo.downLoadUrl + '&key=' + editFileInfo.id + nowTime+'&filePath='+editFileInfo.filePath+'&fileName='+editFileInfo.fileName)
}
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
}
// switch (res.convertState) {
// case 'ERROR':
// this.$message.warning('文档转换失败')
// break
// case 'LODING':
// this.$message.info('文档转换中,请稍后查看')
// break
// case 'SUCCESS':
// const { convertFileInfo } = res
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + convertFileInfo.id))
// break
// }
}).catch(e => {
console.log(e)
this.$message.warning('文件不存在,预览失败')
})
}else {
this.$http.get('lawss/sarLawsFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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)
}
}
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 {
fileList.push(fileObj)
fileList = JSON.stringify(fileList)
sessionStorage.setItem('fileInfo', fileList)
this.$message.error('文档未转换成功或本地读取不到该文档')
}
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
} else {
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
}
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
})
})
}
} else {
this.$message.error('没有在线预览文档权限!')
}
@@ -1405,6 +1405,8 @@ import CustomSVPPS from '@/components/CustomFormComponents/SVPPS'
import CustomOrg from '@/components/CustomFormComponents/OrgTree'
import {dateFormat} from '@/common/date'
import RelatedTermsSelect from './components/RelatedTermsSelect'
import { getBusStandFileByAttId } from 'api/process'
export default {
name: 'OtherStandardDetails',
@@ -2442,6 +2444,21 @@ export default {
}, e => {
})
},
getBusStandFileByAttId(attId) {
return new Promise((resolve, reject) => {
getBusStandFileByAttId({
attId
}).then(res => {
if (res.ok) {
resolve(res.data)
} else {
reject()
}
}).catch(e => {
reject(e)
})
})
},
openFileInPdf(attId, oldFileName) {
// 判断是否是图片格式,图片格式不预览,直接下载
let index1 = oldFileName.lastIndexOf('.')
@@ -2456,50 +2473,83 @@ export default {
this.downloadFile(attId)
return true
}
// 缺少文件
if (this.$route.params.pageType === 'INLAND_STAND') {
if (this.$hasPermission('2d6ab9d465ab73d415194e1ca4313793')) {
if (fileSuffix === '.PDG' || fileSuffix === '.pdg') {
this.getBusStandFileByAttId(attId)
.then(res => {
if(res){
const editFileInfo = res
console.log(editFileInfo)
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
}else {
const nowTime = new Date().getTime()
// window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)));
// window.open('/static/onlyOffice/onlinePreview.html?oldFileName=' + editFileInfo.oldFileName + '&fileType=' + editFileInfo.fileSuffix + '&attId=' + editFileInfo.id + '&fileUrl=' + editFileInfo.downLoadUrl + '&key=' + editFileInfo.id + nowTime+'&filePath='+editFileInfo.filePath+'&fileName='+editFileInfo.fileName)
}
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
}
// switch (res.convertState) {
// case 'ERROR':
// this.$message.warning('文档转换失败')
// break
// case 'LODING':
// this.$message.info('文档转换中,请稍后查看')
// break
// case 'SUCCESS':
// const { convertFileInfo } = res
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + convertFileInfo.id))
// break
// }
}).catch(e => {
console.log(e)
this.$message.warning('文件不存在,预览失败')
})
}else {
this.$http.get('lawss/sarStandFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
this.$http.get('lawss/sarStandFile/queryConvertAtt', {
attId: attId
}, {
_this: this
}, res => {
console.log("res.data", res.data);
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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
console.log("res.data", res.data);
if (res.data) {
let fileObj = {}
fileObj.fileId = res.data.attId
fileObj.fileName = oldFileName
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)
}
}
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 {
fileList.push(fileObj)
fileList = JSON.stringify(fileList)
sessionStorage.setItem('fileInfo', fileList)
this.$message.error('文档未转换成功或本地读取不到该文档')
}
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
} else {
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
}
}, e => {
this.$message.error('文档未转换成功或本地读取不到该文档')
})
})
}
} else {
this.$message.error('没有在线预览文档权限!')
}