@kmkf-fe-packages/kmkf-utils 2.10.19 → 2.10.22

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.
package/README.md CHANGED
@@ -1 +1 @@
1
- 1123111111111111
1
+ 112311111166
@@ -1,6 +1,7 @@
1
1
  export { default as columnsGoodsList } from "./columnsGoodsList";
2
2
  export { default as componentsOptionsMapping } from "./componentsOptionsMapping";
3
3
  export * from './constant';
4
+ export * from './youzan';
4
5
  export declare const getMapping: (data: {
5
6
  dataIndex: string;
6
7
  title: string;
@@ -1,6 +1,7 @@
1
1
  export { default as columnsGoodsList } from "./columnsGoodsList";
2
2
  export { default as componentsOptionsMapping } from "./componentsOptionsMapping";
3
3
  export * from "./constant";
4
+ export * from "./youzan";
4
5
  export var getMapping = function getMapping(data) {
5
6
  var mapping = {};
6
7
  data.forEach(function (item) {
@@ -0,0 +1,26 @@
1
+ export declare const YOUZAN_SHOP_SOURCE = 25;
2
+ export declare const YOUZAN_FLAG_STAR_MAPPING: readonly [{
3
+ readonly flagNum: "1";
4
+ readonly flagName: "红";
5
+ readonly star: "1";
6
+ }, {
7
+ readonly flagNum: "2";
8
+ readonly flagName: "橙";
9
+ readonly star: "2";
10
+ }, {
11
+ readonly flagNum: "3";
12
+ readonly flagName: "绿";
13
+ readonly star: "3";
14
+ }, {
15
+ readonly flagNum: "4";
16
+ readonly flagName: "蓝";
17
+ readonly star: "4";
18
+ }, {
19
+ readonly flagNum: "5";
20
+ readonly flagName: "紫";
21
+ readonly star: "5";
22
+ }];
23
+ export declare const isYouzanShop: (shop?: {
24
+ shopSource?: string | number;
25
+ } | null) => boolean;
26
+ export declare const normalizeYouzanStar: (value: unknown) => number | undefined;
@@ -0,0 +1,29 @@
1
+ export var YOUZAN_SHOP_SOURCE = 25;
2
+ export var YOUZAN_FLAG_STAR_MAPPING = [{
3
+ flagNum: "1",
4
+ flagName: "红",
5
+ star: "1"
6
+ }, {
7
+ flagNum: "2",
8
+ flagName: "橙",
9
+ star: "2"
10
+ }, {
11
+ flagNum: "3",
12
+ flagName: "绿",
13
+ star: "3"
14
+ }, {
15
+ flagNum: "4",
16
+ flagName: "蓝",
17
+ star: "4"
18
+ }, {
19
+ flagNum: "5",
20
+ flagName: "紫",
21
+ star: "5"
22
+ }];
23
+ export var isYouzanShop = function isYouzanShop(shop) {
24
+ return Number(shop === null || shop === void 0 ? void 0 : shop.shopSource) === YOUZAN_SHOP_SOURCE;
25
+ };
26
+ export var normalizeYouzanStar = function normalizeYouzanStar(value) {
27
+ var star = Number(value);
28
+ return Number.isInteger(star) && star >= 1 && star <= 5 ? star : undefined;
29
+ };
@@ -178,45 +178,6 @@ var updateJstItemListHandle = function updateJstItemListHandle(list, type, comLi
178
178
  }
179
179
  return newList;
180
180
  };
181
- var updateJstItemListByConfigHandle = function updateJstItemListByConfigHandle(list, type) {
182
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
183
- var showField = config.showField,
184
- enableItemId = config.enableItemId,
185
- enableSupplierName = config.enableSupplierName;
186
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
187
- if (type === "logistics") {
188
- if (!["logisticsCompany", ""].includes(showField || "")) {
189
- next.logisticsCompany = undefined;
190
- }
191
- if (!["logisticsCode", ""].includes(showField || "")) {
192
- next.logisticsCode = undefined;
193
- }
194
- } else if (type === "send") {
195
- if (!["sendId", "all"].includes(showField || "")) {
196
- next.sendId = undefined;
197
- }
198
- if (!["sendName", "all"].includes(showField || "")) {
199
- next.sendName = undefined;
200
- }
201
- } else if (type === "supply") {
202
- if (!["supplyId", "all"].includes(showField || "")) {
203
- next.supplyId = undefined;
204
- }
205
- if (!["supplyName", "all"].includes(showField || "")) {
206
- next.supplyName = undefined;
207
- }
208
- } else if (type === "itemList") {
209
- if (!enableItemId) {
210
- next.itemId = undefined;
211
- }
212
- if (!enableSupplierName) {
213
- next.supplierName = undefined;
214
- }
215
- }
216
- prv.push(next);
217
- return prv;
218
- }, []);
219
- };
220
181
  export var jstMergeIdenticalGoods = function jstMergeIdenticalGoods() {
221
182
  var goodDetails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
222
183
  var list = [];
@@ -272,16 +233,16 @@ export var jstOrderBackFormValues = function jstOrderBackFormValues() {
272
233
  }
273
234
  break;
274
235
  case "JST_ITEM_SELECT_THIRD":
275
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstItemSelectThird, "itemList", config);
236
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstItemSelectThird;
276
237
  break;
277
238
  case "JST_SUPPLY":
278
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSupply, "supply", config);
239
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstSupply;
279
240
  break;
280
241
  case "JST_LOGISTICS":
281
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstLogistics, "logistics", config);
242
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstLogistics;
282
243
  break;
283
244
  case "JST_SEND_GOOD":
284
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSendGood, "send", config);
245
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstSendGood;
285
246
  break;
286
247
  }
287
248
  return prv;
@@ -241,29 +241,6 @@ var updateBsE3SystemItemListHandle = function updateBsE3SystemItemListHandle(lis
241
241
  }
242
242
  return newList;
243
243
  };
244
- var updateBsE3ItemListByConfigHandle = function updateBsE3ItemListByConfigHandle(list, type) {
245
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
246
- var showField = config.showField;
247
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
248
- if (type === "logistics") {
249
- if (!["logisticsCompany", ""].includes(showField || "")) {
250
- next.logisticsCompany = undefined;
251
- }
252
- if (!["logisticsCode", ""].includes(showField || "")) {
253
- next.logisticsCode = undefined;
254
- }
255
- } else if (type === "send") {
256
- if (!["sendId", "all"].includes(showField || "")) {
257
- next.sendId = undefined;
258
- }
259
- if (!["sendName", "all"].includes(showField || "")) {
260
- next.sendName = undefined;
261
- }
262
- }
263
- prv.push(next);
264
- return prv;
265
- }, []);
266
- };
267
244
  export var bsE3OrderBackFormValues = function bsE3OrderBackFormValues() {
268
245
  var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
269
246
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -313,10 +290,10 @@ export var bsE3OrderBackFormValues = function bsE3OrderBackFormValues() {
313
290
  // prv[uniqueKey] = detail?.bsReturnGoods;
314
291
  // break;
315
292
  case "BS_E3_LOGISTICS":
316
- prv[uniqueKey] = updateBsE3ItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsE3Logistics, "logistics", config);
293
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsE3Logistics;
317
294
  break;
318
295
  case "BS_E3_SEND_GOOD":
319
- prv[uniqueKey] = updateBsE3ItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsE3SendGood, "send", config);
296
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsE3SendGood;
320
297
  break;
321
298
  // case "BS_DELIVERY_NO":
322
299
  // prv[uniqueKey] = detail?.bsDeliveryNo;
@@ -166,29 +166,6 @@ var updateBsSystemItemListHandle = function updateBsSystemItemListHandle(list, t
166
166
  }
167
167
  return newList;
168
168
  };
169
- var updateBsItemListByConfigHandle = function updateBsItemListByConfigHandle(list, type) {
170
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
171
- var showField = config.showField;
172
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
173
- if (type === "logistics") {
174
- if (!["logisticsCompany", ""].includes(showField || "")) {
175
- next.logisticsCompany = undefined;
176
- }
177
- if (!["logisticsCode", ""].includes(showField || "")) {
178
- next.logisticsCode = undefined;
179
- }
180
- } else if (type === "send") {
181
- if (!["sendId", "all"].includes(showField || "")) {
182
- next.sendId = undefined;
183
- }
184
- if (!["sendName", "all"].includes(showField || "")) {
185
- next.sendName = undefined;
186
- }
187
- }
188
- prv.push(next);
189
- return prv;
190
- }, []);
191
- };
192
169
  export var bsOrderBackFormValues = function bsOrderBackFormValues() {
193
170
  var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
194
171
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -254,10 +231,10 @@ export var bsOrderBackFormValues = function bsOrderBackFormValues() {
254
231
  }
255
232
  break;
256
233
  case "BS_LOGISTICS":
257
- prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsLogistics, "logistics", config);
234
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsLogistics;
258
235
  break;
259
236
  case "BS_SEND_GOOD":
260
- prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsSendGood, "send", config);
237
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsSendGood;
261
238
  break;
262
239
  case "BS_DELIVERY_NO":
263
240
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsDeliveryNo;
@@ -163,32 +163,6 @@ var updateDxdItemListHandle = function updateDxdItemListHandle(list, type, comLi
163
163
  return newList;
164
164
  };
165
165
 
166
- // 物流/发货仓按 showField 过滤反填字段(参考 KM:只反填组件配置要显示的字段)
167
- var updateDxdItemListByConfigHandle = function updateDxdItemListByConfigHandle(list, type) {
168
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
169
- var showField = config.showField;
170
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
171
- if (type === "logistics") {
172
- if (!["logisticsCompany", ""].includes(showField || "")) {
173
- next.logisticsCompany = undefined;
174
- }
175
- if (!["logisticsCode", ""].includes(showField || "")) {
176
- next.logisticsCode = undefined;
177
- }
178
- } else if (type === "send") {
179
- if (!["sendId", "all"].includes(showField || "")) {
180
- next.sendId = undefined;
181
- }
182
- if (!["sendName", "all"].includes(showField || "")) {
183
- next.sendName = undefined;
184
- next.sendSnapshotName = undefined;
185
- }
186
- }
187
- prv.push(next);
188
- return prv;
189
- }, []);
190
- };
191
-
192
166
  // DXD 订单数据转换
193
167
  export var dxdOrderTransform = function dxdOrderTransform(detail, form) {
194
168
  var _doOrders$3, _doOrders$4, _doOrders$5, _doOrders$6;
@@ -319,7 +293,6 @@ export var dxdOrderBackFormValues = function dxdOrderBackFormValues() {
319
293
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
320
294
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
321
295
  var uniqueKey = next.uniqueKey;
322
- var config = next.componentConfig;
323
296
  switch (next.workOrderComponentType) {
324
297
  case "DXD_SYSTEM_ORDER":
325
298
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.dxdSystemOrder;
@@ -328,10 +301,10 @@ export var dxdOrderBackFormValues = function dxdOrderBackFormValues() {
328
301
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.dxdGoods;
329
302
  break;
330
303
  case "DXD_LOGISTICS":
331
- prv[uniqueKey] = updateDxdItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.dxdLogistics, "logistics", config);
304
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.dxdLogistics;
332
305
  break;
333
306
  case "DXD_SEND_GOOD":
334
- prv[uniqueKey] = updateDxdItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.dxdSendGood, "send", config);
307
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.dxdSendGood;
335
308
  break;
336
309
  case "DXD_SHOP":
337
310
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.shopCode;
@@ -302,10 +302,10 @@ export var gyOrderBackFormValues = function gyOrderBackFormValues() {
302
302
  }
303
303
  break;
304
304
  case "GY_LOGISTICS":
305
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gyLogistics, "logistics", config);
305
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gyLogistics;
306
306
  break;
307
307
  case "GY_SEND_GOOD":
308
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gySendGood, "send", config);
308
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gySendGood;
309
309
  break;
310
310
  case "GY_RETURN_GOODS":
311
311
  {
@@ -324,35 +324,6 @@ export var gyOrderBackFormValues = function gyOrderBackFormValues() {
324
324
  return prv;
325
325
  }, {});
326
326
  };
327
- var updateGyItemListByConfigHandle = function updateGyItemListByConfigHandle(list, type) {
328
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
329
- var showField = config.showField,
330
- _config$notOrderBack = config.notOrderBack,
331
- notOrderBack = _config$notOrderBack === void 0 ? false : _config$notOrderBack;
332
- if (notOrderBack) {
333
- return list;
334
- }
335
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
336
- if (type === "logistics") {
337
- if (!["logisticsCompany", ""].includes(showField || "")) {
338
- next.logisticsCompany = undefined;
339
- }
340
- if (!["logisticsCode", ""].includes(showField || "")) {
341
- next.logisticsCode = undefined;
342
- }
343
- } else if (type === "send") {
344
- if (!["sendId", "all"].includes(showField || "")) {
345
- next.sendId = undefined;
346
- }
347
- if (!["sendName", "all"].includes(showField || "")) {
348
- next.sendName = undefined;
349
- next.sendSnapshotName = undefined;
350
- }
351
- }
352
- prv.push(next);
353
- return prv;
354
- }, []);
355
- };
356
327
 
357
328
  // 管易根据订单号请求返回的platformCode会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
358
329
  export var filterGyOrders = function filterGyOrders(trades, order_no) {
@@ -452,10 +452,10 @@ export var jkyOrderBackFormValues = function jkyOrderBackFormValues() {
452
452
  }
453
453
  break;
454
454
  case "JKY_LOGISTICS":
455
- prv[uniqueKey] = updateJkyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jkyLogistics, "logistics", config);
455
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jkyLogistics;
456
456
  break;
457
457
  case "JKY_SEND_GOOD":
458
- prv[uniqueKey] = updateJkyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jkySendGood, "send", config);
458
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jkySendGood;
459
459
  break;
460
460
  case "JKY_RETURN_GOODS":
461
461
  {
@@ -474,35 +474,6 @@ export var jkyOrderBackFormValues = function jkyOrderBackFormValues() {
474
474
  return prv;
475
475
  }, {});
476
476
  };
477
- var updateJkyItemListByConfigHandle = function updateJkyItemListByConfigHandle(list, type) {
478
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
479
- var showField = config.showField,
480
- _config$notOrderBack = config.notOrderBack,
481
- notOrderBack = _config$notOrderBack === void 0 ? false : _config$notOrderBack;
482
- if (notOrderBack) {
483
- return list;
484
- }
485
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
486
- if (type === "logistics") {
487
- if (!["logisticsCompany", ""].includes(showField || "")) {
488
- next.logisticsCompany = undefined;
489
- }
490
- if (!["logisticsCode", ""].includes(showField || "")) {
491
- next.logisticsCode = undefined;
492
- }
493
- } else if (type === "send") {
494
- if (!["sendId", "all"].includes(showField || "")) {
495
- next.sendId = undefined;
496
- }
497
- if (!["sendName", "all"].includes(showField || "")) {
498
- next.sendName = undefined;
499
- next.sendSnapshotName = undefined;
500
- }
501
- }
502
- prv.push(next);
503
- return prv;
504
- }, []);
505
- };
506
477
 
507
478
  // 根据订单号请求返回的platformCode会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
508
479
  export var filterJkyOrders = function filterJkyOrders(trades, order_no) {
@@ -183,45 +183,6 @@ var updateJstItemListHandle = function updateJstItemListHandle(list, type, comLi
183
183
  }
184
184
  return newList;
185
185
  };
186
- var updateJstItemListByConfigHandle = function updateJstItemListByConfigHandle(list, type) {
187
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
188
- var showField = config.showField,
189
- enableItemId = config.enableItemId,
190
- enableSupplierName = config.enableSupplierName;
191
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
192
- if (type === "logistics") {
193
- if (!["logisticsCompany", ""].includes(showField || "")) {
194
- next.logisticsCompany = undefined;
195
- }
196
- if (!["logisticsCode", ""].includes(showField || "")) {
197
- next.logisticsCode = undefined;
198
- }
199
- } else if (type === "send") {
200
- if (!["sendId", "all"].includes(showField || "")) {
201
- next.sendId = undefined;
202
- }
203
- if (!["sendName", "all"].includes(showField || "")) {
204
- next.sendName = undefined;
205
- }
206
- } else if (type === "supply") {
207
- if (!["supplyId", "all"].includes(showField || "")) {
208
- next.supplyId = undefined;
209
- }
210
- if (!["supplyName", "all"].includes(showField || "")) {
211
- next.supplyName = undefined;
212
- }
213
- } else if (type === "itemList") {
214
- if (!enableItemId) {
215
- next.itemId = undefined;
216
- }
217
- if (!enableSupplierName) {
218
- next.supplierName = undefined;
219
- }
220
- }
221
- prv.push(next);
222
- return prv;
223
- }, []);
224
- };
225
186
  export var jstMergeIdenticalGoods = function jstMergeIdenticalGoods() {
226
187
  var goodDetails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
227
188
  var list = [];
@@ -280,16 +241,16 @@ export var jstOrderBackFormValues = function jstOrderBackFormValues() {
280
241
 
281
242
  break;
282
243
  case "JST_ITEM_SELECT_THIRD":
283
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstItemSelectThird, "itemList", config);
244
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstItemSelectThird;
284
245
  break;
285
246
  case "JST_SUPPLY":
286
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSupply, "supply", config);
247
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstSupply;
287
248
  break;
288
249
  case "JST_LOGISTICS":
289
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstLogistics, "logistics", config);
250
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstLogistics;
290
251
  break;
291
252
  case "JST_SEND_GOOD":
292
- prv[uniqueKey] = updateJstItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jstSendGood, "send", config);
253
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jstSendGood;
293
254
  break;
294
255
  }
295
256
  return prv;
@@ -296,10 +296,10 @@ export var jyOrderBackFormValues = function jyOrderBackFormValues() {
296
296
  }
297
297
  break;
298
298
  case "JY_LOGISTICS":
299
- prv[uniqueKey] = updateJyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jyLogistics, "logistics", config);
299
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jyLogistics;
300
300
  break;
301
301
  case "JY_SEND_GOOD":
302
- prv[uniqueKey] = updateJyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.jySendGood, "send", config);
302
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.jySendGood;
303
303
  break;
304
304
  case "JY_RETURN_GOODS":
305
305
  {
@@ -318,35 +318,6 @@ export var jyOrderBackFormValues = function jyOrderBackFormValues() {
318
318
  return prv;
319
319
  }, {});
320
320
  };
321
- var updateJyItemListByConfigHandle = function updateJyItemListByConfigHandle(list, type) {
322
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
323
- var showField = config.showField,
324
- _config$notOrderBack = config.notOrderBack,
325
- notOrderBack = _config$notOrderBack === void 0 ? false : _config$notOrderBack;
326
- if (notOrderBack) {
327
- return list;
328
- }
329
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
330
- if (type === "logistics") {
331
- if (!["logisticsCompany", ""].includes(showField || "")) {
332
- next.logisticsCompany = undefined;
333
- }
334
- if (!["logisticsCode", ""].includes(showField || "")) {
335
- next.logisticsCode = undefined;
336
- }
337
- } else if (type === "send") {
338
- if (!["sendId", "all"].includes(showField || "")) {
339
- next.sendId = undefined;
340
- }
341
- if (!["sendName", "all"].includes(showField || "")) {
342
- next.sendName = undefined;
343
- next.sendSnapshotName = undefined;
344
- }
345
- }
346
- prv.push(next);
347
- return prv;
348
- }, []);
349
- };
350
321
 
351
322
  // 巨益根据订单号请求返回的platformCode会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
352
323
  export var filterJyOrders = function filterJyOrders(trades, order_no) {
@@ -47,10 +47,10 @@ export var kmOrderBackFormValues = function kmOrderBackFormValues() {
47
47
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.kmSystemOrder;
48
48
  break;
49
49
  case "KM_LOGISTICS":
50
- prv[uniqueKey] = updateKmItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.kmLogistics, "logistics", config);
50
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.kmLogistics;
51
51
  break;
52
52
  case "KM_SEND_GOOD":
53
- prv[uniqueKey] = updateKmItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.kmSendGood, "send", config);
53
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.kmSendGood;
54
54
  break;
55
55
  case "KM_GOODS":
56
56
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.kmGoods;
@@ -368,30 +368,6 @@ var updateKmItemListHandle = function updateKmItemListHandle(list, type, comList
368
368
  }
369
369
  return newList;
370
370
  };
371
- var updateKmItemListByConfigHandle = function updateKmItemListByConfigHandle(list, type) {
372
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
373
- var showField = config.showField;
374
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
375
- if (type === "logistics") {
376
- if (!["logisticsCompany", ""].includes(showField || "")) {
377
- next.logisticsCompany = undefined;
378
- }
379
- if (!["logisticsCode", ""].includes(showField || "")) {
380
- next.logisticsCode = undefined;
381
- }
382
- } else if (type === "send") {
383
- if (!["sendId", "all"].includes(showField || "")) {
384
- next.sendId = undefined;
385
- }
386
- if (!["sendName", "all"].includes(showField || "")) {
387
- next.sendName = undefined;
388
- next.sendSnapshotName = undefined;
389
- }
390
- }
391
- prv.push(next);
392
- return prv;
393
- }, []);
394
- };
395
371
 
396
372
  // KM 看起来合单也只会返回查询的系统订单号
397
373
  export var filterKmOrders = function filterKmOrders(detail, order_no) {
@@ -1,3 +1,9 @@
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); }
2
+ 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
1
7
  import uuid from "./getUUid";
2
8
  import dayjs from "dayjs";
3
9
 
@@ -38,13 +44,12 @@ export var skxOrderBackFormValues = function skxOrderBackFormValues() {
38
44
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
39
45
  var _detail$onBillNo;
40
46
  var uniqueKey = next.uniqueKey;
41
- var config = next.componentConfig;
42
47
  switch (next.workOrderComponentType) {
43
48
  case "SKX_OUTBOUND_NOTICE_NO":
44
49
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : (_detail$onBillNo = detail.onBillNo) === null || _detail$onBillNo === void 0 ? void 0 : _detail$onBillNo.toUpperCase();
45
50
  break;
46
51
  case "SKX_LOGISTICS":
47
- prv[uniqueKey] = updateSkxItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.skxLogistics, "logistics", config);
52
+ prv[uniqueKey] = normalizeSkxLogisticsCode(detail === null || detail === void 0 ? void 0 : detail.skxLogistics);
48
53
  break;
49
54
  case "SKX_SEND_GOOD":
50
55
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.skxSendGood;
@@ -71,6 +76,14 @@ export var skxOrderBackFormValues = function skxOrderBackFormValues() {
71
76
  return prv;
72
77
  }, initValue);
73
78
  };
79
+ var normalizeSkxLogisticsCode = function normalizeSkxLogisticsCode(list) {
80
+ return list === null || list === void 0 ? void 0 : list.map(function (item) {
81
+ var _item$logisticsCode;
82
+ return _objectSpread(_objectSpread({}, item), {}, {
83
+ logisticsCode: item === null || item === void 0 ? void 0 : (_item$logisticsCode = item.logisticsCode) === null || _item$logisticsCode === void 0 ? void 0 : _item$logisticsCode.toUpperCase()
84
+ });
85
+ });
86
+ };
74
87
  export var formatTrade = function formatTrade(trade) {
75
88
  return trade.subOrderList.map(function (item) {
76
89
  return {
@@ -134,25 +147,6 @@ var updateSkxItemListHandle = function updateSkxItemListHandle(list, type, comLi
134
147
  }
135
148
  return newList;
136
149
  };
137
- var updateSkxItemListByConfigHandle = function updateSkxItemListByConfigHandle(list, type) {
138
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
139
- var showField = config.showField;
140
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
141
- if (type === "logistics") {
142
- if (!["logisticsCompany", ""].includes(showField || "")) {
143
- next.logisticsCompany = undefined;
144
- }
145
- if (!["logisticsCode", ""].includes(showField || "")) {
146
- next.logisticsCode = undefined;
147
- } else {
148
- var _next$logisticsCode;
149
- next.logisticsCode = next === null || next === void 0 ? void 0 : (_next$logisticsCode = next.logisticsCode) === null || _next$logisticsCode === void 0 ? void 0 : _next$logisticsCode.toUpperCase();
150
- }
151
- }
152
- prv.push(next);
153
- return prv;
154
- }, []);
155
- };
156
150
 
157
151
  //斯凯奇订单信息转换
158
152
  export var skxOrderTransform = function skxOrderTransform(detail, form) {
@@ -1,3 +1,9 @@
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); }
2
+ 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
1
7
  import uuid from "./getUUid";
2
8
 
3
9
  // 斯凯奇信息返填
@@ -32,7 +38,6 @@ export var skxReturnOrderBackFormValues = function skxReturnOrderBackFormValues(
32
38
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
33
39
  var _detail$skxReturnBill;
34
40
  var uniqueKey = next.uniqueKey;
35
- var config = next.componentConfig;
36
41
  switch (next.workOrderComponentType) {
37
42
  case "SKX_RETURN_BILL_NO":
38
43
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : (_detail$skxReturnBill = detail.skxReturnBillNo) === null || _detail$skxReturnBill === void 0 ? void 0 : _detail$skxReturnBill.toUpperCase();
@@ -41,7 +46,7 @@ export var skxReturnOrderBackFormValues = function skxReturnOrderBackFormValues(
41
46
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.skxRefundBillNo;
42
47
  break;
43
48
  case "SKX_RETURN_LOGISTICS":
44
- prv[uniqueKey] = updateSkxItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.skxReturnLogistics, "logistics", config);
49
+ prv[uniqueKey] = normalizeSkxLogisticsCode(detail === null || detail === void 0 ? void 0 : detail.skxReturnLogistics);
45
50
  break;
46
51
  case "SKX_RETURN_GOODS":
47
52
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.skxReturnGoods;
@@ -55,6 +60,14 @@ export var skxReturnOrderBackFormValues = function skxReturnOrderBackFormValues(
55
60
  return prv;
56
61
  }, {});
57
62
  };
63
+ var normalizeSkxLogisticsCode = function normalizeSkxLogisticsCode(list) {
64
+ return list === null || list === void 0 ? void 0 : list.map(function (item) {
65
+ var _item$logisticsCode;
66
+ return _objectSpread(_objectSpread({}, item), {}, {
67
+ logisticsCode: item === null || item === void 0 ? void 0 : (_item$logisticsCode = item.logisticsCode) === null || _item$logisticsCode === void 0 ? void 0 : _item$logisticsCode.toUpperCase()
68
+ });
69
+ });
70
+ };
58
71
  export var formatReturnTrade = function formatReturnTrade(trade) {
59
72
  return trade.returnSubOrderList.map(function (item) {
60
73
  return {
@@ -118,25 +131,6 @@ var updateSkxItemListHandle = function updateSkxItemListHandle(list, type, comLi
118
131
  }
119
132
  return newList;
120
133
  };
121
- var updateSkxItemListByConfigHandle = function updateSkxItemListByConfigHandle(list, type) {
122
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
123
- var showField = config.showField;
124
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
125
- if (type === "logistics") {
126
- if (!["logisticsCompany", ""].includes(showField || "")) {
127
- next.logisticsCompany = undefined;
128
- }
129
- if (!["logisticsCode", ""].includes(showField || "")) {
130
- next.logisticsCode = undefined;
131
- } else {
132
- var _next$logisticsCode;
133
- next.logisticsCode = next === null || next === void 0 ? void 0 : (_next$logisticsCode = next.logisticsCode) === null || _next$logisticsCode === void 0 ? void 0 : _next$logisticsCode.toUpperCase();
134
- }
135
- }
136
- prv.push(next);
137
- return prv;
138
- }, []);
139
- };
140
134
 
141
135
  //斯凯奇订单信息转换
142
136
  export var skxReturnOrderTransform = function skxReturnOrderTransform(detail, form) {
@@ -380,35 +380,6 @@ var updateWdtItemListHandle = function updateWdtItemListHandle(list, type, comLi
380
380
  }
381
381
  return newList;
382
382
  };
383
- var updateWdtItemListByConfigHandle = function updateWdtItemListByConfigHandle(list, type) {
384
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
385
- var showField = config.showField,
386
- _config$notOrderBack = config.notOrderBack,
387
- notOrderBack = _config$notOrderBack === void 0 ? false : _config$notOrderBack;
388
- if (notOrderBack) {
389
- return list;
390
- }
391
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
392
- if (type === "logistics") {
393
- if (!["logisticsCompany", ""].includes(showField || "")) {
394
- next.logisticsCompany = undefined;
395
- }
396
- if (!["logisticsCode", ""].includes(showField || "")) {
397
- next.logisticsCode = undefined;
398
- }
399
- } else if (type === "send") {
400
- if (!["sendId", "all"].includes(showField || "")) {
401
- next.sendId = undefined;
402
- }
403
- if (!["sendName", "all"].includes(showField || "")) {
404
- next.sendName = undefined;
405
- next.sendSnapshotName = undefined;
406
- }
407
- }
408
- prv.push(next);
409
- return prv;
410
- }, []);
411
- };
412
383
 
413
384
  // WDT根据订单号请求返回的srcTid会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
414
385
  export var filterWdtOrders = function filterWdtOrders(detail, order_no) {
@@ -451,10 +422,10 @@ export var wdtOrderBackFormValues = function wdtOrderBackFormValues() {
451
422
  }
452
423
  break;
453
424
  case "WDT_LOGISTICS":
454
- prv[uniqueKey] = updateWdtItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.wdtLogistics, "logistics", config);
425
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wdtLogistics;
455
426
  break;
456
427
  case "WDT_SEND_GOOD":
457
- prv[uniqueKey] = updateWdtItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.wdtSendGood, "send", config);
428
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wdtSendGood;
458
429
  break;
459
430
  case "WDT_SHOP":
460
431
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.shopCode;
@@ -433,29 +433,6 @@ var updateWlnItemListHandle = function updateWlnItemListHandle(list, type, comLi
433
433
  }
434
434
  return newList;
435
435
  };
436
- var updateBsItemListByConfigHandle = function updateBsItemListByConfigHandle(list, type) {
437
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
438
- var showField = config.showField;
439
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
440
- if (type === "logistics") {
441
- if (!["logisticsCompany", ""].includes(showField || "")) {
442
- next.logisticsCompany = undefined;
443
- }
444
- if (!["logisticsCode", ""].includes(showField || "")) {
445
- next.logisticsCode = undefined;
446
- }
447
- } else if (type === "send") {
448
- if (!["sendId", "all"].includes(showField || "")) {
449
- next.sendId = undefined;
450
- }
451
- if (!["sendName", "all"].includes(showField || "")) {
452
- next.sendName = undefined;
453
- }
454
- }
455
- prv.push(next);
456
- return prv;
457
- }, []);
458
- };
459
436
  export var wlnOrderBackFormValues = function wlnOrderBackFormValues() {
460
437
  var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
461
438
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -481,10 +458,10 @@ export var wlnOrderBackFormValues = function wlnOrderBackFormValues() {
481
458
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wlnGoods;
482
459
  break;
483
460
  case "WLN_LOGISTICS":
484
- prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.wlnLogistics, "logistics", config);
461
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wlnLogistics;
485
462
  break;
486
463
  case "WLN_SEND_GOOD":
487
- prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.wlnSendGood, "send", config);
464
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wlnSendGood;
488
465
  break;
489
466
  }
490
467
  return prv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "2.10.19",
3
+ "version": "2.10.22",
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": "9dcce65e1ba7ff4b9e15312bc219357360a01c93",
44
+ "gitHead": "57ef936ce0251d160e6cf254976cf3a806188914",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }
@@ -1,284 +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
- return {
155
- gySystemOrder: {
156
- orderNo: orderNo,
157
- isTest: 4,
158
- orders: currentTrades.map(function (item) {
159
- return __assign(__assign({}, item), {
160
- billNo: item.code,
161
- billType: item.orderTypeName,
162
- billTag: item.tagName,
163
- tradeTagName: item.tradeTagName,
164
- deliveryState: deliveryStateMap[item.deliveryState]
165
- });
166
- }),
167
- selectIds: onlyOneSystemOrder ? currentTrades.map(function (item) {
168
- return item.code;
169
- }) : [],
170
- showOrderInfo: currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.map(function (item) {
171
- return __assign(__assign({}, item), {
172
- billNo: item.code,
173
- billType: item.orderTypeName,
174
- billTag: item.tagName,
175
- tradeTagName: item.tradeTagName,
176
- deliveryState: deliveryStateMap[item.deliveryState]
177
- });
178
- })
179
- },
180
- gySystemOrderNo: onlyOneSystemOrder ? (_b = currentTrades[0]) === null || _b === void 0 ? void 0 : _b.code : undefined,
181
- gyReissueGoods: onlyOneSystemOrder ? exports.updateGyGoodsHandle([currentTrades[0]]).filter(function (good) {
182
- return !isStrict || !orderNo || good.platformCode === orderNo;
183
- }) : [],
184
- gyGoods: {
185
- // 订单反填,要清空orders,存的是当前系统订单号勾选上的 订单
186
- orders: currentTrades,
187
- orderNo: orderNo,
188
- shopCode: ((_d = (_c = currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.find) === null || _c === void 0 ? void 0 : _c.call(currentTrades, function (item) {
189
- return item.shopCode;
190
- })) === null || _d === void 0 ? void 0 : _d.shopCode) || null,
191
- vipCode: ((_f = (_e = currentTrades === null || currentTrades === void 0 ? void 0 : currentTrades.find) === null || _e === void 0 ? void 0 : _e.call(currentTrades, function (item) {
192
- return item.vipCode;
193
- })) === null || _f === void 0 ? void 0 : _f.vipCode) || null,
194
- gyGoods: exports.updateGyGoodsHandle(currentTrades).filter(function (good) {
195
- return !isStrict || !orderNo || good.platformCode === orderNo;
196
- })
197
- },
198
- // gyLogistics: updateGyItemListHandle(
199
- // currentTrades,
200
- // "logistics",
201
- // componentList || [],
202
- // form
203
- // ),
204
- gySendGood: updateGyItemListHandle(currentTrades, "send", componentList || [], form)
205
- };
206
- };
207
- exports.gyOrderBackFormValues = function (detail, templateDetail) {
208
- if (detail === void 0) {
209
- detail = {};
210
- }
211
- if (templateDetail === void 0) {
212
- templateDetail = {};
213
- }
214
- return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
215
- var _a, _b;
216
- var uniqueKey = next.uniqueKey;
217
- var config = next.componentConfig;
218
- switch (next.workOrderComponentType) {
219
- case "GY_SYSTEM_ORDER":
220
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gySystemOrder;
221
- break;
222
- case "GY_GOODS":
223
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.gyGoods;
224
- break;
225
- case "GY_REISSUE_GOODS":
226
- prv[uniqueKey] = {
227
- gySystemOrder: detail === null || detail === void 0 ? void 0 : detail.gySystemOrder,
228
- gyReissueGoods: detail === null || detail === void 0 ? void 0 : detail.gyReissueGoods,
229
- gySystemOrderNo: detail === null || detail === void 0 ? void 0 : detail.gySystemOrderNo,
230
- gyReissueType: ["1"],
231
- shopCode: (_a = detail === null || detail === void 0 ? void 0 : detail.gyGoods) === null || _a === void 0 ? void 0 : _a.shopCode,
232
- vipCode: (_b = detail === null || detail === void 0 ? void 0 : detail.gyGoods) === null || _b === void 0 ? void 0 : _b.vipCode
233
- };
234
- break;
235
- case "GY_LOGISTICS":
236
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gyLogistics, "logistics", config);
237
- break;
238
- case "GY_SEND_GOOD":
239
- prv[uniqueKey] = updateGyItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.gySendGood, "send", config);
240
- }
241
- return prv;
242
- }, {});
243
- };
244
- var updateGyItemListByConfigHandle = function updateGyItemListByConfigHandle(list, type, config) {
245
- if (config === void 0) {
246
- config = {};
247
- }
248
- var showField = config.showField,
249
- _a = config.notOrderBack,
250
- notOrderBack = _a === void 0 ? false : _a;
251
- if (notOrderBack) {
252
- return list;
253
- }
254
- return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
255
- if (type === "logistics") {
256
- if (!["logisticsCompany", ""].includes(showField || "")) {
257
- next.logisticsCompany = undefined;
258
- }
259
- if (!["logisticsCode", ""].includes(showField || "")) {
260
- next.logisticsCode = undefined;
261
- }
262
- } else if (type === "send") {
263
- if (!["sendId", "all"].includes(showField || "")) {
264
- next.sendId = undefined;
265
- }
266
- if (!["sendName", "all"].includes(showField || "")) {
267
- next.sendName = undefined;
268
- next.sendSnapshotName = undefined;
269
- }
270
- }
271
- prv.push(next);
272
- return prv;
273
- }, []);
274
- };
275
- // 管易根据订单号请求返回的platformCode会有多个订单号组合在一起的数据 排除其他的,返回当前订单号
276
- exports.filterGyOrders = function (trades, order_no) {
277
- var currentTrades = (trades || []).filter(function (item) {
278
- return (item.platformCode || "").split(",").includes(order_no);
279
- });
280
- if (currentTrades.length) {
281
- return currentTrades;
282
- }
283
- return [];
284
- };