utils.js 35.7 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 11
/**
 * 海运流程
 *
 * @return {*}
 */
12
function seaBaseData() {
huhaiqing's avatar
huhaiqing committed
13 14 15
  return [
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
16
        title: i18n.$t("订舱"),
huhaiqing's avatar
huhaiqing committed
17 18 19 20 21
        imgSrc: {
          start: require("@/assets/images/shipping/dc-start.png"),
          end: require("@/assets/images/shipping/dc-end.png"),
        },
        type: "booking", // 类型
22
        dataKey: "1", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
23 24 25 26 27 28 29 30 31 32
        /**
         * 订舱状态:11、未订舱;12、已订舱
         */
        voName: "bookSeaInfo", // 订舱对象vo
        keyName: "bkStatus",
        status: {
          start: [11],
          wait: [],
          end: [12],
        },
huhaiqing's avatar
huhaiqing committed
33
      },
huhaiqing's avatar
huhaiqing committed
34 35 36
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
37
        title: i18n.$t("排单"),
huhaiqing's avatar
huhaiqing committed
38 39 40 41 42 43
        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",
44
        dataKey: "2", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
45
        /**
huhaiqing's avatar
huhaiqing committed
46
         * 预装状态:21、未预装;22、预装中;23、预装审核中;24、预装审核失败;25、预装审核成功
huhaiqing's avatar
huhaiqing committed
47 48 49 50 51
         */
        voName: "preInstallInfo",
        keyName: "prStatus",
        status: {
          start: [21],
huhaiqing's avatar
huhaiqing committed
52 53
          wait: [22, 23, 24],
          end: [25],
huhaiqing's avatar
huhaiqing committed
54
        },
huhaiqing's avatar
huhaiqing committed
55
      },
56 57 58 59 60 61 62 63 64 65 66 67 68 69
      {
        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",
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
70
        title: i18n.$t("理货"),
71 72 73 74 75 76 77 78 79 80
        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
81
        voName: "tallyInfo",
82 83 84 85 86 87 88
        keyName: "tyStatus",
        status: {
          start: [2111],
          wait: [],
          end: [2112],
        },
      },
huhaiqing's avatar
huhaiqing committed
89
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
90
        title: i18n.$t("拖车"),
huhaiqing's avatar
huhaiqing committed
91 92 93 94 95 96
        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",
97
        dataKey: "3", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
98 99 100 101 102 103 104 105 106 107
        /**
         * 拖车状态:31、未派车;32、已派车
         */
        voName: "trailerInfo",
        keyName: "tlStatus",
        status: {
          start: [31],
          wait: [],
          end: [32],
        },
huhaiqing's avatar
huhaiqing committed
108
      },
huhaiqing's avatar
huhaiqing committed
109 110 111
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
112
        title: i18n.$t("装柜"),
huhaiqing's avatar
huhaiqing committed
113 114 115 116 117 118
        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",
119
        dataKey: "4", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
120
        /**
121
         * 装柜状态:41、未装柜;42、装柜中;43、已装柜、待封柜;44、封柜审核中;45、封柜审核失败;46、封柜审核成功;47、已封柜,待出仓
huhaiqing's avatar
huhaiqing committed
122 123 124 125 126
         */
        voName: "cabinetInfo",
        keyName: "ldStatus",
        status: {
          start: [41],
127 128
          wait: [42, 43, 44, 45, 46],
          end: [47],
huhaiqing's avatar
huhaiqing committed
129
        },
huhaiqing's avatar
huhaiqing committed
130
      },
huhaiqing's avatar
huhaiqing committed
131 132 133
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
134
        title: i18n.$t("报关"),
huhaiqing's avatar
huhaiqing committed
135 136 137 138 139 140
        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",
141
        dataKey: "5", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
142 143 144
        /**
         *报关状态:51、未报关;52、报关中;53、已报关
         */
145
        voName: "customsInfo",
huhaiqing's avatar
huhaiqing committed
146 147 148 149 150 151
        keyName: "dcStatus",
        status: {
          start: [51],
          wait: [52],
          end: [53],
        },
huhaiqing's avatar
huhaiqing committed
152
      },
huhaiqing's avatar
huhaiqing committed
153
      {
huhaiqing's avatar
huhaiqing committed
154
        title: i18n.$t("配船"),
huhaiqing's avatar
huhaiqing committed
155 156 157 158 159 160
        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",
161
        dataKey: "6", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
162 163 164 165 166 167 168 169 170 171
        /**
         * 配船状态:61、未配船;62、已配船
         */
        voName: "shipConfigInfo",
        keyName: "saStatus",
        status: {
          start: [61],
          wait: [],
          end: [62],
        },
huhaiqing's avatar
huhaiqing committed
172
      },
huhaiqing's avatar
huhaiqing committed
173
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
174
        title: i18n.$t("提单补料"),
huhaiqing's avatar
huhaiqing committed
175 176 177 178 179 180
        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",
181
        dataKey: "7", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
182 183 184 185 186 187 188 189 190 191
        /**
         * 提单补料状态:71、未提单补料;72、已提单补料
         */
        voName: "ladingBillInfo",
        keyName: "blStatus",
        status: {
          start: [71],
          wait: [],
          end: [72],
        },
huhaiqing's avatar
huhaiqing committed
192
      },
huhaiqing's avatar
huhaiqing committed
193 194 195
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
196
        title: i18n.$t("驳船"),
huhaiqing's avatar
huhaiqing committed
197 198 199 200 201 202
        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",
203
        dataKey: "8", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
204 205 206 207 208 209 210 211 212 213
        /**
         * 驳船状态:81、未驳船;82、已驳船
         */
        voName: "bargeInfo",
        keyName: "bgStatus",
        status: {
          start: [81],
          wait: [],
          end: [82],
        },
huhaiqing's avatar
huhaiqing committed
214
      },
huhaiqing's avatar
huhaiqing committed
215 216 217
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
218
        title: i18n.$t("起运"),
huhaiqing's avatar
huhaiqing committed
219 220 221 222 223 224
        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",
225
        dataKey: "9", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
226 227 228 229 230 231 232 233 234 235
        /**
         * 起运状态:91、未起运;92、已起运
         */
        voName: "shippingInfo",
        keyName: "dtStatus",
        status: {
          start: [91],
          wait: [],
          end: [92],
        },
huhaiqing's avatar
huhaiqing committed
236
      },
huhaiqing's avatar
huhaiqing committed
237 238 239
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
240
        title: i18n.$t("提单Copy"),
huhaiqing's avatar
huhaiqing committed
241 242 243 244 245 246
        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",
247
        dataKey: "10", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
248 249 250 251 252 253 254 255 256 257
        /**
         * 提单COPY状态:101、未上传;102、已上传
         */
        voName: "ladingCopyInfo",
        keyName: "cpStatus",
        status: {
          start: [101],
          wait: [],
          end: [102],
        },
huhaiqing's avatar
huhaiqing committed
258
      },
huhaiqing's avatar
huhaiqing committed
259 260 261 262 263 264 265
      {
        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"),
        },
dragondean@qq.com's avatar
dragondean@qq.com committed
266
        title: i18n.$t("清关文件"),
267
        dataKey: "11", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
268 269 270 271 272 273 274 275 276 277
        /**
         * 清关文件状态:111、未清关文件;112、已清关文件
         */
        voName: "clearanceDocInfo",
        keyName: "cdStatus",
        status: {
          start: [111],
          wait: [],
          end: [112],
        },
huhaiqing's avatar
huhaiqing committed
278
      },
huhaiqing's avatar
huhaiqing committed
279 280 281
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
282
        title: i18n.$t("到港"),
huhaiqing's avatar
huhaiqing committed
283 284 285 286 287 288
        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",
289
        dataKey: "12", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
290 291 292 293 294 295 296 297 298 299
        /**
         * 到港状态:121、未到港;112、已到港
         */
        voName: "arrivalInfo",
        keyName: "apStatus",
        status: {
          start: [121],
          wait: [],
          end: [122],
        },
huhaiqing's avatar
huhaiqing committed
300
      },
huhaiqing's avatar
huhaiqing committed
301 302 303
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
304
        title: i18n.$t("清关"),
huhaiqing's avatar
huhaiqing committed
305 306 307 308 309 310
        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",
311
        dataKey: "13", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
312 313 314 315 316 317 318 319 320 321
        /**
         * 清关状态:131、未清关;132、已清关
         */
        voName: "clearanceInfo",
        keyName: "clStatus",
        status: {
          start: [131],
          wait: [],
          end: [132],
        },
huhaiqing's avatar
huhaiqing committed
322
      },
huhaiqing's avatar
huhaiqing committed
323 324 325
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
326
        title: i18n.$t("卸柜"),
huhaiqing's avatar
huhaiqing committed
327 328 329 330 331 332
        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",
333
        dataKey: "14", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
334
        /**
huhaiqing's avatar
huhaiqing committed
335
         * 卸柜状态:181、未卸柜;182、卸柜中;183、卸柜审核中;184、卸柜审核失败;185、卸柜审核成功;186、已卸柜
huhaiqing's avatar
huhaiqing committed
336 337 338 339
         */
        voName: "cabinetUnloadInfo",
        keyName: "ulStatus",
        status: {
huhaiqing's avatar
huhaiqing committed
340 341 342
          start: [181],
          wait: [182, 183, 184, 185],
          end: [186],
huhaiqing's avatar
huhaiqing committed
343
        },
huhaiqing's avatar
huhaiqing committed
344
      },
huhaiqing's avatar
huhaiqing committed
345 346 347
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
348
        title: i18n.$t("结算"),
huhaiqing's avatar
huhaiqing committed
349 350 351 352 353 354
        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",
355
        dataKey: "15", // 字典数据键值
huhaiqing's avatar
huhaiqing committed
356
        /**
huhaiqing's avatar
huhaiqing committed
357
         * 结算状态:191、未结算;192、结算中;193、已结算
huhaiqing's avatar
huhaiqing committed
358 359 360 361
         */
        voName: "settlementInfo",
        keyName: "slStatus",
        status: {
huhaiqing's avatar
huhaiqing committed
362 363 364
          start: [191],
          wait: [192],
          end: [193],
huhaiqing's avatar
huhaiqing committed
365
        },
huhaiqing's avatar
huhaiqing committed
366
      },
huhaiqing's avatar
huhaiqing committed
367 368
    ],
  ];
369 370
}

zhoutong's avatar
zhoutong committed
371 372 373 374 375
/**
 * 海空联运流程
 *
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
376
function seaAirBaseData() {
zhoutong's avatar
zhoutong committed
377 378 379
  return [
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
380
        title: i18n.$t("订舱"),
zhoutong's avatar
zhoutong committed
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
401
        title: i18n.$t("排单"),
zhoutong's avatar
zhoutong committed
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
        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",
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
434
        title: i18n.$t("理货"),
zhoutong's avatar
zhoutong committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
        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],
        },
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
454
        title: i18n.$t("拖车"),
zhoutong's avatar
zhoutong committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
476
        title: i18n.$t("装柜"),
zhoutong's avatar
zhoutong committed
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
498
        title: i18n.$t("报关"),
zhoutong's avatar
zhoutong committed
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
        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],
        },
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
518
        title: i18n.$t("配船"),
zhoutong's avatar
zhoutong committed
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
        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],
        },
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
538
        title: i18n.$t("提单补料"),
zhoutong's avatar
zhoutong committed
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
560
        title: i18n.$t("驳船"),
zhoutong's avatar
zhoutong committed
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
582
        title: i18n.$t("起运"),
zhoutong's avatar
zhoutong committed
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
604
        title: i18n.$t("提单Copy"),
zhoutong's avatar
zhoutong committed
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629
        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"),
        },
dragondean@qq.com's avatar
dragondean@qq.com committed
630
        title: i18n.$t("清关文件"),
zhoutong's avatar
zhoutong committed
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645
        dataKey: "11", // 字典数据键值
        /**
         * 清关文件状态:111、未清关文件;112、已清关文件
         */
        voName: "clearanceDocInfo",
        keyName: "cdStatus",
        status: {
          start: [111],
          wait: [],
          end: [112],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
646
        title: i18n.$t("到港"),
zhoutong's avatar
zhoutong committed
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
668
        title: i18n.$t("清关"),
zhoutong's avatar
zhoutong committed
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
690
        title: i18n.$t("二程起飞"),
zhoutong's avatar
zhoutong committed
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
712
        title: i18n.$t("二程到港"),
zhoutong's avatar
zhoutong committed
713 714 715 716 717 718 719 720 721 722
        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
723
        voName: "airArrivalInfo",
zhoutong's avatar
zhoutong committed
724 725 726 727 728 729 730 731 732 733
        keyName: "sapStatus",
        status: {
          start: [151],
          wait: [],
          end: [152],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
734
        title: i18n.$t("卸柜"),
zhoutong's avatar
zhoutong committed
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
        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],
        },
      },
    ],
    [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
756
        title: i18n.$t("结算"),
zhoutong's avatar
zhoutong committed
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778
        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],
        },
      },
    ],
  ];
}

779 780 781 782 783 784 785 786 787 788 789 790 791
/**
 * 详情显示列
 *
 * @return {*}
 */
function getColmnMapping() {
  return {
    bookSeaInfo: [
      {
        title: "SO NO",
        key: "sono",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
792
        title: i18n.$t("船公司类型"),
793 794 795 796
        key: "shipCompanyType",
        type: "supplier",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
797
        title: i18n.$t("驳船港"),
798 799 800 801
        key: "bargePortId",
        type: "dock",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
802
        title: i18n.$t("大船港"),
803 804 805 806
        key: "bigPortId",
        type: "dock",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
807
        title: i18n.$t("目的港"),
808 809 810 811
        key: "destPortId",
        type: "dock",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
812
        title: i18n.$t("订舱公司"),
813 814 815 816
        key: "spaceCompanyId",
        type: "supplier",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
817
        title: i18n.$t("预计驳船时间"),
818 819 820 821
        key: "bargeTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
822
        title: i18n.$t("预计开船时间"),
823 824 825 826
        key: "sailTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
827
        title: i18n.$t("业务员"),
828 829 830 831 832
        key: "operator",
      },
    ],
    preInstallInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
833
        title: i18n.$t("预装时间"),
834 835 836 837
        key: "createTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
838
        title: i18n.$t("业务员"),
839 840 841 842 843
        key: "operator",
      },
    ],
    trailerInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
844
        title: i18n.$t("货柜号"),
845 846 847
        key: "tlContainerNo",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
848
        title: i18n.$t("封条"),
849 850 851
        key: "tlStripSeal",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
852
        title: i18n.$t("拖车公司"),
853 854 855 856
        key: "tlCompanyId",
        type: "supplier",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
857
        title: i18n.$t("拖车时间"),
858 859 860 861
        key: "tlTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
862
        title: i18n.$t("车牌"),
863 864 865
        key: "tlLicensePlate",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
866
        title: i18n.$t("司机"),
867 868 869
        key: "tlDriver",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
870
        title: i18n.$t("联系方式"),
871 872 873
        key: "tlDriverContact",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
874
        title: i18n.$t("业务员"),
875 876 877
        key: "operator",
      },
    ],
huhaiqing's avatar
huhaiqing committed
878 879
    tallyInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
880
        title: i18n.$t("完成理货时间"),
huhaiqing's avatar
huhaiqing committed
881 882 883 884
        key: "tyTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
885
        title: i18n.$t("业务员"),
huhaiqing's avatar
huhaiqing committed
886 887 888
        key: "tyOperator",
      },
    ],
889 890
    agentInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
891
        title: i18n.$t("代理商"),
892 893 894 895
        key: "agentId",
        type: "supplier",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
896
        title: i18n.$t("业务员"),
897 898 899 900 901
        key: "operator",
      },
    ],
    cabinetInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
902
        title: i18n.$t("到仓时间"),
903 904 905 906
        key: "ldInWarehouseTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
907
        title: i18n.$t("仓库类型"),
908 909 910 911
        key: "ldWarehouseType",
        type: "warehouse",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
912
        title: i18n.$t("装柜时间"),
913 914 915 916
        key: "ldBoxTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
917
        title: i18n.$t("出仓时间"),
918 919 920 921
        key: "ldOutWarehouseTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
922
        title: i18n.$t("业务员"),
923 924 925 926 927
        key: "operator",
      },
    ],
    customsInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
928
        title: i18n.$t("报关方式"),
929 930 931 932
        key: "dcCustomsType",
        type: "shipping_customs_type",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
933
        title: i18n.$t("报关行公司"),
934 935 936 937
        key: "dcCompanyId",
        type: "supplier",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
938
        title: i18n.$t("截关时间"),
939 940 941 942
        key: "dcCutOffTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
943
        title: i18n.$t("状态"),
944 945 946 947
        key: "dcCustomsStatus",
        type: "shipping_dcCustoms_status",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
948
        title: i18n.$t("放行时间"),
949 950 951 952
        key: "dcPassTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
953
        title: i18n.$t("新封条"),
954 955 956
        key: "dcStripSeal",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
957
        title: i18n.$t("柜重"),
958 959 960
        key: "dcBoxWgt",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
961
        title: i18n.$t("货重"),
962 963 964
        key: "dcGoodsWgt",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
965
        title: i18n.$t("VGM重量"),
966 967 968
        key: "dcVgmWgt",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
969
        title: i18n.$t("业务员"),
970 971 972 973 974
        key: "operator",
      },
    ],
    shipConfigInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
975
        title: i18n.$t("已配/免配"),
976 977 978 979
        key: "saExmtStatus",
        type: "saExmtStatus",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
980
        title: i18n.$t("业务员"),
981 982 983 984 985
        key: "operator",
      },
    ],
    ladingBillInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
986
        title: i18n.$t("清关代理"),
987 988 989 990
        key: "agentId",
        type: "supplier",
      },
      {
991
        title: i18n.$t("提单号"),
992 993 994
        key: "blMblNo",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
995
        title: i18n.$t("通知方"),
996
        key: "notifyingName",
997 998
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
999
        title: i18n.$t("提单备注"),
1000 1001 1002
        key: "remarks",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1003
        title: i18n.$t("数量(个)"),
1004 1005 1006
        key: "packageNum",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1007
        title: i18n.$t("体积"),
1008 1009 1010
        key: "cbm",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1011
        title: i18n.$t("业务员"),
1012 1013 1014 1015 1016
        key: "operator",
      },
    ],
    bargeInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1017
        title: i18n.$t("驳船"),
1018 1019 1020 1021
        key: "bgExmtStatus",
        type: "bgExmtStatus",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1022
        title: i18n.$t("业务员"),
1023 1024 1025 1026 1027
        key: "operator",
      },
    ],
    shippingInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1028
        title: i18n.$t("实际开船时间"),
1029 1030 1031 1032
        key: "dtRealShipTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1033
        title: i18n.$t("预计到港时间"),
1034 1035 1036 1037
        key: "dtEstArrivalTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1038
        title: i18n.$t("业务员"),
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
        key: "operator",
      },
    ],
    clearanceDocInfo: [
      {
        title: "agent list",
        key: "cdAgentlistType",
        type: "isFile",
      },
      {
        title: "soncap",
        key: "cdSoncapType",
        type: "isFile",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1054
        title: i18n.$t("出单方式"),
1055 1056 1057 1058
        key: "cdOutBillType",
        type: "billingMethod",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1059
        title: i18n.$t("寄送时间"),
1060 1061 1062 1063
        key: "cdSendTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1064
        title: i18n.$t("业务员"),
1065 1066 1067 1068 1069
        key: "operator",
      },
    ],
    arrivalInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1070
        title: i18n.$t("实际到港时间"),
1071 1072 1073 1074
        key: "apRealTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1075
        title: i18n.$t("确认到港"),
1076 1077 1078 1079
        key: "apConfirmTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1080
        title: i18n.$t("卸港时间"),
1081 1082 1083 1084
        key: "apUnloadPortTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1085
        title: i18n.$t("业务员"),
1086 1087 1088 1089 1090
        key: "operator",
      },
    ],
    clearanceInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1091
        title: i18n.$t("预计清关时间"),
1092 1093 1094 1095
        key: "clEstTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1096
        title: i18n.$t("清关时间"),
1097 1098 1099 1100
        key: "clClearTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1101
        title: i18n.$t("业务员"),
1102 1103 1104
        key: "operator",
      },
    ],
zhoutong's avatar
zhoutong committed
1105 1106
    takeOffInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1107
        title: i18n.$t("预计头程时间"),
zhoutong's avatar
zhoutong committed
1108 1109 1110 1111
        key: "estHeadTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1112
        title: i18n.$t("实际头程时间"),
zhoutong's avatar
zhoutong committed
1113 1114 1115 1116
        key: "actHeadTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1117
        title: i18n.$t("预计二程时间"),
zhoutong's avatar
zhoutong committed
1118 1119 1120 1121
        key: "estSecondTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1122
        title: i18n.$t("业务员"),
zhoutong's avatar
zhoutong committed
1123 1124 1125 1126 1127
        key: "operator",
      },
    ],
    airArrivalInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1128
        title: i18n.$t("预计到达时间"),
zhoutong's avatar
zhoutong committed
1129 1130 1131 1132
        key: "estTime",
        type: "datetime",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1133
        title: i18n.$t("实际到达时间"),
zhoutong's avatar
zhoutong committed
1134 1135 1136
        key: "actTime",
        type: "datetime",
      },
zhoutong's avatar
zhoutong committed
1137
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1138
        title: i18n.$t("实际二程时间"),
zhoutong's avatar
zhoutong committed
1139 1140 1141
        key: "actSecondTime",
        type: "datetime",
      },
zhoutong's avatar
zhoutong committed
1142
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1143
        title: i18n.$t("业务员"),
zhoutong's avatar
zhoutong committed
1144 1145 1146
        key: "operator",
      },
    ],
1147 1148
    cabinetUnloadInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1149
        title: i18n.$t("到仓时间"),
1150 1151 1152 1153
        key: "ulWarehouseTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1154
        title: i18n.$t("卸货时间"),
1155 1156 1157 1158
        key: "ulBoxTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1159
        title: i18n.$t("业务员"),
1160 1161 1162 1163 1164
        key: "operator",
      },
    ],
    settlementInfo: [
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1165
        title: i18n.$t("可结算"),
1166 1167 1168 1169
        key: "slSettlementTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1170
        title: i18n.$t("已结算"),
1171 1172 1173 1174
        key: "slSettledTime",
        type: "date",
      },
      {
dragondean@qq.com's avatar
dragondean@qq.com committed
1175
        title: i18n.$t("业务员"),
1176 1177 1178 1179 1180 1181 1182 1183 1184
        key: "operator",
      },
    ],
  };
}

/**
 * 常量字典
 */
huhaiqing's avatar
huhaiqing committed
1185 1186 1187 1188 1189
const constantDict = {
  // 配船状态
  saExmtStatus: [
    {
      value: "1",
dragondean@qq.com's avatar
dragondean@qq.com committed
1190
      label: i18n.$t("免配"),
huhaiqing's avatar
huhaiqing committed
1191 1192 1193
    },
    {
      value: "2",
dragondean@qq.com's avatar
dragondean@qq.com committed
1194
      label: i18n.$t("已配"),
huhaiqing's avatar
huhaiqing committed
1195 1196
    },
  ],
huhaiqing's avatar
huhaiqing committed
1197 1198 1199 1200
  // 驳船
  bgExmtStatus: [
    {
      value: "1",
dragondean@qq.com's avatar
dragondean@qq.com committed
1201
      label: i18n.$t("无驳船"),
huhaiqing's avatar
huhaiqing committed
1202 1203 1204
    },
    {
      value: "2",
dragondean@qq.com's avatar
dragondean@qq.com committed
1205
      label: i18n.$t("有驳船"),
huhaiqing's avatar
huhaiqing committed
1206 1207 1208 1209 1210 1211
    },
  ],
  // 出单方式
  billingMethod: [
    {
      value: "1",
1212
      label: i18n.$t("正本"),
huhaiqing's avatar
huhaiqing committed
1213 1214 1215
    },
    {
      value: "2",
1216
      label: i18n.$t("电放"),
huhaiqing's avatar
huhaiqing committed
1217 1218 1219 1220 1221 1222
    },
  ],
  // 是否有文件
  isFile: [
    {
      value: "1",
dragondean@qq.com's avatar
dragondean@qq.com committed
1223
      label: i18n.$t("无需"),
huhaiqing's avatar
huhaiqing committed
1224 1225 1226
    },
    {
      value: "2",
dragondean@qq.com's avatar
dragondean@qq.com committed
1227
      label: i18n.$t("已做"),
huhaiqing's avatar
huhaiqing committed
1228 1229
    },
  ],
huhaiqing's avatar
huhaiqing committed
1230 1231
};

1232 1233 1234 1235 1236 1237 1238
/**
 * string format number
 *
 * @param {*} obj
 * @param {*} keys
 * @return {*}
 */
1239 1240 1241 1242 1243 1244 1245 1246 1247
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;
}

1248 1249 1250 1251 1252 1253 1254
/**
 * number format string
 *
 * @param {*} obj
 * @param {*} keys
 * @return {*}
 */
1255 1256 1257 1258 1259 1260 1261 1262 1263
function formatNumberString(obj, keys) {
  for (const [key, value] of Object.entries(obj)) {
    if (keys.includes(key) && value) {
      obj[key] = String(value);
    }
  }
  return obj;
}

1264 1265 1266 1267 1268
/**
 * stringDate format Date
 *
 * @param {*} obj
 * @param {*} keys
huhaiqing's avatar
huhaiqing committed
1269
 * @param {string} [format="YYYY-MM-DD HH:mm:ss"]
1270 1271
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
1272
function formatDateStr(obj, keys, format = "YYYY-MM-DD HH:mm:ss") {
1273 1274
  for (const [key, value] of Object.entries(obj)) {
    if (keys.includes(key) && dayjs(value).isValid()) {
huhaiqing's avatar
huhaiqing committed
1275
      obj[key] = dayjs(value).format(format);
1276 1277 1278 1279 1280
    }
  }
  return obj;
}

huhaiqing's avatar
huhaiqing committed
1281 1282 1283 1284
/**
 * 格式化日期
 *
 * @param {*} date
huhaiqing's avatar
huhaiqing committed
1285
 * @param {string} [format="YYYY-MM-DD HH:mm:ss"]
huhaiqing's avatar
huhaiqing committed
1286 1287
 * @return {*}
 */
huhaiqing's avatar
huhaiqing committed
1288
function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
1289 1290 1291 1292
  if (!date) return date;
  return dayjs(date).format(format);
}

huhaiqing's avatar
huhaiqing committed
1293 1294 1295 1296 1297 1298
/**
 * 获取海运流程状态
 *
 * @param {*} val
 * @return {*}
 */
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330
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
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
/**
 * 组装统计信息文字
 *
 * @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") {
huhaiqing's avatar
huhaiqing committed
1342
      content.push(`${total?.num ?? 0}${i18n.$t("")}`);
huhaiqing's avatar
huhaiqing committed
1343 1344
    }
    if (key === "volume") {
1345 1346 1347
      let volume = total?.volume ?? 0;
      volume = volume === 0 ? volume : new Decimal(volume).toFixed(2);
      content.push(`${volume}m³`);
huhaiqing's avatar
huhaiqing committed
1348 1349
    }
    if (key === "weight") {
1350 1351 1352
      let weight = total?.weight ?? 0;
      weight = weight === 0 ? weight : new Decimal(weight).toFixed(2);
      content.push(`${weight}kg`);
huhaiqing's avatar
huhaiqing committed
1353 1354 1355 1356 1357
    }
  }
  return content.join(" ");
}

1358
function getCapacity(capacity) {
huhaiqing's avatar
huhaiqing committed
1359
  return `${capacity?.name ?? ""}${i18n.$t("柜型")} ${capacity?.volume ?? 0}m³ ${
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370
    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))) {
1371 1372 1373 1374
          count.num = Decimal.add(
            count.num,
            Number(secStatistics.num)
          ).toNumber();
1375 1376
        }
        if (!Number.isNaN(Number(secStatistics.volume))) {
1377 1378 1379 1380
          count.volume = Decimal.add(
            count.volume,
            Number(secStatistics.volume)
          );
1381 1382
        }
        if (!Number.isNaN(Number(secStatistics.weight))) {
1383 1384 1385 1386
          count.weight = Decimal.add(
            count.weight,
            Number(secStatistics.weight)
          );
1387 1388 1389 1390 1391 1392 1393
        }
      }
    });
  }
  return getTotlContent(count);
}

huhaiqing's avatar
huhaiqing committed
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404
export const fileTypes = [
  "doc",
  "xls",
  "ppt",
  "txt",
  "pdf",
  "png",
  "jpg",
  "jpeg",
];

huhaiqing's avatar
huhaiqing committed
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416
/**
 * 服务提示消息回调
 *
 * @export
 * @param {*} result
 * @param {*} _vue
 * @return {*}
 */
function serviceMsg(result, _vue) {
  return new Promise((resolve, reject) => {
    const { code, msg } = result;
    if (code === 0) {
huhaiqing's avatar
huhaiqing committed
1417
      _vue.$message.success(i18n.$t("操作成功"));
huhaiqing's avatar
huhaiqing committed
1418 1419 1420 1421 1422 1423 1424 1425
      resolve();
    } else {
      _vue.$message.error(msg);
      reject();
    }
  });
}

1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437
/**
 * 跳转审核详情
 *
 * @param {*} bpmProcessId
 */
function toReviewDetail(bpmProcessId) {
  this.$router.push({
    path: "/bpm/process-instance/detail",
    query: { id: bpmProcessId },
  });
}

huhaiqing's avatar
huhaiqing committed
1438 1439
function downloadFile(funName, params, fileName, fileFormat) {
  _BOX[funName](params).then((res) => {
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452
    const reader = new FileReader();

    reader.onload = (event) => {
      try {
        // 将读取的string转换为json
        // 若果能转换成功 => 接口返回的是json数据,提示报错信息
        const json = JSON.parse(event.target.result);
        if (json.code) {
          window.ElementUI.Message.error(json.msg);
        }
      } catch (err) {
        let blob = new Blob([res], { type: `application/${fileFormat}` });
        FileSaver.saveAs(blob, fileName);
1453
      }
1454 1455
    };
    reader.readAsText(res);
huhaiqing's avatar
huhaiqing committed
1456 1457 1458
  });
}

1459 1460 1461 1462 1463 1464
function downloadFileByUrl(funName, params) {
  _BOX[funName](params).then((res) => {
    if (res.data) FileSaver.saveAs(res.data);
  });
}

1465
export {
1466
  getColmnMapping,
1467
  getSeaStatus,
1468
  seaBaseData,
zhoutong's avatar
zhoutong committed
1469
  seaAirBaseData,
huhaiqing's avatar
huhaiqing committed
1470
  constantDict,
1471 1472 1473
  formatStringNumber,
  formatDateStr,
  formatNumberString,
1474
  formatDate,
huhaiqing's avatar
huhaiqing committed
1475
  getTotlContent,
1476 1477
  getCapacity,
  sumStatistics,
huhaiqing's avatar
huhaiqing committed
1478
  serviceMsg,
1479
  toReviewDetail,
huhaiqing's avatar
huhaiqing committed
1480
  downloadFile,
1481
  downloadFileByUrl,
1482
};