Selaa lähdekoodia

修改附件查看

caojunjie 3 vuotta sitten
vanhempi
commit
655e4be76d
1 muutettua tiedostoa jossa 26 lisäystä ja 5 poistoa
  1. 26 5
      src/views/Warehousing/components/upLoad.vue

+ 26 - 5
src/views/Warehousing/components/upLoad.vue

@@ -111,9 +111,8 @@
         fixed="right"
       >
         <template slot-scope="scope">
-          <el-button size="small" type="text" @click="checkFile(scope)"
-          >查看</el-button
-          >
+          <el-button size="small" type="text" @click="checkFile(scope,0)"
+          >查看</el-button>
           <el-button
             @click.native.prevent="deleteRow(scope.$index, relevantAttachments)"
             :disabled="browseStatus"
@@ -121,9 +120,20 @@
             type="text"
             >删除
           </el-button>
+          <el-button size="small" type="text" @click="checkFile(scope,1)"
+          >下载</el-button>
         </template>
       </el-table-column>
     </el-table>
+    <el-dialog
+        width="80%"
+        title="附件"
+        :visible.sync="innerVisible"
+        append-to-body>
+      <div style="width: 50%;height: 50%;margin: 0 auto">
+        <img :src="url" alt="" style="width: 100%;height: 100%;">
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -147,6 +157,8 @@ export default {
   },
   data() {
     return {
+      innerVisible:false,
+      url:'',
       headers: {
         Authorization: "Bearer " + getToken(),
       },
@@ -177,9 +189,18 @@ export default {
       }
     },
     //附件查看
-    checkFile(scope) {
+    checkFile(scope,type) {
       if (this.relevantAttachments[scope.$index].fUrl) {
-        window.open(this.relevantAttachments[scope.$index].fUrl);
+        if(type === 0){
+          if (scope.row.fName.substring(scope.row.fName.lastIndexOf(".")) === '.jpg'||scope.row.fName.substring(scope.row.fName.lastIndexOf(".")) === '.png'||scope.row.fName.substring(scope.row.fName.lastIndexOf(".")) === '.JPG'||scope.row.fName.substring(scope.row.fName.lastIndexOf(".")) === '.PNG'){
+            this.innerVisible = true
+            this.url = this.relevantAttachments[scope.$index].fUrl
+          }else {
+            window.open(this.relevantAttachments[scope.$index].fUrl);
+          }
+        }else if(type === 1){
+          window.open(this.relevantAttachments[scope.$index].fUrl);
+        }
       } else {
         this.$message.error("请上传附件");
       }