Pārlūkot izejas kodu

面损表-附件上传

jbb 2 gadi atpakaļ
vecāks
revīzija
2934f028aa
1 mainītis faili ar 14 papildinājumiem un 12 dzēšanām
  1. 14 12
      src/views/reportForms/fabric-loss-table.vue

+ 14 - 12
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}" :customRequest="uploadFlie" :remove="removeFile">
+              <a-upload  productName="file" :showUploadList="true" :file-list="fileList" :headers="tokenHeader" :multiple="false"   :action="importExcelUrl"  @change="handleImportExcel"  :data="{code:this.planNO,name:this.fileName}"  :beforeUpload="uploadFlie" :remove="removeFile">
                 <a-button type="primary" >附件上传</a-button>
               </a-upload>
               <!-- <j-upload   v-model="fabricLoss.attachs"  ></j-upload> -->
@@ -809,19 +809,21 @@ export default {
   },
   methods: {
     uploadFlie(file) {
-      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);
-            }
-          })
+      this.fileName = file.name
+      // const formData = new FormData()
+      // formData.append('file',file.file)
+      // 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
-        // }
+        if(data.fileList.length>this.fileList.length&&data.file.status=='uploading'){
+          this.onSearch(this.planNO,'0')
+        }
         
         
       },