Browse Source

MagicHand 导入按钮

wfg 2 weeks ago
parent
commit
dca58184d4

+ 9 - 1
src/api/iosBasicData/bills.js

@@ -78,6 +78,14 @@ export const editypesSendingEdi = (data) => {
     data: data
   })
 }
+// 提交 MagicHand 修改的数据
+export const postMagicHandImportBills = (data) => {
+    return request({
+        url: '/api/blade-los/magicHandImport/submit',
+        method: 'POST',
+        data: data
+    })
+}
 
 
 export const billsRemove = (ids) => {
@@ -337,4 +345,4 @@ export const getGeneralbill = (data) => {
     method: 'get',
     params: data
   })
-}
+}

+ 62 - 2
src/views/iosBasicData/SeafreightExportF/bills/index.vue

@@ -58,6 +58,9 @@
                             </el-dropdown-item>
                         </el-dropdown-menu>
                     </el-dropdown>
+                    <el-button type="primary" size="small" plain
+                               @click="importMagicHand">导入 MH
+                    </el-button>
                     <el-dropdown style="line-height: 0" @command="batchClick">
                         <el-button size="small" type="danger" :disabled="selectionList.length == 0">
                             批量操作<i class="el-icon-arrow-down el-icon--right"></i>
@@ -272,6 +275,14 @@
             </span>
         </el-dialog>
         <update-batch-field ref="updateFieldRef"></update-batch-field>
+
+        <!--导入模板-->
+        <el-dialog title="导入 Magic Hand 文件" append-to-body :visible.sync="magicHandBox" width="555px" :close-on-click-modal="false"
+                   v-dialog-drag>
+            <avue-form :option="magicHandOption" v-model="magicHandForm" :table-loading="magicHandLoading"
+                       :upload-before="beforeUploadMagicHandZipFile" :upload-after="onSuccessUploadMagicHandZipFile">
+            </avue-form>
+        </el-dialog>
     </div>
 </template>
 
@@ -291,7 +302,8 @@ import {
     revokeCheckBillsBatch,
     generateBillBatch,
     revokeBillBatch,
-    batchCopyBills
+    batchCopyBills,
+    postMagicHandImportBills
 } from "@/api/iosBasicData/bills";
 import { mapGetters } from "vuex";
 import billsDetails from "@/views/iosBasicData/SeafreightExportF/bills/billsDetails.vue";
@@ -1357,7 +1369,31 @@ export default {
             billStatusData: [],
             // 财务状态
             accountStatusData: [],
-            saberUserInfo: {} // 当前登录人个人信息
+            saberUserInfo: {}, // 当前登录人个人信息
+
+            //  magicHand 导入
+            magicHandBox: false,
+            magicHandForm: {},
+            magicHandLoading: false,
+            magicHandOption: {
+                submitBtn: false,
+                emptyBtn: false,
+                column: [
+                    {
+                        label: "模板上传",
+                        prop: "zipFile",
+                        type: "upload",
+                        drag: true,
+                        loadText: "模板上传中,请稍等",
+                        span: 24,
+                        propsHttp: {
+                            res: "data"
+                        },
+                        tip: "请上传 .zip 格式文件",
+                        action: "api/blade-los/magicHandImport/importZip"
+                    }
+                ]
+            },
         };
     },
     computed: {
@@ -2312,6 +2348,30 @@ export default {
             done();
         },
 
+        importMagicHand (){
+            this.magicHandBox = true
+        },
+        beforeUploadMagicHandZipFile(file, done, loading) {
+            done();
+            loading = true;
+        },
+        // 上传成功
+        onSuccessUploadMagicHandZipFile(res, done, loading, column) {
+            console.log('onSuccessUploadMagicHandZipFile.res', res)
+            try{
+                if (Object.keys(res).length) {
+                    console.log('onSuccessUploadMagicHandZipFile.res', res)
+
+                    postMagicHandImportBills(res).then(res1 => {
+                        this.$message.success("测试提交 MH 成功");
+                    });
+                }
+            }finally {
+                loading = false;
+                done();
+                this.magicHandBox = false;
+            }
+        },
         //自定义列保存
         async saveColumn(ref, option, optionBack, code) {
             /**