ysy 2 年之前
父节点
当前提交
98a131d87d

+ 11 - 3
src/components/upload/fileUpload.vue

@@ -6,13 +6,14 @@
       :http-request="handlRequest"
       :http-request="handlRequest"
       :before-remove="beforeRemove"
       :before-remove="beforeRemove"
       :on-remove="handleRemove"
       :on-remove="handleRemove"
+      :on-preview="handleItem"
       multiple
       multiple
       :before-upload="beforeUpload"
       :before-upload="beforeUpload"
       :file-list="fileList"
       :file-list="fileList"
       :show-file-list="!showLib"
       :show-file-list="!showLib"
     >
     >
       <slot>
       <slot>
-        <el-button type="primary" icon="el-icon-plus">点击上传</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini">点击上传</el-button>
       </slot>
       </slot>
     </el-upload>
     </el-upload>
     <el-button type="primary" class="lib" @click="handleOpenLib" v-if="showLib"
     <el-button type="primary" class="lib" @click="handleOpenLib" v-if="showLib"
@@ -71,13 +72,14 @@
   import {
   import {
     uploadFile,
     uploadFile,
     removeFile,
     removeFile,
-    getFileList
+    getFileList,
+    getFile
   } from '@/api/system/file/index.js';
   } from '@/api/system/file/index.js';
   import { getImageUrl, getImagePath } from '@/utils/file';
   import { getImageUrl, getImagePath } from '@/utils/file';
   export default {
   export default {
     props: {
     props: {
       value: {
       value: {
-        type: Array,
+        type: [Array,String],
         default: () => []
         default: () => []
       },
       },
       // 所属模块
       // 所属模块
@@ -159,6 +161,7 @@
         },
         },
         get () {
         get () {
           // console.log(this.value, 2);
           // console.log(this.value, 2);
+          if(!Array.isArray(this.value)) return []
           const arr =
           const arr =
             (this.value &&
             (this.value &&
               this.value.map((item) => ({
               this.value.map((item) => ({
@@ -172,6 +175,11 @@
     },
     },
 
 
     methods: {
     methods: {
+      //点击查看图片
+      handleItem(file){
+   
+       getFile({ objectName: file.storePath }, file.name);
+      },
       delFileList () {
       delFileList () {
         this.$emit('input', []);
         this.$emit('input', []);
       },
       },

+ 24 - 6
src/views/material/product/components/MaterialAdd.vue

@@ -88,8 +88,8 @@
 
 
 
 
                         <template v-slot:count="{ row }">
                         <template v-slot:count="{ row }">
-                            <el-input v-model="row.count"  placeholder="请输入" @input="(value) =>
-                            (row.count =  value.replace(
+                            <el-input v-model="row.count" placeholder="请输入" @input="(value) =>
+                            (row.count = value.replace(
                                 /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
                                 /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
                                 '$1$2.$3'
                                 '$1$2.$3'
                             ))
                             ))
@@ -103,6 +103,18 @@
                                 @click.native="categorySelect(row, $index)"></el-input>
                                 @click.native="categorySelect(row, $index)"></el-input>
                         </template>
                         </template>
 
 
+
+                        <template v-slot:bomArtFiles="{ row }">
+                            <fileUpload v-model="row.bomArtFiles"  module="main"
+                                :showLib="false" :limit="5" />
+                            <div v-if="row.bomArtFiles && row.bomArtFiles?.length">
+                                <el-link v-for="link in row.bomArtFiles" :key="link.id" type="primary"
+                                    :underline="false" @click="downloadFile(link)">
+                                    {{ link.name }}</el-link>
+                            </div>
+
+                        </template>
+
                         <template v-slot:remark="{ row }">
                         <template v-slot:remark="{ row }">
                             <el-input v-model="row.remark" placeholder="请输入"></el-input>
                             <el-input v-model="row.remark" placeholder="请输入"></el-input>
                         </template>
                         </template>
@@ -130,10 +142,13 @@ import { pageList } from '@/api/technology/version/version.js';
 import { getCode } from '@/api/codeManagement/index.js';
 import { getCode } from '@/api/codeManagement/index.js';
 import { bomSave, bomUpdate } from '@/api/material/BOM';
 import { bomSave, bomUpdate } from '@/api/material/BOM';
 import ProductModal from '@/components/select/bom/ProductModal.vue'
 import ProductModal from '@/components/select/bom/ProductModal.vue'
+import fileUpload from '@/components/upload/fileUpload';
+import {getFile} from "@/api/system/file";
 export default {
 export default {
     components: {
     components: {
         factorySelect,
         factorySelect,
-        ProductModal
+        ProductModal,
+        fileUpload
     },
     },
     props: {
     props: {
         // 弹窗是否打开
         // 弹窗是否打开
@@ -234,7 +249,7 @@ export default {
                     prop: 'isReworkBom',
                     prop: 'isReworkBom',
                     slot: 'isReworkBom',
                     slot: 'isReworkBom',
                     action: 'isReworkBom'
                     action: 'isReworkBom'
-                 
+
                 },
                 },
                 {
                 {
                     label: '物料编码',
                     label: '物料编码',
@@ -262,7 +277,8 @@ export default {
                 {
                 {
                     label: '附件',
                     label: '附件',
                     slot: 'bomArtFiles',
                     slot: 'bomArtFiles',
-                    action: 'bomArtFiles'
+                    action: 'bomArtFiles',
+                    minWidth: 100,
                 },
                 },
 
 
                 {
                 {
@@ -307,7 +323,9 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
-
+        downloadFile(file) {
+      getFile({ objectName: file.storePath }, file.name);
+    },
 
 
         handleDel(row, index) {
         handleDel(row, index) {
             this.tableData.splice(index, 1);
             this.tableData.splice(index, 1);

+ 32 - 1
src/views/material/product/components/MaterialModal.vue

@@ -121,6 +121,16 @@
                                         {{ row.isReworkBom ? '是' : '否' }}
                                         {{ row.isReworkBom ? '是' : '否' }}
                                     </template>
                                     </template>
 
 
+                                    <template v-slot:bomArtFiles="{ row }">
+
+                                        <div v-if="row.bomArtFiles && row.bomArtFiles?.length">
+                                            <el-link v-for="link in row.bomArtFiles" :key="link.id" type="primary"
+                                                :underline="false" @click="downloadFile(link)">
+                                                {{ link.name }}</el-link>
+                                        </div>
+
+                                    </template>
+
                                     <template v-slot:toolbar>
                                     <template v-slot:toolbar>
                                         <el-button type="primary" size="small" @click="openEdit(index)">编辑</el-button>
                                         <el-button type="primary" size="small" @click="openEdit(index)">编辑</el-button>
 
 
@@ -180,6 +190,7 @@ import { getCategoryBom } from '@/api/material/product';
 import { bomDelete, saveBatch, bomTaskList, bomTaskDelete, getByTaskId } from '@/api/material/BOM';
 import { bomDelete, saveBatch, bomTaskList, bomTaskDelete, getByTaskId } from '@/api/material/BOM';
 import factorySelect from '@/components/CommomSelect/factory-select.vue';
 import factorySelect from '@/components/CommomSelect/factory-select.vue';
 import Production from '@/views/technology/route/components/production/index.vue'
 import Production from '@/views/technology/route/components/production/index.vue'
+import { getFile } from "@/api/system/file";
 
 
 export default {
 export default {
     components: {
     components: {
@@ -268,11 +279,26 @@ export default {
                     prop: 'unit'
                     prop: 'unit'
                 },
                 },
 
 
-         
+
+                {
+                    label: '附件',
+                    slot: 'bomArtFiles',
+                    action: 'bomArtFiles',
+                    minWidth: 100,
+                },
+
+
+
                 {
                 {
                     label: '单位',
                     label: '单位',
                     prop: 'weightUnit'
                     prop: 'weightUnit'
                 },
                 },
+
+                {
+                    label: '备注',
+                    prop: 'remark',
+                },
+
             ],
             ],
 
 
             statusList: [
             statusList: [
@@ -307,6 +333,11 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
+
+        downloadFile(file) {
+            getFile({ objectName: file.storePath }, file.name);
+        },
+
         openEdit(index) {
         openEdit(index) {
             this.current = this.form.bomList[index];
             this.current = this.form.bomList[index];
             console.log(this.current);
             console.log(this.current);