瀏覽代碼

出入库审核添加附件预览功能

zhuqingsong 1 年之前
父節點
當前提交
a56a9dae5c

+ 12 - 6
src/views/InformationAudit/enterWarehouseAudit/detail.vue

@@ -23,9 +23,7 @@
23 23
         </el-table-column>
24 24
         <el-table-column label="附件上传" header-align="center" align="center" width="160">
25 25
           <template #default="scope">
26
-            <span class="fileName" @click="fileDownload(scope.row.filePart, scope.row.fileName)">{{
27
-              scope.row.fileName
28
-            }}</span>
26
+            <span class="fileName" @click="handlePreview1(scope.row.filePart)">{{ scope.row.fileName }}</span>
29 27
           </template>
30 28
         </el-table-column>
31 29
         <el-table-column prop="remarks" label="备注" header-align="center" align="center" />
@@ -38,9 +36,7 @@
38 36
           <el-table-column prop="opinion" label="审核意见" header-align="center" align="center" />
39 37
           <el-table-column label="附件" header-align="center" align="center">
40 38
             <template #default="scope">
41
-              <span class="fileName" @click="fileDownload(scope.row.filePart, scope.row.fileName)">{{
42
-                scope.row.fileName
43
-              }}</span>
39
+              <span class="fileName" @click="handlePreview1(scope.row.filePart)">{{ scope.row.fileName }}</span>
44 40
             </template>
45 41
           </el-table-column>
46 42
           <el-table-column prop="auditingTime" label="审核时间" header-align="center" align="center" />
@@ -114,6 +110,7 @@ import { useDict } from "@/hooks/dict";
114 110
 import store from "@/store";
115 111
 import { useGetters } from "@/hooks/storeHooks";
116 112
 import { getQuery } from "@/hooks/detailQuery/index";
113
+import { sysFile } from "@/api/inAndOut/formationFilling/in";
117 114
 
118 115
 const { access_token } = useGetters(["access_token"]);
119 116
 const { indound_type, is_available } = useDict("indound_type", "is_available");
@@ -310,6 +307,15 @@ const fileDownload = (filePart: any, fileName: string) => {
310 307
   };
311 308
   xhr.send(formData);
312 309
 };
310
+const handlePreview1 = (file: any) => {
311
+  if (file) {
312
+    sysFile(file).then((res: any) => {
313
+      const blob = new Blob([res], { type: "application/pdf;charset=UTF-8" });
314
+      const bFile = URL.createObjectURL(blob);
315
+      window.open(bFile);
316
+    });
317
+  }
318
+};
313 319
 
314 320
 onMounted(() => {
315 321
   getList();

+ 14 - 7
src/views/InformationAudit/outWarehouseAudit/detail.vue

@@ -8,7 +8,7 @@
8 8
             {{ scope.row.outboundType ? showCh(scope.row.outboundType, outdound_type) : scope.row.outboundType }}
9 9
           </template>
10 10
         </el-table-column>
11
-        <el-table-column prop="materialName" label="物资名称" header-align="center" align="center" width="360">
11
+        <el-table-column prop="materialName" label="物资名称" header-align="center" align="center">
12 12
           <template #default="scope">
13 13
             {{ scope.row.materialGroup + "/" + scope.row.materialType + "/" + scope.row.materialName }}
14 14
           </template>
@@ -26,9 +26,7 @@
26 26
         </el-table-column>
27 27
         <el-table-column label="附件上传" header-align="center" align="center" width="160">
28 28
           <template #default="scope">
29
-            <span class="fileName" @click="fileDownload(scope.row.filePart, scope.row.fileName)">{{
30
-              scope.row.fileName
31
-            }}</span>
29
+            <span class="fileName" @click="handlePreview1(scope.row.filePart)">{{ scope.row.fileName }}</span>
32 30
           </template>
33 31
         </el-table-column>
34 32
         <el-table-column prop="remarks" label="备注" header-align="center" align="center" />
@@ -41,9 +39,7 @@
41 39
           <el-table-column prop="opinion" label="审核意见" header-align="center" align="center" />
42 40
           <el-table-column label="附件" header-align="center" align="center">
43 41
             <template #default="scope">
44
-              <span class="fileName" @click="fileDownload(scope.row.filePart, scope.row.fileName)">{{
45
-                scope.row.fileName
46
-              }}</span>
42
+              <span class="fileName" @click="handlePreview1(scope.row.filePart)">{{ scope.row.fileName }}</span>
47 43
             </template>
48 44
           </el-table-column>
49 45
           <el-table-column prop="auditingTime" label="审核时间" header-align="center" align="center" />
@@ -117,6 +113,7 @@ import { useDict } from "@/hooks/dict";
117 113
 import store from "@/store";
118 114
 import { useGetters } from "@/hooks/storeHooks";
119 115
 import { getQuery } from "@/hooks/detailQuery/index";
116
+import { sysFile } from "@/api/inAndOut/formationFilling/in";
120 117
 
121 118
 const { access_token } = useGetters(["access_token"]);
122 119
 const { outdound_type, is_available, province_ch } = useDict("outdound_type", "is_available", "province_ch");
@@ -311,6 +308,16 @@ const fileDownload = (filePart: any, fileName: string) => {
311 308
   xhr.send(formData);
312 309
 };
313 310
 
311
+const handlePreview1 = (file: any) => {
312
+  if (file) {
313
+    sysFile(file).then((res: any) => {
314
+      const blob = new Blob([res], { type: "application/pdf;charset=UTF-8" });
315
+      const bFile = URL.createObjectURL(blob);
316
+      window.open(bFile);
317
+    });
318
+  }
319
+};
320
+
314 321
 onMounted(() => {
315 322
   getList();
316 323
 });