瀏覽代碼

附件新增预览功能

qymljy 1 年之前
父節點
當前提交
625aad8b15
共有 1 個文件被更改,包括 25 次插入2 次删除
  1. 25 2
      src/components/attachment_list/index.vue

+ 25 - 2
src/components/attachment_list/index.vue

@@ -35,7 +35,7 @@
       </el-table-column>
       <el-table-column
         label="操作"
-        width="140">
+        width="170">
         <template slot-scope="scope">
           <div v-if="actid === scope.row.attachmentid">
             <el-button type="text" size="small" @click="saveEdit(scope.row)" :disabled="status === '已失败' || status === '已结案'">保 存</el-button>
@@ -43,6 +43,7 @@
           </div>
           <div v-else>
             <el-button type="text" size="small" @click="download(scope.row)" :disabled="status === '已失败' || status === '已结案'">下 载</el-button>
+            <el-button type="text" size="small" @click="seeClick(scope.row)" >预 览</el-button>
             <el-button :disabled="onlyread || status === '已失败' || status === '已结案' " class="inline-16" type="text" size="small" @click="editAttachment(scope.row)" >编 辑</el-button>
             <el-popconfirm
               title="确定删除当前附件吗?"
@@ -53,17 +54,22 @@
         </template>
       </el-table-column>
     </el-table>
+    <SeeFile ref="seeFile" :fileData="seeFile"></SeeFile>
   </div>
 </template>
 
 <script>
+import SeeFile from '@/components/file-block/components/SeeFile1'
 export default {
   props:['attinfos','onlyread','status'],
   data () {
     return {
       actid:null,
+      seeFile: '',
+      isSeeFileShow:false
     }
   },
+  components:{SeeFile},
   methods:{
     refresh () {
       this.$emit('cancelEdit')
@@ -114,7 +120,24 @@ export default {
       })
       res.code === 1?this.tool.showMessage(res):''
       res.code === 1?this.$emit('onSuccess'):''
-    }
+    },
+    seeClick(item) {
+      console.log(item)
+      if(item.postfix == 'png' || item.postfix == 'PNG' || item.postfix == 'jpg' || item.postfix == 'JPG' || item.postfix == 'bmp' || item.postfix == 'BMP'
+          || item.postfix == 'gif' || item.postfix == 'GIG' || item.postfix == 'WEBP' || item.postfix == 'webp' || item.postfix == 'svg' || item.postfix == 'SVG'
+          || item.postfix == 'TIFF' || item.postfix == 'tiff' || item.postfix == 'MP4' || item.postfix == 'mp4' || item.postfix == 'ogg' || item.postfix == 'webm') {
+        this.seeFile = item
+        this.$refs.seeFile.dialogVisible = true
+      } else if (item.postfix == 'PDF' || item.postfix == 'pdf'){
+        window.open(item.url,'_blank')
+      }else {
+        this.$notify({
+          title:'提示',
+          message:'该文件暂不支持',
+          type:'warning'
+        })
+      }
+    },
   }
 }