Browse Source

装箱单成衣导入校验

jbb 2 years ago
parent
commit
1b72f980db

+ 6 - 1
src/api/document/packing-list/packinglist-clothes.js

@@ -36,8 +36,13 @@ const bitchSubmitList = params => getAction('/splt/syPackingListTailoring/submit
 //批量取消提交
 const bitchCancelSubmitList = params => getAction('/splt/syPackingListTailoring/cancelSubmitBatch', params)
 
+//导入获取信息
+const fileDetail = params => postAction('/splt/syPackingListTailoring/importExcel2', params)
+//导入
+const upload = params => postAction('/splt/syPackingListTailoring/importExcel3', params)
 
 
 
-export {spltList,orderSpltList,deleteSpltList,batchDelete,orderSpltListId,editSpltList,addSpltList,spltListId,SubmitList,cancelSubmitList,bitchSubmitList,bitchCancelSubmitList}
+
+export {spltList,orderSpltList,deleteSpltList,batchDelete,orderSpltListId,editSpltList,addSpltList,spltListId,SubmitList,cancelSubmitList,bitchSubmitList,bitchCancelSubmitList,fileDetail,upload}
 

+ 47 - 3
src/views/packing-list/clothes-list.vue

@@ -102,7 +102,7 @@
         <a-button type="primary" @click="bitchSubmit" icon="check">批量提交</a-button>
         <a-button type="primary" @click="bitchCanelSubmit" icon="close">批量取消提交</a-button>
         <!-- <a-button type="primary" icon="download" @click="handleExportXls('装箱单-成衣')">装箱单成衣导出</a-button> -->
-        <a-upload  name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"  @change="handleImportExcel" >
+        <a-upload  name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"  @change="handleImportExcel" :customRequest="uploadFlie">
           <a-button type="primary" icon="import">导入-来源预装箱单</a-button>
         </a-upload>
       </div>
@@ -221,6 +221,14 @@
       <detailsClothes-drawer ref="detailsClothesDrawer" :father="bb" @ok="modalFormOk"></detailsClothes-drawer>
       <!-- <editClothes-drawer ref="editClothesDrawer" :father="cc" @ok="modalFormOk"></editClothes-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>
 
@@ -231,7 +239,7 @@ import JEllipsis from '@/components/jeecg/JEllipsis'
 import clothesAddDrawer from '@views/packing-list/packinglist-clothes/clothesAddDrawer.vue'
 import detailsClothesDrawer from '@views/packing-list/packinglist-clothes/detailsClothesDrawer.vue'
 import editClothesDrawer from '@views/packing-list/packinglist-clothes/editClothesDrawer.vue'
-import { spltList,deleteSpltList,spltListId,SubmitList,cancelSubmitList,bitchSubmitList,bitchCancelSubmitList} from '@api/document/packing-list/packinglist-clothes'
+import { spltList,deleteSpltList,spltListId,SubmitList,cancelSubmitList,bitchSubmitList,bitchCancelSubmitList,fileDetail,upload} from '@api/document/packing-list/packinglist-clothes'
 
 
 export default {
@@ -480,7 +488,9 @@ export default {
 
       selectedRowKeys: [], // 勾选航
       loading: false, // 表格加载
-
+      visible:false,
+      message:[],//导入文件信息
+      file:{},//导入文件
       // 查询条件
       queryParam: {
         pageNo: '' // 初始页
@@ -546,6 +556,40 @@ export default {
     },
     // 推送
     push() {},
+     // 导入
+    uploadFlie(file) {
+      const formData = new FormData()
+      formData.append('file', file.file)
+      fileDetail(formData).then(res => {
+        this.loading = false
+        if (res.success) {
+          this.visible = true
+          this.message = res.message.split(';').filter((element) => {
+             return element !== ""; 
+          });
+          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.getSpltList()
+           }else{
+            this.$message.error(res.message);
+        }
+      })
+      },
+      //取消导入
+      handleCancel(){
+        this.visible = false
+        this.loading = false
+      },
 
     //批量提交
     bitchSubmit(){