Przeglądaj źródła

导入Excel模块

Qukatie 7 miesięcy temu
rodzic
commit
bb42422c9e

+ 214 - 0
src/views/boxManagement/boxPoolDynamics/components/importModule.vue

@@ -0,0 +1,214 @@
+<template>
+    <div>
+        <el-dialog title="导入数据" append-to-body :visible.sync="excelBox" width="60%" :close-on-click-modal="false"
+            v-dialog-drag>
+            <span>
+                <avue-crud v-if="excelBox" :data="data" :option="option" :table-loading="loading"
+                    :cell-style="cellStyle" @selection-change="selectionChange">
+                    <template slot="menuLeft" slot-scope="{size}">
+                        <el-button type="primary" size="mini" icon="el-icon-download" @click="download()">
+                            下载模板
+                        </el-button>
+                        <el-upload :action="action" :headers="headers" :on-progress="onProgress" :show-file-list=false
+                            accept=".xls,.xlsx" multiple :on-success="onSuccess" :on-error="onError"
+                            :on-change="onChange" style="float: right">
+                            <el-button type="success" size="mini" icon="el-icon-upload">上传数据</el-button>
+                        </el-upload>
+                    </template>
+                </avue-crud>
+            </span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="excelBox = false" size="mini">取 消</el-button>
+                <el-button type="primary" @click="importData" size="mini">导 入</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { getDicinit } from "@/api/dicSelect/index";
+import { getToken } from "@/util/auth";
+export default {
+    data() {
+        return {
+            loading: false,
+            headers: { "Blade-Auth": 'Bearer ' + getToken() },
+            action: null,
+            excelBox: false,
+            data: [],
+            selectionList: [],
+            option: {
+                height: 500,
+                border: true,
+                align: 'center',
+                menu: false,
+                addBtn: false,
+                stripe: true,
+                tip: false,
+                selection: true,
+                column: [
+                    {
+                        label: '放箱号',
+                        prop: 'containerNumber',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱号',
+                        prop: 'boxCode',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱型',
+                        prop: 'boxType',
+                        overHidden: true,
+                    },
+                    {
+                        label: '港口',
+                        prop: 'portName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '场站',
+                        prop: 'stationName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '提单号',
+                        prop: 'mblno',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱动态',
+                        prop: 'boxStatus',
+                        overHidden: true,
+                    },
+                    {
+                        label: '动态日期',
+                        prop: 'boxStatusDate',
+                        overHidden: true,
+                    },
+                    {
+                        label: '单据号',
+                        prop: 'billNo',
+                        overHidden: true,
+                    },
+                    {
+                        label: '结果',
+                        prop: 'result',
+                        overHidden: true,
+                    },
+                    {
+                        label: '原因',
+                        prop: 'reason',
+                        overHidden: true,
+                    }
+                ]
+            },
+            url: null,
+            type: null
+        };
+    },
+    created() { },
+    methods: {
+        //文件上传时的钩子
+        onProgress(event, file, fileList) {
+            this.loading = true
+        },
+        //文件上传成功时的钩子
+        onSuccess(res, file) {
+            this.data = res.data
+            this.loading = false
+        },
+        //文件上传失败时的钩子
+        onError(err, file, fileList) {
+
+            let errorMsg = err.toString();
+            errorMsg = errorMsg.replace('Error:', '')
+            errorMsg = JSON.parse(errorMsg)
+            this.$message.error(errorMsg.msg);
+            this.loading = false
+        },
+        //上传成功和上传失败时都会被调用
+        onChange(file, fileList) {
+            // if (file.status == "fail") {
+            //     this.$message.error("上传失败");
+            // }
+        },
+        // //上传文件之前的钩子
+        // beforeUpload(file) {
+
+        // },
+        openDialog(type) {
+            this.data = []
+            this.selectionList = []
+            this.excelBox = true
+            if (type == 1) {
+                this.action = '/api/blade-los/boxPool/emptyContainerEntryAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerEntry'
+            }
+            if (type == 2) {
+                this.action = '/api/blade-los/boxPool/emptyContainerAppearanceAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerAppearance'
+            }
+            if (type == 3) {
+                this.action = '/api/blade-los/boxPool/giveAnEncoreAnalysis'
+                this.url = '/blade-los/boxPool/giveAnEncore'
+            }
+            if (type == 4) {
+                this.action = '/api/blade-los/boxPool/returnEmptyAnalysis'
+                this.url = '/blade-los/boxPool/returnEmpty'
+            }
+            this.type = type
+        },
+        download() {
+            if (this.type == 1) {
+                window.open(`/api/blade-los/boxPool/emptyContainerEntry/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 2) {
+                window.open(`/api/blade-los/boxPool/emptyContainerAppearance/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 3 || this.type == 4) {
+                window.open(`/api/blade-los/boxPool/giveAnEncore/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+        },
+        selectionChange(list) {
+            this.selectionList = list
+        },
+        importData() {
+            if (this.data.length == 0) {
+                return this.$message.error("请上传数据");
+            }
+            if (this.selectionList.length == 0) {
+                return this.$message.error("请选择数据");
+            }
+            this.loading = true
+            getDicinit('POST', this.url, this.selectionList).then(res => {
+                console.log(11111)
+                this.excelBox = false
+                this.$emit('refreshData')
+            }).finally(() => {
+                this.loading = false;
+            })
+
+        },
+        cellStyle({ row, column, rowIndex, columnIndex }) {
+            if (row.result == '失败') {
+                return {
+                    color: '#F56C6C',
+                }
+            } else {
+                return {
+                    color: '##67C23A',
+                }
+            }
+        }
+    }
+}
+
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-dialog__body {
+    padding: 10px 8px !important;
+}
+</style>

+ 48 - 33
src/views/boxManagement/boxPoolDynamics/index.vue

@@ -1,15 +1,18 @@
 <template>
     <div>
         <basic-container v-if="isShow">
-            <el-button v-if="roleName.includes('admin')||roleName.includes('箱管')" type="warning" plain size="small"
+            <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="warning" plain size="small"
                 @click="allClick('POL空箱提箱进场(EXCEL)')">POL空箱提箱进场(EXCEL)</el-button>
 
-            <el-button v-if="roleName.includes('admin')||roleName.includes('箱管')" type="success" plain size="small" @click="allClick('POL空箱出场(EXCEL)')">POL空箱出场(EXCEL)</el-button>
-            <el-button v-if="roleName.includes('admin')||roleName.includes('箱管')" type="info" plain size="small" @click="allClick('POD空箱进场(EXCEL)')">POD空箱进场(EXCEL)</el-button>
+            <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="success" plain size="small"
+                @click="allClick('POL空箱出场(EXCEL)')">POL空箱出场(EXCEL)</el-button>
+            <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="info" plain size="small"
+                @click="allClick('POD空箱进场(EXCEL)')">POD空箱进场(EXCEL)</el-button>
             <!-- <el-button type="primary" plain size="small"
                                 @click="allClick('POL返场(EXCEL)')">POL返场(EXCEL)</el-button> -->
 
-            <el-button v-if="roleName.includes('admin')||roleName.includes('箱管')" type="danger" plain size="small" @click="allClick('POL无货返空(EXCEL)')">POL无货返空(EXCEL)</el-button>
+            <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="danger" plain size="small"
+                @click="allClick('POL无货返空(EXCEL)')">POL无货返空(EXCEL)</el-button>
 
             <el-tabs v-model="activeName" type="card" style="margin-top: 8px;">
                 <el-tab-pane label="按港口" name="1">
@@ -76,6 +79,7 @@
                     温馨提示 第一次导入时请先下载模板
                 </p>
             </el-dialog>
+            <import-module ref="importModule" @refreshData="refreshData" />
         </basic-container>
         <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
     </div>
@@ -85,6 +89,7 @@
 import { getList, getList2, getList3 } from "@/api/boxManagement/boxPoolDynamics/index.js";
 import { getWorkDicts } from "@/api/system/dictbiz";
 import detailsPage from "./detailsPage";
+import importModule from "./components/importModule.vue";
 import { getToken } from "@/util/auth";
 import _ from "lodash";
 export default {
@@ -570,12 +575,18 @@ export default {
         };
     },
     components: {
-        detailsPage
+        detailsPage,
+        importModule
     },
     async created() {
         this.option2 = await this.getColumnData(this.getColumnName(466), this.optionBack2);
     },
     methods: {
+        refreshData() {
+            this.refreshChange()
+            this.refreshChange2()
+            this.refreshChange3()
+        },
         uploadBefore(file, done, loading) {
             done();
             loading = true;
@@ -614,40 +625,44 @@ export default {
         },
         allClick(name) {
             if (name == 'POL空箱出场(EXCEL)') {
-                this.excelOption.column.forEach(item => {
-                    if (item.prop == 'excelFile') {
-                        item.action = "/api/blade-los/boxPool/emptyContainerAppearance"
-                    }
-                })
-                this.excelType = 1
-                this.excelBox = true
+                this.$refs.importModule.openDialog(2)
+                // this.excelOption.column.forEach(item => {
+                //     if (item.prop == 'excelFile') {
+                //         item.action = "/api/blade-los/boxPool/emptyContainerAppearance"
+                //     }
+                // })
+                // this.excelType = 1
+                // this.excelBox = true
             }
             if (name == 'POD空箱进场(EXCEL)') {
-                this.excelOption.column.forEach(item => {
-                    if (item.prop == 'excelFile') {
-                        item.action = "/api/blade-los/boxPool/giveAnEncore"
-                    }
-                })
-                this.excelType = 3
-                this.excelBox = true
+                this.$refs.importModule.openDialog(3)
+                // this.excelOption.column.forEach(item => {
+                //     if (item.prop == 'excelFile') {
+                //         item.action = "/api/blade-los/boxPool/giveAnEncore"
+                //     }
+                // })
+                // this.excelType = 3
+                // this.excelBox = true
             }
             if (name == 'POL无货返空(EXCEL)') {
-                this.excelOption.column.forEach(item => {
-                    if (item.prop == 'excelFile') {
-                        item.action = "/api/blade-los/boxPool/returnEmpty"
-                    }
-                })
-                this.excelType = 3
-                this.excelBox = true
+                this.$refs.importModule.openDialog(4)
+                // this.excelOption.column.forEach(item => {
+                //     if (item.prop == 'excelFile') {
+                //         item.action = "/api/blade-los/boxPool/returnEmpty"
+                //     }
+                // })
+                // this.excelType = 3
+                // this.excelBox = true
             }
             if (name == 'POL空箱提箱进场(EXCEL)') {
-                this.excelOption.column.forEach(item => {
-                    if (item.prop == 'excelFile') {
-                        item.action = "/api/blade-los/boxPool/emptyContainerEntry"
-                    }
-                })
-                this.excelType = 2
-                this.excelBox = true
+                this.$refs.importModule.openDialog(1)
+                // this.excelOption.column.forEach(item => {
+                //     if (item.prop == 'excelFile') {
+                //         item.action = "/api/blade-los/boxPool/emptyContainerEntry"
+                //     }
+                // })
+                // this.excelType = 2
+                // this.excelBox = true
             }
         },
         addButton() {

+ 3 - 3
src/views/iosBasicData/OceanFreightImport/bills/assembly/EntrustmentLnformation.vue

@@ -649,7 +649,7 @@
                                     </span>
                                     <el-input ref="quantityRef" style="width: 100%;" v-model="assemblyForm.quantity"
                                         size="small" autocomplete="off" min="1"
-                                        :disabled="detailData.seeDisabled || (assemblyForm.masterBillNo && assemblyForm.billType == 'MH')"
+                                        :disabled="detailData.seeDisabled"
                                         @input="quantityInput" @focus="quantityFocus" clearable
                                         placeholder="请输入件数"></el-input>
                                 </el-form-item>
@@ -689,7 +689,7 @@
                                     </span>
                                     <el-input ref="grossWeightRef" step="0.01" style="width: 100%;"
                                         v-model="assemblyForm.grossWeight" size="small" autocomplete="off"
-                                        :disabled="detailData.seeDisabled || (assemblyForm.masterBillNo && assemblyForm.billType == 'MH')"
+                                        :disabled="detailData.seeDisabled"
                                         @input="floatingInput($event, 'grossWeight')" @focus="quantityFocus" clearable
                                         placeholder="请输入毛重"></el-input>
                                 </el-form-item>
@@ -702,7 +702,7 @@
                                     </span>
                                     <el-input ref="measurementRef" step="0.01" style="width: 106%;"
                                         v-model="assemblyForm.measurement" size="small" autocomplete="off"
-                                        :disabled="detailData.seeDisabled || (assemblyForm.masterBillNo && assemblyForm.billType == 'MH')"
+                                        :disabled="detailData.seeDisabled"
                                         @input="floatingInput($event, 'measurement')" @focus="quantityFocus" clearable
                                         placeholder="请输入尺码/体积"></el-input>
                                 </el-form-item>

+ 3 - 3
src/views/iosBasicData/SeafreightExportF/bills/assembly/EntrustmentLnformation.vue

@@ -549,7 +549,7 @@
                                     </span>
                                     <el-input ref="quantityRef" style="width: 100%;" v-model="assemblyForm.quantity"
                                         size="small" autocomplete="off" min="1"
-                                        :disabled="detailData.seeDisabled || assemblyForm.billType == 'MH'"
+                                        :disabled="detailData.seeDisabled"
                                         @input="quantityInput" @focus="quantityFocus" clearable
                                         placeholder="请输入件数"></el-input>
                                 </el-form-item>
@@ -589,7 +589,7 @@
                                     </span>
                                     <el-input ref="grossWeightRef" step="0.01" style="width: 100%;"
                                         v-model="assemblyForm.grossWeight" size="small" autocomplete="off"
-                                        :disabled="detailData.seeDisabled || assemblyForm.billType == 'MH'"
+                                        :disabled="detailData.seeDisabled"
                                         @input="floatingInput($event, 'grossWeight')" @focus="quantityFocus" clearable
                                         placeholder="请输入毛重"></el-input>
                                 </el-form-item>
@@ -602,7 +602,7 @@
                                     </span>
                                     <el-input ref="measurementRef" step="0.01" style="width: 106%;"
                                         v-model="assemblyForm.measurement" size="small" autocomplete="off"
-                                        :disabled="detailData.seeDisabled || assemblyForm.billType == 'MH'"
+                                        :disabled="detailData.seeDisabled"
                                         @input="floatingInput($event, 'measurement')" @focus="quantityFocus" clearable
                                         placeholder="请输入尺码/体积"></el-input>
                                 </el-form-item>