<template>
    <div>
        <div class="customer-head">
            <div class="customer-back">
                <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
                    @click="goBack(0)">返回列表
                </el-button>
            </div>
            <div class="add-customer-btn">
                <el-button size="small" style="margin-right: 8px" :disabled="!form.id" @click="$refs.print.openDialog()">预 览
                </el-button>
                <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
                    v-if="editButton"
                    :disabled="showLock || !(roleName.indexOf('admin') != -1 || roleName.indexOf('允许修改他人业务') != -1 || saberUserInfo.user_id == form.createUser)"
                    @click="inEdit">编 辑
                </el-button>
                <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small"
                    :disabled="isSaveBtn || form.status != 0" @click="submit">保 存
                </el-button>
                <el-button v-if="form.id" class="el-button--small-yh" style="margin-left: 6px;" type="success" size="small"
                    :disabled="(form.status != 0 && form.status != 4)" @click="application">单据请核
                </el-button>
                <el-button v-if="form.status == 1" class="el-button--small-yh" style="margin-left: 6px;" type="danger"
                    size="small" @click="revokeApplication">撤销单据请核
                </el-button>
                <el-dropdown style="line-height: 0">
                    <el-button class="el-button--small-yh" style="margin-left: 6px;" type="warning" :disabled="!form.id"
                        size="small">
                        审 批<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">审核进度
                        </el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </div>
        </div>
        <div style="margin-top: 50px">
            <trade-card title="基础信息">
                <avue-form :option="optionForm" v-model="form" ref="form">
                    <template slot="corpCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('客户')">客户:</span>
                    </template>
                    <template slot="hshipperCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('客户')">发货人:</span>
                    </template>
                    <template slot="hconsigneeCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('客户')">收货人:</span>
                    </template>
                    <template slot="mnotifyCntyCodeLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('原产地')">原产地:</span>
                    </template>
                    <template slot="polCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('港口')">起运港:</span>
                    </template>
                    <template slot="podCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('港口')">目的港:</span>
                    </template>
                    <template slot="vesselCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('船名')">船名:</span>
                    </template>
                    <template slot="carrierCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('客户')">船公司:</span>
                    </template>
                    <template slot="bookingAgentCnNameLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('客户')">船代:</span>
                    </template>
                    <template slot="hscodeLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('HSCODE')">HSCODE:</span>
                    </template>
                    <template slot="packingUnitLabel">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('包装')">包装:</span>
                    </template>
                    <tempalte slot="corpCnName">
                        <dic-select v-model="form.corpCnName" placeholder="客户" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="dicChange('corpCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <tempalte slot="polCnName">
                        <dic-select v-model="form.polCnName" placeholder="起运港" key="id" label="cnName" res="records"
                            url="/blade-los/bports/list" :filterable="true" :remote="true" dataName="cnName"
                            @selectChange="dicChange('polCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <tempalte slot="podCnName">
                        <dic-select v-model="form.podCnName" placeholder="目的港" key="id" label="cnName" res="records"
                            url="/blade-los/bports/list" :filterable="true" :remote="true" dataName="cnName"
                            @selectChange="dicChange('podCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <!-- <tempalte slot="srcCnName">
                        <dic-select v-model="form.srcCnName" placeholder="业务员" key="id" label="realName" res="records"
                            url="/blade-user/page" :filterable="true" :remote="true" dataName="realName"
                            @selectChange="dicChange('srcCnName', $event)" :disabled="editDisabled"></dic-select>
                    </tempalte> -->
                    <tempalte slot="srcType" slot-scope="{ row }">
                        <div style="display: flex;">
                            <dic-select style="margin-right: 4px;" v-model="form.srcType" placeholder="业务来源" key="dictKey"
                                keyValue="dictKey" label="dictValue"
                                url="/blade-system/dict-biz/dictionary?code=source_Type" :filterable="true"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                                @selectChange="dicChange('srcType', $event)"></dic-select>
                            <el-input v-show="!form.srcType" v-model="form.srcCnName" placeholder="请选择" :disabled="true">
                            </el-input>
                            <dic-select v-show="form.srcType == 'OWN'" v-model="form.srcCnName" placeholder="所属公司" key="id"
                                label="deptName" url="/blade-system/dept/lazy-list?parentId=0" :filterable="true"
                                @selectChange="dicChange('srcCnName', $event)"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></dic-select>
                            <dic-select v-show="form.srcType == 'AGENT'" v-model="form.srcCnName" placeholder="代理" key="id"
                                label="cnName" res="records" url="/blade-los/bcorps/listByType?corpTypeName=代理客户"
                                :filterable="true" :remote="true" dataName="cnName"
                                @selectChange="dicChange('srcCnName', $event)"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></dic-select>
                            <dic-select v-show="form.srcType == 'SALES'" v-model="form.srcCnName" placeholder="业务员" key="id"
                                label="realName" res="records" url="/blade-user/page" :filterable="true" :remote="true"
                                dataName="realName" @selectChange="dicChange('srcCnName', $event)"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></dic-select>
                        </div>
                    </tempalte>
                    <tempalte slot="hshipperCnName">
                        <dic-select v-model="form.hshipperCnName" placeholder="发货人" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=国外工厂" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="dicChange('hshipperCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <tempalte slot="hconsigneeCnName">
                        <dic-select v-model="form.hconsigneeCnName" placeholder="收货人" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=国内贸易商" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="dicChange('hconsigneeCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <tempalte slot="carrierCnName">
                        <dic-select v-model="form.carrierCnName" placeholder="船公司" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=船公司" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="dicChange('carrierCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></dic-select>
                    </tempalte>
                    <tempalte slot="bookingAgentCnName">
                        <dic-select v-model="form.bookingAgentCnName" placeholder="船代" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=船代" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="dicChange('bookingAgentCnName', $event)"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            :searchShow="true"></dic-select>
                    </tempalte>
                    <!-- <template slot="hscode">
                        <div style="display:flex;">
                            <dic-select v-model="form.hscode" placeholder="品名" key="id" res="records" label="hsCode"
                                url="/blade-los/bcommodity/list" :filterable="true" :remote="true" dataName="hsCode"
                                @selectChange="dicChange('hscode', $event)"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></dic-select>
                            <el-input style="margin-left: 10px;" v-model="form.commodityCnName" placeholder="请输入品名"
                                :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"></el-input>
                        </div>
                    </template> -->
                    <tempalte slot="mnotifyCntyCode" slot-scope="{ row }">
                        <dic-select v-model="form.mnotifyCntyCode" placeholder="原产地" key="id" label="cnName" res="records"
                            url="/blade-los/bcountrys/list" :filterable="true" :remote="true" dataName="cnName"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            @selectChange="dicChange('mnotifyCntyCode', $event)" :searchShow="true"></dic-select>
                    </tempalte>
                </avue-form>
            </trade-card>
            <trade-card title="箱信息">
                <avue-crud :option="option" :data="form.preContainersList" id="out-table" ref="crud"
                    @selection-change="selectionChange" @resetColumn="resetColumn('crud', 'option', 'optionBack', 388)"
                    @saveColumn="saveColumn('crud', 'option', 'optionBack', 388)">
                    <template slot="indexHeader" slot-scope="{row,index}">
                        <el-button type="primary" size="mini" icon="el-icon-plus"
                            :disabled="editDisabled || form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') !== -1"
                            circle @click="addRow()">
                        </el-button>
                    </template>
                    <template slot="cntrTypeCodeHeader" slot-scope="{column}">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('箱型')">{{ (column || {}).label
                        }}</span>
                    </template>
                    <template slot="goodsNameHeader" slot-scope="{column}">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('HSCODE')">{{ (column || {}).label
                        }}</span>
                    </template>
                    <template slot="hsCodeHeader" slot-scope="{column}">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('HSCODE')">{{ (column || {}).label
                        }}</span>
                    </template>
                    <template slot="goodsTypeHeader" slot-scope="{column}">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('类型')">{{ (column || {}).label
                        }}</span>
                    </template>
                    <template slot="index" slot-scope="{row,index}">
                        <span>{{ index + 1 }}</span>
                    </template>
                    <template slot="cntrTypeCode" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit && !row.srcId" v-model="row.cntrTypeCode" placeholder="箱型" key="id"
                            res="records" label="cnName" url="/blade-los/bcntrtypes/list" :filterable="true" :remote="true"
                            dataName="cnName"></dic-select>
                        <span v-else>{{ row.cntrTypeCode }}</span>
                    </template>
                    <template slot="boxNo" slot-scope="{ row }">
                        <el-input v-if="row.$cellEdit && !row.srcId" v-model="row.boxNo" placeholder="请输入内容"
                            size="small"></el-input>
                        <span v-else>{{ row.boxNo }}</span>
                    </template>
                    <template slot="hsCodeForm" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit" v-model="row.hsCode" placeholder="HSCODE" key="id" res="records"
                            label="hsCode" url="/blade-los/bcommodity/list" :filterable="true" :remote="true"
                            dataName="hsCode" @selectChange="rowDicChange('hsCode', $event, row)"></dic-select>
                        <span v-else>{{ row.hsCode }}</span>
                    </template>
                    <template slot="goodsName" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit && !row.srcId" v-model="row.goodsName" placeholder="品名" key="id"
                            res="records" label="cnName" url="/blade-los/bcommodity/list" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="rowDicChange('goodsName', $event, row)"></dic-select>
                        <span v-else>{{ row.goodsName }}</span>
                    </template>
                    <tempalte slot="goodsType" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit && !row.srcId" v-model="row.goodsType" placeholder="类型"
                            key="dictKey" label="dictValue" url="/blade-system/dict-biz/dictionary?code=goods-type"
                            :filterable="true"></dic-select>
                        <span v-else>{{ row.goodsType }}</span>
                    </tempalte>
                    <tempalte slot="number" slot-scope="{ row }">
                        <el-input-number v-if="row.$cellEdit && !row.srcId" v-model="row.number" :controls="false"
                            placeholder="请输入 件数" size="small" style="width: 100%;"
                            @change="amountChange(row)"></el-input-number>
                        <span v-else>{{ row.number }}</span>
                    </tempalte>
                    <tempalte slot="netWeight" slot-scope="{ row }">
                        <el-input-number v-if="row.$cellEdit && !row.srcId" v-model="row.netWeight" :controls="false"
                            placeholder="请输入 净重" size="small" style="width: 100%;"></el-input-number>
                        <span v-else>{{ row.netWeight }}</span>
                    </tempalte>
                    <tempalte slot="amount" slot-scope="{ row }">
                        <el-input-number v-if="row.$cellEdit && !row.srcId" v-model="row.amount" :controls="false"
                            placeholder="请输入 总金额" size="small" style="width: 100%;"
                            @change="amountChange(row)"></el-input-number>
                        <span v-else>{{ row.amount }}</span>
                    </tempalte>
                    <template slot="menu" slot-scope="{ row, index }">
                        <el-button size="small" type="text" :disabled="editDisabled || row.whetherDispatchVehicles == 1"
                            @click="rowCell('箱编辑', row, index)">{{ row.$cellEdit ? '保 存' : '编 辑' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.type == 2"
                            @click="rowCell('派车', row, index)">{{ row.type == 1 ? '撤销派车' : '派车' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.type == 1"
                            @click="rowCell('自提', row, index)">{{ row.type == 2 ? '撤销自提' : '自 提' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.whetherDispatchVehicles == 1"
                            @click="rowCell('箱删除', row, index)">删 除</el-button>
                    </template>
                </avue-crud>
            </trade-card>
            <trade-card title="派车">
                <avue-crud :option="option2" :data="form.dispatchVehiclesList" id="out-table" ref="crud2"
                    @selection-change="selectionChange" @resetColumn="resetColumn('crud2', 'option2', 'optionBack2', 389)"
                    @saveColumn="saveColumn('crud2', 'option2', 'optionBack2', 389)">
                    <tempalte slot="fleetName" slot-scope="{ row, index }">
                        <dic-select v-if="row.$cellEdit" v-model="row.fleetName" placeholder="承运车队" key="id" label="cnName"
                            res="records" url="/blade-los/bcorps/listByType?corpTypeName=车队" :filterable="true"
                            :remote="true" dataName="cnName" @selectChange="rowDicChange('fleetName', $event, row)"
                            :disabled="editDisabled"></dic-select>
                        <span v-else>{{ row.fleetName }}</span>
                    </tempalte>
                    <tempalte slot="pickupAddressName" slot-scope="{ row, index }">
                        <dic-select v-if="row.$cellEdit" v-model="row.pickupAddressName" placeholder="提箱地点" key="id"
                            label="cnName" res="records" url="/blade-los/blocations/list" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="rowDicChange('pickupAddressName', $event, row)"
                            :disabled="editDisabled"></dic-select>
                        <span v-else>{{ row.pickupAddressName }}</span>
                    </tempalte>
                    <tempalte slot="deliveryAddressName" slot-scope="{ row, index }">
                        <dic-select v-if="row.$cellEdit" v-model="row.deliveryAddressName" placeholder="送货地点" key="id"
                            label="cnName" res="records" url="/blade-los/blocations/list" :filterable="true" :remote="true"
                            dataName="cnName" @selectChange="rowDicChange('deliveryAddressName', $event, row)"
                            :disabled="editDisabled"></dic-select>
                        <span v-else>{{ row.deliveryAddressName }}</span>
                    </tempalte>
                    <!-- <template slot="returnCyName" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit" v-model="row.returnCyName" placeholder="返空场站" key="id"
                            label="cnName" res="records" url="/blade-los/bcorps/listByType?corpTypeName=场站"
                            :filterable="true" :remote="true" dataName="cnName"
                            @selectChange="rowDicChange('returnCyName', $event, row)"></dic-select>
                        <span v-else>{{ row.returnCyName }}</span>
                    </template> -->
                    <template slot="menu" slot-scope="{ row, index }">
                        <el-button size="small" type="text"
                            :disabled="editDisabled || row.whetherDispatchVehicles == 1 || row.whetherWarehouseEntry == 1"
                            @click="rowCell('派车编辑', row, index)">
                            {{ row.$cellEdit ? '保 存' : '编 辑' }}
                        </el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.$cellEdit"
                            @click="rowCell('还箱', row, index)">{{ row.whetherReturn == 1 ? '撤销还箱' : '确认还箱' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.$cellEdit"
                            @click="rowCell('查验/倒柜派车', row, index)">{{ row.whetherInspection == 1 ? '撤销查验/倒柜派车' : '查验/倒柜派车'
                            }}</el-button>
                        <el-button size="small" type="text"
                            :disabled="editDisabled || row.whetherWarehouseEntry == 1 || row.$cellEdit"
                            @click="rowCell('入库派车', row, index)">
                            {{ row.whetherDispatchVehicles == 1 ? '撤销入库派车' : '入库派车' }}
                        </el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.$cellEdit"
                            @click="rowCell('生成入库', row, index)">{{ row.whetherWarehouseEntry == 1 ? '撤销入库' : '入 库'
                            }}</el-button>
                        <!-- <el-button size="small" type="text"
                            :disabled="editDisabled || row.whetherDispatchVehicles == 1 || row.whetherWarehouseEntry == 1"
                            @click="rowCell('派车删除', row, index)">删 除</el-button> -->
                    </template>
                </avue-crud>
            </trade-card>
            <trade-card title="入库">
                <avue-crud :option="option3" :data="form.inStorageList" id="out-table" ref="crud3"
                    @selection-change="selectionChange" @resetColumn="resetColumn('crud3', 'option3', 'optionBack3', 390)"
                    @saveColumn="saveColumn('crud3', 'option3', 'optionBack3', 390)">
                    <template slot="storageUnitHeader" slot-scope="{column}">
                        <span style="color: #1e9fff;cursor: pointer;" @click="inJump('入库单位')">{{ (column || {}).label
                        }}</span>
                    </template>
                    <template slot="warehouseName" slot-scope="{ row }">
                        <dic-select v-if="row.$cellEdit" v-model="row.warehouseName" placeholder="入库" key="id" label="cname"
                            url="/blade-los/storage/list" res="records" :filterable="true" :remote="true" dataName="cname"
                            @selectChange="rowDicChange('warehouseName', $event, row)"></dic-select>
                        <span v-else>{{ row.warehouseName }}</span>
                    </template>
                    <template slot="menu" slot-scope="{ row, index }">
                        <el-button size="small" type="text" :disabled="editDisabled || row.confirmDispatchVehicles == 1"
                            @click="rowCell('入库编辑', row, index)">
                            {{ row.$cellEdit ? '保 存' : '编 辑' }}
                        </el-button>
                        <el-button size="small" type="text"
                            :disabled="editDisabled || row.whetherInOutStorage == 1 || row.$cellEdit"
                            @click="rowCell('入库确认', row, index)">
                            {{ row.confirmDispatchVehicles == 1 ? '撤销确认' : '入库确认' }}
                        </el-button>
                        <el-button size="small" type="text"
                            :disabled="editDisabled || row.surplusQuantity == 0 || row.$cellEdit"
                            @click="rowCell('生成出库', row, index)">
                            出 库
                        </el-button>
                        <el-button size="small" type="text"
                            :disabled="editDisabled || row.surplusQuantity == 0 || row.$cellEdit"
                            @click="rowCell('撤销出库', row, index)">
                            撤销出库
                        </el-button>
                        <!-- <el-button size="small" type="text"
                            :disabled="editDisabled || row.confirmDispatchVehicles == 1 || row.whetherInOutStorage == 1"
                            @click="rowCell('入库删除', row, index)">删 除</el-button> -->
                    </template>
                </avue-crud>
            </trade-card>
            <trade-card title="出库">
                <avue-crud :option="option4" :data="form.outStorageList" id="out-table" ref="crud4"
                    @selection-change="selectionChange" @resetColumn="resetColumn('crud4', 'option4', 'optionBack4', 391)"
                    @saveColumn="saveColumn('crud4', 'option4', 'optionBack4', 391)">
                    <template slot="menu" slot-scope="{ row, index }">
                        <el-button size="small" type="text" :disabled="editDisabled || row.confirmDispatchVehicles == 1"
                            @click="rowCell('出库编辑', row, index)">{{ row.$cellEdit ? '保 存' : '编 辑' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled" @click="rowCell('出库确认', row, index)">{{
                            row.confirmDispatchVehicles ==
                            1 ? '撤销确认' : '出库确认' }}</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled" @click="rowCell('开票', row, index)">开
                            票</el-button>
                        <el-button size="small" type="text" :disabled="editDisabled || row.confirmDispatchVehicles == 1"
                            @click="rowCell('出库删除', row, index)">删 除</el-button>
                    </template>
                </avue-crud>
            </trade-card>
            <trade-card title="费用明细">
                <fee-info ref="feeInfo" :form="form" :disabled="editDisabled" @getDetails="getDetails"></fee-info>
            </trade-card>
            <containerTitle title="上传附件"></containerTitle>
            <c-upload :data="form.filesList" :enumerationValue="76" deleteUrl="/api/blade-los/filescenter/remove" display
                :disabled="editDisabled"></c-upload>
        </div>
        <business-reports :id="form.id" ref="print" businessValue="HYJK" classifyCode="业务" groupCode="销售报告"
            :type="1"></business-reports>
        <!--审核弹窗-->
        <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
            :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
            <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
        </el-dialog>
        <el-dialog append-to-body title="查验/倒柜派车" :visible.sync="carVisible" width="40%" :close-on-click-modal="false"
            v-dialog-drag @closed="carClosed">
            <span>
                <avue-form :option="carOption" v-model="carForm">
                    <tempalte slot="inspectionFleetName">
                        <dic-select v-model="carForm.inspectionFleetName" placeholder="承运车队" key="id" label="cnName"
                            res="records" url="/blade-los/bcorps/listByType?corpTypeName=车队" :filterable="true"
                            :remote="true" dataName="cnName"
                            @selectChange="dicChange('inspectionFleetName', $event)"></dic-select>
                    </tempalte>
                </avue-form>
            </span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="carVisible = false">取 消</el-button>
                <el-button type="primary" @click="carSubmit(carForm)">确 定</el-button>
            </span>
        </el-dialog>
        <el-dialog append-to-body title="还箱" :visible.sync="boxVisible" width="40%" :close-on-click-modal="false"
            v-dialog-drag @closed="boxClosed()">
            <span>
                <avue-form :option="boxOption" v-model="boxForm">
                    <template slot="returnCyName">
                        <dic-select v-model="boxForm.returnCyName" placeholder="返空场站" key="id" label="cnName" res="records"
                            url="/blade-los/bcorps/listByType?corpTypeName=场站" :filterable="true" :remote="true"
                            dataName="cnName"></dic-select>
                    </template>
                </avue-form>
            </span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="boxVisible = false">取 消</el-button>
                <el-button type="primary" @click="boxSubmit(boxForm)">确 定</el-button>
            </span>
        </el-dialog>
        <dictbiz-dialog ref="dictbiz" :title="dicTitle" :code="dicCode" :parentId="parentId" @closed="getAllWorkDicts">
        </dictbiz-dialog>
    </div>
</template>

<script>
import { submit, getDetail, detailTradeByMblno, remove, checkAgent, revokeCheckAgent, copyAgent, generateDispatchVehicles, confirmDispatchVehicles, generateWarehouseEntry, confirmWarehouseEntry, generateOutbound, dispatchvehiclesRemove, inoutstorageRemove, calculationWarehouseUnitPrice, billsCopyBills, submitList1, submitList2, revokePrecontainers, revokeDispatchVehicles, revokeWarehouseEntry, revokeInoutstorage, revokeOutbound, confirmInspection, revokeInspection, confirmReturnBox, revokeReturnBox } from "@/api/tradeAgency/oceanFreightImport";
import { contrastObj, contrastList } from "@/util/contrastData";
import feeInfo from "@/components/tradeAgency/fee-oceanFreight";
import dicSelect from "@/components/dicSelect/main";
import checkSchedule from "@/components/checkH/checkSchedule.vue";
import businessReports from "@/components/tradeAgency/businessReportsJK.vue";
import { precontainersRemove } from "@/api/iosBasicData/ReceivingOrders/precontainers";
import _ from "lodash";
export default {
    name: "detailsPage",
    data() {
        return {
            dicTitle: null,
            parentId: null,
            dicCode: null,
            carForm: {
                // id: null,
                // inspectionFleetId: null,
                // inspectionFleetName: null,
                // inspectionLicenseNumber: null,
                // inspectionFullName: null,
                // inspectionContactInformation: null
            },
            boxForm: {
                // id: null,
                // returnDate: null,
                // returnCyName: null,
            },
            boxVisible: false,
            carVisible: false,
            checkId: '', // 审核需要的id
            batchNo: '',
            checkScheduleDialog: false, // 审核弹窗
            editButton: false,
            editDisabled: false,
            form: {
                billNoFormat: 'HYJK',
                businessTypeCode: 'HYJK',
                businessType: 'SI',
                status: 0,
                seaType: 'I',
                billingStatus: 0,
                mshipperCntyName: '一般贸易',
                feeCenterListC: [],
                feeCenterListD: [],
                filesList: [],
                inStorageList: [],//入库
                outStorageList: [],//出库
                dispatchVehiclesList: [],//派车
                preContainersList: []//箱信息
            },
            oldForm: {
                billNoFormat: 'HYJK',
                businessTypeCode: 'HYJK',
                businessType: 'SI',
                status: 0,
                seaType: 'I',
                billingStatus: 0,
                mshipperCntyName: '一般贸易',
                feeCenterListC: [],
                feeCenterListD: [],
                filesList: [],
                inStorageList: [],//入库
                outStorageList: [],//出库
                dispatchVehiclesList: [],//派车
                preContainersList: []//箱信息
            },
            optionForm: {
                menuBtn: false,
                span: 8,
                disabled: false,
                column: [
                    {
                        label: '客户',
                        prop: "corpCnName",
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "委托编号",
                        prop: "billNo",
                        disabled: true,
                    },
                    {
                        label: "提单号",
                        prop: "mblno",
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: '合同号',
                        prop: "bookingNo",
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: '原产地',
                        prop: "mnotifyCntyCode",
                        type: 'select',
                        filterable: true,
                        remote: true,
                        dicUrl: "/api/blade-los/bcountrys/list",
                        props: {
                            label: 'cnName',
                            value: 'cnName',
                            res: 'data.records'
                        },
                        disabled: false,
                    },
                    {
                        label: '运输方式',
                        prop: "mnotifyCntyName",
                        type: 'select',
                        filterable: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=mode_transport",
                        props: {
                            label: 'dictValue',
                            value: 'dictValue',
                        },
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "发货人",
                        prop: "hshipperCnName",
                        disabled: false,
                    },
                    {
                        label: "收货人",
                        prop: "hconsigneeCnName",
                        disabled: false,
                    },
                    {
                        label: "船名",
                        prop: "vesselCnName",
                        type: 'select',
                        filterable: true,
                        remote: true,
                        allowCreate: true,
                        dicUrl: "/api/blade-los/bvessels/list?cnName={{key}}",
                        props: {
                            label: 'cnName',
                            value: 'cnName',
                            res: 'data.records'
                        },
                        disabled: false,
                    },
                    {
                        label: "航次",
                        prop: "voyageNo",
                        overHidden: true,
                    },
                    {
                        label: '起运港',
                        prop: "polCnName",
                        disabled: false,
                    },
                    {
                        label: '目的港',
                        prop: "podCnName",
                        disabled: false,
                    },
                    {
                        label: "开船日期",
                        prop: "etd",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                    },
                    {
                        label: "预计到港",
                        prop: "bookingDate",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                    },
                    {
                        label: "实际到港",
                        prop: "eta",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "船公司",
                        prop: "carrierCnName",
                        disabled: false,
                    },
                    {
                        label: "船代",
                        prop: "bookingAgentCnName",
                        disabled: false,
                    },
                    {
                        label: '装箱方式',
                        prop: "loadType",
                        type: 'select',
                        dicData: [{
                            label: '整箱',
                            value: 'FCL'
                        }, {
                            label: '拼箱',
                            value: 'LCL'
                        }],
                        disabled: false,
                    },
                    // {
                    //     label: "HSCODE",
                    //     prop: "hscode",
                    //     disabled: false,
                    // },
                    {
                        label: "件数",
                        prop: "quantity",
                        disabled: false,
                    },
                    {
                        label: "包装",
                        prop: "packingUnit",
                        type: 'select',
                        filterable: true,
                        remote: true,
                        dicUrl: "/api/blade-los/bpackages/list?cnName={{key}}",
                        props: {
                            label: 'cnName',
                            value: 'cnName',
                            res: 'data.records'
                        },
                        disabled: false,
                    },
                    {
                        label: "尺码",
                        prop: "measurement",
                        disabled: false,
                    },
                    {
                        label: "毛重",
                        prop: "grossWeight",
                        disabled: false,
                    },
                    {
                        label: "净重",
                        prop: "netWeight",
                        disabled: false,
                    },
                    {
                        label: "是否退押",
                        prop: "billingStatus",
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        disabled: false,
                    },
                    {
                        label: "放单方式",
                        prop: "mconsigneeCntyCode",
                        type: 'select',
                        filterable: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=release_method",
                        props: {
                            label: 'dictValue',
                            value: 'dictValue',
                        },
                        disabled: false,
                    },
                    {
                        label: "免箱期",
                        prop: "iqNo",
                        disabled: false,
                    },
                    {
                        label: '报关单号',
                        prop: "mnotify2CntyName",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: "报关日期",
                        prop: "issueDate",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                    },
                    {
                        label: "放行日期",
                        prop: "cyReturnTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                    },
                    {
                        label: "提箱码头",
                        prop: "charData",
                        type: 'select',
                        filterable: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=container_terminal",
                        props: {
                            label: 'dictValue',
                            value: 'dictValue',
                        },
                        disabled: false,
                    },
                    {
                        label: '业务来源',
                        prop: "srcType",
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '贸易方式',
                        prop: "mshipperCntyName",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=trade_Mode",
                        props: {
                            label: "dictValue",
                            value: "dictValue"
                        },
                        disabled: false,
                        rules: [{
                            required: true,
                            message: " ",
                            trigger: "blur"
                        }],
                    },
                    // {
                    //     label: '业务员',
                    //     prop: "srcCnName",
                    //     disabled: false,
                    //     rules: [{
                    //         required: true,
                    //         message: " ",
                    //         trigger: "blur"
                    //     }]
                    // },
                    {
                        label: '备注',
                        prop: "remarks",
                        type: 'textarea',
                        disabled: false,
                        span: 18,
                        minRows: 2,
                    },
                ]
            },
            carOption: {
                labelWidth: 120,
                menuBtn: false,
                span: 12,
                disabled: false,
                column: [
                    {
                        label: '查验/倒柜承运车队',
                        prop: "inspectionFleetName",
                        disabled: false,
                    },
                    {
                        label: '查验/倒柜车号',
                        prop: "inspectionLicenseNumber",
                        disabled: false,
                    },
                    {
                        label: '查验/倒柜姓名',
                        prop: "inspectionFullName",
                        disabled: false,
                    },
                    {
                        label: '查验/倒柜联系方式',
                        prop: "inspectionContactInformation",
                        disabled: false,
                    }
                ]
            },
            boxOption: {
                // labelWidth: 120,
                menuBtn: false,
                span: 12,
                disabled: false,
                column: [
                    {
                        label: "返空时间",
                        prop: "returnDate",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                    },
                    {
                        label: "返空场站",
                        prop: "returnCyName",
                    },
                ]
            },
            option: {},
            optionBack: {
                height: 'auto',
                calcHeight: 30,
                menuWidth: 180,
                tip: false,
                border: true,
                addBtn: false,
                viewBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                selection: true,
                align: 'center',
                column: [
                    {
                        label: "index",
                        prop: "index",
                        width: "55",
                        headerslot: true,
                    },
                    {
                        label: "箱型",
                        prop: "cntrTypeCode",
                        width: "100",
                        overHidden: true,
                    },
                    {
                        label: "箱号",
                        prop: "boxNo",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: "HSCODE",
                        prop: "hsCode",
                        width: "100",
                        overHidden: true,
                        cell: true,
                        slot: true,
                        formslot: true,
                        rules: [
                            {
                                required: true,
                                message: '请输入HSCODE',
                                trigger: 'blur'
                            }
                        ]
                    },
                    {
                        label: "品名",
                        prop: "goodsName",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: "类型",
                        prop: "goodsType",
                        width: "80",
                        overHidden: true
                    },
                    {
                        label: "件数",
                        prop: "number",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: "净重",
                        prop: "netWeight",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: "总金额",
                        prop: "amount",
                        width: "100",
                        overHidden: true
                    },
                    {
                        label: '币别',
                        prop: 'curCode',
                        type: 'select',
                        cell: true,
                        filterable: true,
                        dicData: [
                            { label: 'CNY', value: 'CNY' },
                            { label: 'USD', value: 'USD' }
                        ],
                        overHidden: true,
                    },
                    {
                        label: "查验类型",
                        prop: "inspectionType",
                        cell: true,
                        type: 'select',
                        filterable: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=inspection_type",
                        props: {
                            label: 'dictValue',
                            value: 'dictValue',
                        },
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "查验时间",
                        prop: "inspectionDate",
                        width: "100",
                        cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        overHidden: true
                    },
                    {
                        label: "是否机检",
                        prop: "whetherMachineInspection",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "90",
                        overHidden: true
                    },
                    {
                        label: "是否取样",
                        prop: "whetherSampling",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "90",
                        overHidden: true
                    },
                    {
                        label: "是否入库",
                        prop: "whetherWarehousing",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "90",
                        overHidden: true
                    },
                    {
                        label: "是否返场",
                        prop: "whetherReturnSite",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "90",
                        overHidden: true
                    },
                    // {
                    //     label: "是否还箱",
                    //     prop: "whetherReturn",
                    //     cell: true,
                    //     type: 'select',
                    //     dicData: [{
                    //         label: '是',
                    //         value: 1
                    //     }, {
                    //         label: '否',
                    //         value: 0
                    //     }],
                    //     width: "90",
                    //     overHidden: true
                    // },
                    {
                        label: "备注",
                        prop: "remarks",
                        width: "120",
                        cell: true,
                        overHidden: true
                    }
                ]
            },
            option2: {},
            optionBack2: {
                height: 'auto',
                calcHeight: 30,
                menuWidth: 360,
                tip: false,
                border: true,
                index: true,
                addBtn: false,
                viewBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                selection: true,
                align: 'center',
                column: [
                    {
                        label: "承运车队",
                        prop: "fleetName",
                        width: "120",
                        overHidden: true,
                    },
                    {
                        label: "车号",
                        prop: "licenseNumber",
                        cell: true,
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "姓名",
                        prop: "fullName",
                        cell: true,
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "联系方式",
                        prop: "contactInformation",
                        cell: true,
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "是否入库",
                        prop: "whetherWarehousing",
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "提箱时间",
                        prop: "pickupDate",
                        cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "提箱地点",
                        prop: "pickupAddressName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "送货时间",
                        prop: "deliveryDate",
                        width: "120",
                        cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        overHidden: true
                    },
                    {
                        label: "送货地点",
                        prop: "deliveryAddressName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "是否打冷",
                        prop: "whetherChill",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "运费价格",
                        prop: "freightPrice",
                        cell: true,
                        type: 'number',
                        controls: false,
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "返空时间",
                        prop: "returnDate",
                        // cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "返空场站",
                        prop: "returnCyName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "查验/倒柜承运车队",
                        prop: "inspectionFleetName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "查验/倒柜车号",
                        prop: "inspectionLicenseNumber",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "查验/倒柜姓名",
                        prop: "inspectionFullName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "查验/倒柜联系方式",
                        prop: "inspectionContactInformation",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "箱号",
                        prop: "boxNo",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "备注",
                        prop: "remarks",
                        width: "120",
                        cell: true,
                        overHidden: true
                    }
                ]
            },
            option3: {},
            optionBack3: {
                height: 'auto',
                calcHeight: 30,
                menuWidth: 200,
                tip: false,
                border: true,
                index: true,
                addBtn: false,
                viewBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                selection: true,
                align: 'center',
                column: [
                    {
                        label: "仓库",
                        prop: "warehouseName",
                        width: "120",
                        overHidden: true,
                    },
                    {
                        label: "品名",
                        prop: "goodsName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "箱号",
                        prop: "boxNo",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "入库单位",
                        prop: "storageUnit",
                        width: "120",
                        cell: true,
                        type: 'select',
                        filterable: true,
                        remote: true,
                        dicUrl: "/api/blade-los/bunits/list",
                        props: {
                            label: 'cnName',
                            value: 'cnName',
                            res: 'data.records'
                        },
                        overHidden: true
                    },
                    {
                        label: "入库时间",
                        prop: "storageDate",
                        width: "120",
                        cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        overHidden: true
                    },
                    {
                        label: "件数",
                        prop: "quantity",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "净重",
                        prop: "grossWeight",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "是否保税",
                        prop: "whetherBonded",
                        cell: true,
                        width: "120",
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        overHidden: true
                    },
                    {
                        label: "是否分拣",
                        prop: "whetherSorting",
                        width: "120",
                        cell: true,
                        type: 'select',
                        dicData: [{
                            label: '是',
                            value: 1
                        }, {
                            label: '否',
                            value: 0
                        }],
                        overHidden: true
                    },
                    {
                        label: "平均单价",
                        prop: "warehouseUnitPrice",
                        cell: true,
                        type: 'number',
                        controls: false,
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "车号",
                        prop: "licenseNumber",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "姓名",
                        prop: "fullName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "联系方式",
                        prop: "tel",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "备注",
                        prop: "remarks",
                        width: "120",
                        cell: true,
                        overHidden: true
                    }
                ]
            },
            option4: {},
            optionBack4: {
                height: 'auto',
                calcHeight: 30,
                menuWidth: 180,
                tip: false,
                border: true,
                index: true,
                addBtn: false,
                viewBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                selection: true,
                align: 'center',
                column: [
                    {
                        label: "品名",
                        prop: "goodsName",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "箱号",
                        prop: "boxNo",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "出库时间",
                        prop: "outStorageDate",
                        width: "120",
                        cell: true,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd 00:00:00",
                        overHidden: true
                    },
                    {
                        label: "出库件数",
                        prop: "outQuantity",
                        width: "120",
                        cell: true,
                        type: 'number',
                        controls: false,
                        overHidden: true
                    },
                    {
                        label: "出库净重",
                        prop: "outWeight",
                        width: "120",
                        cell: true,
                        type: 'number',
                        controls: false,
                        overHidden: true
                    },
                    {
                        label: "件数",
                        prop: "quantity",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "毛重",
                        prop: "grossWeight",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "存储天数",
                        prop: "storageDays",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "仓储费",
                        prop: "storageFeesAmount",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "剩余件数",
                        prop: "surplusQuantity",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "剩余重量",
                        prop: "surplusWeight",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "剩余货值",
                        prop: "surplusGoodsAmount",
                        width: "120",
                        overHidden: true
                    },
                    {
                        label: "备注",
                        prop: "remarks",
                        width: "120",
                        cell: true,
                        overHidden: true
                    }
                ]
            },
            showLock: false,
            roleName: [],
            saberUserInfo: ''
        }
    },
    components: {
        dicSelect,
        feeInfo,
        checkSchedule,
        businessReports
    },
    props: {
        detailData: Object
    },
    async created() {
        this.roleName = localStorage.getItem('roleName').split(',')
        this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
        this.option = await this.getColumnData(this.getColumnName(388), this.optionBack);
        this.option2 = await this.getColumnData(this.getColumnName(389), this.optionBack2);
        this.option3 = await this.getColumnData(this.getColumnName(390), this.optionBack3);
        this.option4 = await this.getColumnData(this.getColumnName(391), this.optionBack4);
        if (this.detailData.id) {
            this.showLock = true
            this.editButton = true
            this.editDisabled = true
            this.optionForm.disabled = true
            this.getDetails(this.detailData.id)
        }
        if (this.$route.query.billNo) {
            this.showLock = true
            this.getDetaiByMblno(this.$route.query.billNo)
        }
        if (this.detailData.copyId) {
            this.getCopydate(this.detailData.copyId)
        }
    },
    methods: {
        inLock() {
            const data = {
                moduleName: "SI",
                tableName: "SI_Detail",
                billId: this.form.id,
                no: localStorage.getItem("browserID"),
                billNo: this.form.mblno
            };
            this.inDetailsKey(this.$route.name, {
                moduleName: "SI",
                tableName: "SI_Detail",
                billId: this.form.id,
                billNo: this.form.mblno

            });
            this.checkLock(data).then(res => {
                if (res.data.code == 200) {
                    this.onLock(data).then(res => {
                        if (res.data.code == 200) {
                            this.showLock = false
                        }
                    });
                }
            });
        },
        inJump(name) {
            if (name == '客户') {
                this.$router.push({
                    path: "/iosBasicData/bcorps/index",
                    query: { type: 'new' },
                })
            }
            if (name == '原产地') {
                this.$router.push({
                    path: "/iosBasicData/bcountrys/index",
                    query: { type: 'new' },
                })
            }
            if (name == '港口') {
                this.$router.push({
                    path: "/iosBasicData/bports/index",
                    query: { type: 'new' },
                })
            }
            if (name == 'HSCODE') {
                this.$router.push({
                    path: "/iosBasicData/bcommodity/index",
                    query: { type: 'new' },
                })
            }
            if (name == '船名') {
                this.$router.push({
                    path: "/iosBasicData/bvessels/index",
                    query: { type: 'new' },
                })
            }
            if (name == '包装') {
                this.$router.push({
                    path: "/iosBasicData/bpackages/index",
                    query: { type: 'new' },
                })
            }
            if (name == '箱型') {
                this.$router.push({
                    path: "/iosBasicData/bcntrtypes/index",
                    query: { type: 'new' },
                })
            }
            if (name == '类型') {
                this.$refs.dictbiz.open()
                this.dicTitle = '添加类型'
                this.parentId = '1813125517193330690'
                this.dicCode = 'goods-type'
            }
            if (name == '入库单位') {
                this.$router.push({
                    path: "/iosBasicData/bunits/index",
                    query: { type: 'new' },
                })
            }
        },
        getAllWorkDicts() {
            this.dicTitle = null
            this.parentId = null
            this.dicCode = null
        },
        getDetaiByMblno(billNo) {
            this.editButton = true
            this.editDisabled = true
            this.optionForm.disabled = true
            const loading = this.$loading({
                lock: true,
                text: '加载中',
                spinner: 'el-icon-loading',
                background: 'rgba(255,255,255,0.7)'
            });
            detailTradeByMblno({ mblno: this.$route.query.billNo }).then(res => {
                this.form = res.data.data
                this.$refs.crud.dicInit();
                this.$refs.crud3.dicInit();
            }).finally(() => {
                loading.close()
            })
        },
        addRow() {
            if (!this.form.corpId) return this.$message.error("请选择客户名称");
            this.form.preContainersList.push({
                whetherMachineInspection: 0,
                whetherSampling: 0,
                whetherWarehousing: 0,
                whetherReturnSite: 0,
                curCode: 'CNY',
                $cellEdit: true
            })
            this.$nextTick(() => {
                this.$refs.crud.doLayout();
                this.$refs.crud.dicInit();
            });
        },
        amountChange(row) {
            if (!row.number) row.number = 1
            row.price = _.round(_.divide(row.amount, row.number ? row.number : 1), 2)
        },
        boxClosed() {
            this.boxForm = {
                // id: null,
                // returnDate: null,
                // returnCyName: null,
            }
        },
        carClosed() {
            this.carForm = {
                // id: null,
                // inspectionFleetId: null,
                // inspectionFleetName: null,
                // inspectionLicenseNumber: null,
                // inspectionFullName: null,
                // inspectionContactInformation: null
            }
        },
        carSubmit(row) {
            this.form.dispatchVehiclesList.forEach(e => {
                if (e.id == row.id) {
                    this.$set(e, 'inspectionFleetId', row.inspectionFleetId)
                    this.$set(e, 'inspectionFleetName', row.inspectionFleetName)
                    this.$set(e, 'inspectionLicenseNumber', row.inspectionLicenseNumber)
                    this.$set(e, 'inspectionFullName', row.inspectionFullName)
                    this.$set(e, 'inspectionContactInformation', row.inspectionContactInformation)
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    confirmInspection(row).then(res => {
                        this.$message.success("查验/倒柜派车成功");
                        this.carVisible = false
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }
            })
        },
        boxSubmit(row) {
            this.form.dispatchVehiclesList.forEach(e => {
                if (e.id == row.id) {
                    this.$set(e, 'returnDate', row.returnDate)
                    this.$set(e, 'returnCyName', row.returnCyName)
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    confirmReturnBox(row).then(res => {
                        this.$message.success("还箱成功");
                        this.boxVisible = false
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }
            })
        },
        dicChange(name, row) {
            if (name == 'inspectionFleetName') {
                if (row) {
                    this.carForm.inspectionFleetId = row.id
                    this.carForm.inspectionFullName = row.mgrName
                    this.carForm.inspectionContactInformation = row.tel
                } else {
                    this.carForm.inspectionFleetId = null
                    this.carForm.inspectionFullName = null
                    this.carForm.inspectionContactInformation = null
                }
            }
            if (name == 'corpCnName') {
                if (row) {
                    this.form.corpId = row.id
                    this.form.corpCnName = row.cnName
                    this.form.srcType = row.sourceType
                    this.form.srcCnName = row.srcCnName
                    this.form.srcId = row.srcId
                } else {
                    this.form.corpId = null
                    this.form.srcType = null
                    this.form.srcCnName = null
                    this.form.srcId = null
                }
            }
            if (name == 'polCnName') {
                console.log(row)
                if (row) {
                    this.form.polId = row.id
                    this.form.polCode = row.code
                    this.form.polCnName = row.cnName
                    this.form.polEnName = row.enName

                } else {
                    this.form.polId = null
                    this.form.polCode = null
                    this.form.polEnName = null
                }
            }
            if (name == 'podCnName') {
                if (row) {
                    this.form.polId = row.id
                    this.form.polCode = row.code
                    this.form.podCnName = row.cnName
                    this.form.polEnName = row.enName
                } else {
                    this.form.polId = null
                    this.form.polCode = null
                    this.form.polEnName = null
                }
            }
            if (name == 'srcType') {
                if (!row) {
                    this.form.srcId = null
                    this.form.srcCnName = null
                }
            }
            if (name == 'srcCnName') {
                if (row) {
                    this.form.srcId = row.id
                } else {
                    this.form.srcId = null
                }
            }
            if (name == 'hshipperCnName') {
                if (row) {
                    this.form.hshipperId = row.id
                    this.form.hshipperCnName = row.cnName
                } else {
                    this.form.hshipperId = null
                }
            }
            if (name == 'hconsigneeCnName') {
                if (row) {
                    this.form.hconsigneeId = row.id
                    this.form.hconsigneeCnName = row.cnName
                } else {
                    this.form.hconsigneeId = null
                }
            }
            if (name == 'carrierCnName') {
                if (row) {
                    this.form.carrierId = row.id
                } else {
                    this.form.carrierId = null
                }
            }
            // if (name == 'hscode') {
            //     if (row) {
            //         this.form.commodityCnName = row.cnName
            //     } else {
            //         this.form.commodityCnName = null
            //     }
            // }
            if (name == 'bookingAgentCnName') {
                if (row) {
                    this.form.bookingAgentId = row.id
                    this.form.bookingAgentCnName = row.cnName
                } else {
                    this.form.bookingAgentId = null
                }
            }
            if (name == 'mnotifyCntyCode') {
                if (row) {
                    this.form.mnotifyCntyCode = row.cnName
                }
            }
        },
        rowDicChange(name, row, el) {
            if (name == 'hsCode') {
                if (row) {
                    el.goodsName = row.cnName
                } else {
                    el.goodsName = null
                }
            }
            // if (name == 'goodsName') {
            //     if (row) {
            //         el.hsCode = row.hsCode
            //     } else {
            //         el.hsCode = null
            //     }
            // }
            if (name == 'fleetName') {
                if (row) {
                    el.fleetId = row.id
                    el.fullName = row.mgrName
                    el.contactInformation = row.tel
                } else {
                    el.fleetId = null
                    el.fullName = null
                    el.contactInformation = null
                }
            }
            if (name == 'pickupAddressName') {
                if (row) {
                    el.pickupAddressId = row.id
                } else {
                    el.pickupAddressId = null
                }
            }
            if (name == 'deliveryAddressName') {
                if (row) {
                    el.deliveryAddressId = row.id
                } else {
                    el.deliveryAddressId = null
                }
            }
            if (name == 'warehouseName') {
                if (row) {
                    el.warehouseId = row.id
                } else {
                    el.warehouseId = null
                }
            }
        },
        rowCell(name, row, index) {
            if (name == '箱编辑') {
                if (row.$cellEdit == true) {
                    if (!row.cntrTypeCode || !row.boxNo || !row.goodsName || !row.goodsType || !row.number || !row.netWeight || !row.amount) {
                        return this.$message.error((!row.cntrTypeCode ? "箱型," : '') + (!row.boxNo ? "箱号," : '') + (!row.goodsName ? "品名," : '') + (!row.goodsType ? "类型," : '') + (!row.number ? "件数," : '') + (!row.netWeight ? "净重," : '') + (!row.amount ? "总金额" : '') + "不能为空");
                    }
                    this.$set(row, "$cellEdit", false);
                } else {
                    this.$set(row, "$cellEdit", true);
                }
            }
            if (name == '箱删除') {
                if (row.id) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    precontainersRemove(row.id).then(res => {
                        this.$message.success("删除成功");
                        this.form.preContainersList.splice(index, 1);
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    this.$message.success("删除成功");
                    this.form.preContainersList.splice(index, 1);
                }
            }
            if (name == '派车编辑') {
                if (row.$cellEdit == true) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    submitList1(this.form.dispatchVehiclesList).then(res => {
                        this.form.dispatchVehiclesList = res.data.data
                        this.$message.success("保存成功");
                    }).finally(() => {
                        loading.close()
                    })
                    this.$set(row, "$cellEdit", false);
                } else {
                    this.$set(row, "$cellEdit", true);
                }
            }
            if (name == '入库编辑') {
                if (row.$cellEdit == true) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    submitList2(this.form.inStorageList).then(res => {
                        this.form.inStorageList = res.data.data
                        this.$message.success("保存成功");
                    }).finally(() => {
                        loading.close()
                    })
                    this.$set(row, "$cellEdit", false);
                } else {
                    this.$set(row, "$cellEdit", true);
                }
            }
            if (name == '出库编辑') {
                if (row.$cellEdit == true) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    submitList2(this.form.outStorageList).then(res => {
                        this.form.outStorageList = res.data.data
                        this.$message.success("保存成功");
                    }).finally(() => {
                        loading.close()
                    })
                    this.$set(row, "$cellEdit", false);
                } else {
                    this.$set(row, "$cellEdit", true);
                }
            }
            if (name == '派车') {
                if (!row.id) {
                    return this.$message.error('请保存数据');
                }
                if (row.whetherMachineInspection == 1) {
                    if (!row.inspectionType || !row.inspectionDate) {
                        return this.$message.error((!row.inspectionType ? "查验类型," : '') + (!row.inspectionDate ? "查验时间" : '') + "不能为空");
                    }
                }
                let obj = {
                    ...row,
                    type: 1,
                }
                if (row.whetherDispatchVehicles == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokePrecontainers(obj).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    generateDispatchVehicles(obj).then(res => {
                        this.$message.success("派车成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }

            }
            if (name == '自提') {
                if (!row.id) {
                    return this.$message.error('请保存数据');
                }
                let obj = {
                    ...row,
                    type: 2,
                }
                if (row.whetherDispatchVehicles == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokePrecontainers(obj).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    generateDispatchVehicles(obj).then(res => {
                        this.$message.success("自提成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }
            }
            // if (name == '派车删除') {
            //     const loading = this.$loading({
            //         lock: true,
            //         text: '加载中',
            //         spinner: 'el-icon-loading',
            //         background: 'rgba(255,255,255,0.7)'
            //     });
            //     dispatchvehiclesRemove({ ids: row.id }).then(res => {
            //         this.$message.success("删除成功");
            //         this.form.dispatchVehiclesList.splice(index, 1);
            //     }).finally(() => {
            //         loading.close()
            //     })
            // }
            if (name == '还箱') {
                if (row.whetherReturn == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeReturnBox(row).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    this.boxForm = row
                    this.boxVisible = true
                }
            }
            if (name == '查验/倒柜派车') {
                if (row.whetherInspection == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeInspection(row).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    this.carForm = row
                    this.carVisible = true
                }
            }
            if (name == '入库派车') {
                if (!row.fleetName || !row.licenseNumber || !row.fullName || !row.contactInformation || !row.deliveryDate || !row.deliveryAddressName) {
                    return this.$message.error((!row.fleetName ? "承运车队，" : '') + (!row.licenseNumber ? "车号，" : '') + (!row.fullName ? "姓名，" : '') + (!row.contactInformation ? "联系方式，" : '') + (!row.deliveryDate ? "送货时间，" : null) + (!row.deliveryAddressName ? "送货地点" : null) + "不能为空");
                }
                if (row.whetherDispatchVehicles == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeDispatchVehicles(row).then(res => {
                        this.$message.success("撤销成功");
                        this.optionForm.disabled = false
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    console.log(row)
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    confirmDispatchVehicles(row).then(res => {
                        this.$message.success("派车成功");
                        this.optionForm.disabled = true
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }

            }
            if (name == '生成入库') {
                if (!row.fleetName || !row.licenseNumber || !row.fullName || !row.contactInformation || !row.deliveryDate || !row.deliveryAddressName) {
                    return this.$message.error((!row.fleetName ? "承运车队，" : '') + (!row.licenseNumber ? "车号，" : '') + (!row.fullName ? "姓名，" : '') + (!row.contactInformation ? "联系方式，" : '') + (!row.deliveryDate ? "送货时间，" : null) + (!row.deliveryAddressName ? "送货地点" : null) + "不能为空");
                }
                if (row.whetherWarehouseEntry == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeWarehouseEntry(row).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    generateWarehouseEntry(row).then(res => {
                        this.$message.success("生成入库成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }

            }
            if (name == '入库确认') {
                if (!this.form.eta || !row.storageDate || !row.warehouseName) {
                    return this.$message.error((!this.form.eta ? "基础信息的实际到港，" : '') + (!row.storageDate ? "入库时间，" : '') + (!row.warehouseName ? "仓库" : '') + "不能为空");
                }
                if (row.confirmDispatchVehicles == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeInoutstorage(row).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    calculationWarehouseUnitPrice(row).then(res => {
                        this.$confirm(res.data.data, '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            dangerouslyUseHTMLString: true,
                        }).then(() => {
                            const loading = this.$loading({
                                lock: true,
                                text: '加载中',
                                spinner: 'el-icon-loading',
                                background: 'rgba(255,255,255,0.7)'
                            });
                            confirmWarehouseEntry(row).then(res => {
                                this.$message.success("入库成功");
                                this.getDetails(this.form.id)
                            }).finally(() => {
                                loading.close()
                            })
                        })
                    })
                }
            }
            if (name == '生成出库') {
                if (!row.warehouseName || !row.warehouseUnitPrice) {
                    return this.$message.error((!row.warehouseName ? "仓库，" : '') + (!row.warehouseUnitPrice ? "仓储单价" : '') + "不能为空");
                }
                const loading = this.$loading({
                    lock: true,
                    text: '加载中',
                    spinner: 'el-icon-loading',
                    background: 'rgba(255,255,255,0.7)'
                });
                generateOutbound(row).then(res => {
                    this.$message.success("生成出库成功");
                    this.getDetails(this.form.id)
                }).finally(() => {
                    loading.close()
                })

            }
            if (name == '撤销出库') {
                if (!row.warehouseName || !row.warehouseUnitPrice) {
                    return this.$message.error((!row.warehouseName ? "仓库，" : '') + (!row.warehouseUnitPrice ? "仓储单价" : '') + "不能为空");
                }
                const loading = this.$loading({
                    lock: true,
                    text: '加载中',
                    spinner: 'el-icon-loading',
                    background: 'rgba(255,255,255,0.7)'
                });
                revokeOutbound(row).then(res => {
                    this.$message.success("撤销成功");
                    this.getDetails(this.form.id)
                }).finally(() => {
                    loading.close()
                })

            }
            if (name == '出库确认') {
                if (!row.outStorageDate || !row.outQuantity || !row.outWeight) {
                    return this.$message.error((!row.outStorageDate ? "出库时间，" : '') + (!row.outQuantity ? "出库件数，" : '') + (!row.outWeight ? "出库重量" : '') + "不能为空");
                }
                if (row.confirmDispatchVehicles == 1) {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    revokeInoutstorage(row).then(res => {
                        this.$message.success("撤销成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                } else {
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    confirmWarehouseEntry(row).then(res => {
                        this.$message.success("出库成功");
                        this.getDetails(this.form.id)
                    }).finally(() => {
                        loading.close()
                    })
                }

            }
            if (name == '开票') {
                this.$message.error("待开发");
            }
            if (name == '出库删除') {
                const loading = this.$loading({
                    lock: true,
                    text: '加载中',
                    spinner: 'el-icon-loading',
                    background: 'rgba(255,255,255,0.7)'
                });
                inoutstorageRemove({ ids: row.id }).then(res => {
                    this.$message.success("删除成功");
                    this.form.outStorageList.splice(index, 1);
                }).finally(() => {
                    loading.close()
                })
            }
        },
        getDetails(id) {
            const loading = this.$loading({
                lock: true,
                text: '加载中',
                spinner: 'el-icon-loading',
                background: 'rgba(255,255,255,0.7)'
            });
            getDetail({ id: id }).then(res => {
                this.form = res.data.data
                this.oldForm = this.deepClone(res.data.data)
                this.inLock()
                this.$refs.crud.dicInit();
                this.$refs.crud3.dicInit();
            }).finally(() => {
                loading.close()
            })
        },
        getCopydate(id) {
            const loading = this.$loading({
                lock: true,
                text: '加载中',
                spinner: 'el-icon-loading',
                background: 'rgba(255,255,255,0.7)'
            });
            billsCopyBills({ id: id }).then(res => {
                console.log(res.data.data, 33333333333333)
                res.data.data.billNoFormat = 'HYJK'
                res.data.data.businessTypeCode = 'HYJK'
                this.form = res.data.data
            }).finally(() => {
                loading.close()
            })
        },
        inEdit() {
            this.editButton = false
            if (this.form.status == 0 || this.form.status == 4) {
                if (this.form.dispatchVehiclesList.findIndex(item => item.whetherDispatchVehicles == '1') == -1) {
                    this.optionForm.disabled = false
                }
                this.editDisabled = false
            }
        },
        allClick(name) {
        },
        submit(type) {
            this.$refs["form"].validate((valid, done) => {
                done();
                if (valid) {
                    for (let row of this.form.preContainersList) {
                        console.log(row)
                        if (!row.cntrTypeCode || !row.boxNo || !row.goodsName || !row.goodsType || !row.number || !row.netWeight || !row.amount) {
                            return this.$message.error("箱信息:" + (!row.cntrTypeCode ? "箱型," : '') + (!row.boxNo ? "箱号," : '') + (!row.goodsName ? "品名," : '') + (!row.goodsType ? "类型," : '') + (!row.number ? "件数," : '') + (!row.netWeight ? "净重," : '') + (!row.amount ? "总金额" : '') + "不能为空");
                        }
                    }
                    if (this.$refs.feeInfo.submitValidate()) {
                        const loading = this.$loading({
                            lock: true,
                            text: '加载中',
                            spinner: 'el-icon-loading',
                            background: 'rgba(255,255,255,0.7)'
                        });
                        submit(this.form).then(res => {
                            this.$message.success("保存成功");
                            if (type == 'goBack') {
                                if (this.form.id) {
                                    this.unLock({
                                        moduleName: "SI",
                                        tableName: "SI_Detail",
                                        billId: this.form.id,
                                        billNo: this.form.mblno
                                    });
                                }
                                this.$emit("goBack", type);
                                this.$emit('updateKey')
                            }
                            this.getDetails(res.data.data.id)
                        }).finally(() => {
                            loading.close();
                        })
                    }
                } else {
                    return false;
                }
            });
        },
        application() {
            if (this.form.feeCenterListD.length == 0 && this.form.feeCenterListC.length == 0) return this.$message.error("费用不能为空");
            if (this.$refs.feeInfo.submitValidate()) {
                this.$confirm("确定请核数据?", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).then(() => {
                    let obj = {}
                    obj = {
                        id: this.form.id,
                        url: '/tradeAgency/oceanFreightImport/index',
                        pageStatus: '',
                        pageLabel: '海运进口(T)',
                    }
                    const loading = this.$loading({
                        lock: true,
                        text: '加载中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(255,255,255,0.7)'
                    });
                    checkAgent(obj).then(res => {
                        this.$message.success("请核成功");
                        this.editDisabled = true
                        this.optionForm.disabled = true
                        this.getDetails(res.data.data.id)
                    }).finally(() => {
                        loading.close();
                    })
                });
            }
        },
        revokeApplication() {
            this.$confirm("确定撤销请核?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                let obj = {}
                obj = {
                    id: this.form.id,
                }
                const loading = this.$loading({
                    lock: true,
                    text: '加载中',
                    spinner: 'el-icon-loading',
                    background: 'rgba(255,255,255,0.7)'
                });
                revokeCheckAgent(obj).then(res => {
                    this.$message.success("撤销请核成功");
                    this.getDetails(res.data.data.id)
                    this.editDisabled = false
                    this.optionForm.disabled = false
                }).finally(() => {
                    loading.close();
                })
            });

        },
        //请核关闭
        choceScheduleFun() {
            this.checkScheduleDialog = false
        },
        //自定义列保存
        async saveColumn(ref, option, optionBack, code) {
            const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
            if (inSave) {
                this.$message.success("保存成功");
                //关闭窗口
                this.$refs[ref].$refs.dialogColumn.columnBox = false;
            }
        },
        //自定义列重置
        async resetColumn(ref, option, optionBack, code) {
            this[option] = this[optionBack];
            const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
            if (inSave) {
                this.$message.success("重置成功");
                this.$refs[ref].$refs.dialogColumn.columnBox = false;
            }
        },
        goBack(type) {
            if (contrastObj(this.form, this.oldForm) || contrastList(this.form.preContainersList, this.oldForm.preContainersList) || contrastList(this.form.feeCenterListD, this.oldForm.feeCenterListD) || contrastList(this.form.feeCenterListC, this.oldForm.feeCenterListC) || contrastList(this.form.filesList, this.oldForm.filesList)) {
                this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                })
                    .then(() => {
                        this.submit('goBack')
                    })
                    .catch(() => {
                        if (this.form.id) {
                            this.unLock({
                                moduleName: "SI",
                                tableName: "SI_Detail",
                                billId: this.form.id,
                                billNo: this.form.mblno
                            });
                        }
                        this.$emit("goBack", type);
                        this.$emit('updateKey')
                    });
            } else {
                if (this.form.id) {
                    this.unLock({
                        moduleName: "SI",
                        tableName: "SI_Detail",
                        billId: this.form.id,
                        billNo: this.form.mblno
                    });
                }
                this.$emit("goBack", type);
                this.$emit('updateKey')
            }
        },
    }
}
</script>

<style lang="scss" scoped>
::v-deep .el-form-item {
    margin-bottom: 8px !important;
}

::v-deep .el-table .cell {
    padding: 0 2px !important;

    .el-form-item {
        margin-bottom: 0px !important;
    }

}

::v-deep .avue-crud .el-table .el-form-item__label {
    left: -1px;
}

::v-deep#out-table .back-one {
    background: #ecf5ff !important;
}

::v-deep#out-table .back-two {
    background: #ecf5ff !important;
}

::v-deep .el-table--small td,
.el-table--small th {
    padding: 2px !important;
}

::v-deep .el-card__body {
    padding: 3px 10px;
}
</style>
