zhuliu 1 سال پیش
والد
کامیت
dd23618417

+ 0 - 2
src/main.js

@@ -60,8 +60,6 @@ Vue.use(vmFunction)
 import elTableInfiniteScroll from 'el-table-infinite-scroll'
 Vue.use(elTableInfiniteScroll)
 
-import { Base64 } from 'js-base64'
-Vue.use(Base64)
 
 Vue.config.productionTip = false
 Vue.prototype.$constants = constants//公用数据

+ 27 - 1
src/utils/common.js

@@ -3,6 +3,8 @@ import router from '../router'
 import { Message } from 'element-ui'
 import Permission from '@/utils/permissions'
 import showPermissionDialog from "@/utils/model/noPermission/index";
+import { Base64 } from 'js-base64';
+import Config from '@/config'
 export default {
   /**
    * 防抖
@@ -229,7 +231,7 @@ export default {
     }
   },
 
-  //查看图片
+  //查看图片1
   checkViewer(guid) {
     if(!guid){
       return ''
@@ -237,6 +239,30 @@ export default {
     return `/api/fileManager/downloadFile?fileId=${guid}`
   },
 
+  //查看图片2
+  checkGuid(guid,type='pdf') {
+    if(!guid){
+      return ''
+    }
+    var src = this.checkViewer(guid)
+    var previewUrl = src + '&fullfilename=test.'+type
+    return `http://${Config.staticURL}:8012/onlinePreview?url=` + encodeURIComponent(Base64.encode(window.location.origin+previewUrl))
+  },
+
+  //跳转预览界面
+  previewFile(data,guid,type='pdf'){
+    var FileUrl = this.checkGuid(guid,type)
+    const router1 = router.resolve({
+      path: '/checkFile',
+      query: {
+        ...data,
+        FileUrl: FileUrl,
+        guid:guid
+      }
+    })
+    window.open(router1.href, '_blank');
+  },
+
    //查看专利详情
    checkPatentDetails(patentNo,projectId) {
       router.push(

+ 0 - 3
src/utils/index.js

@@ -54,9 +54,6 @@ export const downLoadBase64 = (content, fileName) => {
 
 export const downLoad2 = (guid) => {
   const href = commonJS.checkViewer(guid)
-
-  // const href = `/api/v2/common/download?url=${encodeURIComponent(url)}`
-
   const anchor = document.createElement('a');
   const fileName = 'download';
   if ('download' in anchor) {

+ 3 - 125
src/utils/model/menu/mixins.js

@@ -7,135 +7,13 @@ export const File = {
     },
     // 预览
     preview(data) {
-      let guid = data.guid
-      var item = JSON.parse(JSON.stringify(data))
-
-      var arr = ['png', 'jpeg', 'bmp', 'jpg']
-      if (arr.includes(item.type)) {
-        var FileUrl = this.$commonJS.checkViewer(guid)
-        var isPicture = 1
-      } else {
-        let http = this.$c.staticURL
-        var url = this.$commonJS.checkViewer(guid)
-        var FileUrl = `http://${http}:8012/onlinePreview?url=` + btoa(encodeURIComponent(url + '&fullfilename=test.' + item.type))
-        var isPicture = 0
-      }
-      // return
-      const router = this.$router.resolve({
-        path: '/checkFile',
-        query: {
-          row: JSON.stringify(item),
-          FileUrl: FileUrl,
-          isPicture: isPicture
-        }
-      })
-      window.open(router.href, '_blank');
+      var guid = data.guid || data.fileGuid
+      this.$commonJS.previewFile(data,guid,data.type)
     },
-    // preview(row){
-    //     var item = JSON.parse(JSON.stringify(row))
-    //     var arr = ['png','jpeg','bmp','jpg']
-    //     if(arr.includes(item.suffix)){
-    //         var FileUrl = this.$p + item.url
-    //         var isPicture = 1
-    //     }else if(item.suffix == 'pdf'){
-    //         var FileUrl = this.$p + item.url
-    //         var isPicture = 0
-    //     }else{
-    //         var FileUrl =  `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$p + item.url))
-    //         var isPicture = 0
-    //     }
-    //     const router = this.$router.resolve({
-    //         path: '/checkFile',
-    //         query: {
-    //             row: JSON.stringify(item),
-    //             FileUrl: FileUrl,
-    //             isPicture:isPicture
-    //         }
-    //     })
-    //     window.open(router.href, '_blank');
-    // },
+
     delFile(item) {
       this.$emit('delFile', item)
     }
   },
 }
 
-export const File2 = {
-  methods: {
-    downLoad(row) {
-      var item = JSON.parse(JSON.stringify(row))
-      var href = ''
-      if (item.originalName) {
-        href = `http://${this.$c.hostname}:8801/fileManager/downloadSystemFile?fileId=${item.id}`
-      } else {
-        href = `/api/report/api/download/downloadFile?url=${encodeURIComponent(item.url)}`
-      }
-      const anchor = document.createElement('a');
-      const fileName = 'download';
-      if ('download' in anchor) {
-        anchor.href = href;
-        anchor.setAttribute("download", fileName);
-        anchor.className = "download-js-link";
-        anchor.innerHTML = "downloading...";
-        anchor.style.display = "none";
-        document.body.appendChild(anchor);
-        setTimeout(function () {
-          anchor.click();
-          document.body.removeChild(anchor);
-        }, 66);
-        return true;
-      }
-    },
-    preview(row) {
-      var item = JSON.parse(JSON.stringify(row))
-      if (item.originalName) {
-        item.url = `http://${this.$c.hostname}:8801/fileManager/downloadSystemFile?fileId=${item.id}`
-        var arr = ['png', 'jpeg', 'bmp', 'jpg']
-        if (arr.includes(item.suffix)) {
-          var FileUrl = item.url
-          var isPicture = 1
-        } else if (item.suffix == 'pdf') {
-          var FileUrl = item.url
-          var isPicture = 0
-        } else {
-          var FileUrl = `http://${this.$c.hostname}:8012/onlinePreview?url=` + btoa(encodeURIComponent(item.url + '&fullfilename=test.' + item.suffix))
-          var isPicture = 0
-        }
-        const router = this.$router.resolve({
-          path: '/checkFile',
-          query: {
-            row: JSON.stringify(item),
-            FileUrl: FileUrl,
-            isPicture: isPicture
-          }
-        })
-        window.open(router.href, '_blank');
-        return false
-      }
-      var arr = ['png', 'jpeg', 'bmp', 'jpg']
-      if (arr.includes(item.suffix)) {
-        var FileUrl = this.$rImg + item.url
-        var isPicture = 1
-      } else if (item.suffix == 'pdf') {
-        var FileUrl = this.$rImg + item.url
-        var isPicture = 0
-      } else {
-        var FileUrl = `http://${this.$c.hostname}:8012/onlinePreview?url=` + btoa(encodeURIComponent(this.$rImg + item.url))
-        var isPicture = 0
-      }
-      const router = this.$router.resolve({
-        path: '/checkFile',
-        query: {
-          row: JSON.stringify(item),
-          FileUrl: FileUrl,
-          isPicture: isPicture,
-          reportId: true
-        }
-      })
-      window.open(router.href, '_blank');
-    },
-    delFile(item) {
-      this.$emit('delFile', item.id)
-    }
-  },
-}

+ 13 - 16
src/views/components/view/checkFile.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="height_100">
         <div class="header">
-            <div style="color:black">{{ FileName }}</div>
+            <div style="color:black">{{ fileName }}</div>
             <div>
                 <el-link style="font-size: 16px" @click="downLoadFile"><i class="fa el-icon-download"></i><span style="margin-left:10px">下载</span></el-link>
             </div>
@@ -21,31 +21,29 @@ export default {
     data() {
         return {
             loadLoading:true,
-            FileName:'',
+            // FileName:'',
             height:document.documentElement.clientHeight - 200,
-            srcList:[],
+            // srcList:[],
         }
     },
     computed:{
-        row(){
-            return JSON.parse(this.$route.query.row);
-        },
+        // row(){
+        //     return JSON.parse(this.$route.query.row);
+        // },
         FileUrl(){
             return this.$route.query.FileUrl
         },
         isPicture(){
-            return this.$route.query.isPicture
+            return this.$route.query.isPicture || 0
+        },
+        fileName(){
+            return this.$route.query.fileName
         },
-        reportId(){
-            return this.$route.query.reportId
+        guid(){
+            return this.$route.query.guid
         }
     },
     mounted(){
-        // this.FileName = this.row.name?this.row.name+'.'+this.row.suffix:this.row.fileName
-      this.FileName = this.row.originalName
-        if(this.isPicture == 1){
-            this.srcList = [this.FileUrl]
-        }else{
             var that = this
             this.$nextTick(()=>{
                 var a = document.getElementById('checkIframe')
@@ -56,13 +54,12 @@ export default {
                     that.loadLoading = false
                 }
             })
-        }
         
     },
   methods: {
     downLoadFile(){ 
         var href = ''
-        href =  this.$commonJS.checkViewer(this.row.guid)
+        href =  this.$commonJS.checkViewer(this.guid)
         const anchor = document.createElement('a');
         const fileName = 'download';
         if ('download' in anchor) {

+ 0 - 13
src/views/event/components/details/mixins.js

@@ -13,19 +13,6 @@ export const checkVisual = {
           eventName:eventName
       },true);
     },
-    handleDownload(row) {
-      var FileUrl = `http://${this.$c.hostname}:8012/onlinePreview?url=` + btoa(encodeURIComponent(this.$p + row.url))
-      // var FileUrl =  `http://192.168.1.24:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$p + row.url))
-      const router = this.$router.resolve({
-        path: '/checkFile',
-        query: {
-          row: JSON.stringify(row),
-          FileUrl: FileUrl,
-          isPicture: 0
-        }
-      })
-      window.open(router.href, '_blank');
-    },
   }
 }
 

+ 12 - 24
src/views/patentMining/components/handleExamine/detailsPage.vue

@@ -51,7 +51,9 @@
               <template slot="label">
                 <i class="el-icon-location-outline"></i> 所属流程
               </template>
-              {{ pathOptions.filter(item => { return item.value == detailsMessage.processId })[0].label}}
+              <span>
+                {{getPathOptions()}}
+              </span> 
             </el-descriptions-item>
             <el-descriptions-item>
               <template slot="label">
@@ -134,6 +136,13 @@ export default {
     this.getDetails()
   },
   methods: {
+    getPathOptions(){
+      var obj = this.pathOptions.find(item => { return item.value == this.detailsMessage.processId })
+      if(obj){
+        return obj.label
+      }
+      return ''
+    },
     // 点击左侧图标回到指定位置
     handleTarget(val) {
       let dom = ''
@@ -194,29 +203,8 @@ export default {
     // 预览
     preview(data) {
       let guid = data.guid
-      var item = JSON.parse(JSON.stringify(data))
-
-      var arr = ['png', 'jpeg', 'bmp', 'jpg']
-      if (arr.includes(item.type)) {
-        var FileUrl = this.$commonJS.checkViewer(guid)
-        var isPicture = 1
-      } else {
-        let http = '139.224.24.90'
-        var url = this.$commonJS.checkViewer(guid)
-        // var FileUrl = `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$commonJS.checkViewer(guid)+ '&fullfilename=test.'+item.type))
-        var FileUrl = `http://${http}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(url + '&fullfilename=test.'+item.type))
-        var isPicture = 0
-      }
-      // return
-      const router = this.$router.resolve({
-        path: '/checkFile',
-        query: {
-          row: JSON.stringify(item),
-          FileUrl: FileUrl,
-          isPicture: isPicture
-        }
-      })
-      window.open(router.href, '_blank');
+      data.fileName = data.originalName
+      this.$commonJS.previewFile(data,guid,data.type)
     },
     // 下载
     downloads(data) {

+ 1 - 3
src/views/project/patentDetails/components/notPatentDetails.vue

@@ -73,10 +73,8 @@ export default {
   },
   methods: {
     getUrl(){
-        let http = this.$c.staticURL
         var guid = this.evidence.literatureNo
-        var url = this.$commonJS.checkViewer(guid)
-        this.url = `http://${http}:8012/onlinePreview?url=` + btoa(encodeURIComponent(url + '&fullfilename=test.' + this.evidence.systemFile.type))
+        this.url = this.$commonJS.checkGuid(guid,this.evidence.systemFile.type)
     },
     load(){
         var that = this

+ 2 - 8
src/views/project/patentDetails/components/patentMessage/PatentPDF.vue

@@ -21,8 +21,7 @@
 
 <script>
 import { patentDetails } from './mixins';
-
-import {Base64} from 'js-base64'
+import { Base64 } from 'js-base64';
 export default {
   mixins: [patentDetails],
   props: ['patent', 'projectId', 'patentNo'],
@@ -90,12 +89,7 @@ export default {
       //   this.src = `http://${this.$c.staticURL}:8012/onlinePreview?url=` + btoa(encodeURIComponent(src + '&fullfilename=test.pdf'))
       // } else {
       if (obj) {//外部内部都是返回guid
-        var src = this.$commonJS.checkViewer(obj.pdfGuid)
-        console.log('URL:'+src,'guid:'+obj.pdfGuid,Base64.encode(src))
-        var previewUrl = src + '&fullfilename=test.pdf'
-        // this.src = `http://${this.$c.staticURL}:8012/onlinePreview?url=` + btoa(encodeURIComponent(src + '&fullfilename=test.pdf'))
-        // this.src = `http://${this.$c.staticURL}:8012/onlinePreview?url=` + encodeURIComponent(Base64.encode(previewUrl))
-        this.src = `http://${this.$c.staticURL}:8012/onlinePreview?url=` + btoa(encodeURIComponent(Base64.encode(previewUrl)))
+        this.src = this.$commonJS.checkGuid(obj.pdfGuid)
       }
       // }
       this.$nextTick(() => {

+ 6 - 1
src/views/report/components/patentList/components/customFields/index.vue

@@ -262,7 +262,12 @@ export default {
                 return item.name != '其他'
               })
               this.$set(data[index], 'options', arr)
-              this.$set(data[index], 'topN', data[index].options[0].topN)
+              if(data[index].options && data[index].options.length>0){
+                this.$set(data[index], 'topN', data[index].options[0].topN)
+              }else{
+                this.$set(data[index], 'topN', 10)
+              }
+              
               if (data[index].options.length == data[index].topN) {//判断加载更多按钮是否存在
                 this.$set(data[index], 'isShowBtn', true)
               } else {

+ 4 - 5
src/views/report/components/reportFile/reportFileTable.vue

@@ -80,10 +80,8 @@
 </template>
 
 <script>
-// import { downLoad2 } from "@/utils"
-import { File } from '@/utils/model/menu/mixins'
+import { downLoad2 } from "@/utils"
 export default {
-  mixins: [File],
   props: ['projectId'],
   data() {
     return {
@@ -306,10 +304,11 @@ export default {
           this.handleEdit(row)
           break;
         case '0'://下载
-          this.downLoad(row)
+          downLoad2(row.fileGuid)
           break;
         case '1'://预览
-          this.preview(row)
+          row.fileName = row.referencesName
+          this.$commonJS.previewFile(row,row.fileGuid,row.type)
           break;
         case '2'://删除
           this.handleDelete(row)