Browse Source

面损表附件上传

jbb 2 years ago
parent
commit
6d5220c39e
1 changed files with 19 additions and 17 deletions
  1. 19 17
      src/views/reportForms/fabric-loss-table.vue

+ 19 - 17
src/views/reportForms/fabric-loss-table.vue

@@ -103,7 +103,7 @@
               <a-button type="primary" @click="openEnclosure">附件</a-button>
             </a-col>
             <a-col :md="6" :sm="8" class="noprint">
-              <a-upload  name="file" :showUploadList="true" :file-list="fileList" :multiple="false"  :headers="tokenHeader"  :action="importExcelUrl"  @change="handleImportExcel"  :data="{code:this.planNO,name:this.fileName}" :beforeUpload="uploadFlie" :remove="removeFile">
+              <a-upload  name="file" :showUploadList="true" :file-list="fileList" :multiple="false"  :headers="tokenHeader"  :action="importExcelUrl"  @change="handleImportExcel"  :data="{code:this.planNO,name:this.fileName}" :customRequest="uploadFlie" :remove="removeFile">
                 <a-button type="primary" >附件上传</a-button>
               </a-upload>
               <!-- <j-upload   v-model="fabricLoss.attachs"  ></j-upload> -->
@@ -474,6 +474,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import JUpload from '@/components/jeecg/JUpload'
 import moment from 'moment'
+import { runInThisContext } from 'vm'
 
 export default {
   name: 'FabricLossTable', // 面料损耗表
@@ -802,26 +803,25 @@ export default {
         importExcelUrl: 'report/FabricLoss/addFile' ,// 导入
       },
       noteOne: '', // 备注 1
-      noteTwo: '' // 备注 2
+      noteTwo: '', // 备注 2
+      dd:0
     }
   },
-
   methods: {
     uploadFlie(file) {
-      this.fileName = file.name
+      this.fileName = file.file.name
+      fileDetail({code:this.planNO,name:this.fileName}).then(res => {
+            if (res.success) {
+              this.onSearch(this.planNO,'0')
+            }else{
+              this.$message.error(res.message);
+            }
+          })
       },
       handleImportExcel(data){
-        if(data.fileList.length>this.fileList.length){
-          this.fileList=[]
-          data.fileList.map(item=>{
-          this.fileList.push({
-            uid: '-1',
-            name: item.name,
-            status: 'done',
-            url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+item.name
-          })
-        })
-        }
+        // if(data.fileList.length>this.fileList.length){
+        //   this.fileList=data.fileList
+        // }
         
         
       },
@@ -903,9 +903,10 @@ export default {
             if (res.success) {
               this.PrintButton = false
               this.fabricLoss = res.result;
-              var fileList = this.fabricLoss.attachs.split(",")
+              var fileList =  this.fabricLoss.attachs!==''?this.fabricLoss.attachs.split(","):[]
               this.fileList = []
-              fileList.map(item=>{
+              if(fileList.length!==0){
+                fileList.map(item=>{
                   this.fileList.push({
                     uid: '-1',
                     name: item,
@@ -913,6 +914,7 @@ export default {
                     url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+item
                   })
               })
+              }
               this.edit = this.fabricLoss.edit
               // 开票成本成衣:获取原币和本币金额是否完全相同,完全相同隐藏美元列
               var findList = this.fabricLoss.fabricCostClothesList.filter(e=>e.ioriSum!=e.isum);