@kmkf-fe-packages/kmkf-utils 2.0.15 → 2.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,14 @@ var msgTypeCh = {
8
8
  YT: "圆通拦截",
9
9
  feishu: "飞书",
10
10
  xz_qywx: "企业微信 [接口]",
11
- xz_qq: "QQ消息 [接口]"
11
+ xz_qq: "QQ消息 [接口]",
12
+ JST_REISSUE: '聚水潭补发',
13
+ JST_GET_LOGISTICS_CODE: '聚水潭获取物流单号',
14
+ JST_RETURN: '聚水潭退货',
15
+ JST_EXCHANGE: '聚水潭换货',
16
+ REISSUE: '补发',
17
+ GET_LOGISTICS_CODE: '获取物流单号',
18
+ RETURN: '退货',
19
+ EXCHANGE: '换货'
12
20
  };
13
21
  export default msgTypeCh;
@@ -82,6 +82,8 @@ declare enum TComponentType {
82
82
  WDT_SYSTEM_ORDER = "WDT_SYSTEM_ORDER",
83
83
  WDT_RETURN_GOODS = "WDT_RETURN_GOODS",
84
84
  WDT_EXCHANGE_GOODS = "WDT_EXCHANGE_GOODS",
85
+ JST_RETURN_GOODS = "JST_RETURN_GOODS",
86
+ JST_EXCHANGE_GOODS = "JST_EXCHANGE_GOODS",
85
87
  }
86
88
 
87
89
  declare enum PlatForm {
@@ -1 +1,2 @@
1
1
  export * from './logisticsData';
2
+ export * from './warehouseData';
@@ -1 +1,2 @@
1
- export * from "./logisticsData";
1
+ export * from "./logisticsData";
2
+ export * from "./warehouseData";
@@ -0,0 +1,7 @@
1
+ declare type WarehouseType = {
2
+ disabled: boolean;
3
+ label: string;
4
+ value: number;
5
+ };
6
+ export declare const getWarehouseDataAsync: () => Promise<WarehouseType[]>;
7
+ export default getWarehouseDataAsync;
@@ -0,0 +1,32 @@
1
+ import { fetchAll } from "../../utils";
2
+ import request from "../../request";
3
+ var queryWarehouseList = function queryWarehouseList(_ref) {
4
+ var pageNo = _ref.pageNo,
5
+ pageSize = _ref.pageSize;
6
+ return request({
7
+ url: "/qy/gdfw/jst/erp/warehouse/list",
8
+ method: "post",
9
+ data: {
10
+ pageNo: pageNo,
11
+ pageSize: pageSize
12
+ }
13
+ });
14
+ };
15
+ export var getWarehouseDataAsync = function getWarehouseDataAsync() {
16
+ return fetchAll("JST_WAREHOUSE_DATA", queryWarehouseList, function (data) {
17
+ var list = [];
18
+ var warehouses = data || [];
19
+ warehouses.map(function (item) {
20
+ list.push({
21
+ label: item.name,
22
+ value: item.wmsCoId,
23
+ disabled: false
24
+ });
25
+ });
26
+ return list;
27
+ }, {
28
+ pageNo: 1,
29
+ pageSize: 100
30
+ });
31
+ };
32
+ export default getWarehouseDataAsync;
@@ -1,6 +1,6 @@
1
1
  interface OptionsItem {
2
2
  label: string;
3
- value: string;
3
+ value: string | number;
4
4
  disabled: boolean;
5
5
  }
6
6
  declare type SendGoodPlatform = string;
@@ -8,7 +8,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
8
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
10
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
- import { BSE3, WDT, KM, GY } from "../servers/index";
11
+ import { BSE3, WDT, KM, GY, JST } from "../servers/index";
12
12
  var SendData = /*#__PURE__*/_createClass(function SendData(platform) {
13
13
  var _this = this;
14
14
  _classCallCheck(this, SendData);
@@ -56,7 +56,8 @@ var SendData = /*#__PURE__*/_createClass(function SendData(platform) {
56
56
  bsE3: BSE3,
57
57
  wdt: WDT,
58
58
  km: KM,
59
- gy: GY
59
+ gy: GY,
60
+ jst: JST
60
61
  }[this.platform];
61
62
  });
62
63
  export var SendDataCenter = /*#__PURE__*/function () {
@@ -71,6 +72,7 @@ export var SendDataCenter = /*#__PURE__*/function () {
71
72
  if (platform === "BS_E3_SEND_GOOD") platform = "bsE3";
72
73
  if (platform === "KM_SEND_GOOD") platform = "km";
73
74
  if (platform === "GY_SEND_GOOD") platform = "gy";
75
+ if (platform === "JST_SEND_GOOD") platform = "jst";
74
76
  if (!this.instanceMap.has(platform)) {
75
77
  this.instanceMap.set(platform, new SendData(platform));
76
78
  }
@@ -10,7 +10,7 @@ export { BS_SYSTEM_ORDER_CONFIG, bsOrderBackFormValues, bsOrderTransform, } from
10
10
  export { bsE3OrderBackFormValues, bsE3OrderTransform, updateBsE3GoodsHandle, filterBsE3Orders, BS_E3_ORDER_STATUS_MAP, BS_E3_BOOLEAN_STATUS_MAP, BS_E3_SYSTEM_ORDER_CONFIG, } from "./bsE3OrderBackFormValues";
11
11
  export { WLN_SYSTEM_ORDER_CONFIG, wlnOrderBackFormValues, wlnOrderTransform, } from "./wlnOrderBackFormValues";
12
12
  export { WDT_SYSTEM_ORDER_CONFIG, wdtOrderBackFormValues, wdtOrderTransform, WDT_ORDER_TYPE_MAP, filterWdtOrders, updateWdtGoodsHandle, } from "./wdtOrderBackFormValues";
13
- export { default as jstOrderBackFormValues } from "./jstOrderBackFormValues";
13
+ export * from "./jstOrderBackFormValues";
14
14
  export { kmOrderBackFormValues, kmOrderTransform, KM_SYSTEM_ORDER_CONFIG, filterKmOrders, } from "./kmOrderBackFormValues";
15
15
  export { getIsPlatformCodesIncludeOrderNos, GY_DELIVERY_STATE_MAPPING, GY_SYSTEM_ORDER_CONFIG, updateGyGoodsHandle, gyOrderTransform, gyOrderBackFormValues, filterGyOrders, } from "./gyOrderBackFormValues";
16
16
  export { default as uuid } from "./getUUid";
@@ -10,7 +10,8 @@ export { BS_SYSTEM_ORDER_CONFIG, bsOrderBackFormValues, bsOrderTransform } from
10
10
  export { bsE3OrderBackFormValues, bsE3OrderTransform, updateBsE3GoodsHandle, filterBsE3Orders, BS_E3_ORDER_STATUS_MAP, BS_E3_BOOLEAN_STATUS_MAP, BS_E3_SYSTEM_ORDER_CONFIG } from "./bsE3OrderBackFormValues";
11
11
  export { WLN_SYSTEM_ORDER_CONFIG, wlnOrderBackFormValues, wlnOrderTransform } from "./wlnOrderBackFormValues";
12
12
  export { WDT_SYSTEM_ORDER_CONFIG, wdtOrderBackFormValues, wdtOrderTransform, WDT_ORDER_TYPE_MAP, filterWdtOrders, updateWdtGoodsHandle } from "./wdtOrderBackFormValues";
13
- export { default as jstOrderBackFormValues } from "./jstOrderBackFormValues";
13
+ // export { default as jstOrderBackFormValues } from "./jstOrderBackFormValues";
14
+ export * from "./jstOrderBackFormValues";
14
15
  export { kmOrderBackFormValues, kmOrderTransform, KM_SYSTEM_ORDER_CONFIG, filterKmOrders } from "./kmOrderBackFormValues";
15
16
  export { getIsPlatformCodesIncludeOrderNos, GY_DELIVERY_STATE_MAPPING, GY_SYSTEM_ORDER_CONFIG, updateGyGoodsHandle, gyOrderTransform, gyOrderBackFormValues, filterGyOrders } from "./gyOrderBackFormValues";
16
17
  export { default as uuid } from "./getUUid";
@@ -1,2 +1,40 @@
1
- declare const _default: (detail?: any[], templateDetail?: any) => any;
2
- export default _default;
1
+ export declare const JST_SYSTEM_ORDER_CONFIG: {
2
+ key: string;
3
+ name: string;
4
+ selectId: string;
5
+ columns: {
6
+ dataIndex: string;
7
+ title: string;
8
+ width: number;
9
+ }[];
10
+ };
11
+ export declare const JST_ORDER_STATUS_MAP: Record<number, string>;
12
+ export declare const updateJstGoodsHandle: (orders?: any[], canEdit?: boolean) => any;
13
+ export declare const jstMergeIdenticalGoods: <T extends {
14
+ skuId: string;
15
+ qty: number;
16
+ }>(goodDetails?: T[]) => T[];
17
+ export declare const jstOrderBackFormValues: (detail?: any, templateDetail?: any) => any;
18
+ export declare const jstOrderTransform: (detail: any, form: any) => {
19
+ jstSystemOrder: {
20
+ orderNo: any;
21
+ orders: any;
22
+ selectIds: any;
23
+ showOrderInfo: any;
24
+ };
25
+ jstSystemOrderNo: any;
26
+ jstReissueGoods: any;
27
+ jstReturnGoods: any;
28
+ jstSystemOrderBillType: any;
29
+ jstGoods: {
30
+ orders: any;
31
+ orderNo: any;
32
+ shopCode: any;
33
+ jstGoods: any;
34
+ };
35
+ jstLogistics: any;
36
+ jstSendGood: any;
37
+ jstSupply: any;
38
+ jstItemSelectThird: any;
39
+ };
40
+ export declare const filterJstOrders: (detail: any, order_no: string) => any;
@@ -1,112 +1,316 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
4
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- //重组聚水潭商品数据
8
- var updateJSTItemListHandle = function updateJSTItemListHandle() {
9
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
10
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "logistics";
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ import uuid from "./getUUid";
14
+ import { SendDataCenter } from "./SendData";
15
+ export var JST_SYSTEM_ORDER_CONFIG = {
16
+ key: "jstSystemShowOrder",
17
+ name: "聚水潭",
18
+ selectId: "jstSystemSelectIds",
19
+ columns: [{
20
+ dataIndex: "orderType",
21
+ title: "订单类型",
22
+ width: 150
23
+ }, {
24
+ dataIndex: "oId",
25
+ title: "系统订单号",
26
+ width: 160
27
+ }, {
28
+ dataIndex: "labels",
29
+ title: "订单标签",
30
+ width: 150
31
+ }, {
32
+ dataIndex: "mergeSoId",
33
+ title: "合并订单号",
34
+ width: 160
35
+ }]
36
+ };
37
+ export var JST_ORDER_STATUS_MAP = {
38
+ 0: "未确认",
39
+ 1: "已确认",
40
+ 3: "已作废",
41
+ 5: "已完成"
42
+ };
43
+ export var updateJstGoodsHandle = function updateJstGoodsHandle() {
44
+ var orders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
45
+ var canEdit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
46
+ var list = orders.reduce(function (prv, next) {
47
+ var _next$items;
48
+ var goods = (next === null || next === void 0 ? void 0 : (_next$items = next.items) === null || _next$items === void 0 ? void 0 : _next$items.map(function (item) {
49
+ var _item$uuid;
50
+ item.canDelete = true;
51
+ item.canEdit = canEdit;
52
+ item.uuid = (_item$uuid = item.uuid) !== null && _item$uuid !== void 0 ? _item$uuid : uuid();
53
+ return _objectSpread({}, item);
54
+ })) || [];
55
+ prv.push.apply(prv, _toConsumableArray(goods));
56
+ return prv;
57
+ }, []);
58
+ return list;
59
+ };
60
+ var updateJstItemListHandle = function updateJstItemListHandle(list, type, comList, form) {
61
+ var _newList;
62
+ if (type === "logistics") {
63
+ var _comList$find, _currentCom$component;
64
+ var currentCom = comList === null || comList === void 0 ? void 0 : (_comList$find = comList.find) === null || _comList$find === void 0 ? void 0 : _comList$find.call(comList, function (item) {
65
+ return item.workOrderComponentType === "JST_LOGISTICS";
66
+ });
67
+ var notOrderBack = (currentCom === null || currentCom === void 0 ? void 0 : (_currentCom$component = currentCom.componentConfig) === null || _currentCom$component === void 0 ? void 0 : _currentCom$component.notOrderBack) || false;
68
+ if (notOrderBack) {
69
+ var _currentValue;
70
+ var currentValue = form.getFieldValue(currentCom.uniqueKey);
71
+ currentValue = (_currentValue = currentValue) !== null && _currentValue !== void 0 && _currentValue.length ? currentValue : [{
72
+ logisticsCode: "",
73
+ logisticsCompany: ""
74
+ }];
75
+ return currentValue;
76
+ }
77
+ } else if (type === "send") {
78
+ var _comList$find2, _currentCom$component2;
79
+ var _currentCom = comList === null || comList === void 0 ? void 0 : (_comList$find2 = comList.find) === null || _comList$find2 === void 0 ? void 0 : _comList$find2.call(comList, function (item) {
80
+ return item.workOrderComponentType === "JST_SEND_GOOD";
81
+ });
82
+ var _notOrderBack = (_currentCom === null || _currentCom === void 0 ? void 0 : (_currentCom$component2 = _currentCom.componentConfig) === null || _currentCom$component2 === void 0 ? void 0 : _currentCom$component2.notOrderBack) || false;
83
+ if (_notOrderBack) {
84
+ var _currentValue3;
85
+ var _currentValue2 = form.getFieldValue(_currentCom.uniqueKey);
86
+ _currentValue2 = (_currentValue3 = _currentValue2) !== null && _currentValue3 !== void 0 && _currentValue3.length ? _currentValue2 : [{
87
+ sendId: "",
88
+ sendName: ""
89
+ }];
90
+ return _currentValue2;
91
+ }
92
+ }
93
+ var newList = list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
94
+ var items = ((next === null || next === void 0 ? void 0 : next.items) || []).map(function (t) {
95
+ return _objectSpread({
96
+ title: (t === null || t === void 0 ? void 0 : t.name) || "",
97
+ picUrl: (t === null || t === void 0 ? void 0 : t.pic) || "",
98
+ platform: "jst"
99
+ }, type === "itemList" ? {
100
+ itemId: t === null || t === void 0 ? void 0 : t.supplierId,
101
+ supplierName: t === null || t === void 0 ? void 0 : t.supplierName
102
+ } : {
103
+ skuId: (t === null || t === void 0 ? void 0 : t.skuId) || ""
104
+ });
105
+ });
106
+ var params = {
107
+ items: items
108
+ };
109
+ if (type === "logistics") {
110
+ params.logisticsCompany = next === null || next === void 0 ? void 0 : next.logisticsCompany;
111
+ params.logisticsCode = next === null || next === void 0 ? void 0 : next.lcId;
112
+ } else if (type === "send") {
113
+ params.sendId = next === null || next === void 0 ? void 0 : next.wmsCoId;
114
+ params.sendName = (next === null || next === void 0 ? void 0 : next.wmsCoId) && SendDataCenter.getInstance("jst").getSendNameByCode(next === null || next === void 0 ? void 0 : next.wmsCoId);
115
+ params.sendSnapshotId = next === null || next === void 0 ? void 0 : next.wmsCoId;
116
+ } else if (type === "supply") {
117
+ params.supplyId = next === null || next === void 0 ? void 0 : next.drpCoIdTo;
118
+ params.supplyName = next === null || next === void 0 ? void 0 : next.drpCoName;
119
+ }
120
+ if (type === "itemList") {
121
+ prv.push.apply(prv, _toConsumableArray(items.map(function (itemListItem) {
122
+ return _objectSpread({}, itemListItem);
123
+ })));
124
+ } else {
125
+ prv.push(params);
126
+ }
127
+ return prv;
128
+ }, []);
129
+ if (!((_newList = newList) !== null && _newList !== void 0 && _newList.length)) {
130
+ switch (type) {
131
+ case "logistics":
132
+ newList = [{
133
+ logisticsCode: ""
134
+ }];
135
+ break;
136
+ case "supply":
137
+ newList = [{
138
+ supplyName: "",
139
+ supplyId: ""
140
+ }];
141
+ break;
142
+ case "send":
143
+ newList = [{
144
+ sendId: "",
145
+ sendName: ""
146
+ }];
147
+ break;
148
+ }
149
+ }
150
+ return newList;
151
+ };
152
+ var updateJstItemListByConfigHandle = function updateJstItemListByConfigHandle(list, type) {
11
153
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12
154
  var showField = config.showField,
13
155
  enableItemId = config.enableItemId,
14
156
  enableSupplierName = config.enableSupplierName;
15
- if (type !== "itemList") {
16
- var newList = list === null || list === void 0 ? void 0 : list.map(function (item) {
17
- var items = item.items.map(function (t) {
18
- return {
19
- title: t.skuName,
20
- picUrl: t.pic,
21
- platform: "jst",
22
- skuId: t.skuId
23
- };
24
- });
25
- var params = {
26
- items: items
27
- };
28
- if (type === "logistics") {
29
- params.logisticsCompany = item.logisticsCompany;
30
- params.logisticsCode = item.lId;
31
- } else if (type === "supply") {
32
- if (["supplyId", "all"].includes(showField || "")) {
33
- params.supplyId = item.drpCoIdTo;
34
- }
35
- if (["supplyName", "all"].includes(showField || "")) {
36
- params.supplyName = item.drpCoName;
37
- }
38
- } else if (type === "send") {
39
- if (["sendId", "all"].includes(showField || "")) {
40
- params.sendId = item.wmsCoId;
41
- }
42
- if (["sendName", "all"].includes(showField || "")) {
43
- params.sendName = item.wmsCoName;
44
- }
157
+ return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
158
+ if (type === "logistics") {
159
+ if (!["logisticsCompany", ""].includes(showField || "")) {
160
+ next.logisticsCompany = undefined;
45
161
  }
46
- return params;
47
- });
48
- if (!newList.length) {
49
- switch (type) {
50
- case "logistics":
51
- newList = [{
52
- logisticsCode: ""
53
- }];
54
- break;
55
- case "supply":
56
- newList = [{
57
- supplyId: ""
58
- }];
59
- break;
60
- case "send":
61
- newList = [{
62
- sendId: "",
63
- sendName: ""
64
- }];
65
- break;
162
+ if (!["logisticsCode", ""].includes(showField || "")) {
163
+ next.logisticsCode = undefined;
164
+ }
165
+ } else if (type === "send") {
166
+ if (!["sendId", "all"].includes(showField || "")) {
167
+ next.sendId = undefined;
168
+ }
169
+ if (!["sendName", "all"].includes(showField || "")) {
170
+ next.sendName = undefined;
171
+ }
172
+ } else if (type === "supply") {
173
+ if (!["supplyId", "all"].includes(showField || "")) {
174
+ next.supplyId = undefined;
175
+ }
176
+ if (!["supplyName", "all"].includes(showField || "")) {
177
+ next.supplyName = undefined;
178
+ }
179
+ } else if (type === "itemList") {
180
+ if (!enableItemId) {
181
+ next.itemId = undefined;
182
+ }
183
+ if (!enableSupplierName) {
184
+ next.supplierName = undefined;
66
185
  }
67
186
  }
68
- return newList;
69
- } else {
70
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
71
- var items = next.items.map(function (t) {
72
- var params = {
73
- title: t.skuName,
74
- picUrl: t.pic,
75
- platform: "jst"
76
- };
77
- if (enableItemId) {
78
- params.itemId = t.supplierId;
79
- }
80
- if (enableSupplierName) {
81
- params.supplierName = t.supplierName;
82
- }
83
- return params;
84
- });
85
- prv.push.apply(prv, _toConsumableArray(items));
86
- return prv;
87
- }, []);
187
+ prv.push(next);
188
+ return prv;
189
+ }, []);
190
+ };
191
+ export var jstMergeIdenticalGoods = function jstMergeIdenticalGoods() {
192
+ var goodDetails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
193
+ var list = [];
194
+ if (goodDetails.length) {
195
+ var obj = {};
196
+ goodDetails.forEach(function (goods) {
197
+ var goodIndex = obj[goods.skuId];
198
+ if (typeof goodIndex !== "number") {
199
+ obj[goods.skuId] = list.length;
200
+ list.push(goods);
201
+ } else {
202
+ list[goodIndex].qty = (list[goodIndex].qty || 0) + (goods.qty || 0);
203
+ }
204
+ });
88
205
  }
206
+ return list;
89
207
  };
90
- export default (function () {
91
- var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
208
+ export var jstOrderBackFormValues = function jstOrderBackFormValues() {
209
+ var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
92
210
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
93
211
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
94
212
  var uniqueKey = next.uniqueKey;
95
213
  var config = next.componentConfig;
96
214
  switch (next.workOrderComponentType) {
215
+ case "JST_SYSTEM_ORDER":
216
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstSystemOrder;
217
+ break;
218
+ case "JST_GOODS":
219
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstGoods;
220
+ break;
221
+ case "JST_REISSUE_GOODS":
222
+ prv[uniqueKey] = {
223
+ jstSystemOrder: detail === null || detail === void 0 ? void 0 : detail.jstSystemOrder,
224
+ jstSystemOrderNo: detail === null || detail === void 0 ? void 0 : detail.jstSystemOrderNo,
225
+ jstReissueType: ["1"],
226
+ jstReissueGoods: jstMergeIdenticalGoods((detail === null || detail === void 0 ? void 0 : detail.jstReissueGoods) || []),
227
+ jstSystemOrderBillType: (detail === null || detail === void 0 ? void 0 : detail.jstSystemOrderBillType) || ""
228
+ };
229
+ break;
230
+ case "JST_RETURN_GOODS":
231
+ prv[uniqueKey] = {
232
+ jstSystemOrder: detail === null || detail === void 0 ? void 0 : detail.jstSystemOrder,
233
+ jstSystemOrderNo: detail === null || detail === void 0 ? void 0 : detail.jstSystemOrderNo,
234
+ jstReturnType: ["1"],
235
+ jstReturnGoods: jstMergeIdenticalGoods((detail === null || detail === void 0 ? void 0 : detail.jstReturnGoods) || []),
236
+ jstSystemOrderBillType: (detail === null || detail === void 0 ? void 0 : detail.jstSystemOrderBillType) || ""
237
+ };
238
+ break;
97
239
  case "JST_ITEM_SELECT_THIRD":
98
- prv[uniqueKey] = updateJSTItemListHandle(detail, "itemList", config);
240
+ prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstItemSelectThird, "itemList", config);
99
241
  break;
100
242
  case "JST_SUPPLY":
101
- prv[uniqueKey] = updateJSTItemListHandle(detail, "supply", config);
102
- break;
103
- case "JST_SEND_GOOD":
104
- prv[uniqueKey] = updateJSTItemListHandle(detail, "send", config);
243
+ prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSupply, "supply", config);
105
244
  break;
106
245
  case "JST_LOGISTICS":
107
- prv[uniqueKey] = updateJSTItemListHandle(detail, "logistics", config);
246
+ prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstLogistics, "logistics", config);
247
+ break;
248
+ case "JST_SEND_GOOD":
249
+ prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSendGood, "send", config);
108
250
  break;
109
251
  }
110
252
  return prv;
111
253
  }, {});
112
- });
254
+ };
255
+ //jst订单信息转换
256
+ export var jstOrderTransform = function jstOrderTransform(detail, form) {
257
+ var _form$getFieldValue, _newOrderList$, _newOrderList$2, _orderList$find, _orderList$find$call;
258
+ var orderNo = detail.orderNo,
259
+ _detail$orderList = detail.orderList,
260
+ orderList = _detail$orderList === void 0 ? [] : _detail$orderList,
261
+ componentList = detail.componentList;
262
+ var jstGoodsCom = (componentList || []).find(function (com) {
263
+ return com.workOrderComponentType === "JST_GOODS";
264
+ });
265
+ var isStrict = jstGoodsCom ? (_form$getFieldValue = form.getFieldValue(jstGoodsCom.uniqueKey)) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.isStrict : false;
266
+ var newOrderList = orderList === null || orderList === void 0 ? void 0 : orderList.map(function (item) {
267
+ return _objectSpread({}, item);
268
+ });
269
+ var onlyOneSystemOrder = (newOrderList === null || newOrderList === void 0 ? void 0 : newOrderList.length) === 1;
270
+ return {
271
+ jstSystemOrder: {
272
+ orderNo: orderNo,
273
+ orders: newOrderList,
274
+ selectIds: onlyOneSystemOrder ? orderList.map(function (item) {
275
+ return item.oId;
276
+ }) : [],
277
+ showOrderInfo: newOrderList
278
+ },
279
+ // TODO: 当只有一条系统单时默认选中该系统单
280
+ jstSystemOrderNo: onlyOneSystemOrder ? (_newOrderList$ = newOrderList[0]) === null || _newOrderList$ === void 0 ? void 0 : _newOrderList$.oId : undefined,
281
+ jstReissueGoods: onlyOneSystemOrder ? updateJstGoodsHandle([newOrderList[0]], true).filter(function (good) {
282
+ return !isStrict || !orderNo || good.originalDealCode === orderNo;
283
+ }) : [],
284
+ jstReturnGoods: onlyOneSystemOrder ? updateJstGoodsHandle([newOrderList[0]], true).filter(function (good) {
285
+ return !isStrict || !orderNo || good.originalDealCode === orderNo;
286
+ }) : [],
287
+ jstSystemOrderBillType: onlyOneSystemOrder ? (_newOrderList$2 = newOrderList[0]) === null || _newOrderList$2 === void 0 ? void 0 : _newOrderList$2.orderType : "",
288
+ jstGoods: {
289
+ // 订单反填,要清空orders,存的是当前系统订单号勾选上的 订单
290
+ orders: orderList || [],
291
+ orderNo: orderNo,
292
+ shopCode: (orderList === null || orderList === void 0 ? void 0 : (_orderList$find = orderList.find) === null || _orderList$find === void 0 ? void 0 : (_orderList$find$call = _orderList$find.call(orderList, function (item) {
293
+ return item.sdCode;
294
+ })) === null || _orderList$find$call === void 0 ? void 0 : _orderList$find$call.sdCode) || null,
295
+ jstGoods: updateJstGoodsHandle(orderList).filter(function (good) {
296
+ return !isStrict || !orderNo || good.originalDealCode === orderNo;
297
+ })
298
+ },
299
+ jstLogistics: updateJstItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orderList, "logistics", (detail === null || detail === void 0 ? void 0 : detail.componentList) || [], form),
300
+ jstSendGood: updateJstItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orderList, "send", (detail === null || detail === void 0 ? void 0 : detail.componentList) || [], form),
301
+ jstSupply: updateJstItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orderList, "logistics", (detail === null || detail === void 0 ? void 0 : detail.componentList) || [], form),
302
+ jstItemSelectThird: updateJstItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orderList, "itemList", (detail === null || detail === void 0 ? void 0 : detail.componentList) || [], form)
303
+ };
304
+ };
305
+
306
+ // TODO: 确定合并单,例如: WDT根据订单号请求返回的srcTid会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
307
+ export var filterJstOrders = function filterJstOrders(detail, order_no) {
308
+ var currentTrades = (detail === null || detail === void 0 ? void 0 : detail.orderList) || [];
309
+ // .filter(
310
+ // (item: Record<string, any>) => item?.dealCode === order_no
311
+ // );
312
+ if (currentTrades.length) {
313
+ return currentTrades;
314
+ }
315
+ return [];
316
+ };
@@ -12,7 +12,7 @@ import isNull from "./isNull";
12
12
  import { kmOrderBackFormValues } from "./kmOrderBackFormValues";
13
13
  import { bsOrderBackFormValues } from "./bsOrderBackFormValues";
14
14
  import { wlnOrderBackFormValues } from "./wlnOrderBackFormValues";
15
- import jstOrderBackFormValues from "./jstOrderBackFormValues";
15
+ import { jstOrderBackFormValues } from "./jstOrderBackFormValues";
16
16
  import { wdtOrderBackFormValues } from "./wdtOrderBackFormValues";
17
17
  import { bsE3OrderBackFormValues } from "./bsE3OrderBackFormValues";
18
18
  import { gyOrderBackFormValues } from "./gyOrderBackFormValues";
@@ -227,7 +227,7 @@ export default (function (_ref) {
227
227
  }
228
228
  return prv;
229
229
  }, {});
230
- var jstValues = jstOrderBackFormValues(detail["jstItemList"], templateDetail);
230
+ var jstValues = jstOrderBackFormValues(detail["jstOrder"], templateDetail);
231
231
  var bsValues = bsOrderBackFormValues(detail["bsOrder"], templateDetail);
232
232
  var wlnValues = wlnOrderBackFormValues(detail["wlnOrder"], templateDetail);
233
233
  var wdtValues = wdtOrderBackFormValues(detail["wdtOrder"], templateDetail);
@@ -1,5 +1,5 @@
1
1
  export default (function (key) {
2
- return ["itemList", "itemId", "supplierName", "numIid", "aloneItemId", "aloneItemEncode", "jstItemList", "logisticsCompany", "logisticsCode", "supplyId", "supplyName", "sendId", "sendName", "dateTime", "basicMultSelect", "memberLevel", "checkbox", "multSelect", "rate", "picture", "file", "wdtGoods", "wdtReissueType", "wdtSystemOrderNo", "wdtReissueGoods", "wdtSendGood", "wdtSendId", "wdtSendName", "wdtLogisticsCode", "wdtSystemShowOrder", "wdtSystemSelectIds", "wdtLogisticsCompany", "wdtLogisticsList", "wdtReturnGoods", "wdtReturnType", "wdtExchangeGoods", "bsSendGood", "bsSendId", "bsSendName", "bsGoods", "bsExchangeType", "bsExchangeReturnGoods", "bsExchangeSwapOutGoods", "bsExchangeGiftGoods", "bsReissueType", "bsReissueGoods", "bsReturnGoods", "bsReturnType", "bsLogisticsList", "bsLogisticsCompany", "bsLogisticsCode", "kmSystemShowOrder", "bsSystemShowOrder", "bsSystemSelectIds", "bsE3SystemOrderNo", "bsE3SystemShowOrder", "bsE3SystemSelectIds", "bsE3Goods", "bsE3ReissueGoods", "bsE3ReissueType", "reissueLogisticsList", "reissueLogisticsCompany", "reissueLogisticsCode", "deliveryNoList", "deliveryNoIds", "returnGoodsStatusList", "returnGoodsTradeIdList", "returnGoodsTradeItemList", "tradeIdList", "tradeItemList", "wlnLogisticsList", "wlnLogisticsCompany", "wlnLogisticsCode", "wlnSystemShowOrder", "wlnSystemSelectIds", "wlnGoods", "wlnSendGood", "wlnSendId", "wlnSendName", "exchangeReason", "flowTag", "returnGoodsStatusList", "returnGoodsStatusValue", "exchangeReason", "exchangeStatusValue", "inStockStatusItemList", "inStockStatusList", "bsE3InStockStatusItemList", "bsE3InStockStatusList", "reissueStatusValue", "reissueReason", "adjustWorkOrderStatusValue", "adjustWorkOrderReason", "msgStatusValues", "msgStatus4Search", "createStatusValue", "createReason", "invoiceStatusValue", "invoiceReason", "invoicingStatusValue", "invoicingReason", "trajectoryList", "trajectoryMoreCompany", "trajectoryMoreCode", "trajectoryMoreSnapshot", "logisticsInterceptList", "logisticsInterceptCompanyList", "logisticsInterceptCodeList", "logisticsInterceptTypeList", "logisticsInterceptStatusList", "logisticsInterceptApiStatusList", "interceptLogisticsApiStatus", "logisticsInterceptSnapshotList", "productList", "label", "kmSendGood", "kmSendId", "kmSendName", "gyGoods", "gyReissueType", "gySystemOrderNo", "gyReissueGoods", "gySendGood", "gySendId", "gySendName", "gyLogisticsCode", "gySystemShowOrder", "gySystemSelectIds", "gyLogisticsCompany", "gyLogisticsList", "gyReturnGoods", "gyReturnType", "gyExchangeGoods", "kmLogisticsList"].reduce(function (cur, nxt) {
2
+ return ["itemList", "itemId", "supplierName", "numIid", "aloneItemId", "aloneItemEncode", "jstItemList", "logisticsCompany", "logisticsCode", "supplyId", "supplyName", "sendId", "sendName", "dateTime", "basicMultSelect", "memberLevel", "checkbox", "multSelect", "rate", "picture", "file", "wdtGoods", "wdtReissueType", "wdtSystemOrderNo", "wdtReissueGoods", "wdtSendGood", "wdtSendId", "wdtSendName", "wdtLogisticsCode", "wdtSystemShowOrder", "wdtSystemSelectIds", "wdtLogisticsCompany", "wdtLogisticsList", "wdtReturnGoods", "wdtReturnType", "wdtExchangeGoods", "bsSendGood", "bsSendId", "bsSendName", "bsGoods", "bsExchangeType", "bsExchangeReturnGoods", "bsExchangeSwapOutGoods", "bsExchangeGiftGoods", "bsReissueType", "bsReissueGoods", "bsReturnGoods", "bsReturnType", "bsLogisticsList", "bsLogisticsCompany", "bsLogisticsCode", "kmSystemShowOrder", "bsSystemShowOrder", "bsSystemSelectIds", "bsE3SystemOrderNo", "bsE3SystemShowOrder", "bsE3SystemSelectIds", "bsE3Goods", "bsE3ReissueGoods", "bsE3ReissueType", "reissueLogisticsList", "reissueLogisticsCompany", "reissueLogisticsCode", "deliveryNoList", "deliveryNoIds", "returnGoodsStatusList", "returnGoodsTradeIdList", "returnGoodsTradeItemList", "tradeIdList", "tradeItemList", "wlnLogisticsList", "wlnLogisticsCompany", "wlnLogisticsCode", "wlnSystemShowOrder", "wlnSystemSelectIds", "wlnGoods", "wlnSendGood", "wlnSendId", "wlnSendName", "exchangeReason", "flowTag", "returnGoodsStatusList", "returnGoodsStatusValue", "exchangeReason", "exchangeStatusValue", "inStockStatusItemList", "inStockStatusList", "bsE3InStockStatusItemList", "bsE3InStockStatusList", "reissueStatusValue", "reissueReason", "adjustWorkOrderStatusValue", "adjustWorkOrderReason", "msgStatusValues", "msgStatus4Search", "createStatusValue", "createReason", "invoiceStatusValue", "invoiceReason", "invoicingStatusValue", "invoicingReason", "trajectoryList", "trajectoryMoreCompany", "trajectoryMoreCode", "trajectoryMoreSnapshot", "logisticsInterceptList", "logisticsInterceptCompanyList", "logisticsInterceptCodeList", "logisticsInterceptTypeList", "logisticsInterceptStatusList", "logisticsInterceptApiStatusList", "interceptLogisticsApiStatus", "logisticsInterceptSnapshotList", "productList", "label", "kmSendGood", "kmSendId", "kmSendName", "gyGoods", "gyReissueType", "gySystemOrderNo", "gyReissueGoods", "gySendGood", "gySendId", "gySendName", "gyLogisticsCode", "gySystemShowOrder", "gySystemSelectIds", "gyLogisticsCompany", "gyLogisticsList", "gyReturnGoods", "gyReturnType", "gyExchangeGoods", "kmLogisticsList", 'jstGoods', 'jstSendGood', 'jstReissueType', 'jstReissueGoods', 'jstSystemOrderNo', 'jstLogisticsList', 'jstSystemShowOrder', 'jstSystemSelectIds', 'jstReturnGoods', 'jstReturnType', 'jstExchangeGoods'].reduce(function (cur, nxt) {
3
3
  return cur || (key === null || key === void 0 ? void 0 : key.includes(nxt));
4
4
  }, false);
5
5
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "7d7f5e05f6404b38e0c6c7063a3ade5f1e4331d7",
44
+ "gitHead": "5c8da8bf3e0ca213a31946282f6c6411167589d5",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }
@@ -1,285 +0,0 @@
1
- "use strict";
2
-
3
- var __assign = this && this.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- exports.__esModule = true;
14
- exports.filterGyOrders = exports.gyOrderBackFormValues = exports.gyOrderTransform = exports.updateGyGoodsHandle = exports.GY_SYSTEM_ORDER_CONFIG = void 0;
15
- var getUUid_1 = require("./getUUid");
16
- var deliveryStateMap = {
17
- 0: "未发货",
18
- 2: "全部发货"
19
- };
20
- exports.GY_SYSTEM_ORDER_CONFIG = {
21
- key: "gySystemShowOrder",
22
- name: "管易",
23
- selectId: "gySystemSelectIds",
24
- columns: [{
25
- dataIndex: "billType",
26
- title: "订单类型",
27
- width: 150
28
- }, {
29
- dataIndex: "billNo",
30
- title: "系统订单号",
31
- width: 160
32
- }, {
33
- dataIndex: "tradeTagName",
34
- title: "订单标记名称",
35
- width: 150
36
- }, {
37
- dataIndex: "billTag",
38
- title: "订单标签",
39
- width: 150
40
- }, {
41
- dataIndex: "deliveryState",
42
- title: "发货状态",
43
- width: 150
44
- }]
45
- };
46
- exports.updateGyGoodsHandle = function (orders) {
47
- if (orders === void 0) {
48
- orders = [];
49
- }
50
- return orders === null || orders === void 0 ? void 0 : orders.reduce(function (acc, cur) {
51
- if (Array.isArray(cur.details)) {
52
- acc.push.apply(acc, cur.details.map(function (item) {
53
- var _a;
54
- item.goodName = item.itemName;
55
- item.goodShortName = item.itemSimpleName;
56
- item.goodNo = item.itemCode;
57
- item.specNo = item.skuCode;
58
- item.specName = item.skuName;
59
- item.canDelete = true;
60
- item.uuid = (_a = item.uuid) !== null && _a !== void 0 ? _a : getUUid_1["default"]();
61
- return item;
62
- }));
63
- }
64
- return acc;
65
- }, []);
66
- };
67
- var updateGyItemListHandle = function updateGyItemListHandle(list, type, comList, form) {
68
- var _a, _b;
69
- if (type === "logistics") {
70
- //管易物流信息组件先不做
71
- // const currentCom = comList?.find?.(
72
- // (item) => item.workOrderComponentType === "GY_LOGISTICS"
73
- // );
74
- // const notOrderBack = currentCom?.componentConfig?.notOrderBack || false;
75
- // if (notOrderBack) {
76
- // let currentValue = form.getFieldValue(currentCom.uniqueKey);
77
- // currentValue = currentValue?.length
78
- // ? currentValue
79
- // : [{ logisticsCode: "", logisticsCompany: "" }];
80
- // return currentValue;
81
- // }
82
- } else if (type === "send") {
83
- var currentCom = (_a = comList === null || comList === void 0 ? void 0 : comList.find) === null || _a === void 0 ? void 0 : _a.call(comList, function (item) {
84
- return item.workOrderComponentType === "GY_SEND_GOOD";
85
- });
86
- var notOrderBack = ((_b = currentCom === null || currentCom === void 0 ? void 0 : currentCom.componentConfig) === null || _b === void 0 ? void 0 : _b.notOrderBack) || false;
87
- if (notOrderBack) {
88
- var currentValue = form.getFieldValue(currentCom.uniqueKey);
89
- currentValue = (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) ? currentValue : [{
90
- sendId: "",
91
- sendName: ""
92
- }];
93
- return currentValue;
94
- }
95
- }
96
- var newList = list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
97
- var items = ((next === null || next === void 0 ? void 0 : next.details) || []).map(function (t) {
98
- return {
99
- title: (t === null || t === void 0 ? void 0 : t.itemName) || "",
100
- picUrl: (t === null || t === void 0 ? void 0 : t.picPath) || "",
101
- platform: "gy",
102
- skuId: (t === null || t === void 0 ? void 0 : t.itemCode) || ""
103
- };
104
- });
105
- var params = {
106
- items: items
107
- };
108
- if (type === "logistics") {
109
- // params.logisticsCompany = next?.shippingCode;
110
- // params.logisticsCode = next?.shippingSn;
111
- } else if (type === "send") {
112
- params.sendId = next === null || next === void 0 ? void 0 : next.warehouseCode;
113
- //下拉框,取id
114
- params.sendName = next === null || next === void 0 ? void 0 : next.warehouseCode;
115
- params.sendSnapshotName = next === null || next === void 0 ? void 0 : next.warehouseName;
116
- }
117
- prv.push(params);
118
- return prv;
119
- }, []);
120
- if (!(newList === null || newList === void 0 ? void 0 : newList.length)) {
121
- switch (type) {
122
- case "logistics":
123
- newList = [{
124
- logisticsCode: ""
125
- }];
126
- break;
127
- case "supply":
128
- newList = [{
129
- supplyId: ""
130
- }];
131
- break;
132
- case "send":
133
- newList = [{
134
- sendId: "",
135
- sendName: ""
136
- }];
137
- break;
138
- }
139
- }
140
- return newList;
141
- };
142
- //管易订单信息转换
143
- exports.gyOrderTransform = function (detail, form) {
144
- var _a, _b, _c, _d, _e, _f;
145
- var orderNo = detail.orderNo,
146
- _g = detail.trades,
147
- currentTrades = _g === void 0 ? [] : _g,
148
- componentList = detail.componentList;
149
- var gyGoodsCom = (componentList || []).find(function (com) {
150
- return com.workOrderComponentType === "GY_GOODS";
151
- });
152
- var isStrict = gyGoodsCom ? (_a = form.getFieldValue(gyGoodsCom.uniqueKey)) === null || _a === void 0 ? void 0 : _a.isStrict : false;
153
- var onlyOneSystemOrder = (currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.length) === 1;
154
- console.log("触发---getGyOrderList--4");
155
- return {
156
- gySystemOrder: {
157
- orderNo: orderNo,
158
- isTest: 4,
159
- orders: currentTrades.map(function (item) {
160
- return __assign(__assign({}, item), {
161
- billNo: item.code,
162
- billType: item.orderTypeName,
163
- billTag: item.tagName,
164
- tradeTagName: item.tradeTagName,
165
- deliveryState: deliveryStateMap[item.deliveryState]
166
- });
167
- }),
168
- selectIds: onlyOneSystemOrder ? currentTrades.map(function (item) {
169
- return item.code;
170
- }) : [],
171
- showOrderInfo: currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.map(function (item) {
172
- return __assign(__assign({}, item), {
173
- billNo: item.code,
174
- billType: item.orderTypeName,
175
- billTag: item.tagName,
176
- tradeTagName: item.tradeTagName,
177
- deliveryState: deliveryStateMap[item.deliveryState]
178
- });
179
- })
180
- },
181
- gySystemOrderNo: onlyOneSystemOrder ? (_b = currentTrades[0]) === null || _b === void 0 ? void 0 : _b.code : undefined,
182
- gyReissueGoods: onlyOneSystemOrder ? exports.updateGyGoodsHandle([currentTrades[0]]).filter(function (good) {
183
- return !isStrict || !orderNo || good.platformCode === orderNo;
184
- }) : [],
185
- gyGoods: {
186
- // 订单反填,要清空orders,存的是当前系统订单号勾选上的 订单
187
- orders: currentTrades,
188
- orderNo: orderNo,
189
- shopCode: ((_d = (_c = currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.find) === null || _c === void 0 ? void 0 : _c.call(currentTrades, function (item) {
190
- return item.shopCode;
191
- })) === null || _d === void 0 ? void 0 : _d.shopCode) || null,
192
- vipCode: ((_f = (_e = currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.find) === null || _e === void 0 ? void 0 : _e.call(currentTrades, function (item) {
193
- return item.vipCode;
194
- })) === null || _f === void 0 ? void 0 : _f.vipCode) || null,
195
- gyGoods: exports.updateGyGoodsHandle(currentTrades).filter(function (good) {
196
- return !isStrict || !orderNo || good.platformCode === orderNo;
197
- })
198
- },
199
- // gyLogistics: updateGyItemListHandle(
200
- // currentTrades,
201
- // "logistics",
202
- // componentList || [],
203
- // form
204
- // ),
205
- gySendGood: updateGyItemListHandle(currentTrades, "send", componentList || [], form)
206
- };
207
- };
208
- exports.gyOrderBackFormValues = function (detail, templateDetail) {
209
- if (detail === void 0) {
210
- detail = {};
211
- }
212
- if (templateDetail === void 0) {
213
- templateDetail = {};
214
- }
215
- return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
216
- var _a, _b;
217
- var uniqueKey = next.uniqueKey;
218
- var config = next.componentConfig;
219
- switch (next.workOrderComponentType) {
220
- case "GY_SYSTEM_ORDER":
221
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gySystemOrder;
222
- break;
223
- case "GY_GOODS":
224
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gyGoods;
225
- break;
226
- case "GY_REISSUE_GOODS":
227
- prv[uniqueKey] = {
228
- gySystemOrder: detail === null || detail === void 0 ? void 0 : detail.gySystemOrder,
229
- gyReissueGoods: detail === null || detail === void 0 ? void 0 : detail.gyReissueGoods,
230
- gySystemOrderNo: detail === null || detail === void 0 ? void 0 : detail.gySystemOrderNo,
231
- gyReissueType: ["1"],
232
- shopCode: (_a = detail === null || detail === void 0 ? void 0 : detail.gyGoods) === null || _a === void 0 ? void 0 : _a.shopCode,
233
- vipCode: (_b = detail === null || detail === void 0 ? void 0 : detail.gyGoods) === null || _b === void 0 ? void 0 : _b.vipCode
234
- };
235
- break;
236
- case "GY_LOGISTICS":
237
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gyLogistics, "logistics", config);
238
- break;
239
- case "GY_SEND_GOOD":
240
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gySendGood, "send", config);
241
- }
242
- return prv;
243
- }, {});
244
- };
245
- var updateGyItemListByConfigHandle = function updateGyItemListByConfigHandle(list, type, config) {
246
- if (config === void 0) {
247
- config = {};
248
- }
249
- var showField = config.showField,
250
- _a = config.notOrderBack,
251
- notOrderBack = _a === void 0 ? false : _a;
252
- if (notOrderBack) {
253
- return list;
254
- }
255
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
256
- if (type === "logistics") {
257
- if (!["logisticsCompany", ""].includes(showField || "")) {
258
- next.logisticsCompany = undefined;
259
- }
260
- if (!["logisticsCode", ""].includes(showField || "")) {
261
- next.logisticsCode = undefined;
262
- }
263
- } else if (type === "send") {
264
- if (!["sendId", "all"].includes(showField || "")) {
265
- next.sendId = undefined;
266
- }
267
- if (!["sendName", "all"].includes(showField || "")) {
268
- next.sendName = undefined;
269
- next.sendSnapshotName = undefined;
270
- }
271
- }
272
- prv.push(next);
273
- return prv;
274
- }, []);
275
- };
276
- // 管易根据订单号请求返回的platformCode会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
277
- exports.filterGyOrders = function (trades, order_no) {
278
- var currentTrades = (trades || []).filter(function (item) {
279
- return (item.platformCode || "").split(",").includes(order_no);
280
- });
281
- if (currentTrades.length) {
282
- return currentTrades;
283
- }
284
- return [];
285
- };