jbb пре 2 година
родитељ
комит
13256d9aef

+ 6 - 1
src/api/document/advance-packingList.js

@@ -41,5 +41,10 @@ const batchCanelSubmit = params => getAction('/spapl/syPreAssembledPackingList/c
 //推送
 const push = params => getAction('/spapl/syPreAssembledPackingList/push', params)
 
+//导入获取信息
+const fileDetail = params => postAction('/spapl/syPreAssembledPackingList/importExcel2', params)
+//导入
+const upload = params => postAction('/spapl/syPreAssembledPackingList/importExcel3', params)
 
-export { getadPaList, deleteAdPaList, itemByMainId, editById, addAdvPac, shipList, queryShippingDetails, submit, cancelSubmit,batchSubmit ,batchPush,push,batchCanelSubmit}
+
+export { getadPaList, deleteAdPaList, itemByMainId, editById, addAdvPac, shipList, queryShippingDetails, submit, cancelSubmit,batchSubmit ,batchPush,push,batchCanelSubmit,fileDetail,upload}

+ 52 - 3
src/views/advance-packingList/adPaList-clothes.vue

@@ -100,7 +100,7 @@
         <a-button type="primary" @click="addAdpacking" icon="plus">新增</a-button>
         <a-button type="primary" icon="download" @click="handleExportXls('预装箱单-成衣','0')">预装箱单成衣导出</a-button>
         <a-button type="primary" icon="download" @click="handleExportXls('预装箱单-成衣','1')">预装箱单成衣导出-装箱单</a-button>
-        <a-upload productName="file" :showUploadList="false"  :multiple="false"  :headers="tokenHeader"  :action="importExcelUrl"   @change="handleImportExcel">
+        <a-upload productName="file" :showUploadList="false"  :multiple="false"  :headers="tokenHeader"  :action="importExcelUrl"   @change="handleImportExcel" :customRequest="uploadFlie">
           <a-button type="primary" icon="import">导入-来源出运明细</a-button>
         </a-upload>
         <a-button type="primary" @click="batchSubmit" icon="check">批量提交</a-button>
@@ -249,6 +249,14 @@
 
       <detailsAdpacking-drawer ref="detailsAdpackingDrawer" @ok="modalFormOk"></detailsAdpacking-drawer>
     </div>
+    <!-- 导入确认框 -->
+    <div>
+      <a-modal :visible="visible" title="是否继续导入" @ok="handleOk" @cancel="handleCancel">
+        <ul>
+          <li v-for="(item,index) in message" :key="index">{{item}}</li>
+        </ul>
+      </a-modal>
+    </div>
   </div>
 </template>
 
@@ -260,7 +268,7 @@ import { downFile } from '@/api/manage'
 import addAdpackingDrawer from '@views/advance-packingList/addAdpackingDrawer.vue'
 import detailsAdpackingDrawer from '@views/advance-packingList/detailsAdpackingDrawer.vue'
 
-import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit,exportList} from '@api/document/advance-packingList.js'
+import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit,exportList,fileDetail,upload} from '@api/document/advance-packingList.js'
 
 export default {
   productName: 'AdPaListClothes', // 预装箱单-成衣
@@ -475,7 +483,9 @@ export default {
         }
       ],
       adPaListClothesData: [],
-
+      visible:false,
+      message:[],//导入文件信息
+      file:{},//导入文件
       queryParam: {
         pageSize:20
         // pageNo: '',
@@ -505,6 +515,7 @@ export default {
       console.log(this.queryParam)
       this.$nextTick(() => {
         getadPaList(this.queryParam).then(res => {
+          this.loading = false
           if (res.success) {
             this.adPaListClothesData = [];
             if (res.result.records != null){
@@ -515,6 +526,8 @@ export default {
               current: res.result.current,
               pageSize: res.result.size
             }
+          }else{
+            this.$message.error(res.message);
           }
         })
       })
@@ -623,6 +636,42 @@ export default {
       })
     },
 
+     // 导入信息
+    uploadFlie(file) {
+      const formData = new FormData()
+      formData.append('file',file.file)
+      fileDetail(formData).then(res => {
+        if (res.success) {
+          this.visible = true
+          this.message = res.message.split(';').filter((element) => {
+             return element !== ""; 
+          });
+          console.log(this.message)
+          debugger
+          this.file = file
+        }else{
+          this.$message.error(res.message);
+        }
+      })},
+      //继续导入
+      handleOk(){
+         const formData = new FormData()
+         formData.append('file', this.file.file)
+         upload(formData).then(res => {
+           this.visible = false
+           if (res.success) {
+             this.getadPaListClothes()
+           }else{
+            this.$message.error(res.message);
+        }
+      })
+      },
+      //取消导入
+      handleCancel(){
+        this.visible = false
+        this.loading = false
+      },
+
 
     //  删除
     handleDelete(record) {