Merge branch 'dev_20231219_preview' into 'master'
Dev 20231219 preview See merge request laws-foton-slrs/foton-laws-system-front!137
This commit is contained in:
+84
-28
@@ -1,35 +1,91 @@
|
||||
/**
|
||||
* 文件预览
|
||||
*/
|
||||
import { onlyOfficeUrl,kkFileViewUrl } from '@/sysConfig'
|
||||
import { onlyOfficeUrl, kkFileViewUrl } from '@/sysConfig'
|
||||
import { getBusStandFileByAttId } from 'api/process'
|
||||
let Base64 = require('js-base64').Base64;
|
||||
const Base64 = require('js-base64').Base64;
|
||||
import store from '@/store'
|
||||
import { Loading } from "element-ui";
|
||||
import { Loading } from 'element-ui';
|
||||
import axios from '@/common/axiosV2'
|
||||
import isMobile from '@/store/isMobile'
|
||||
|
||||
export default attId => {
|
||||
const loading = Loading.service({
|
||||
lock: true,
|
||||
text: '正在加载文件',
|
||||
spinner: 'el-icon-loading',
|
||||
})
|
||||
getBusStandFileByAttId({
|
||||
attId
|
||||
}).then(res => {
|
||||
if(res){
|
||||
const editFileInfo = res.data
|
||||
if(editFileInfo.fileSuffix.toLowerCase() === 'pdg'){
|
||||
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
|
||||
}else if(editFileInfo.fileSuffix.toLowerCase() === 'pdf'){
|
||||
window.open('./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)
|
||||
window.open(kkFileViewUrl+'/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(store.getters.userInfo.userName));
|
||||
|
||||
}
|
||||
}
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
// 获取转换为pdf的文件
|
||||
function queryConvertAtt (data) {
|
||||
return axios({
|
||||
url: 'api/lawss/sarLawsFile/queryConvertAtt',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
async function preview (attId) {
|
||||
const loading = Loading.service({
|
||||
lock: true,
|
||||
text: '正在加载文件',
|
||||
spinner: 'el-icon-loading',
|
||||
})
|
||||
const res = await getBusStandFileByAttId({ attId })
|
||||
if (res.ok && res.data) {
|
||||
const file = res.data
|
||||
if (file.fileSuffix.toLowerCase() === 'pdg') {
|
||||
if (isMobile()) {
|
||||
this.$message.warning('pdg文件,不支持手机端预览')
|
||||
} else {
|
||||
window.open('book://ssreader/e0?url=' + file.downLoadUrl)
|
||||
}
|
||||
} else if (file.fileSuffix.toLowerCase() === 'pdf') {
|
||||
window.open('./static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + file.id))
|
||||
} else {
|
||||
// onlyoffice在线编辑文件转换为pdf预览 -> kkfileview预览乱码
|
||||
if (file.onlined && file.onlined === 1) {
|
||||
const res = await queryConvertAtt({ attId })
|
||||
if (res.ok && res.data) {
|
||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
|
||||
} else {
|
||||
this.$message.error('文档未转换成功或本地读取不到该文档')
|
||||
}
|
||||
} else {
|
||||
window.open(kkFileViewUrl + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(file.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(store.getters.userInfo.userName));
|
||||
}
|
||||
}
|
||||
}
|
||||
loading.close()
|
||||
}
|
||||
|
||||
export default preview;
|
||||
// export default (attId) => {
|
||||
// const loading = Loading.service({
|
||||
// lock: true,
|
||||
// text: '正在加载文件',
|
||||
// spinner: 'el-icon-loading',
|
||||
// })
|
||||
// getBusStandFileByAttId({
|
||||
// attId
|
||||
// }).then(res => {
|
||||
// if(res) {
|
||||
// const editFileInfo = res.data
|
||||
// if(editFileInfo.fileSuffix.toLowerCase() === 'pdg') {
|
||||
// window.open('book://ssreader/e0?url=' + editFileInfo.downLoadUrl)
|
||||
// }else if(editFileInfo.fileSuffix.toLowerCase() === 'pdf') {
|
||||
// window.open('./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)
|
||||
// if (res.data && res.data.onlined === 1) {
|
||||
// queryConvertAtt({ attId }).then(res => {
|
||||
// if (res.ok && res.data) {
|
||||
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId))
|
||||
// } else {
|
||||
// this.$message.error('文档未转换成功或本地读取不到该文档')
|
||||
// }
|
||||
// }).catch(() => {
|
||||
// this.$message.error('文档未转换成功或本地读取不到该文档')
|
||||
// })
|
||||
// }
|
||||
// window.open(kkFileViewUrl + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(store.getters.userInfo.userName));
|
||||
// }
|
||||
// }
|
||||
// }).finally(() => {
|
||||
// loading.close()
|
||||
// })
|
||||
// }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable -->
|
||||
<!--企标详情页-->
|
||||
<template>
|
||||
<div class="other-standard-details v-class" :class="{'hidden': !isMoreAwayBtn}">
|
||||
@@ -1341,6 +1342,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* eslint-disable */
|
||||
import PutQuestionButton from '@/components/PutQuestionButton'
|
||||
import {dateFormat} from '../../../common/date'
|
||||
import { getBusStandFileByAttId } from 'api/process'
|
||||
@@ -2590,6 +2592,12 @@ export default {
|
||||
})
|
||||
},
|
||||
openFileInPdf (attId, oldFileName) {
|
||||
if (this.$hasPermission('43ae63abc1b64e6bd5cf3bb75b423bc2')) {
|
||||
this.$preview(attId)
|
||||
} else {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
/*
|
||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
||||
let index1 = oldFileName.lastIndexOf('.')
|
||||
let index2 = oldFileName.length
|
||||
@@ -2680,6 +2688,7 @@ export default {
|
||||
} else {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
*/
|
||||
this.$http.get('lawss/sarBussionessStand/logBuss', {
|
||||
standCode: this.sarStandardsInfoEO.standCode,
|
||||
standName: this.sarStandardsInfoEO.standName
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable -->
|
||||
<!--政策详情页-->
|
||||
<template>
|
||||
<div class="other-standard-details v-class" :class="{'hidden': !isMoreAwayBtn}">
|
||||
@@ -906,6 +907,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* eslint-disable */
|
||||
import PutQuestionButton from '@/components/PutQuestionButton'
|
||||
import {dateFormat} from '../../../common/date'
|
||||
import { getBusStandFileByAttId } from 'api/process'
|
||||
@@ -1511,6 +1513,12 @@ export default {
|
||||
})
|
||||
},
|
||||
openFileInPdf (attId, oldFileName) {
|
||||
if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) {
|
||||
this.$preview(attId)
|
||||
} else {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
/*
|
||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
||||
let index1 = oldFileName.lastIndexOf('.')
|
||||
let index2 = oldFileName.length
|
||||
@@ -1601,6 +1609,7 @@ export default {
|
||||
} else {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
*/
|
||||
},
|
||||
showItemsModel (attField) {
|
||||
this.fileType = attField
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable -->
|
||||
<!--国内标准法规详情页-->
|
||||
<template>
|
||||
<div :class="{'hidden': !isMoreAwayBtn}" class="other-standard-details v-class">
|
||||
@@ -1820,6 +1821,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* eslint-disable */
|
||||
import PutQuestionButton from '@/components/PutQuestionButton'
|
||||
import CustomSVPPS from '@/components/CustomFormComponents/SVPPS'
|
||||
import CustomSelectArray from '@/components/CustomFormComponents/SelectArray'
|
||||
@@ -3269,6 +3271,14 @@ export default {
|
||||
})
|
||||
},
|
||||
openFileInPdf(attId, oldFileName) {
|
||||
if (this.$route.params.pageType === 'INLAND_STAND' && this.$hasPermission('2d6ab9d465ab73d415194e1ca4313793')) {
|
||||
this.$preview(attId)
|
||||
} else if (this.$route.params.pageType === 'FOREIGN_STAND' && this.$hasPermission('ee684b4a9975f5d8a6dfe898c0332f98')) {
|
||||
this.$preview(attId)
|
||||
} else {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
/*
|
||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
||||
let index1 = oldFileName.lastIndexOf('.')
|
||||
let index2 = oldFileName.length
|
||||
@@ -3391,6 +3401,7 @@ export default {
|
||||
this.$message.error('没有在线预览文档权限!')
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (this.$route.params.pageType === 'INLAND_STAND') {
|
||||
let standNumber = this.sarStandardsInfoEO.standSortShow + ' ' + this.sarStandardsInfoEO.standNumber + '-' + this.sarStandardsInfoEO.standYear || this.sarStandardsInfoEO.standSort + ' ' + this.sarStandardsInfoEO.standNumber
|
||||
this.$http.get('sarStandardsInfo/sar-standards-info/logInvalid', {
|
||||
|
||||
@@ -2836,6 +2836,8 @@
|
||||
})
|
||||
},
|
||||
openFileInPdf(attId, oldFileName) {
|
||||
this.$preview(attId)
|
||||
/*
|
||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
||||
let index1 = oldFileName.lastIndexOf('.')
|
||||
let index2 = oldFileName.length
|
||||
@@ -2878,6 +2880,7 @@
|
||||
} else {
|
||||
this.$message.warning('PDG文件,不支持手机端预览')
|
||||
}
|
||||
*/
|
||||
},
|
||||
getFileInfo(fileId) {
|
||||
Axios({
|
||||
|
||||
@@ -1269,6 +1269,8 @@
|
||||
})
|
||||
},
|
||||
openFileInPdf(attId, oldFileName) {
|
||||
this.$preview(attId)
|
||||
/*
|
||||
// 判断是否是图片格式,图片格式不预览,直接下载
|
||||
let index1 = oldFileName.lastIndexOf('.')
|
||||
let index2 = oldFileName.length
|
||||
@@ -1298,6 +1300,7 @@
|
||||
}else {
|
||||
this.$message.warning('PDG文件,不支持手机端预览')
|
||||
}
|
||||
*/
|
||||
},
|
||||
showItemsModel(attField) {
|
||||
if (attField) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable -->
|
||||
<!--征求意见详情-->
|
||||
<template>
|
||||
<div class="consultationDetails">
|
||||
@@ -270,6 +271,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* eslint-disable */
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
@@ -570,7 +572,10 @@ export default {
|
||||
})
|
||||
},
|
||||
handleQueryPdf(file){
|
||||
this.$preview(file.attId)
|
||||
/*
|
||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + file.attId))
|
||||
*/
|
||||
},
|
||||
isVisible(e) {
|
||||
if (e.target.visibilityState === "visible") {
|
||||
|
||||
Reference in New Issue
Block a user