diff --git a/src/common/preview/index.js b/src/common/preview/index.js
index 4176911a2..c0e055d41 100644
--- a/src/common/preview/index.js
+++ b/src/common/preview/index.js
@@ -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/sarBussStandFile/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()
+// })
+// }
diff --git a/src/pages/details/otherBussStandardDetails/index.vue b/src/pages/details/otherBussStandardDetails/index.vue
index cf1457fc6..8d3d622d3 100644
--- a/src/pages/details/otherBussStandardDetails/index.vue
+++ b/src/pages/details/otherBussStandardDetails/index.vue
@@ -1,3 +1,4 @@
+
@@ -1341,6 +1342,7 @@
-