Explorar el Código

在线查看文件

zhuliu hace 2 años
padre
commit
25844245e8

+ 2 - 3
RMS-FrontEnd/src/views/components/common/menu/component/checkFile.vue

@@ -1,8 +1,8 @@
 <template>
     <div>
-        <div class="header">
+        <div class="header">    
             <div>{{ FileName }}</div>
-            <div>
+            <div v-if="!row.downLoad">
                 <el-link style="font-size: 16px" @click="downLoad"><i class="fa el-icon-download"></i><span style="margin-left:10px">下载</span></el-link>
             </div>
         </div>
@@ -35,7 +35,6 @@ export default {
         }
     },
     mounted(){
-        console.log(this.isPicture)
         this.FileName = this.row.name?this.row.name+'.'+this.row.suffix:this.row.fileName
         if(this.isPicture){
             this.srcList = [this.FileUrl]

+ 30 - 4
RMS-FrontEnd/src/views/report/components/CreateReport.vue

@@ -418,10 +418,36 @@ export default {
       // console.log(this.file, fileList);
       },
     handlePreview(file) {
-      // console.log(file);
-      // this.$api.seeFile()
-      // this.imageUrl ='https://view.xdocin.com/view?src=' + URL.createObjectURL(file.raw)
-      // this.showFile = true
+          var item={
+              name:file.name,
+              suffix:'',
+              downLoad:true
+            }
+            var index = file.raw.type.lastIndexOf('/')
+            var type = file.raw.type.substring(index+1,file.raw.type.length)
+            var arr = ['png','jpeg','bmp','jpg']
+            if(arr.includes(type)){
+              // this.FileVisible = true
+              var FileUrl =  URL.createObjectURL(file.raw)
+              var isPicture = 1
+              // this.srcList = [URL.createObjectURL(file.raw)]
+            }else if(type == 'pdf'){
+              // this.FileVisible = true
+              var FileUrl = URL.createObjectURL(file.raw)
+              var isPicture = 0
+              // this.srcList = []
+            }else{
+              return false
+            }
+            const router = this.$router.resolve({
+                path: '/checkFile',
+                query: {
+                    row: JSON.stringify(item),
+                    FileUrl: FileUrl,
+                    isPicture:isPicture
+                }
+            })
+            window.open(router.href, '_blank');
     },
    showFile1(url){
     // this.showFile = true

+ 23 - 7
RMS-FrontEnd/src/views/report/reportDetails/components/basicMessage.vue

@@ -188,21 +188,37 @@ export default {
         },
         handlePreview(file) {
             // console.log(file);
-            
+            // return false
+            var item={
+              name:file.name,
+              suffix:'',
+              downLoad:true
+            }
             var index = file.raw.type.lastIndexOf('/')
             var type = file.raw.type.substring(index+1,file.raw.type.length)
             var arr = ['png','jpeg','bmp','jpg']
             if(arr.includes(type)){
-              this.FileVisible = true
+              // this.FileVisible = true
               this.FileUrl =  URL.createObjectURL(file.raw)
-              this.srcList = [URL.createObjectURL(file.raw)]
+              var isPicture = 1
+              // this.srcList = [URL.createObjectURL(file.raw)]
             }else if(type == 'pdf'){
-              this.FileVisible = true
+              // this.FileVisible = true
               this.FileUrl = URL.createObjectURL(file.raw)
-              this.srcList = []
+              var isPicture = 0
+              // this.srcList = []
+            }else{
+              return false
             }
-            // this.imageUrl ='https://view.xdocin.com/view?src=' + URL.createObjectURL(file.raw)
-            // this.showFile = true
+            const router = this.$router.resolve({
+                path: '/checkFile',
+                query: {
+                    row: JSON.stringify(item),
+                    FileUrl: this.FileUrl,
+                    isPicture:isPicture
+                }
+            })
+            window.open(router.href, '_blank');
         },
         submit(){
             let formData = new FormData()