utils.js 37.4 KB
Newer Older
1
import dayjs from "dayjs";
huhaiqing's avatar
huhaiqing committed
2 3
import * as _BOX from "@/api/ecw/box";
import FileSaver from "file-saver";
4
import Decimal from "decimal.js";
5
import i18n from '@/i18n'
6 7 8 9 10
/**
 * 节点状态值
 *
 * @return {*}
 */
11
function getStatusName(statu) {
12
  const statusName = new Map();
huhaiqing's avatar
huhaiqing committed
13

14 15
  statusName.set(11, i18n.t("未订舱"));
  statusName.set(12, i18n.t("已订舱"));
huhaiqing's avatar
huhaiqing committed
16

17 18 19 20 21
  statusName.set(21, i18n.t("未预装"));
  statusName.set(22, i18n.t("预装中"));
  statusName.set(23, i18n.t("预装审核中"));
  statusName.set(24, i18n.t("预装审核失败"));
  statusName.set(25, i18n.t("预装审核成功"));
huhaiqing's avatar
huhaiqing committed
22

23 24
  statusName.set(2111, i18n.t("未理货"));
  statusName.set(2112, i18n.t("已理货"));
25

26 27
  statusName.set(31, i18n.t("未派车"));
  statusName.set(32, i18n.t("已派车"));
huhaiqing's avatar
huhaiqing committed
28

29 30 31 32 33 34 35
  statusName.set(41, i18n.t("未装柜"));
  statusName.set(42, i18n.t("装柜中"));
  statusName.set(43, i18n.t("已装柜、待封柜"));
  statusName.set(44, i18n.t("封柜审核中"));
  statusName.set(45, i18n.t("封柜审核失败"));
  statusName.set(46, i18n.t("封柜审核成功"));
  statusName.set(47, i18n.t("已封柜,待出仓"));
huhaiqing's avatar
huhaiqing committed
36

37 38 39
  statusName.set(51, i18n.t("未报关"));
  statusName.set(52, i18n.t("报关中"));
  statusName.set(53, i18n.t("已报关"));
huhaiqing's avatar
huhaiqing committed
40

41 42
  statusName.set(61, i18n.t("未配船"));
  statusName.set(62, i18n.t("已配船"));
huhaiqing's avatar
huhaiqing committed
43

44 45
  statusName.set(71, i18n.t("未提单补料"));
  statusName.set(72, i18n.t("已提单补料"));
huhaiqing's avatar
huhaiqing committed
46

47 48
  statusName.set(81, i18n.t("未驳船"));
  statusName.set(82, i18n.t("已驳船"));
huhaiqing's avatar
huhaiqing committed
49

50 51
  statusName.set(91, i18n.t("未起运"));
  statusName.set(92, i18n.t("已起运"));
huhaiqing's avatar
huhaiqing committed
52

53 54
  statusName.set(101, i18n.t("未上传"));
  statusName.set(102, i18n.t("已上传"));
huhaiqing's avatar
huhaiqing committed
55

56 57
  statusName.set(111, i18n.t("未清关文件"));
  statusName.set(112, i18n.t("已清关文件"));
huhaiqing's avatar
huhaiqing committed
58

59 60
  statusName.set(121, i18n.t("未到港"));
  statusName.set(122, i18n.t("已到港"));
huhaiqing's avatar
huhaiqing committed
61

62 63
  statusName.set(131, i18n.t("未清关"));
  statusName.set(132, i18n.t("已清关"));
huhaiqing's avatar
huhaiqing committed
64

65 66 67 68 69 70
  statusName.set(181, i18n.t("未卸柜"));
  statusName.set(182, i18n.t("卸柜中"));
  statusName.set(183, i18n.t("卸柜审核中"));
  statusName.set(184, i18n.t("卸柜审核失败"));
  statusName.set(185, i18n.t("卸柜审核成功"));
  statusName.set(186, i18n.t("已卸柜"));
huhaiqing's avatar
huhaiqing committed
71

72 73 74
  statusName.set(191, i18n.t("未结算"));
  statusName.set(192, i18n.t("结算中"));
  statusName.set(193, i18n.t("已结算"));
huhaiqing's avatar
huhaiqing committed
75

76
  return statusName.get(statu);
77 78
}

79 80 81 82 83
/**
 * 海运流程
 *
 * @return {*}
 */
84
function seaBaseData() {
huhaiqing's avatar
huhaiqing committed
85 86 87
  return [
    [
      {
88
        title: i18n.t("订舱"),
huhaiqing's avatar
huhaiqing committed
89 90 91 92 93
        imgSrc: {
          start: require("@/assets/images/shipping/dc-start.png"),
          end: require("@/assets/images/shipping/dc-end.png"),
        },
        type: "booking", // 类型
94
        dataKey: "1", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
95 96 97 98 99 100 101 102 103 104
        /**
         * 订舱状态:11、未订舱;12、已订舱
         */
        voName: "bookSeaInfo", // 订舱对象vo
        keyName: "bkStatus",
        status: {
          start: [11],
          wait: [],
          end: [12],
        },
huhaiqing's avatar
huhaiqing committed
105
      },
huhaiqing's avatar
huhaiqing committed
106 107 108
    ],
    [
      {
109
        title: i18n.t("排单"),
huhaiqing's avatar
huhaiqing committed
110 111 112 113 114 115
        imgSrc: {
          start: require("@/assets/images/shipping/yz-start.png"),
          wait: require("@/assets/images/shipping/yz-wait.png"),
          end: require("@/assets/images/shipping/yz-end.png"),
        },
        type: "preinstall",
116
        dataKey: "2", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
117
        /**
huhaiqing's avatar
huhaiqing committed
118
         * 预装状态:21、未预装;22、预装中;23、预装审核中;24、预装审核失败;25、预装审核成功
huhaiqing's avatar
huhaiqing committed
119 120 121 122 123
         */
        voName: "preInstallInfo",
        keyName: "prStatus",
        status: {
          start: [21],
huhaiqing's avatar
huhaiqing committed
124 125
          wait: [22, 23, 24],
          end: [25],
huhaiqing's avatar
huhaiqing committed
126
        },
huhaiqing's avatar
huhaiqing committed
127
      },
128 129 130 131 132 133 134 135 136 137 138 139 140 141
      {
        title: "AGENT",
        imgSrc: {
          start: require("@/assets/images/shipping/agent-start.png"),
          wait: require("@/assets/images/shipping/agent-wait.png"),
          end: require("@/assets/images/shipping/agent-end.png"),
        },
        type: "agent",
        voName: "agentInfo",
        currStatus: "start",
      },
    ],
    [
      {
142
        title: i18n.t("理货"),
143 144 145 146 147 148 149 150 151 152
        imgSrc: {
          start: require("@/assets/images/shipping/lh-start.png"),
          wait: require("@/assets/images/shipping/lh-wait.png"),
          end: require("@/assets/images/shipping/lh-end.png"),
        },
        type: "tally",
        dataKey: "16", // 字典数据键值
        /**
         * 理货状态:2111、未理货;2112、已理货
         */
huhaiqing's avatar
huhaiqing committed
153
        voName: "tallyInfo",
154 155 156 157 158 159 160
        keyName: "tyStatus",
        status: {
          start: [2111],
          wait: [],
          end: [2112],
        },
      },
huhaiqing's avatar
huhaiqing committed
161
      {
162
        title: i18n.t("拖车"),
huhaiqing's avatar
huhaiqing committed
163 164 165 166 167 168
        imgSrc: {
          start: require("@/assets/images/shipping/tc-start.png"),
          wait: require("@/assets/images/shipping/tc-wait.png"),
          end: require("@/assets/images/shipping/tc-end.png"),
        },
        type: "trailer",
169
        dataKey: "3", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
170 171 172 173 174 175 176 177 178 179
        /**
         * 拖车状态:31、未派车;32、已派车
         */
        voName: "trailerInfo",
        keyName: "tlStatus",
        status: {
          start: [31],
          wait: [],
          end: [32],
        },
huhaiqing's avatar
huhaiqing committed
180
      },
huhaiqing's avatar
huhaiqing committed
181 182 183
    ],
    [
      {
184
        title: i18n.t("装柜"),
huhaiqing's avatar
huhaiqing committed
185 186 187 188 189 190
        imgSrc: {
          start: require("@/assets/images/shipping/zg-start.png"),
          wait: require("@/assets/images/shipping/zg-wait.png"),
          end: require("@/assets/images/shipping/zg-end.png"),
        },
        type: "cabinet",
191
        dataKey: "4", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
192
        /**
193
         * 装柜状态:41、未装柜;42、装柜中;43、已装柜、待封柜;44、封柜审核中;45、封柜审核失败;46、封柜审核成功;47、已封柜,待出仓
huhaiqing's avatar
huhaiqing committed
194 195 196 197 198
         */
        voName: "cabinetInfo",
        keyName: "ldStatus",
        status: {
          start: [41],
199 200
          wait: [42, 43, 44, 45, 46],
          end: [47],
huhaiqing's avatar
huhaiqing committed
201
        },
huhaiqing's avatar
huhaiqing committed
202
      },
huhaiqing's avatar
huhaiqing committed
203 204 205
    ],
    [
      {
206
        title: i18n.t("报关"),
huhaiqing's avatar
huhaiqing committed
207 208 209 210 211 212
        imgSrc: {
          start: require("@/assets/images/shipping/bg-start.png"),
          wait: require("@/assets/images/shipping/bg-wait.png"),
          end: require("@/assets/images/shipping/bg-end.png"),
        },
        type: "cusDeclaration",
213
        dataKey: "5", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
214 215 216
        /**
         *报关状态:51、未报关;52、报关中;53、已报关
         */
217
        voName: "customsInfo",
huhaiqing's avatar
huhaiqing committed
218 219 220 221 222 223
        keyName: "dcStatus",
        status: {
          start: [51],
          wait: [52],
          end: [53],
        },
huhaiqing's avatar
huhaiqing committed
224
      },
huhaiqing's avatar
huhaiqing committed
225 226 227 228 229 230 231 232
      {
        title: "配船",
        imgSrc: {
          start: require("@/assets/images/shipping/pc-start.png"),
          wait: require("@/assets/images/shipping/pc-wait.png"),
          end: require("@/assets/images/shipping/pc-end.png"),
        },
        type: "ship",
233
        dataKey: "6", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
234 235 236 237 238 239 240 241 242 243
        /**
         * 配船状态:61、未配船;62、已配船
         */
        voName: "shipConfigInfo",
        keyName: "saStatus",
        status: {
          start: [61],
          wait: [],
          end: [62],
        },
huhaiqing's avatar
huhaiqing committed
244
      },
huhaiqing's avatar
huhaiqing committed
245
      {
246
        title: i18n.t("提单补料"),
huhaiqing's avatar
huhaiqing committed
247 248 249 250 251 252
        imgSrc: {
          start: require("@/assets/images/shipping/tdcl-start.png"),
          wait: require("@/assets/images/shipping/tdcl-wait.png"),
          end: require("@/assets/images/shipping/tdcl-end.png"),
        },
        type: "subMaterial",
253
        dataKey: "7", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
254 255 256 257 258 259 260 261 262 263
        /**
         * 提单补料状态:71、未提单补料;72、已提单补料
         */
        voName: "ladingBillInfo",
        keyName: "blStatus",
        status: {
          start: [71],
          wait: [],
          end: [72],
        },
huhaiqing's avatar
huhaiqing committed
264
      },
huhaiqing's avatar
huhaiqing committed
265 266 267
    ],
    [
      {
268
        title: i18n.t("驳船"),
huhaiqing's avatar
huhaiqing committed
269 270 271 272 273 274
        imgSrc: {
          start: require("@/assets/images/shipping/bc-start.png"),
          wait: require("@/assets/images/shipping/bc-wait.png"),
          end: require("@/assets/images/shipping/bc-end.png"),
        },
        type: "barge",
275
        dataKey: "8", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
276 277 278 279 280 281 282 283 284 285
        /**
         * 驳船状态:81、未驳船;82、已驳船
         */
        voName: "bargeInfo",
        keyName: "bgStatus",
        status: {
          start: [81],
          wait: [],
          end: [82],
        },
huhaiqing's avatar
huhaiqing committed
286
      },
huhaiqing's avatar
huhaiqing committed
287 288 289
    ],
    [
      {
290
        title: i18n.t("起运"),
huhaiqing's avatar
huhaiqing committed
291 292 293 294 295 296
        imgSrc: {
          start: require("@/assets/images/shipping/qy-start.png"),
          wait: require("@/assets/images/shipping/qy-wait.png"),
          end: require("@/assets/images/shipping/qy-end.png"),
        },
        type: "departure",
297
        dataKey: "9", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
298 299 300 301 302 303 304 305 306 307
        /**
         * 起运状态:91、未起运;92、已起运
         */
        voName: "shippingInfo",
        keyName: "dtStatus",
        status: {
          start: [91],
          wait: [],
          end: [92],
        },
huhaiqing's avatar
huhaiqing committed
308
      },
huhaiqing's avatar
huhaiqing committed
309 310 311
    ],
    [
      {
312
        title: i18n.t("提单Copy"),
huhaiqing's avatar
huhaiqing committed
313 314 315 316 317 318
        imgSrc: {
          start: require("@/assets/images/shipping/tdcopy-start.png"),
          wait: require("@/assets/images/shipping/tdcopy-wait.png"),
          end: require("@/assets/images/shipping/tdcopy-end.png"),
        },
        type: "blCopy",
319
        dataKey: "10", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
320 321 322 323 324 325 326 327 328 329
        /**
         * 提单COPY状态:101、未上传;102、已上传
         */
        voName: "ladingCopyInfo",
        keyName: "cpStatus",
        status: {
          start: [101],
          wait: [],
          end: [102],
        },
huhaiqing's avatar
huhaiqing committed
330
      },
huhaiqing's avatar
huhaiqing committed
331 332 333 334 335 336 337
      {
        type: "clrDocument",
        imgSrc: {
          start: require("@/assets/images/shipping/qg-start.png"),
          wait: require("@/assets/images/shipping/qg-wait.png"),
          end: require("@/assets/images/shipping/qg-end.png"),
        },
338
        title: i18n.t("清关文件"),
339
        dataKey: "11", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
340 341 342 343 344 345 346 347 348 349
        /**
         * 清关文件状态:111、未清关文件;112、已清关文件
         */
        voName: "clearanceDocInfo",
        keyName: "cdStatus",
        status: {
          start: [111],
          wait: [],
          end: [112],
        },
huhaiqing's avatar
huhaiqing committed
350
      },
huhaiqing's avatar
huhaiqing committed
351 352 353
    ],
    [
      {
354
        title: i18n.t("到港"),
huhaiqing's avatar
huhaiqing committed
355 356 357 358 359 360
        imgSrc: {
          start: require("@/assets/images/shipping/dg-start.png"),
          wait: require("@/assets/images/shipping/dg-wait.png"),
          end: require("@/assets/images/shipping/dg-end.png"),
        },
        type: "arrival",
361
        dataKey: "12", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
362 363 364 365 366 367 368 369 370 371
        /**
         * 到港状态:121、未到港;112、已到港
         */
        voName: "arrivalInfo",
        keyName: "apStatus",
        status: {
          start: [121],
          wait: [],
          end: [122],
        },
huhaiqing's avatar
huhaiqing committed
372
      },
huhaiqing's avatar
huhaiqing committed
373 374 375
    ],
    [
      {
376
        title: i18n.t("清关"),
huhaiqing's avatar
huhaiqing committed
377 378 379 380 381 382
        imgSrc: {
          start: require("@/assets/images/shipping/qg-start.png"),
          wait: require("@/assets/images/shipping/qg-wait.png"),
          end: require("@/assets/images/shipping/qg-end.png"),
        },
        type: "cusClearance",
383
        dataKey: "13", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
384 385 386 387 388 389 390 391 392 393
        /**
         * 清关状态:131、未清关;132、已清关
         */
        voName: "clearanceInfo",
        keyName: "clStatus",
        status: {
          start: [131],
          wait: [],
          end: [132],
        },
huhaiqing's avatar
huhaiqing committed
394
      },
huhaiqing's avatar
huhaiqing committed
395 396 397
    ],
    [
      {
398
        title: i18n.t("卸柜"),
huhaiqing's avatar
huhaiqing committed
399 400 401 402 403 404
        imgSrc: {
          start: require("@/assets/images/shipping/xg-start.png"),
          wait: require("@/assets/images/shipping/xg-wait.png"),
          end: require("@/assets/images/shipping/xg-end.png"),
        },
        type: "unloading",
405
        dataKey: "14", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
406
        /**
huhaiqing's avatar
huhaiqing committed
407
         * 卸柜状态:181、未卸柜;182、卸柜中;183、卸柜审核中;184、卸柜审核失败;185、卸柜审核成功;186、已卸柜
huhaiqing's avatar
huhaiqing committed
408 409 410 411
         */
        voName: "cabinetUnloadInfo",
        keyName: "ulStatus",
        status: {
huhaiqing's avatar
huhaiqing committed
412 413 414
          start: [181],
          wait: [182, 183, 184, 185],
          end: [186],
huhaiqing's avatar
huhaiqing committed
415
        },
huhaiqing's avatar
huhaiqing committed
416
      },
huhaiqing's avatar
huhaiqing committed
417 418 419
    ],
    [
      {
420
        title: i18n.t("结算"),
huhaiqing's avatar
huhaiqing committed
421 422 423 424 425 426
        imgSrc: {
          start: require("@/assets/images/shipping/js-start.png"),
          wait: require("@/assets/images/shipping/js-wait.png"),
          end: require("@/assets/images/shipping/js-end.png"),
        },
        type: "settlement",
427
        dataKey: "15", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
428
        /**
huhaiqing's avatar
huhaiqing committed
429
         * 结算状态:191、未结算;192、结算中;193、已结算
huhaiqing's avatar
huhaiqing committed
430 431 432 433
         */
        voName: "settlementInfo",
        keyName: "slStatus",
        status: {
huhaiqing's avatar
huhaiqing committed
434 435 436
          start: [191],
          wait: [192],
          end: [193],
huhaiqing's avatar
huhaiqing committed
437
        },
huhaiqing's avatar
huhaiqing committed
438
      },
huhaiqing's avatar
huhaiqing committed
439 440
    ],
  ];
441 442
}

zhoutong's avatar
zhoutong committed
443 444 445 446 447
/**
 * 海空联运流程
 *
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
448
function seaAirBaseData() {
zhoutong's avatar
zhoutong committed
449 450 451
  return [
    [
      {
452
        title: i18n.t("订舱"),
zhoutong's avatar
zhoutong committed
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
        imgSrc: {
          start: require("@/assets/images/shipping/dc-start.png"),
          end: require("@/assets/images/shipping/dc-end.png"),
        },
        type: "booking", // 类型
        dataKey: "1", // 字典数据键值
        /**
         * 订舱状态:11、未订舱;12、已订舱
         */
        voName: "bookSeaInfo", // 订舱对象vo
        keyName: "bkStatus",
        status: {
          start: [11],
          wait: [],
          end: [12],
        },
      },
    ],
    [
      {
473
        title: i18n.t("排单"),
zhoutong's avatar
zhoutong committed
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
        imgSrc: {
          start: require("@/assets/images/shipping/yz-start.png"),
          wait: require("@/assets/images/shipping/yz-wait.png"),
          end: require("@/assets/images/shipping/yz-end.png"),
        },
        type: "preinstall",
        dataKey: "2", // 字典数据键值
        /**
         * 预装状态:21、未预装;22、预装中;23、预装审核中;24、预装审核失败;25、预装审核成功
         */
        voName: "preInstallInfo",
        keyName: "prStatus",
        status: {
          start: [21],
          wait: [22, 23, 24],
          end: [25],
        },
      },
      {
        title: "AGENT",
        imgSrc: {
          start: require("@/assets/images/shipping/agent-start.png"),
          wait: require("@/assets/images/shipping/agent-wait.png"),
          end: require("@/assets/images/shipping/agent-end.png"),
        },
        type: "agent",
        voName: "agentInfo",
        currStatus: "start",
      },
    ],
    [
      {
506
        title: i18n.t("理货"),
zhoutong's avatar
zhoutong committed
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
        imgSrc: {
          start: require("@/assets/images/shipping/lh-start.png"),
          wait: require("@/assets/images/shipping/lh-wait.png"),
          end: require("@/assets/images/shipping/lh-end.png"),
        },
        type: "tally",
        dataKey: "16", // 字典数据键值
        /**
         * 理货状态:2111、未理货;2112、已理货
         */
        voName: "tallyInfo",
        keyName: "tyStatus",
        status: {
          start: [2111],
          wait: [],
          end: [2112],
        },
      },
      {
526
        title: i18n.t("拖车"),
zhoutong's avatar
zhoutong committed
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
        imgSrc: {
          start: require("@/assets/images/shipping/tc-start.png"),
          wait: require("@/assets/images/shipping/tc-wait.png"),
          end: require("@/assets/images/shipping/tc-end.png"),
        },
        type: "trailer",
        dataKey: "3", // 字典数据键值
        /**
         * 拖车状态:31、未派车;32、已派车
         */
        voName: "trailerInfo",
        keyName: "tlStatus",
        status: {
          start: [31],
          wait: [],
          end: [32],
        },
      },
    ],
    [
      {
548
        title: i18n.t("装柜"),
zhoutong's avatar
zhoutong committed
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
        imgSrc: {
          start: require("@/assets/images/shipping/zg-start.png"),
          wait: require("@/assets/images/shipping/zg-wait.png"),
          end: require("@/assets/images/shipping/zg-end.png"),
        },
        type: "cabinet",
        dataKey: "4", // 字典数据键值
        /**
         * 装柜状态:41、未装柜;42、装柜中;43、已装柜、待封柜;44、封柜审核中;45、封柜审核失败;46、封柜审核成功;47、已封柜,待出仓
         */
        voName: "cabinetInfo",
        keyName: "ldStatus",
        status: {
          start: [41],
          wait: [42, 43, 44, 45, 46],
          end: [47],
        },
      },
    ],
    [
      {
570
        title: i18n.t("报关"),
zhoutong's avatar
zhoutong committed
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
        imgSrc: {
          start: require("@/assets/images/shipping/bg-start.png"),
          wait: require("@/assets/images/shipping/bg-wait.png"),
          end: require("@/assets/images/shipping/bg-end.png"),
        },
        type: "cusDeclaration",
        dataKey: "5", // 字典数据键值
        /**
         *报关状态:51、未报关;52、报关中;53、已报关
         */
        voName: "customsInfo",
        keyName: "dcStatus",
        status: {
          start: [51],
          wait: [52],
          end: [53],
        },
      },
      {
590
        title: i18n.t("配船"),
zhoutong's avatar
zhoutong committed
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
        imgSrc: {
          start: require("@/assets/images/shipping/pc-start.png"),
          wait: require("@/assets/images/shipping/pc-wait.png"),
          end: require("@/assets/images/shipping/pc-end.png"),
        },
        type: "ship",
        dataKey: "6", // 字典数据键值
        /**
         * 配船状态:61、未配船;62、已配船
         */
        voName: "shipConfigInfo",
        keyName: "saStatus",
        status: {
          start: [61],
          wait: [],
          end: [62],
        },
      },
      {
610
        title: i18n.t("提单补料"),
zhoutong's avatar
zhoutong committed
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
        imgSrc: {
          start: require("@/assets/images/shipping/tdcl-start.png"),
          wait: require("@/assets/images/shipping/tdcl-wait.png"),
          end: require("@/assets/images/shipping/tdcl-end.png"),
        },
        type: "subMaterial",
        dataKey: "7", // 字典数据键值
        /**
         * 提单补料状态:71、未提单补料;72、已提单补料
         */
        voName: "ladingBillInfo",
        keyName: "blStatus",
        status: {
          start: [71],
          wait: [],
          end: [72],
        },
      },
    ],
    [
      {
632
        title: i18n.t("驳船"),
zhoutong's avatar
zhoutong committed
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
        imgSrc: {
          start: require("@/assets/images/shipping/bc-start.png"),
          wait: require("@/assets/images/shipping/bc-wait.png"),
          end: require("@/assets/images/shipping/bc-end.png"),
        },
        type: "barge",
        dataKey: "8", // 字典数据键值
        /**
         * 驳船状态:81、未驳船;82、已驳船
         */
        voName: "bargeInfo",
        keyName: "bgStatus",
        status: {
          start: [81],
          wait: [],
          end: [82],
        },
      },
    ],
    [
      {
654
        title: i18n.t("起运"),
zhoutong's avatar
zhoutong committed
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
        imgSrc: {
          start: require("@/assets/images/shipping/qy-start.png"),
          wait: require("@/assets/images/shipping/qy-wait.png"),
          end: require("@/assets/images/shipping/qy-end.png"),
        },
        type: "departure",
        dataKey: "9", // 字典数据键值
        /**
         * 起运状态:91、未起运;92、已起运
         */
        voName: "shippingInfo",
        keyName: "dtStatus",
        status: {
          start: [91],
          wait: [],
          end: [92],
        },
      },
    ],
    [
      {
676
        title: i18n.t("提单Copy"),
zhoutong's avatar
zhoutong committed
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701
        imgSrc: {
          start: require("@/assets/images/shipping/tdcopy-start.png"),
          wait: require("@/assets/images/shipping/tdcopy-wait.png"),
          end: require("@/assets/images/shipping/tdcopy-end.png"),
        },
        type: "blCopy",
        dataKey: "10", // 字典数据键值
        /**
         * 提单COPY状态:101、未上传;102、已上传
         */
        voName: "ladingCopyInfo",
        keyName: "cpStatus",
        status: {
          start: [101],
          wait: [],
          end: [102],
        },
      },
      {
        type: "clrDocument",
        imgSrc: {
          start: require("@/assets/images/shipping/qg-start.png"),
          wait: require("@/assets/images/shipping/qg-wait.png"),
          end: require("@/assets/images/shipping/qg-end.png"),
        },
702
        title: i18n.t("清关文件"),
zhoutong's avatar
zhoutong committed
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717
        dataKey: "11", // 字典数据键值
        /**
         * 清关文件状态:111、未清关文件;112、已清关文件
         */
        voName: "clearanceDocInfo",
        keyName: "cdStatus",
        status: {
          start: [111],
          wait: [],
          end: [112],
        },
      },
    ],
    [
      {
718
        title: i18n.t("到港"),
zhoutong's avatar
zhoutong committed
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739
        imgSrc: {
          start: require("@/assets/images/shipping/dg-start.png"),
          wait: require("@/assets/images/shipping/dg-wait.png"),
          end: require("@/assets/images/shipping/dg-end.png"),
        },
        type: "arrival",
        dataKey: "12", // 字典数据键值
        /**
         * 到港状态:121、未到港;112、已到港
         */
        voName: "arrivalInfo",
        keyName: "apStatus",
        status: {
          start: [121],
          wait: [],
          end: [122],
        },
      },
    ],
    [
      {
740
        title: i18n.t("清关"),
zhoutong's avatar
zhoutong committed
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
        imgSrc: {
          start: require("@/assets/images/shipping/qg-start.png"),
          wait: require("@/assets/images/shipping/qg-wait.png"),
          end: require("@/assets/images/shipping/qg-end.png"),
        },
        type: "cusClearance",
        dataKey: "13", // 字典数据键值
        /**
         * 清关状态:131、未清关;132、已清关
         */
        voName: "clearanceInfo",
        keyName: "clStatus",
        status: {
          start: [131],
          wait: [],
          end: [132],
        },
      },
    ],
    [
      {
762
        title: i18n.t("二程起飞"),
zhoutong's avatar
zhoutong committed
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
        imgSrc: {
          start: require("@/assets/images/shipping/ecqf-start.png"),
          wait: require("@/assets/images/shipping/ecqf-wait.png"),
          end: require("@/assets/images/shipping/ecqf-end.png"),
        },
        type: "twoWayTakeoff",
        dataKey: "14", // 字典数据键值
        /**
         * 起飞状态:141、未起飞;142、已起飞
         */
        voName: "takeOffInfo",
        keyName: "stkStatus",
        status: {
          start: [141],
          wait: [],
          end: [142],
        },
      },
    ],
    [
      {
784
        title: i18n.t("二程到港"),
zhoutong's avatar
zhoutong committed
785 786 787 788 789 790 791 792 793 794
        imgSrc: {
          start: require("@/assets/images/shipping/ecdg-start.png"),
          wait: require("@/assets/images/shipping/ecdg-wait.png"),
          end: require("@/assets/images/shipping/ecdg-end.png"),
        },
        type: "twoWayArrival",
        dataKey: "15", // 字典数据键值
        /**
         * 清关状态:131、未清关;132、已清关
         */
zhoutong's avatar
zhoutong committed
795
        voName: "airArrivalInfo",
zhoutong's avatar
zhoutong committed
796 797 798 799 800 801 802 803 804 805
        keyName: "sapStatus",
        status: {
          start: [151],
          wait: [],
          end: [152],
        },
      },
    ],
    [
      {
806
        title: i18n.t("卸柜"),
zhoutong's avatar
zhoutong committed
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
        imgSrc: {
          start: require("@/assets/images/shipping/xg-start.png"),
          wait: require("@/assets/images/shipping/xg-wait.png"),
          end: require("@/assets/images/shipping/xg-end.png"),
        },
        type: "unloading",
        dataKey: "14", // 字典数据键值
        /**
         * 卸柜状态:181、未卸柜;182、卸柜中;183、卸柜审核中;184、卸柜审核失败;185、卸柜审核成功;186、已卸柜
         */
        voName: "cabinetUnloadInfo",
        keyName: "ulStatus",
        status: {
          start: [181],
          wait: [182, 183, 184, 185],
          end: [186],
        },
      },
    ],
    [
      {
828
        title: i18n.t("结算"),
zhoutong's avatar
zhoutong committed
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
        imgSrc: {
          start: require("@/assets/images/shipping/js-start.png"),
          wait: require("@/assets/images/shipping/js-wait.png"),
          end: require("@/assets/images/shipping/js-end.png"),
        },
        type: "settlement",
        dataKey: "15", // 字典数据键值
        /**
         * 结算状态:191、未结算;192、结算中;193、已结算
         */
        voName: "settlementInfo",
        keyName: "slStatus",
        status: {
          start: [191],
          wait: [192],
          end: [193],
        },
      },
    ],
  ];
}

851 852 853 854 855 856 857 858 859 860 861 862 863
/**
 * 详情显示列
 *
 * @return {*}
 */
function getColmnMapping() {
  return {
    bookSeaInfo: [
      {
        title: "SO NO",
        key: "sono",
      },
      {
864
        title: i18n.t("船公司类型"),
865 866 867 868
        key: "shipCompanyType",
        type: "supplier",
      },
      {
869
        title: i18n.t("驳船港"),
870 871 872 873
        key: "bargePortId",
        type: "dock",
      },
      {
874
        title: i18n.t("大船港"),
875 876 877 878
        key: "bigPortId",
        type: "dock",
      },
      {
879
        title: i18n.t("目的港"),
880 881 882 883
        key: "destPortId",
        type: "dock",
      },
      {
884
        title: i18n.t("订舱公司"),
885 886 887 888
        key: "spaceCompanyId",
        type: "supplier",
      },
      {
889
        title: i18n.t("预计驳船时间"),
890 891 892 893
        key: "bargeTime",
        type: "date",
      },
      {
894
        title: i18n.t("预计开船时间"),
895 896 897 898
        key: "sailTime",
        type: "date",
      },
      {
899
        title: i18n.t("业务员"),
900 901 902 903 904
        key: "operator",
      },
    ],
    preInstallInfo: [
      {
905
        title: i18n.t("预装时间"),
906 907 908 909
        key: "createTime",
        type: "date",
      },
      {
910
        title: i18n.t("业务员"),
911 912 913 914 915
        key: "operator",
      },
    ],
    trailerInfo: [
      {
916
        title: i18n.t("货柜号"),
917 918 919
        key: "tlContainerNo",
      },
      {
920
        title: i18n.t("封条"),
921 922 923
        key: "tlStripSeal",
      },
      {
924
        title: i18n.t("拖车公司"),
925 926 927 928
        key: "tlCompanyId",
        type: "supplier",
      },
      {
929
        title: i18n.t("拖车时间"),
930 931 932 933
        key: "tlTime",
        type: "date",
      },
      {
934
        title: i18n.t("车牌"),
935 936 937
        key: "tlLicensePlate",
      },
      {
938
        title: i18n.t("司机"),
939 940 941
        key: "tlDriver",
      },
      {
942
        title: i18n.t("联系方式"),
943 944 945
        key: "tlDriverContact",
      },
      {
946
        title: i18n.t("业务员"),
947 948 949
        key: "operator",
      },
    ],
huhaiqing's avatar
huhaiqing committed
950 951
    tallyInfo: [
      {
952
        title: i18n.t("完成理货时间"),
huhaiqing's avatar
huhaiqing committed
953 954 955 956
        key: "tyTime",
        type: "datetime",
      },
      {
957
        title: i18n.t("业务员"),
huhaiqing's avatar
huhaiqing committed
958 959 960
        key: "tyOperator",
      },
    ],
961 962
    agentInfo: [
      {
963
        title: i18n.t("代理商"),
964 965 966 967
        key: "agentId",
        type: "supplier",
      },
      {
968
        title: i18n.t("业务员"),
969 970 971 972 973
        key: "operator",
      },
    ],
    cabinetInfo: [
      {
974
        title: i18n.t("到仓时间"),
975 976 977 978
        key: "ldInWarehouseTime",
        type: "date",
      },
      {
979
        title: i18n.t("仓库类型"),
980 981 982 983
        key: "ldWarehouseType",
        type: "warehouse",
      },
      {
984
        title: i18n.t("装柜时间"),
985 986 987 988
        key: "ldBoxTime",
        type: "date",
      },
      {
989
        title: i18n.t("出仓时间"),
990 991 992 993
        key: "ldOutWarehouseTime",
        type: "date",
      },
      {
994
        title: i18n.t("业务员"),
995 996 997 998 999
        key: "operator",
      },
    ],
    customsInfo: [
      {
1000
        title: i18n.t("报关方式"),
1001 1002 1003 1004
        key: "dcCustomsType",
        type: "shipping_customs_type",
      },
      {
1005
        title: i18n.t("报关行公司"),
1006 1007 1008 1009
        key: "dcCompanyId",
        type: "supplier",
      },
      {
1010
        title: i18n.t("截关时间"),
1011 1012 1013 1014
        key: "dcCutOffTime",
        type: "date",
      },
      {
1015
        title: i18n.t("状态"),
1016 1017 1018 1019
        key: "dcCustomsStatus",
        type: "shipping_dcCustoms_status",
      },
      {
1020
        title: i18n.t("放行时间"),
1021 1022 1023 1024
        key: "dcPassTime",
        type: "date",
      },
      {
1025
        title: i18n.t("新封条"),
1026 1027 1028
        key: "dcStripSeal",
      },
      {
1029
        title: i18n.t("柜重"),
1030 1031 1032
        key: "dcBoxWgt",
      },
      {
1033
        title: i18n.t("货重"),
1034 1035 1036
        key: "dcGoodsWgt",
      },
      {
1037
        title: i18n.t("VGM重量"),
1038 1039 1040
        key: "dcVgmWgt",
      },
      {
1041
        title: i18n.t("业务员"),
1042 1043 1044 1045 1046
        key: "operator",
      },
    ],
    shipConfigInfo: [
      {
1047
        title: i18n.t("已配/免配"),
1048 1049 1050 1051
        key: "saExmtStatus",
        type: "saExmtStatus",
      },
      {
1052
        title: i18n.t("业务员"),
1053 1054 1055 1056 1057
        key: "operator",
      },
    ],
    ladingBillInfo: [
      {
1058
        title: i18n.t("清关代理"),
1059 1060 1061 1062
        key: "agentId",
        type: "supplier",
      },
      {
1063
        title: i18n.t("提单品名"),
1064 1065 1066
        key: "blMblNo",
      },
      {
1067
        title: i18n.t("通知方"),
1068
        key: "notifyingId",
huhaiqing's avatar
huhaiqing committed
1069
        type: "user",
1070 1071
      },
      {
1072
        title: i18n.t("提单备注"),
1073 1074 1075
        key: "remarks",
      },
      {
1076
        title: i18n.t("数量(个)"),
1077 1078 1079
        key: "packageNum",
      },
      {
1080
        title: i18n.t("体积"),
1081 1082 1083
        key: "cbm",
      },
      {
1084
        title: i18n.t("业务员"),
1085 1086 1087 1088 1089
        key: "operator",
      },
    ],
    bargeInfo: [
      {
1090
        title: i18n.t("驳船"),
1091 1092 1093 1094
        key: "bgExmtStatus",
        type: "bgExmtStatus",
      },
      {
1095
        title: i18n.t("业务员"),
1096 1097 1098 1099 1100
        key: "operator",
      },
    ],
    shippingInfo: [
      {
1101
        title: i18n.t("实际开船时间"),
1102 1103 1104 1105
        key: "dtRealShipTime",
        type: "datetime",
      },
      {
1106
        title: i18n.t("预计到港时间"),
1107 1108 1109 1110
        key: "dtEstArrivalTime",
        type: "date",
      },
      {
1111
        title: i18n.t("业务员"),
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
        key: "operator",
      },
    ],
    clearanceDocInfo: [
      {
        title: "agent list",
        key: "cdAgentlistType",
        type: "isFile",
      },
      {
        title: "soncap",
        key: "cdSoncapType",
        type: "isFile",
      },
      {
1127
        title: i18n.t("出单方式"),
1128 1129 1130 1131
        key: "cdOutBillType",
        type: "billingMethod",
      },
      {
1132
        title: i18n.t("寄送时间"),
1133 1134 1135 1136
        key: "cdSendTime",
        type: "date",
      },
      {
1137
        title: i18n.t("业务员"),
1138 1139 1140 1141 1142
        key: "operator",
      },
    ],
    arrivalInfo: [
      {
1143
        title: i18n.t("实际到港时间"),
1144 1145 1146 1147
        key: "apRealTime",
        type: "datetime",
      },
      {
1148
        title: i18n.t("确认到港"),
1149 1150 1151 1152
        key: "apConfirmTime",
        type: "datetime",
      },
      {
1153
        title: i18n.t("卸港时间"),
1154 1155 1156 1157
        key: "apUnloadPortTime",
        type: "date",
      },
      {
1158
        title: i18n.t("业务员"),
1159 1160 1161 1162 1163
        key: "operator",
      },
    ],
    clearanceInfo: [
      {
1164
        title: i18n.t("预计清关时间"),
1165 1166 1167 1168
        key: "clEstTime",
        type: "date",
      },
      {
1169
        title: i18n.t("清关时间"),
1170 1171 1172 1173
        key: "clClearTime",
        type: "datetime",
      },
      {
1174
        title: i18n.t("业务员"),
1175 1176 1177
        key: "operator",
      },
    ],
zhoutong's avatar
zhoutong committed
1178 1179
    takeOffInfo: [
      {
1180
        title: i18n.t("预计头程时间"),
zhoutong's avatar
zhoutong committed
1181 1182 1183 1184
        key: "estHeadTime",
        type: "datetime",
      },
      {
1185
        title: i18n.t("实际头程时间"),
zhoutong's avatar
zhoutong committed
1186 1187 1188 1189
        key: "actHeadTime",
        type: "datetime",
      },
      {
1190
        title: i18n.t("预计二程时间"),
zhoutong's avatar
zhoutong committed
1191 1192 1193 1194
        key: "estSecondTime",
        type: "date",
      },
      {
1195
        title: i18n.t("业务员"),
zhoutong's avatar
zhoutong committed
1196 1197 1198 1199 1200
        key: "operator",
      },
    ],
    airArrivalInfo: [
      {
1201
        title: i18n.t("预计到达时间"),
zhoutong's avatar
zhoutong committed
1202 1203 1204 1205
        key: "estTime",
        type: "datetime",
      },
      {
1206
        title: i18n.t("实际到达时间"),
zhoutong's avatar
zhoutong committed
1207 1208 1209
        key: "actTime",
        type: "datetime",
      },
zhoutong's avatar
zhoutong committed
1210
      {
1211
        title: i18n.t("实际二程时间"),
zhoutong's avatar
zhoutong committed
1212 1213 1214
        key: "actSecondTime",
        type: "datetime",
      },
zhoutong's avatar
zhoutong committed
1215
      {
1216
        title: i18n.t("业务员"),
zhoutong's avatar
zhoutong committed
1217 1218 1219
        key: "operator",
      },
    ],
1220 1221
    cabinetUnloadInfo: [
      {
1222
        title: i18n.t("到仓时间"),
1223 1224 1225 1226
        key: "ulWarehouseTime",
        type: "date",
      },
      {
1227
        title: i18n.t("卸货时间"),
1228 1229 1230 1231
        key: "ulBoxTime",
        type: "date",
      },
      {
1232
        title: i18n.t("业务员"),
1233 1234 1235 1236 1237
        key: "operator",
      },
    ],
    settlementInfo: [
      {
1238
        title: i18n.t("可结算"),
1239 1240 1241 1242
        key: "slSettlementTime",
        type: "date",
      },
      {
1243
        title: i18n.t("已结算"),
1244 1245 1246 1247
        key: "slSettledTime",
        type: "date",
      },
      {
1248
        title: i18n.t("业务员"),
1249 1250 1251 1252 1253 1254 1255 1256 1257
        key: "operator",
      },
    ],
  };
}

/**
 * 常量字典
 */
huhaiqing's avatar
huhaiqing committed
1258 1259 1260 1261 1262
const constantDict = {
  // 配船状态
  saExmtStatus: [
    {
      value: "1",
1263
      label: i18n.t("免配"),
huhaiqing's avatar
huhaiqing committed
1264 1265 1266
    },
    {
      value: "2",
1267
      label: i18n.t("已配"),
huhaiqing's avatar
huhaiqing committed
1268 1269
    },
  ],
huhaiqing's avatar
huhaiqing committed
1270 1271 1272 1273
  // 驳船
  bgExmtStatus: [
    {
      value: "1",
1274
      label: i18n.t("无驳船"),
huhaiqing's avatar
huhaiqing committed
1275 1276 1277
    },
    {
      value: "2",
1278
      label: i18n.t("有驳船"),
huhaiqing's avatar
huhaiqing committed
1279 1280 1281 1282 1283 1284
    },
  ],
  // 出单方式
  billingMethod: [
    {
      value: "1",
1285
      label: i18n.t("电放"),
huhaiqing's avatar
huhaiqing committed
1286 1287 1288
    },
    {
      value: "2",
1289
      label: i18n.t("正本"),
huhaiqing's avatar
huhaiqing committed
1290 1291 1292 1293 1294 1295
    },
  ],
  // 是否有文件
  isFile: [
    {
      value: "1",
1296
      label: i18n.t("无需"),
huhaiqing's avatar
huhaiqing committed
1297 1298 1299
    },
    {
      value: "2",
1300
      label: i18n.t("已做"),
huhaiqing's avatar
huhaiqing committed
1301 1302
    },
  ],
huhaiqing's avatar
huhaiqing committed
1303 1304
};

1305 1306 1307 1308 1309 1310 1311
/**
 * string format number
 *
 * @param {*} obj
 * @param {*} keys
 * @return {*}
 */
1312 1313 1314 1315 1316 1317 1318 1319 1320
function formatStringNumber(obj, keys) {
  for (const [key, value] of Object.entries(obj)) {
    if (keys.includes(key) && !Number.isNaN(Number(value))) {
      obj[key] = Number(value);
    }
  }
  return obj;
}

1321 1322 1323 1324 1325 1326 1327
/**
 * number format string
 *
 * @param {*} obj
 * @param {*} keys
 * @return {*}
 */
1328 1329 1330 1331 1332 1333 1334 1335 1336
function formatNumberString(obj, keys) {
  for (const [key, value] of Object.entries(obj)) {
    if (keys.includes(key) && value) {
      obj[key] = String(value);
    }
  }
  return obj;
}

1337 1338 1339 1340 1341
/**
 * stringDate format Date
 *
 * @param {*} obj
 * @param {*} keys
huhaiqing's avatar
huhaiqing committed
1342
 * @param {string} [format="YYYY-MM-DD HH:mm:ss"]
1343 1344
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
1345
function formatDateStr(obj, keys, format = "YYYY-MM-DD HH:mm:ss") {
1346 1347
  for (const [key, value] of Object.entries(obj)) {
    if (keys.includes(key) && dayjs(value).isValid()) {
huhaiqing's avatar
huhaiqing committed
1348
      obj[key] = dayjs(value).format(format);
1349 1350 1351 1352 1353
    }
  }
  return obj;
}

huhaiqing's avatar
huhaiqing committed
1354 1355 1356 1357
/**
 * 格式化日期
 *
 * @param {*} date
huhaiqing's avatar
huhaiqing committed
1358
 * @param {string} [format="YYYY-MM-DD HH:mm:ss"]
huhaiqing's avatar
huhaiqing committed
1359 1360
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
1361
function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
1362 1363 1364 1365
  if (!date) return date;
  return dayjs(date).format(format);
}

huhaiqing's avatar
huhaiqing committed
1366 1367 1368 1369 1370 1371
/**
 * 获取海运流程状态
 *
 * @param {*} val
 * @return {*}
 */
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
function getSeaStatus(val) {
  let currNodeStatus = 11,
    isBreak = false,
    datas = seaBaseData();
  // 迭代每个节点
  for (let i = 0; i < datas.length; i++) {
    const nodes = datas[i];
    for (let j = 0; j < nodes.length; j++) {
      const node = nodes[j];
      const { keyName, voName, status } = node;
      if (!keyName) continue;
      const { start, wait, end } = status;

      if (start.includes(val[keyName]) && val[voName]) {
        currNodeStatus = val[keyName];
      }

      if (wait.includes(val[keyName])) {
        currNodeStatus = val[keyName];
        isBreak = true;
        break;
      }

      if (end.includes(val[keyName])) {
        currNodeStatus = val[keyName];
      }
    }
    if (isBreak) break;
  }
  return currNodeStatus;
}

huhaiqing's avatar
huhaiqing committed
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
/**
 * 组装统计信息文字
 *
 * @param {*} total
 * @param {string} [keys=["num", "volume", "weight"]]
 * @return {*}
 */
function getTotlContent(total, keys = ["num", "volume", "weight"]) {
  let content = [];
  for (const key of keys) {
    if (key === "num") {
      content.push(`${total?.num ?? 0}`);
    }
    if (key === "volume") {
1418 1419 1420
      let volume = total?.volume ?? 0;
      volume = volume === 0 ? volume : new Decimal(volume).toFixed(2);
      content.push(`${volume}m³`);
huhaiqing's avatar
huhaiqing committed
1421 1422
    }
    if (key === "weight") {
1423 1424 1425
      let weight = total?.weight ?? 0;
      weight = weight === 0 ? weight : new Decimal(weight).toFixed(2);
      content.push(`${weight}kg`);
huhaiqing's avatar
huhaiqing committed
1426 1427 1428 1429 1430
    }
  }
  return content.join(" ");
}

1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443
function getCapacity(capacity) {
  return `${capacity?.name ?? ""}柜型 ${capacity?.volume ?? 0}m³ ${
    capacity?.weight ?? 0
  }kg`;
}

function sumStatistics(val) {
  let count = { num: 0, volume: 0, weight: 0 };
  if (Array.isArray(val)) {
    val.forEach((item) => {
      const { secStatistics } = item;
      if (secStatistics) {
        if (!Number.isNaN(Number(secStatistics.num))) {
1444 1445 1446 1447
          count.num = Decimal.add(
            count.num,
            Number(secStatistics.num)
          ).toNumber();
1448 1449
        }
        if (!Number.isNaN(Number(secStatistics.volume))) {
1450 1451 1452 1453
          count.volume = Decimal.add(
            count.volume,
            Number(secStatistics.volume)
          );
1454 1455
        }
        if (!Number.isNaN(Number(secStatistics.weight))) {
1456 1457 1458 1459
          count.weight = Decimal.add(
            count.weight,
            Number(secStatistics.weight)
          );
1460 1461 1462 1463 1464 1465 1466
        }
      }
    });
  }
  return getTotlContent(count);
}

huhaiqing's avatar
huhaiqing committed
1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477
export const fileTypes = [
  "doc",
  "xls",
  "ppt",
  "txt",
  "pdf",
  "png",
  "jpg",
  "jpeg",
];

huhaiqing's avatar
huhaiqing committed
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
/**
 * 服务提示消息回调
 *
 * @export
 * @param {*} result
 * @param {*} _vue
 * @return {*}
 */
function serviceMsg(result, _vue) {
  return new Promise((resolve, reject) => {
    const { code, msg } = result;
    if (code === 0) {
      _vue.$message.success("操作成功");
      resolve();
    } else {
      _vue.$message.error(msg);
      reject();
    }
  });
}

1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
/**
 * 跳转审核详情
 *
 * @param {*} bpmProcessId
 */
function toReviewDetail(bpmProcessId) {
  this.$router.push({
    path: "/bpm/process-instance/detail",
    query: { id: bpmProcessId },
  });
}

huhaiqing's avatar
huhaiqing committed
1511 1512 1513 1514 1515 1516 1517
function downloadFile(funName, params, fileName, fileFormat) {
  _BOX[funName](params).then((res) => {
    let blob = new Blob([res], { type: `application/${fileFormat}` });
    FileSaver.saveAs(blob, fileName);
  });
}

1518 1519 1520 1521 1522 1523
function downloadFileByUrl(funName, params) {
  _BOX[funName](params).then((res) => {
    if (res.data) FileSaver.saveAs(res.data);
  });
}

1524
export {
1525
  getStatusName,
1526
  getColmnMapping,
1527
  getSeaStatus,
1528
  seaBaseData,
zhoutong's avatar
zhoutong committed
1529
  seaAirBaseData,
huhaiqing's avatar
huhaiqing committed
1530
  constantDict,
1531 1532 1533
  formatStringNumber,
  formatDateStr,
  formatNumberString,
1534
  formatDate,
huhaiqing's avatar
huhaiqing committed
1535
  getTotlContent,
1536 1537
  getCapacity,
  sumStatistics,
huhaiqing's avatar
huhaiqing committed
1538
  serviceMsg,
1539
  toReviewDetail,
huhaiqing's avatar
huhaiqing committed
1540
  downloadFile,
1541
  downloadFileByUrl,
1542
};