ysy 1 jaar geleden
bovenliggende
commit
ca25c7f522

+ 6 - 2
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -893,6 +893,8 @@
 
     <fileIndex v-if="fileShow" @close="fileClose"></fileIndex>
 
+    <fileBrowse  ref="browseRef"></fileBrowse>
+
     <div class="btns">
       <el-button
         type="primary"
@@ -926,6 +928,7 @@
   import standardOutput from './standardOutput.vue';
   import term from '../qualityTesting/term';
   import fileIndex from '../file/index.vue';
+    import fileBrowse from '../file/fileBrowse.vue'
   export default {
     components: {
       userSearch,
@@ -936,7 +939,8 @@
       ProductModalMultiple,
       standardOutput,
       term,
-      fileIndex
+      fileIndex,
+      fileBrowse
     },
     mixins: [dictMixins],
     data() {
@@ -1304,7 +1308,7 @@
       },
 
       fileDetails(row) {
-        
+         this.$refs.browseRef.setFileUrl(row)
       },
       addJob() {
         this.$refs.jobRef.open();

+ 123 - 0
src/views/material/BOMmanage/file/fileBrowse.vue

@@ -0,0 +1,123 @@
+<template>
+  <el-dialog
+    title="详情"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <div>
+      <iframe
+        :src="fileUrl"
+        width="100%"
+        style="height: calc(70vh - 20px); margin-top: 30px"
+        frameborder="0"
+        allowfullscreen="true"
+      ></iframe>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="handleClose"> 关闭 </el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  export default {
+    components: {},
+    mixins: [],
+
+    data() {
+      return {
+        fileType: 1,
+        fileUrl: '',
+        visible: false
+      };
+    },
+    computed: {},
+    mounted() {},
+    methods: {
+      setFileUrl(row) {
+        console.log(row);
+        let file = row.storagePath[0];
+        let url = sessionStorage.filePath + file.storePath;
+        const fileExt = file.name.substr(file.name.lastIndexOf('.') + 1);
+        this.fileType = this.getFileType().includes(fileExt) ? 2 : 1;
+        if (this.fileType == 2) {
+          this.fileUrl =
+            '/fm/' +
+            (['dxf', 'dwg'].includes(fileExt) ? '2DViewer' : '3DViewer') +
+            '/view.html?url=' +
+            sessionStorage.filePath +
+            '/' +
+            row.outputNdsFiles;
+        } else {
+          if (process.env.NODE_ENV === 'development') {
+            this.fileUrl =
+              'http://192.168.1.251:51001/kkfile/onlinePreview?url=' +
+              btoa(url);
+          } else {
+            this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
+          }
+        }
+        this.visible = true;
+      },
+
+      getFileType() {
+        return [
+          'par',
+          'asm',
+          'psm',
+          'dft',
+          'sldprt',
+          'sldasm',
+          'ipt',
+          ' iam',
+          'prt',
+          '3dxml',
+          'CATPart',
+          'CATProduct',
+          'cgr',
+          'model',
+          'exp',
+          'session',
+          'x_t',
+          'xmt_txt',
+          'x_b',
+          'xmp_bin',
+          'xmp_txt',
+          'sat',
+          '.sab',
+          '.igs',
+          'iges',
+          'stp',
+          'step',
+          'jt',
+          'xcgm',
+          '3dm',
+          'stl',
+          'obj',
+          '3mf',
+          'fbx',
+          'vda',
+          'dxf',
+          'dwg',
+          'pdf',
+          'idf',
+          'idb',
+          'emn',
+          'brd'
+        ];
+      },
+
+      handleClose() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 31 - 35
src/views/material/BOMmanage/file/index.vue

@@ -53,12 +53,23 @@
               :selection.sync="selection"
               highlight-current-row
             >
+
+            <template v-slot:action="{ row, $index }">
+           
+              <el-link type="primary"  @click="fileDetails(row)"
+                >详情</el-link
+              >
+            </template>
+
             </ele-pro-table>
           </template>
         </ele-split-layout>
       </el-card>
     </div>
 
+
+    <fileBrowse  ref="browseRef"></fileBrowse>
+
     <div slot="footer">
       <el-button type="primary" @click="handleSave"> 选择 </el-button>
       <el-button @click="handleClose"> 取消 </el-button>
@@ -70,8 +81,11 @@
   import { getDocTreeListAPI, filePageAPI } from '@/api/material/file';
   import { mapGetters } from 'vuex';
 
+
+      import fileBrowse from '../file/fileBrowse.vue'
+
   export default {
-    components: {},
+    components: { fileBrowse },
     mixins: [],
 
     data() {
@@ -185,6 +199,16 @@
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 100
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 100,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+
           }
         ]
       };
@@ -255,43 +279,15 @@
         this.$emit('close', JSON.parse(JSON.stringify(this.selection)));
       },
 
-      /* 表格操作按钮事件 */
-      handleOperation(type, data) {
-        switch (type) {
-          case 'checkOut':
-            this.checkOut(data);
-            break;
-          case 'checkIn':
-            this.checkIn(data);
-            break;
-          default:
-            break;
-        }
-      },
 
-      // 检出文档
-      checkOut(row) {
-        let query = {
-          id: row.id,
-          userId: this.user.info.userId
-        };
-        checkOutAPI(query).then((res) => {
-          this.$message({
-            type: 'success',
-            message: res.msg,
-            duration: 1000
-          });
-          this.reload();
-        });
+      fileDetails(row) {
+         this.$refs.browseRef.setFileUrl(row)
       },
 
-      // 归还文档
-      checkIn(row) {
-        let query = {
-          id: row.id,
-          userId: this.user.info
-        }
-      }
+
+
+
+
     }
   };
 </script>