startPacking.vue 26.8 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3 4 5 6
<template>
  <div class="startPacking">
    <el-card>
      <el-row class="content-area">

        <!-- 左侧 -->
7 8
        <el-col :span="6" class="left-area">
          <el-row v-for="item in listData" :key="item.id" class="title-info" :class="item.id === tableData.id ? 'selected' : ''">
huhaiqing's avatar
huhaiqing committed
9
            <div @click="partClick(item)">
huhaiqing's avatar
huhaiqing committed
10 11 12
              <p>{{item.title}}</p>
            </div>
            <div>
huhaiqing's avatar
huhaiqing committed
13
              <template v-if="item.secStatistics">
huhaiqing's avatar
huhaiqing committed
14
                {{getTotlContent(item.secStatistics)}}
huhaiqing's avatar
huhaiqing committed
15
              </template>
huhaiqing's avatar
huhaiqing committed
16 17 18 19 20
            </div>
          </el-row>
        </el-col>

        <!-- 右侧 -->
21
        <el-col :span="18" class="right-area">
huhaiqing's avatar
huhaiqing committed
22 23 24

          <!-- 操作 -->
          <el-row class="table-title">
25
            <div>{{$t('当前装柜')}}:{{tableData.title}}</div>
huhaiqing's avatar
huhaiqing committed
26
            <div>
huhaiqing's avatar
huhaiqing committed
27
              <template v-if="!isUnderReview">
28 29 30 31 32
                <el-input v-model="qrCode" :placeholder="$t('请输入二维码/条码编号')" clearable></el-input>
                <el-button type="primary" @click="handlerBatchCreate('single')">{{$t('确定')}}</el-button>
                <el-button type="primary" @click="handlerClick('batchInput',$t('批量输入'))">{{$t('批量输入')}}</el-button>
                <el-button type="primary" @click="handlerClick('correction',$t('装柜纠错'))">{{$t('装柜纠错')}}</el-button>
                <el-button type="primary" @click="handlerClick('correctionOrder',$t('批量装柜纠错'))">{{$t('批量装柜纠错')}}</el-button>
huhaiqing's avatar
huhaiqing committed
33
              </template>
huhaiqing's avatar
huhaiqing committed
34 35 36 37
            </div>
          </el-row>

          <!-- 表格 -->
huhaiqing's avatar
huhaiqing committed
38
          <el-row class="table-content">
huhaiqing's avatar
huhaiqing committed
39
            <el-table :data="tableData.sectionOrderList" border max-height="500px">
huhaiqing's avatar
huhaiqing committed
40
              <el-table-column :label="$t('序号')" align="center" width="50" prop="tidanNum" />
41
              <el-table-column :label="$t('订单号')" align="center" prop="orderNo">
huhaiqing's avatar
huhaiqing committed
42
                <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
43 44 45 46
                  <div>
                    <a href="javascript:void(0);" class="order-href" @click="orderClick(scope.row)">{{ scope.row.orderNo }}</a>
                  </div>
                  <div style="color:blue;fontWeight:bold;">
47
                    {{ scope.row.isExternalWarehouse === 1 ? '(' + $t('外部仓') + ')' : ''}}
huhaiqing's avatar
huhaiqing committed
48
                  </div>
huhaiqing's avatar
huhaiqing committed
49 50
                </template>
              </el-table-column>
51
              <el-table-column :label="$t('货物信息')" align="center" prop="goodsList">
huhaiqing's avatar
huhaiqing committed
52 53
                <template slot-scope="scope">
                  <section class="table-goodList">
54
                    <div v-for="(item, index) in scope.row.goodsList" :key="index" class="goodList-div">
huhaiqing's avatar
huhaiqing committed
55
                      <p>{{$t('品名')}}{{$l(item,'prodTitle')}}</p>
huhaiqing's avatar
huhaiqing committed
56
                      <p>{{$t('品牌')}}:【<template v-if="item.brandName">{{item.brandName}}</template>
Marcus's avatar
Marcus committed
57
                        <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="item.feeType" />{{ $t('】') }}</p>
58
                      <p>{{$t('其他')}}:{{getTotlContent(item)}}</p>
huhaiqing's avatar
huhaiqing committed
59 60 61 62
                    </div>
                  </section>
                </template>
              </el-table-column>
63 64
              <el-table-column :label="$t('报关方式')" align="center" prop="customsType">
                <template slot-scope="scope">
65 66 67
                  <div :class="scope.row.customsType !== 1 ? 'custom_type_red' : ''">
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="scope.row.customsType" />
                  </div>
68 69
                </template>
              </el-table-column>
70
              <el-table-column :label="$t('计划箱数')" align="center" prop="num">
huhaiqing's avatar
huhaiqing committed
71
                <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
72
                  {{getTotlContent(scope.row,['num'])}}
huhaiqing's avatar
huhaiqing committed
73 74
                </template>
              </el-table-column>
75
              <el-table-column :label="$t('实装箱数')" align="center" prop="installNum">
huhaiqing's avatar
huhaiqing committed
76
                <template slot-scope="scope">
77
                  {{ scope.row.installNum }}{{$t('')}}
huhaiqing's avatar
huhaiqing committed
78 79
                </template>
              </el-table-column>
80
              <el-table-column :label="$t('体积')" align="center" prop="volume">
huhaiqing's avatar
huhaiqing committed
81
                <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
82
                  {{getTotlContent(scope.row,['volume'])}}
huhaiqing's avatar
huhaiqing committed
83 84
                </template>
              </el-table-column>
85
              <el-table-column :label="$t('重量')" align="center" prop="weight">
huhaiqing's avatar
huhaiqing committed
86
                <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
87
                  {{getTotlContent(scope.row,['weight'])}}
huhaiqing's avatar
huhaiqing committed
88 89
                </template>
              </el-table-column>
90
              <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
huhaiqing's avatar
huhaiqing committed
91
                <template slot-scope="scope">
92
                  <el-button type="text" size="small" @click="moveOut(scope.row)" v-if="!isUnderReview && scope.row.installNum === 0">{{$t('移出')}}</el-button>
huhaiqing's avatar
huhaiqing committed
93
                  <el-button type="text" size="small" v-if="isShowSplitOrder(scope.row)" @click="handlerSplitOrder(scope.row, 'splitOrder', $t('拆单'))">{{$t('拆单')}}</el-button>
huhaiqing's avatar
huhaiqing committed
94 95 96 97 98 99 100 101 102 103 104
                </template>
              </el-table-column>
            </el-table>
          </el-row>

        </el-col>
      </el-row>
    </el-card>

    <!-- 统计 -->
    <el-row>
105
      <el-col :span="6" class="totle-info">
huhaiqing's avatar
huhaiqing committed
106
        <div class="count-info">
107
          <p>{{$t('总计')}}:{{getSumData}}</p>
huhaiqing's avatar
huhaiqing committed
108 109
        </div>
        <div>
110
          <p>{{$t('容量')}}:</p>
111
          <p>{{calcCapacity}}</p>
huhaiqing's avatar
huhaiqing committed
112
        </div>
113
        <div>{{$t('已装')}} {{getInstallNumCount}} {{$t('箱')}}</div>
huhaiqing's avatar
huhaiqing committed
114 115 116
      </el-col>
    </el-row>

huhaiqing's avatar
huhaiqing committed
117 118 119
    <!-- 审核流程 -->
    <el-row class="process-area">
      <div class="process">
120
        <div>{{$t('审批流程')}}</div>
huhaiqing's avatar
huhaiqing committed
121 122 123 124
        <work-flow xmlkey="close_container" v-model="selectedUsers"></work-flow>
      </div>
      <!-- 操作 -->
      <div v-if="!isUnderReview">
huhaiqing's avatar
huhaiqing committed
125
        <el-button type="primary" @click="handlerClick('supplementOrder',$t('补单'))">{{$t('补单')}}</el-button>
126
        <el-button type="primary" @click="applyCloseCabinet">{{$t('封柜申请')}}</el-button>
huhaiqing's avatar
huhaiqing committed
127
        <el-button type="primary" @click="handlerClick('modifyCabinet',$t('修改柜信息'))">{{$t('修改柜信息')}}</el-button>
huhaiqing's avatar
huhaiqing committed
128 129
      </div>
      <div v-if="isUnderReview">
130 131 132
        <el-button type="primary" @click="jumpReviewDetail">{{$t('封柜审核中')}}</el-button>
        <el-button plain type="primary" @click="canclAudit">{{$t('取消审核')}}</el-button>
        <el-button plain type="primary" @click="$emit('closeDialog1')">{{$t('返回')}}</el-button>
huhaiqing's avatar
huhaiqing committed
133
      </div>
huhaiqing's avatar
huhaiqing committed
134 135 136
    </el-row>

    <!-- 对话框 -->
137
    <el-dialog custom-class="shipping-dialog" :title="dialogConfig.title" :visible.sync="dialogConfig.dialogVisible" :fullscreen="dialogConfig.fullscreen" :width="dialogConfig.width" :modal-append-to-body=false append-to-body>
huhaiqing's avatar
huhaiqing committed
138 139
      <!-- 已装未装订单 -->
      <template v-if="dialogConfig.type === 'orderTable'">
140
        <el-table :data="orderList" height="500px" border>
141 142
          <el-table-column :label="$t('已装')" align="center" prop="loadTag" />
          <el-table-column :label="$t('未装')" align="center" prop="unloadTag" />
143
        </el-table>
huhaiqing's avatar
huhaiqing committed
144 145
      </template>
      <!-- 补单 -->
146
      <supplementOrder v-if="dialogConfig.type === 'supplementOrder' && dialogConfig.dialogVisible" v-bind="$attrs" :shipmentObj="shipmentObj" @supplementFinish="supplementFinish" />
huhaiqing's avatar
huhaiqing committed
147
      <!-- 修改柜信息 -->
huhaiqing's avatar
huhaiqing committed
148
      <template v-if="dialogConfig.type === 'modifyCabinet' && dialogConfig.dialogVisible">
149
        <el-form ref="modifyForm" :rules="rules" :model="modifyCabinetObj" label-width="80px">
zhoutong's avatar
zhoutong committed
150
          <el-form-item v-if="false" :label="$t('起运仓库')" prop="startWarehouseId">
151
            <el-select v-model="modifyCabinetObj.startWarehouseId" :placeholder="$t('请选择仓库')" filterable>
huhaiqing's avatar
huhaiqing committed
152
              <el-option v-for="warehouse in $attrs.warehouseList" :key="warehouse.id" :label="$l(warehouse, 'title')" :value="warehouse.id"></el-option>
huhaiqing's avatar
huhaiqing committed
153 154
            </el-select>
          </el-form-item>
155 156 157
          <el-form-item :label="$t('预装日期')">{{preinstallDate}}</el-form-item>
          <el-form-item :label="$t('选择柜型')" prop="cabinetId">
            <el-select v-model="modifyCabinetObj.cabinetId" :placeholder="$t('请选择柜型')">
158
              <el-option v-for="item in cabinetList" :label="item.name" :value="item.id" :key="item.id"></el-option>
huhaiqing's avatar
huhaiqing committed
159 160
            </el-select>
          </el-form-item>
161 162
          <el-form-item :label="$t('柜号')">
            <el-input v-model="modifyCabinetObj.cubNo" :placeholder="$t('请输入柜号')" clearable />
huhaiqing's avatar
huhaiqing committed
163 164 165
          </el-form-item>
        </el-form>
        <el-row class="operate-button">
166 167
          <el-button type="primary" @click="onSubmit('modifyForm')">{{$t('下一步')}}</el-button>
          <el-button @click="closeDialog2">{{$t('取消')}}</el-button>
huhaiqing's avatar
huhaiqing committed
168 169 170
        </el-row>
      </template>
      <!-- 装柜纠错 -->
huhaiqing's avatar
huhaiqing committed
171
      <template v-if="dialogConfig.type === 'correction' && dialogConfig.dialogVisible">
172
        <el-form ref="correctionForm" :rules="rules" :model="correctionObj" label-position="top">
173 174
          <el-form-item :label="$t('装柜纠错(二维码/条形码编号)')" prop="qrCode">
            <el-input v-model="correctionObj.qrCode" :placeholder="$t('请输入二维码/条形码编号')" clearable />
huhaiqing's avatar
huhaiqing committed
175 176 177
          </el-form-item>
        </el-form>
        <el-row class="operate-button">
178 179
          <el-button type="primary" @click="onSubmit('correctionForm')">{{$t('提交')}}</el-button>
          <el-button @click="closeDialog2">{{$t('取消')}}</el-button>
huhaiqing's avatar
huhaiqing committed
180 181 182
        </el-row>
      </template>
      <!-- 批量装柜纠错(订单号) -->
huhaiqing's avatar
huhaiqing committed
183
      <template v-if="dialogConfig.type === 'correctionOrder' && dialogConfig.dialogVisible">
184
        <el-form ref="orderForm" :rules="rules" :model="orderObj" label-position="top">
185 186
          <el-form-item :label="$t('装柜纠错') +'(' + $t('订单号') + ')'" prop="orderNo">
            <el-input type="textarea" :rows="3" v-model="orderObj.orderNo" :placeholder="$t('请输入,多个以逗号分隔')" clearable />
huhaiqing's avatar
huhaiqing committed
187 188 189
          </el-form-item>
        </el-form>
        <el-row class="operate-button">
190 191
          <el-button type="primary" @click="onSubmit('orderForm')">{{$t('提交')}}</el-button>
          <el-button @click="closeDialog2">{{$t('取消')}}</el-button>
huhaiqing's avatar
huhaiqing committed
192 193 194
        </el-row>
      </template>
      <!-- 装柜批量输入 -->
huhaiqing's avatar
huhaiqing committed
195
      <template v-if="dialogConfig.type === 'batchInput' && dialogConfig.dialogVisible">
huhaiqing's avatar
huhaiqing committed
196 197
        <el-form ref="batchForm" :rules="rules" :model="batchObj">
          <el-form-item label="" prop="qrCode" class="two-element">
198 199
            <el-input v-model="batchObj.qrCode" :placeholder="$t('请输入订单号')" clearable />
            <el-button style="marginLeft:10px;" type="primary" @click="queryOrderInfo">{{$t('确定')}}</el-button>
huhaiqing's avatar
huhaiqing committed
200
          </el-form-item>
huhaiqing's avatar
huhaiqing committed
201 202 203

          <el-row>
            <el-col :span="12">
204
              <el-form-item :label="$t('订单号')">
huhaiqing's avatar
huhaiqing committed
205 206 207 208
                {{boxOrderInfo.orderNo}}
              </el-form-item>
            </el-col>
            <el-col :span="12">
209
              <el-form-item :label="$t('箱数')">
210
                <el-input-number v-if="boxOrderInfo.isExternalWarehouse === 1" v-model="batchObj.boxNum" :min="0" :max="boxOrderInfo.num" />
huhaiqing's avatar
huhaiqing committed
211
                <template v-else>
212
                  {{boxOrderInfo.num}}
huhaiqing's avatar
huhaiqing committed
213 214 215 216 217 218 219
                </template>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
220
              <el-form-item :label="$t('方数')">
huhaiqing's avatar
huhaiqing committed
221 222 223 224
                {{getTotlContent(boxOrderInfo, ['volume'])}}
              </el-form-item>
            </el-col>
            <el-col :span="12">
225
              <el-form-item :label="$t('重量')">
huhaiqing's avatar
huhaiqing committed
226 227 228 229 230
                {{getTotlContent(boxOrderInfo, ['weight'])}}
              </el-form-item>
            </el-col>
          </el-row>

huhaiqing's avatar
huhaiqing committed
231 232
        </el-form>
        <el-row class="operate-button">
233 234
          <el-button type="primary" :disabled="boxOrderInfo.orderId ? false : true" @click="batchLoad">{{$t('提交')}}</el-button>
          <el-button @click="closeDialog2">{{$t('取消')}}</el-button>
huhaiqing's avatar
huhaiqing committed
235 236
        </el-row>
      </template>
huhaiqing's avatar
huhaiqing committed
237
      <!-- 拆单 -->
238
      <splitOrder v-bind="$attrs" v-on="$listeners" :shipmentObj="shipmentObj" v-if="dialogConfig.type === 'splitOrder' && dialogConfig.dialogVisible" :currRow="currRow" @closeDialog2="closeDialog2" />
huhaiqing's avatar
huhaiqing committed
239 240 241 242 243
    </el-dialog>
  </div>
</template>

<script>
244
import dayjs from "dayjs";
huhaiqing's avatar
huhaiqing committed
245
import supplementOrder from "./supplementOrder.vue";
huhaiqing's avatar
huhaiqing committed
246
import { getCabinetPage } from "@/api/ecw/cabinet";
247
import { getbox } from "@/api/ecw/box";
huhaiqing's avatar
huhaiqing committed
248 249 250
import {
  loadSecGoodsList,
  orderTagList,
huhaiqing's avatar
huhaiqing committed
251
  singleCreate,
huhaiqing's avatar
huhaiqing committed
252
  batchCreate,
huhaiqing's avatar
huhaiqing committed
253
  singleDelete,
huhaiqing's avatar
huhaiqing committed
254 255 256 257
  batchDelete,
  remove,
  boxUpdate,
  approvalCreate,
huhaiqing's avatar
huhaiqing committed
258
  approvalCancel,
huhaiqing's avatar
huhaiqing committed
259 260
  getOrderDetailByBoxNo,
  externalLoad,
huhaiqing's avatar
huhaiqing committed
261
} from "@/api/ecw/boxSea";
262 263 264 265 266
import {
  getTotlContent,
  serviceMsg,
  getCapacity,
  sumStatistics,
267
  toReviewDetail,
268
} from "../../utils";
huhaiqing's avatar
huhaiqing committed
269
import splitOrder from "./splitOrder.vue";
huhaiqing's avatar
huhaiqing committed
270
import WorkFlow from "@/components/WorkFlow";
271
import Decimal from "decimal.js";
huhaiqing's avatar
huhaiqing committed
272 273 274 275 276 277

/**
 * 开始装柜
 */
export default {
  name: "startPacking",
huhaiqing's avatar
huhaiqing committed
278
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
279 280
  components: {
    supplementOrder,
huhaiqing's avatar
huhaiqing committed
281
    splitOrder,
huhaiqing's avatar
huhaiqing committed
282
    WorkFlow,
huhaiqing's avatar
huhaiqing committed
283
  },
huhaiqing's avatar
huhaiqing committed
284 285 286
  props: {
    shipmentObj: Object,
  },
huhaiqing's avatar
huhaiqing committed
287 288 289
  data() {
    return {
      // 表格数据
huhaiqing's avatar
huhaiqing committed
290 291 292
      listData: [],
      // 表格数据
      tableData: {},
huhaiqing's avatar
huhaiqing committed
293 294 295 296 297 298 299 300
      // 弹窗配置
      dialogConfig: {
        title: "",
        dialogVisible: false,
        width: "30%",
        type: "",
        fullscreen: false,
      },
huhaiqing's avatar
huhaiqing committed
301
      // 已装/未装
302
      orderList: [],
huhaiqing's avatar
huhaiqing committed
303 304
      // 柜型
      cabinetList: [],
huhaiqing's avatar
huhaiqing committed
305 306
      // 二维码/条码编号
      qrCode: "",
huhaiqing's avatar
huhaiqing committed
307
      // 批量输入
huhaiqing's avatar
huhaiqing committed
308 309 310
      batchObj: {
        boxNum: 0,
      },
huhaiqing's avatar
huhaiqing committed
311 312 313 314 315 316 317 318
      // 批量纠错(订单号)
      orderObj: {},
      // 纠错
      correctionObj: {},
      // 修改柜信息
      modifyCabinetObj: {},
      // 修改柜信息校验
      rules: {
huhaiqing's avatar
huhaiqing committed
319
        startWarehouseId: [
320
          { required: true, message: this.$t("必填"), trigger: "change" },
huhaiqing's avatar
huhaiqing committed
321
        ],
322 323 324 325 326 327 328 329 330
        cabinetId: [
          { required: true, message: this.$t("必填"), trigger: "change" },
        ],
        qrCode: [
          { required: true, message: this.$t("必填"), trigger: "change" },
        ],
        orderNo: [
          { required: true, message: this.$t("必填"), trigger: "change" },
        ],
huhaiqing's avatar
huhaiqing committed
331
      },
huhaiqing's avatar
huhaiqing committed
332 333
      // 当前行
      currRow: {},
huhaiqing's avatar
huhaiqing committed
334
      selectedUsers: [],
huhaiqing's avatar
huhaiqing committed
335 336
      // 订单信息
      boxOrderInfo: {},
337
      newshipmentObj: {}
huhaiqing's avatar
huhaiqing committed
338 339
    };
  },
huhaiqing's avatar
huhaiqing committed
340 341
  created() {
    this.getLoadSecGoodsList();
huhaiqing's avatar
huhaiqing committed
342 343 344 345
    // 柜型
    getCabinetPage(null).then((response) => {
      this.cabinetList = response.data.list;
    });
346
    // this.getBoxInfo()
huhaiqing's avatar
huhaiqing committed
347
  },
huhaiqing's avatar
huhaiqing committed
348
  methods: {
huhaiqing's avatar
huhaiqing committed
349
    getTotlContent,
350 351 352 353 354 355
    getBoxInfo() {
      getbox(this.shipmentObj.id).then((res) => {
        const { data } = res;
        this.newshipmentObj = data ?? {};
      });
    },
huhaiqing's avatar
huhaiqing committed
356 357 358 359 360 361 362
    /* 装柜部分列表 */
    getLoadSecGoodsList() {
      loadSecGoodsList({ shipmentId: this.shipmentObj.id }).then((res) => {
        const { data = [] } = res;
        this.listData = data.map((item, index) => {
          return {
            ...item,
363
            title: this.$t("第{index}部分", { index: 1 + index }),
huhaiqing's avatar
huhaiqing committed
364 365 366 367 368 369 370
          };
        });
        if (this.listData.length) {
          this.tableData = this.listData[0];
        }
      });
    },
huhaiqing's avatar
huhaiqing committed
371 372 373 374
    /** 点击事件统一入口 */
    handlerClick(type, title) {
      this.shwoDialog({ type, title });
    },
huhaiqing's avatar
huhaiqing committed
375 376 377 378 379
    /* 拆单 */
    handlerSplitOrder(row, type, title) {
      this.currRow = row;
      this.shwoDialog({ type, title });
    },
huhaiqing's avatar
huhaiqing committed
380 381
    /** 表格订单号点击 */
    orderClick(row) {
huhaiqing's avatar
huhaiqing committed
382
      orderTagList({ orderId: row.orderId }).then((res) => {
383
        const { data = {} } = res;
384 385 386 387 388 389 390 391 392 393 394 395 396 397
        this.orderList = [];
        // 取最长的list
        let dataLength = data.loadList.length;
        if (data.unLoadList.length > dataLength) {
          dataLength = data.unLoadList.length;
        }

        // 组装数据,用一个table组件渲染
        for (let index = 0; index < dataLength; index++) {
          this.orderList.push({
            loadTag: data.loadList[index],
            unloadTag: data.unLoadList[index],
          });
        }
huhaiqing's avatar
huhaiqing committed
398
      });
huhaiqing's avatar
huhaiqing committed
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
      this.shwoDialog({
        type: "orderTable",
        title: row.selfNo,
      });
    },
    /** 弹窗事件 */
    shwoDialog(config) {
      this.$set(this.dialogConfig, "title", config.title);
      this.$set(this.dialogConfig, "type", config.type);
      switch (config.type) {
        case "orderTable":
          this.$set(this.dialogConfig, "fullscreen", false);
          break;
        case "supplementOrder":
          this.$set(this.dialogConfig, "fullscreen", true);
          break;
huhaiqing's avatar
huhaiqing committed
415 416
        case "batchInput":
          this.$set(this.dialogConfig, "fullscreen", false);
huhaiqing's avatar
huhaiqing committed
417
          this.batchObj = { boxNum: 0 };
huhaiqing's avatar
huhaiqing committed
418
          this.boxOrderInfo = {};
huhaiqing's avatar
huhaiqing committed
419 420 421 422 423 424 425 426 427 428 429 430
          break;
        case "correction":
          this.$set(this.dialogConfig, "fullscreen", false);
          this.correctionObj = {};
          break;
        case "correctionOrder":
          this.$set(this.dialogConfig, "fullscreen", false);
          this.orderObj = {};
          break;
        case "modifyCabinet":
          this.$set(this.dialogConfig, "fullscreen", false);
          this.modifyCabinetObj = {};
431 432
          this.$set(this.modifyCabinetObj,'cabinetId',this.shipmentObj.cabinetId)
          this.$set(this.modifyCabinetObj,'cubNo',this.shipmentObj.cubNo)
huhaiqing's avatar
huhaiqing committed
433
          break;
huhaiqing's avatar
huhaiqing committed
434 435 436
        case "splitOrder":
          this.$set(this.dialogConfig, "fullscreen", true);
          break;
huhaiqing's avatar
huhaiqing committed
437 438 439 440
      }
      this.$set(this.dialogConfig, "dialogVisible", true);
    },
    /** 关闭弹窗 */
441
    closeDialog2() {
huhaiqing's avatar
huhaiqing committed
442 443 444 445 446 447
      this.$set(this.dialogConfig, "dialogVisible", false);
    },
    /** 修改提交 */
    onSubmit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
448 449 450 451
          if (formName === "batchForm") {
            this.handlerBatchCreate("batch");
          }
          if (formName === "correctionForm") {
huhaiqing's avatar
huhaiqing committed
452 453 454 455 456 457
            this.handlerBatchDelete(
              {
                orderNumCode: this.correctionObj.qrCode,
              },
              "single"
            );
huhaiqing's avatar
huhaiqing committed
458 459
          }
          if (formName === "orderForm") {
huhaiqing's avatar
huhaiqing committed
460 461 462 463
            this.handlerBatchDelete(
              { orderNo: this.orderObj.orderNo },
              "batch"
            );
huhaiqing's avatar
huhaiqing committed
464 465 466 467
          }
          if (formName === "modifyForm") {
            this.modifyBoxUpdate();
          }
huhaiqing's avatar
huhaiqing committed
468 469 470
        }
      });
    },
huhaiqing's avatar
huhaiqing committed
471 472 473 474
    /* 部分点击 */
    partClick(item) {
      this.tableData = item;
    },
huhaiqing's avatar
huhaiqing committed
475 476 477 478 479 480 481 482
    /* 装柜 */
    handlerBatchCreate(type) {
      let params = {
        shipmentId: this.shipmentObj.id,
        secId: this.tableData.id,
      };
      if (type === "single") {
        if (!this.qrCode) {
483
          this.$message.error(this.$t("请输入二维码/条码编号"));
huhaiqing's avatar
huhaiqing committed
484 485 486
          return;
        }
        params.orderNumCode = this.qrCode;
huhaiqing's avatar
huhaiqing committed
487 488
        singleCreate(params).then((res) => {
          serviceMsg(res, this).then(() => {
huhaiqing's avatar
huhaiqing committed
489
            this.qrCode = "";
huhaiqing's avatar
huhaiqing committed
490 491 492
            this.getLoadSecGoodsList();
          });
        });
huhaiqing's avatar
huhaiqing committed
493 494
      } else {
        params.orderNo = this.batchObj.qrCode;
huhaiqing's avatar
huhaiqing committed
495 496
        batchCreate(params).then((res) => {
          serviceMsg(res, this).then(() => {
497
            this.closeDialog2();
huhaiqing's avatar
huhaiqing committed
498 499
            this.getLoadSecGoodsList();
          });
huhaiqing's avatar
huhaiqing committed
500
        });
huhaiqing's avatar
huhaiqing committed
501
      }
huhaiqing's avatar
huhaiqing committed
502 503
    },
    /* 删除已装柜 */
huhaiqing's avatar
huhaiqing committed
504
    handlerBatchDelete(params, type) {
huhaiqing's avatar
huhaiqing committed
505 506 507 508 509
      params = {
        shipmentId: this.shipmentObj.id,
        secId: this.tableData.id,
        ...params,
      };
huhaiqing's avatar
huhaiqing committed
510 511 512 513

      if (type === "single") {
        singleDelete(params).then((res) => {
          serviceMsg(res, this).then(() => {
514
            this.closeDialog2();
huhaiqing's avatar
huhaiqing committed
515 516
            this.getLoadSecGoodsList();
          });
huhaiqing's avatar
huhaiqing committed
517
        });
huhaiqing's avatar
huhaiqing committed
518 519 520
      } else {
        batchDelete(params).then((res) => {
          serviceMsg(res, this).then(() => {
521
            this.closeDialog2();
huhaiqing's avatar
huhaiqing committed
522 523 524 525
            this.getLoadSecGoodsList();
          });
        });
      }
huhaiqing's avatar
huhaiqing committed
526 527 528 529 530 531 532 533 534 535 536 537
    },
    /* 移出 */
    moveOut(row) {
      let params = {
        shipmentId: this.shipmentObj.id,
        secId: this.tableData.id,
        orderId: row.orderId,
      };
      remove(params).then((res) => {
        serviceMsg(res, this).then(() => {
          this.getLoadSecGoodsList();
        });
538 539
      }).catch((res) => {
        if (res.code === 666) {
540
              this.$confirm("<div style='max-height:500px;overflow:auto'>"+res.msg+this.$t('是否需要一起移出?')+"</div>", this.$t("提示"), {
zhoutong's avatar
zhoutong committed
541 542 543 544
                dangerouslyUseHTMLString: true,
                distinguishCancelAndClose: true,
                confirmButtonText: '确定移出',
                cancelButtonText: '仅移出当前订单'
545 546 547 548 549 550 551 552
              })
                .then((_) => {
                  remove({ ...params, deleteType: 2 }).then((res) => {
                    serviceMsg(res, this).then(() => {
                      this.getLoadSecGoodsList();
                    });
                  });
                })
zhoutong's avatar
zhoutong committed
553 554 555 556 557 558
                .catch(action => {
                  if(action =='cancel'){
                    remove({ ...params, deleteType: 1 }).then((res) => {
                      serviceMsg(res, this).then(() => {
                        this.getLoadSecGoodsList();
                      });
559
                    });
zhoutong's avatar
zhoutong committed
560
                  }
561 562
                });
            }
huhaiqing's avatar
huhaiqing committed
563 564 565 566 567 568 569 570 571 572
      });
    },
    /* 修改柜信息 */
    modifyBoxUpdate() {
      let params = {
        shipmentId: this.shipmentObj.id,
        ...this.modifyCabinetObj,
      };
      boxUpdate(params).then((res) => {
        serviceMsg(res, this);
573 574
        // this.getBoxInfo()
        this.$emit('getBoxInfo')
575
        this.closeDialog2();
huhaiqing's avatar
huhaiqing committed
576 577 578 579
      });
    },
    /* 补单完成 */
    supplementFinish() {
580
      this.closeDialog2();
huhaiqing's avatar
huhaiqing committed
581 582 583 584 585
      this.getLoadSecGoodsList();
    },
    /* 申请封柜 */
    applyCloseCabinet() {
      approvalCreate({
586
        applyReason: this.$t("封柜审核"),
huhaiqing's avatar
huhaiqing committed
587
        approvalStatus: 0,
588
        approvalType: 2, // 封柜
huhaiqing's avatar
huhaiqing committed
589 590
        copyUserId: this.selectedUsers,
        shipmentId: this.shipmentObj.id,
huhaiqing's avatar
huhaiqing committed
591
      }).then((res) => {
huhaiqing's avatar
huhaiqing committed
592
        serviceMsg(res, this).then(() => {
593
          this.$emit("closeDialog1", "submit");
huhaiqing's avatar
huhaiqing committed
594
        });
huhaiqing's avatar
huhaiqing committed
595 596
      });
    },
huhaiqing's avatar
huhaiqing committed
597 598
    /* 是否显示拆单 */
    isShowSplitOrder(row) {
huhaiqing's avatar
huhaiqing committed
599
      if (row.num > row.installNum && row.installNum !== 0) {
huhaiqing's avatar
huhaiqing committed
600 601 602 603
        return true;
      }
      return false;
    },
huhaiqing's avatar
huhaiqing committed
604 605 606
    /* 取消审核 */
    canclAudit() {
      approvalCancel({
607
        applyReason: this.$t("取消审核"),
608
        id: this.shipmentObj["cabinetApprovalInfo"].id,
huhaiqing's avatar
huhaiqing committed
609 610 611
        shipmentId: this.shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then(() => {
612
          this.$emit("closeDialog1", "submit");
huhaiqing's avatar
huhaiqing committed
613 614 615
        });
      });
    },
huhaiqing's avatar
huhaiqing committed
616
    /* 跳转详情 */
617 618 619
    jumpReviewDetail() {
      const { cabinetApprovalInfo } = this.shipmentObj;
      toReviewDetail.apply(this, [cabinetApprovalInfo.bpmProcessId]);
620
      this.$emit("closeDialog1", "close");
621
    },
huhaiqing's avatar
huhaiqing committed
622 623 624 625 626 627 628 629 630
    queryOrderInfo() {
      this.$refs["batchForm"].validate((valid) => {
        if (valid) {
          getOrderDetailByBoxNo({
            orderNumCode: this.batchObj.qrCode,
            shipmentId: this.shipmentObj.id,
          }).then((res) => {
            const { data } = res;
            this.boxOrderInfo = data;
huhaiqing's avatar
huhaiqing committed
631
            this.batchObj.boxNum = Number(data.num);
huhaiqing's avatar
huhaiqing committed
632 633 634 635 636 637
          });
        }
      });
    },
    batchLoad() {
      if (!this.boxOrderInfo.orderId) {
638
        this.$message.error(this.$t("请输入订单号"));
huhaiqing's avatar
huhaiqing committed
639 640 641
        return;
      }
      if (this.batchObj.boxNum === 0) {
642
        this.$message.error(this.$t("箱数不能为0"));
huhaiqing's avatar
huhaiqing committed
643 644
        return;
      }
645

huhaiqing's avatar
huhaiqing committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
      let params = {
        boxNum: this.boxOrderInfo.num,
        orderId: this.boxOrderInfo.orderId,
        orderNo: this.boxOrderInfo.orderNo,
        shipmentId: this.shipmentObj.id,
      };
      if (this.boxOrderInfo.isExternalWarehouse === 1) {
        params.boxNum = this.batchObj.boxNum;
      }

      externalLoad(params).then((res) => {
        serviceMsg(res, this).then(() => {
          this.closeDialog2();
          this.boxOrderInfo = {};
          this.getLoadSecGoodsList();
        });
      });
    },
huhaiqing's avatar
huhaiqing committed
664
  },
huhaiqing's avatar
huhaiqing committed
665 666 667 668
  computed: {
    /* 是否审核中 */
    isUnderReview() {
      const { currNode } = this.$attrs;
669 670 671 672
      return this.shipmentObj[currNode.keyName] === 44 ? true : false;
    },
    /* 预计时间 */
    preinstallDate() {
673 674 675 676
      if (this.shipmentObj.preInstallInfo.createTime) {
        return dayjs(this.shipmentObj.preInstallInfo.createTime).format(
          "YYYY-MM-DD HH:mm:ss"
        );
677 678
      }
      return null;
huhaiqing's avatar
huhaiqing committed
679
    },
680 681 682 683 684 685 686 687 688
    /* 容量 */
    calcCapacity() {
      const { cabinetRespVO } = this.shipmentObj;
      return getCapacity(cabinetRespVO);
    },
    /* 总计 */
    getSumData() {
      return sumStatistics(this.listData);
    },
689 690 691 692 693
    /* 已装总数 */
    getInstallNumCount() {
      let count = 0;
      if (Array.isArray(this.listData)) {
        this.listData.forEach((item) => {
huhaiqing's avatar
huhaiqing committed
694
          const { sectionOrderList = [] } = item;
695
          sectionOrderList.forEach((item) => {
696
            count = Decimal.add(count, item.installNum).toNumber();
697 698 699 700 701
          });
        });
      }
      return count;
    },
huhaiqing's avatar
huhaiqing committed
702
  },
huhaiqing's avatar
huhaiqing committed
703 704 705 706 707
};
</script>

<style lang="scss" scoped>
.startPacking {
huhaiqing's avatar
huhaiqing committed
708 709
  display: flex;
  flex-direction: column;
huhaiqing's avatar
huhaiqing committed
710 711 712 713 714 715 716 717 718
  p {
    margin: 0;
  }
  .content-area {
    display: flex;
    .left-area {
      border-right: 3px solid #e6ebf5;
      padding-right: 10px;
      .title-info {
huhaiqing's avatar
huhaiqing committed
719 720 721 722 723 724 725 726 727
        height: 80px;

        &.selected {
          > div:first-child {
            background-color: #4f9cdd;
            color: #fff;
          }
        }

huhaiqing's avatar
huhaiqing committed
728 729 730 731 732
        > div:first-child {
          font-size: 16px;
          background-color: #f2f2f2;
          line-height: 30px;
          text-align: center;
huhaiqing's avatar
huhaiqing committed
733
          cursor: pointer;
huhaiqing's avatar
huhaiqing committed
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
        }
        > :last-child {
          display: flex;
          > p {
            margin-right: 10px;
            color: #4f9cdd;
          }
        }
      }
    }
    .right-area {
      padding-left: 10px;
      .table-title {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
        > div:first-child {
          flex: 1;
          font-size: 16px;
        }
        > div:last-child {
          display: flex;
          > .el-input {
            margin-right: 10px;
          }
        }
      }
huhaiqing's avatar
huhaiqing committed
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
      .table-content {
        .table-goodList {
          .goodList-div {
            border-bottom: 1px solid #e6ebf5;
            > p {
              text-align: left;
            }
            > p:last-child {
              > span {
                margin-right: 5px;
              }
            }
          }
          > div:last-child {
            border-bottom: none;
          }
        }

        .el-table {
          color: red;
        }
huhaiqing's avatar
huhaiqing committed
782 783 784 785 786 787 788 789 790 791
      }
    }
  }
  .totle-info {
    font-size: 20px;
    margin-top: 15px;
    > div {
      display: flex;
      margin-bottom: 5px;
    }
huhaiqing's avatar
huhaiqing committed
792 793 794 795 796
    .count-info {
      > p > span {
        margin-right: 5px;
      }
    }
huhaiqing's avatar
huhaiqing committed
797
  }
huhaiqing's avatar
huhaiqing committed
798 799 800 801 802 803 804 805 806 807 808 809 810

  .process-area {
    margin-top: 15px;
    padding-bottom: 30px;
    .process {
      display: flex;
      flex-direction: column;
      > :first-child {
        color: #606266;
        font-weight: bolder;
        font-size: 16px;
      }
    }
huhaiqing's avatar
huhaiqing committed
811 812 813
  }
}
</style>