@kmkf-fe-packages/basic-components 2.10.9-beta.12 → 2.10.9-beta.14

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/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import { Cascader, DatePicker, Image, InputNumber, Input, Select, Upload, messag
3
3
  import { EyeOutlined, DeleteOutlined, CloseOutlined, PlusSquareOutlined, MinusCircleFilled, PlusCircleFilled, CopyOutlined, CloseCircleOutlined, CaretUpOutlined, UpOutlined, DownOutlined, PlusOutlined, VideoCameraTwoTone } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
- import { AddressData, BsAddressData, WdtAddressData, GyAddressData, JstAddressData, request as request$1, ExpressData, isNull, imgResize, uuid, servers, columnsGoodsList, LogisticsAddressData, SendDataCenter, kmSkuTypeMap, hasAddNullComponent, SUBMIT_TIME_ID, UPGRADE_TIME_ID, FINAL_TIME_ID, CUSTOM_TIME_ID, useStatus, finalFormData, transformList, dataSourceTrans, DATA_SPLIT_COMPONENT_FIELDS_MAP, findLabelBySelectValue, BS_E3_BOOLEAN_STATUS_MAP, DxdSuppliersData, filterWdtOrders, WDT_ORDER_TYPE_MAP, tradeStatusMap, filterBsE3Orders, filterGyOrders, GY_DELIVERY_STATE_MAPPING, filterJstOrders, filterJyOrders, JY_ORDER_TYPE_MAP, JY_ORDER_STATUS_MAP, filterJkyOrders, JKY_ORDER_FROM_MAP, JKY_ORDER_TYPE_MAP, JKY_ORDER_STATUS_MAP, getJkyLogisticInfo, filterKmOrders, getSystemShowHead, getIsPlatformCodesIncludeOrderNos, BS_SYSTEM_ORDER_CONFIG, KM_SYSTEM_ORDER_CONFIG, WLN_SYSTEM_ORDER_CONFIG, WDT_SYSTEM_ORDER_CONFIG, BS_E3_SYSTEM_ORDER_CONFIG, GY_SYSTEM_ORDER_CONFIG, JST_SYSTEM_ORDER_CONFIG, JY_SYSTEM_ORDER_CONFIG, JKY_SYSTEM_ORDER_CONFIG, WDT_RETURN_BILL_NO_CONFIG, PLATFORM_AFTER_SALES_ORDER_CONFIG, DXD_SYSTEM_ORDER_CONFIG, BS_E3_ORDER_STATUS_MAP, KM_ORDER_TYPE_MAP, KM_ORDER_STATUS, updateOrderSubFormGoodsHandle, updateWlnGoodsHandle, updateWdtGoodsHandle, updateBsE3GoodsHandle, updateGyGoodsHandle, updateJstGoodsHandle, updateKmGoodsHandle, updateJyGoodsHandle, updateJkyGoodsHandle, updateDxdGoodsHandle, updateWdtAftersaleGoodsHandle, jstMergeIdenticalGoods, msgTypeCh, pushGyLog, skxSystemOrderBackValues, skxReturnSystemOrderBackValues, formatTrade, updateSkxGoodsHandle, formatReturnTrade, updateSkxReturnGoodsHandle } from '@kmkf-fe-packages/kmkf-utils';
6
+ import { AddressData, BsAddressData, WdtAddressData, GyAddressData, JstAddressData, request as request$1, ExpressData, isNull, imgResize, uuid, servers, columnsGoodsList, LogisticsAddressData, isJdLogisticsCompany, getJdCustomerCodeOptions, SendDataCenter, kmSkuTypeMap, hasAddNullComponent, SUBMIT_TIME_ID, UPGRADE_TIME_ID, FINAL_TIME_ID, CUSTOM_TIME_ID, useStatus, finalFormData, transformList, dataSourceTrans, DATA_SPLIT_COMPONENT_FIELDS_MAP, findLabelBySelectValue, BS_E3_BOOLEAN_STATUS_MAP, DxdSuppliersData, filterWdtOrders, WDT_ORDER_TYPE_MAP, tradeStatusMap, filterBsE3Orders, filterGyOrders, GY_DELIVERY_STATE_MAPPING, filterJstOrders, filterJyOrders, JY_ORDER_TYPE_MAP, JY_ORDER_STATUS_MAP, filterJkyOrders, JKY_ORDER_FROM_MAP, JKY_ORDER_TYPE_MAP, JKY_ORDER_STATUS_MAP, getJkyLogisticInfo, filterKmOrders, getSystemShowHead, getIsPlatformCodesIncludeOrderNos, BS_SYSTEM_ORDER_CONFIG, KM_SYSTEM_ORDER_CONFIG, WLN_SYSTEM_ORDER_CONFIG, WDT_SYSTEM_ORDER_CONFIG, BS_E3_SYSTEM_ORDER_CONFIG, GY_SYSTEM_ORDER_CONFIG, JST_SYSTEM_ORDER_CONFIG, JY_SYSTEM_ORDER_CONFIG, JKY_SYSTEM_ORDER_CONFIG, WDT_RETURN_BILL_NO_CONFIG, PLATFORM_AFTER_SALES_ORDER_CONFIG, DXD_SYSTEM_ORDER_CONFIG, BS_E3_ORDER_STATUS_MAP, KM_ORDER_TYPE_MAP, KM_ORDER_STATUS, updateOrderSubFormGoodsHandle, updateWlnGoodsHandle, updateWdtGoodsHandle, updateBsE3GoodsHandle, updateGyGoodsHandle, updateJstGoodsHandle, updateKmGoodsHandle, updateJyGoodsHandle, updateJkyGoodsHandle, updateDxdGoodsHandle, updateWdtAftersaleGoodsHandle, jstMergeIdenticalGoods, msgTypeCh, pushGyLog, skxSystemOrderBackValues, skxReturnSystemOrderBackValues, formatTrade, updateSkxGoodsHandle, formatReturnTrade, updateSkxReturnGoodsHandle } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import every from 'lodash/every';
8
8
  import maxBy from 'lodash/maxBy';
9
9
  import { debounce, isNaN as isNaN$1, isNumber as isNumber$1, uniqBy, cloneDeep, difference, differenceWith, isBoolean, isEqual, takeRight, reject as reject$1, intersection, isEmpty } from 'lodash';
@@ -736,6 +736,12 @@ var ApaasUpload = function ApaasUpload(_ref) {
736
736
  resetProps = _objectWithoutProperties(_ref, _excluded$4);
737
737
  var inputRef = useRef(null);
738
738
  var valueRef = useRef(value);
739
+ // 当前批次的文件选择序号,用于按选择顺序展示上传结果
740
+ var batchSeqRef = useRef(0);
741
+ // 当前批次的上传结果,按序号存储,最后统一排序合并
742
+ var batchResultsRef = useRef(new Map());
743
+ // 当前批次正在处理的文件数,用于判断批次何时结束
744
+ var pendingCountRef = useRef(0);
739
745
  var _useState = useState(false),
740
746
  _useState2 = _slicedToArray(_useState, 2),
741
747
  visible = _useState2[0],
@@ -751,6 +757,32 @@ var ApaasUpload = function ApaasUpload(_ref) {
751
757
  useEffect(function () {
752
758
  valueRef.current = value;
753
759
  }, [value]);
760
+ // 获取当前批次的文件选择序号;没有正在处理的文件时视为新一批,重置批次状态
761
+ var acquireBatchSeq = function acquireBatchSeq() {
762
+ if (pendingCountRef.current === 0) {
763
+ batchSeqRef.current = 0;
764
+ batchResultsRef.current.clear();
765
+ }
766
+ return batchSeqRef.current++;
767
+ };
768
+ // 将单个文件结果存入当前批次,本批次全部完成时按选择顺序合并到 value
769
+ var appendResult = function appendResult(batchSeq, result) {
770
+ if (valueRef.current.length + batchResultsRef.current.size < maxCount) {
771
+ batchResultsRef.current.set(batchSeq, result);
772
+ }
773
+ pendingCountRef.current = Math.max(0, pendingCountRef.current - 1);
774
+ if (pendingCountRef.current === 0 && batchResultsRef.current.size > 0) {
775
+ var sorted = _toConsumableArray(batchResultsRef.current.entries()).sort(function (a, b) {
776
+ return a[0] - b[0];
777
+ }).map(function (_ref2) {
778
+ var _ref3 = _slicedToArray(_ref2, 2),
779
+ v = _ref3[1];
780
+ return v;
781
+ });
782
+ handleChange([].concat(_toConsumableArray(valueRef.current), _toConsumableArray(sorted)));
783
+ batchResultsRef.current.clear();
784
+ }
785
+ };
754
786
  var imgReader = function imgReader(item) {
755
787
  var blob = item.getAsFile(),
756
788
  reader = new FileReader();
@@ -758,14 +790,16 @@ var ApaasUpload = function ApaasUpload(_ref) {
758
790
  message.error("\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
759
791
  return;
760
792
  }
761
- if (valueRef.current.length >= maxCount) {
793
+ if (valueRef.current.length + pendingCountRef.current >= maxCount) {
762
794
  message.error("\u53EA\u80FD\u4E0A\u4F20".concat(maxCount, "\u5F20\u56FE\u7247"));
763
795
  return;
764
796
  }
797
+ var batchSeq = acquireBatchSeq();
798
+ pendingCountRef.current += 1;
765
799
  reader.onload = function (e) {
766
800
  var _e$target;
767
801
  var result = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
768
- handleChange([].concat(_toConsumableArray(valueRef.current), [result]));
802
+ appendResult(batchSeq, result);
769
803
  };
770
804
  reader.readAsDataURL(blob);
771
805
  };
@@ -798,7 +832,8 @@ var ApaasUpload = function ApaasUpload(_ref) {
798
832
  // 手动上传模式, 一直返回false
799
833
  var beforeUpload = function beforeUpload(file) {
800
834
  var size = file.size / 1024 / 1024 < maxSize;
801
- if (value.length > maxCount) {
835
+ // 并发上传时用「已上传 + 待上传」一起判断,避免一次选多张时超出 maxCount
836
+ if (valueRef.current.length + pendingCountRef.current >= maxCount) {
802
837
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u5F20\u56FE\u7247\uFF01"));
803
838
  return Upload.LIST_IGNORE;
804
839
  }
@@ -806,8 +841,10 @@ var ApaasUpload = function ApaasUpload(_ref) {
806
841
  message.error("\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
807
842
  return Upload.LIST_IGNORE;
808
843
  }
844
+ var batchSeq = acquireBatchSeq();
845
+ pendingCountRef.current += 1;
809
846
  getBase64(file).then(function (res) {
810
- return handleChange([].concat(_toConsumableArray(valueRef.current), [res]));
847
+ appendResult(batchSeq, res);
811
848
  });
812
849
  return Upload.LIST_IGNORE;
813
850
  };
@@ -909,6 +946,7 @@ var ApaasUpload = function ApaasUpload(_ref) {
909
946
  name: "file",
910
947
  listType: "picture-card",
911
948
  maxCount: maxCount,
949
+ multiple: true,
912
950
  className: styles.upload,
913
951
  beforeUpload: beforeUpload
914
952
  }, resetProps), value.length >= maxCount ? null : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
@@ -1049,6 +1087,16 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1049
1087
  resetProps = _objectWithoutProperties(_ref, _excluded$6);
1050
1088
  var inputRef = useRef(null);
1051
1089
  var valueRef = useRef(value);
1090
+ // 并发上传时用于正确控制 loading 状态(多个文件同时上传)
1091
+ var uploadingCountRef = useRef(0);
1092
+ // 已选中待上传的文件数,用于数量预占,避免并发上传超过 maxCount
1093
+ var pendingCountRef = useRef(0);
1094
+ // 文件序号,保证并发上传时文件名唯一
1095
+ var seqRef = useRef(0);
1096
+ // 当前批次的文件选择序号,用于按选择顺序展示上传结果
1097
+ var batchSeqRef = useRef(0);
1098
+ // 当前批次的上传结果,按序号存储,最后统一排序合并
1099
+ var batchResultsRef = useRef(new Map());
1052
1100
  var _useState = useState(false),
1053
1101
  _useState2 = _slicedToArray(_useState, 2),
1054
1102
  uploading = _useState2[0],
@@ -1063,48 +1111,80 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1063
1111
  useEffect(function () {
1064
1112
  valueRef.current = value;
1065
1113
  }, [value]);
1114
+ var genFileName = function genFileName() {
1115
+ seqRef.current += 1;
1116
+ return "".concat(uniqueKey, "_").concat(seqRef.current, "_").concat(new Date().getTime(), ".jpg");
1117
+ };
1118
+ // 获取当前批次的文件选择序号;没有正在上传的文件时视为新一批,重置批次状态
1119
+ var acquireBatchSeq = function acquireBatchSeq() {
1120
+ if (pendingCountRef.current === 0) {
1121
+ batchSeqRef.current = 0;
1122
+ batchResultsRef.current.clear();
1123
+ }
1124
+ return batchSeqRef.current++;
1125
+ };
1066
1126
  var asyncUpload = /*#__PURE__*/function () {
1067
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
1068
- var _valueRef$current;
1069
- var formData, fileName, _yield$request, success, data;
1127
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, batchSeq) {
1128
+ var formData, fileName, _yield$request, success, data, sorted;
1070
1129
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1071
1130
  while (1) switch (_context.prev = _context.next) {
1072
1131
  case 0:
1132
+ pendingCountRef.current += 1;
1133
+ uploadingCountRef.current += 1;
1073
1134
  setUploading(true);
1074
1135
  formData = new FormData();
1075
1136
  formData.append('file', file);
1076
- fileName = "".concat(uniqueKey, "_").concat(((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.length) + 1, "_").concat(new Date().getTime(), ".jpg");
1137
+ fileName = genFileName();
1077
1138
  formData.append('fileName', fileName);
1078
- _context.prev = 5;
1079
- _context.next = 8;
1139
+ _context.prev = 7;
1140
+ _context.next = 10;
1080
1141
  return request(actionUrl, {
1081
1142
  method: 'post',
1082
1143
  body: formData
1083
1144
  });
1084
- case 8:
1145
+ case 10:
1085
1146
  _yield$request = _context.sent;
1086
1147
  success = _yield$request.success;
1087
1148
  data = _yield$request.data;
1088
1149
  if (success) {
1089
- handleChange([].concat(_toConsumableArray(valueRef.current), [data]));
1150
+ if (valueRef.current.length + batchResultsRef.current.size < maxCount) {
1151
+ // 先暂存到当前批次,等本批次全部完成后再按选择顺序合并
1152
+ batchResultsRef.current.set(batchSeq, data);
1153
+ }
1090
1154
  }
1091
- _context.next = 17;
1155
+ _context.next = 19;
1092
1156
  break;
1093
- case 14:
1094
- _context.prev = 14;
1095
- _context.t0 = _context["catch"](5);
1157
+ case 16:
1158
+ _context.prev = 16;
1159
+ _context.t0 = _context["catch"](7);
1096
1160
  message.error('图片上传失败');
1097
- case 17:
1098
- _context.prev = 17;
1099
- setUploading(false);
1100
- return _context.finish(17);
1101
- case 20:
1161
+ case 19:
1162
+ _context.prev = 19;
1163
+ pendingCountRef.current = Math.max(0, pendingCountRef.current - 1);
1164
+ uploadingCountRef.current = Math.max(0, uploadingCountRef.current - 1);
1165
+ // 本批次全部上传完成,按选择序号排序后一次性合并到 value
1166
+ if (pendingCountRef.current === 0 && batchResultsRef.current.size > 0) {
1167
+ sorted = _toConsumableArray(batchResultsRef.current.entries()).sort(function (a, b) {
1168
+ return a[0] - b[0];
1169
+ }).map(function (_ref3) {
1170
+ var _ref4 = _slicedToArray(_ref3, 2),
1171
+ v = _ref4[1];
1172
+ return v;
1173
+ });
1174
+ handleChange([].concat(_toConsumableArray(valueRef.current), _toConsumableArray(sorted)));
1175
+ batchResultsRef.current.clear();
1176
+ }
1177
+ if (uploadingCountRef.current === 0) {
1178
+ setUploading(false);
1179
+ }
1180
+ return _context.finish(19);
1181
+ case 25:
1102
1182
  case "end":
1103
1183
  return _context.stop();
1104
1184
  }
1105
- }, _callee, null, [[5, 14, 17, 20]]);
1185
+ }, _callee, null, [[7, 16, 19, 25]]);
1106
1186
  }));
1107
- return function asyncUpload(_x) {
1187
+ return function asyncUpload(_x, _x2) {
1108
1188
  return _ref2.apply(this, arguments);
1109
1189
  };
1110
1190
  }();
@@ -1120,24 +1200,24 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1120
1200
  return;
1121
1201
  }
1122
1202
  reader.onload = /*#__PURE__*/function () {
1123
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
1124
- var _e$target, _valueRef$current2;
1203
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
1204
+ var _e$target;
1125
1205
  var result, fileName, file;
1126
1206
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1127
1207
  while (1) switch (_context2.prev = _context2.next) {
1128
1208
  case 0:
1129
1209
  result = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
1130
- fileName = "".concat(uniqueKey, "_").concat(((_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.length) + 1, "_").concat(new Date().getTime(), ".jpg");
1210
+ fileName = genFileName();
1131
1211
  file = dataURLtoFile(result, fileName);
1132
- asyncUpload(file);
1212
+ asyncUpload(file, acquireBatchSeq());
1133
1213
  case 4:
1134
1214
  case "end":
1135
1215
  return _context2.stop();
1136
1216
  }
1137
1217
  }, _callee2);
1138
1218
  }));
1139
- return function (_x2) {
1140
- return _ref3.apply(this, arguments);
1219
+ return function (_x3) {
1220
+ return _ref5.apply(this, arguments);
1141
1221
  };
1142
1222
  }();
1143
1223
  reader.readAsDataURL(blob);
@@ -1171,7 +1251,8 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1171
1251
  // 手动上传模式, 一直返回false
1172
1252
  var beforeUpload = function beforeUpload(file) {
1173
1253
  var size = file.size / 1024 / 1024 < maxSize;
1174
- if (value.length > maxCount) {
1254
+ // 并发上传时用「已上传 + 待上传」一起判断,避免一次选多张时超出 maxCount
1255
+ if (valueRef.current.length + pendingCountRef.current >= maxCount) {
1175
1256
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u5F20\u56FE\u7247\uFF01"));
1176
1257
  return Upload.LIST_IGNORE;
1177
1258
  }
@@ -1179,7 +1260,7 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1179
1260
  message.error("\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
1180
1261
  return Upload.LIST_IGNORE;
1181
1262
  }
1182
- asyncUpload(file);
1263
+ asyncUpload(file, acquireBatchSeq());
1183
1264
  return Upload.LIST_IGNORE;
1184
1265
  };
1185
1266
  var handleDelete = function handleDelete(key) {
@@ -1276,6 +1357,7 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref, ref) {
1276
1357
  name: "file",
1277
1358
  listType: "picture-card",
1278
1359
  maxCount: maxCount,
1360
+ multiple: true,
1279
1361
  className: styles$1.upload,
1280
1362
  beforeUpload: beforeUpload
1281
1363
  }, resetProps), value.length >= maxCount ? null : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
@@ -1319,6 +1401,16 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1319
1401
  resetProps = _objectWithoutProperties(_ref, _excluded$7);
1320
1402
  var inputRef = useRef(null);
1321
1403
  var valueRef = useRef(value);
1404
+ // 并发上传时用于正确控制 loading 状态(多个文件同时上传)
1405
+ var uploadingCountRef = useRef(0);
1406
+ // 已选中待上传的文件数,用于数量预占,避免并发上传超过 maxCount
1407
+ var pendingCountRef = useRef(0);
1408
+ // 文件序号,保证并发上传时文件名唯一
1409
+ var seqRef = useRef(0);
1410
+ // 当前批次的文件选择序号,用于按选择顺序展示上传结果
1411
+ var batchSeqRef = useRef(0);
1412
+ // 当前批次的上传结果,按序号存储,最后统一排序合并
1413
+ var batchResultsRef = useRef(new Map());
1322
1414
  var _useState = useState(false),
1323
1415
  _useState2 = _slicedToArray(_useState, 2),
1324
1416
  uploading = _useState2[0],
@@ -1333,61 +1425,84 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1333
1425
  useEffect(function () {
1334
1426
  valueRef.current = value;
1335
1427
  }, [value]);
1428
+ var genFileName = function genFileName() {
1429
+ seqRef.current += 1;
1430
+ return "".concat(uniqueKey, "_").concat(seqRef.current, "_").concat(new Date().getTime(), ".jpg");
1431
+ };
1432
+ // 获取当前批次的文件选择序号;没有正在上传的文件时视为新一批,重置批次状态
1433
+ var acquireBatchSeq = function acquireBatchSeq() {
1434
+ if (pendingCountRef.current === 0) {
1435
+ batchSeqRef.current = 0;
1436
+ batchResultsRef.current.clear();
1437
+ }
1438
+ return batchSeqRef.current++;
1439
+ };
1336
1440
  var asyncUpload = /*#__PURE__*/function () {
1337
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
1338
- var _valueRef$current;
1339
- var formData, fileName, showName, _yield$request, success, data;
1441
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, batchSeq) {
1442
+ var formData, fileName, showName, _yield$request, success, data, sorted;
1340
1443
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1341
1444
  while (1) switch (_context.prev = _context.next) {
1342
1445
  case 0:
1446
+ pendingCountRef.current += 1;
1447
+ uploadingCountRef.current += 1;
1343
1448
  setUploading(true);
1344
1449
  formData = new FormData();
1345
1450
  formData.append('file', file);
1346
- fileName = "".concat(uniqueKey, "_").concat(((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.length) + 1, "_").concat(new Date().getTime(), ".jpg");
1451
+ fileName = genFileName();
1347
1452
  formData.append('fileName', fileName);
1348
1453
  showName = file.name.substring(0, file.name.lastIndexOf('.'));
1349
- _context.prev = 6;
1350
- _context.next = 9;
1454
+ _context.prev = 8;
1455
+ _context.next = 11;
1351
1456
  return request(actionUrl, {
1352
1457
  method: 'post',
1353
1458
  body: formData
1354
1459
  });
1355
- case 9:
1460
+ case 11:
1356
1461
  _yield$request = _context.sent;
1357
1462
  success = _yield$request.success;
1358
1463
  data = _yield$request.data;
1359
- if (!success) {
1360
- _context.next = 16;
1361
- break;
1362
- }
1363
- if (!(valueRef.current.length >= maxCount)) {
1364
- _context.next = 15;
1365
- break;
1464
+ if (success) {
1465
+ if (valueRef.current.length + batchResultsRef.current.size < maxCount) {
1466
+ // 先暂存到当前批次,等本批次全部完成后再按选择顺序合并
1467
+ batchResultsRef.current.set(batchSeq, {
1468
+ url: data,
1469
+ name: showName
1470
+ });
1471
+ }
1366
1472
  }
1367
- return _context.abrupt("return");
1368
- case 15:
1369
- handleChange([].concat(_toConsumableArray(valueRef.current), [{
1370
- url: data,
1371
- name: showName
1372
- }]));
1373
- case 16:
1374
- _context.next = 21;
1473
+ _context.next = 20;
1375
1474
  break;
1376
- case 18:
1377
- _context.prev = 18;
1378
- _context.t0 = _context["catch"](6);
1475
+ case 17:
1476
+ _context.prev = 17;
1477
+ _context.t0 = _context["catch"](8);
1379
1478
  message.error('图片上传失败');
1380
- case 21:
1381
- _context.prev = 21;
1382
- setUploading(false);
1383
- return _context.finish(21);
1384
- case 24:
1479
+ case 20:
1480
+ _context.prev = 20;
1481
+ pendingCountRef.current = Math.max(0, pendingCountRef.current - 1);
1482
+ uploadingCountRef.current = Math.max(0, uploadingCountRef.current - 1);
1483
+ // 本批次全部上传完成,按选择序号排序后一次性合并到 value
1484
+ if (pendingCountRef.current === 0 && batchResultsRef.current.size > 0) {
1485
+ sorted = _toConsumableArray(batchResultsRef.current.entries()).sort(function (a, b) {
1486
+ return a[0] - b[0];
1487
+ }).map(function (_ref3) {
1488
+ var _ref4 = _slicedToArray(_ref3, 2),
1489
+ v = _ref4[1];
1490
+ return v;
1491
+ });
1492
+ handleChange([].concat(_toConsumableArray(valueRef.current), _toConsumableArray(sorted)));
1493
+ batchResultsRef.current.clear();
1494
+ }
1495
+ if (uploadingCountRef.current === 0) {
1496
+ setUploading(false);
1497
+ }
1498
+ return _context.finish(20);
1499
+ case 26:
1385
1500
  case "end":
1386
1501
  return _context.stop();
1387
1502
  }
1388
- }, _callee, null, [[6, 18, 21, 24]]);
1503
+ }, _callee, null, [[8, 17, 20, 26]]);
1389
1504
  }));
1390
- return function asyncUpload(_x) {
1505
+ return function asyncUpload(_x, _x2) {
1391
1506
  return _ref2.apply(this, arguments);
1392
1507
  };
1393
1508
  }();
@@ -1403,24 +1518,24 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1403
1518
  return;
1404
1519
  }
1405
1520
  reader.onload = /*#__PURE__*/function () {
1406
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
1407
- var _e$target, _valueRef$current2;
1521
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
1522
+ var _e$target;
1408
1523
  var result, fileName, file;
1409
1524
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1410
1525
  while (1) switch (_context2.prev = _context2.next) {
1411
1526
  case 0:
1412
1527
  result = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
1413
- fileName = "".concat(uniqueKey, "_").concat(((_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.length) + 1, "_").concat(new Date().getTime(), ".jpg");
1528
+ fileName = genFileName();
1414
1529
  file = dataURLtoFile(result, fileName);
1415
- asyncUpload(file);
1530
+ asyncUpload(file, acquireBatchSeq());
1416
1531
  case 4:
1417
1532
  case "end":
1418
1533
  return _context2.stop();
1419
1534
  }
1420
1535
  }, _callee2);
1421
1536
  }));
1422
- return function (_x2) {
1423
- return _ref3.apply(this, arguments);
1537
+ return function (_x3) {
1538
+ return _ref5.apply(this, arguments);
1424
1539
  };
1425
1540
  }();
1426
1541
  reader.readAsDataURL(blob);
@@ -1454,7 +1569,8 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1454
1569
  // 手动上传模式, 一直返回false
1455
1570
  var beforeUpload = function beforeUpload(file) {
1456
1571
  var size = file.size / 1024 / 1024 < maxSize;
1457
- if (value.length > maxCount) {
1572
+ // 并发上传时用「已上传 + 待上传」一起判断,避免一次选多张时超出 maxCount
1573
+ if (valueRef.current.length + pendingCountRef.current >= maxCount) {
1458
1574
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u5F20\u56FE\u7247\uFF01"));
1459
1575
  return Upload.LIST_IGNORE;
1460
1576
  }
@@ -1462,7 +1578,7 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1462
1578
  message.error("\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
1463
1579
  return Upload.LIST_IGNORE;
1464
1580
  }
1465
- asyncUpload(file);
1581
+ asyncUpload(file, acquireBatchSeq());
1466
1582
  return Upload.LIST_IGNORE;
1467
1583
  };
1468
1584
  var handleDelete = function handleDelete(key) {
@@ -1596,6 +1712,7 @@ var ApaasUploadProAsync = function ApaasUploadProAsync(_ref, ref) {
1596
1712
  name: "file",
1597
1713
  listType: "picture-card",
1598
1714
  maxCount: maxCount,
1715
+ multiple: true,
1599
1716
  className: styles$2.uploadPro,
1600
1717
  beforeUpload: beforeUpload
1601
1718
  }, resetProps), value.length >= maxCount ? null : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
@@ -8515,7 +8632,7 @@ var processLogisticsInterception = function processLogisticsInterception(getValu
8515
8632
  address = every(address, function (item) {
8516
8633
  return !item;
8517
8634
  }) ? [] : address;
8518
- var subFields = ['interceptCompany', 'interceptCode', 'interceptType', 'interceptSenderMobile', 'interceptDetail', 'interceptReceiverName', 'interceptReceiverMobile', 'interceptLogisticsStatus', 'interceptLogisticsStatusOther', 'interceptLogisticsSnapshot', 'qySelfInterceptLogisticsStatus', 'interceptLogisticsUserKCode', 'interceptLogisticsUserSecretKey'];
8635
+ var subFields = ['interceptCompany', 'interceptCode', 'interceptType', 'interceptSenderMobile', 'interceptDetail', 'interceptReceiverName', 'interceptReceiverMobile', 'interceptLogisticsStatus', 'interceptLogisticsStatusOther', 'interceptLogisticsSnapshot', 'qySelfInterceptLogisticsStatus', 'interceptLogisticsUserKCode', 'interceptLogisticsUserSecretKey', 'interceptLogisticsCustomerCode'];
8519
8636
  var map = subFields.reduce(function (cur, nxt) {
8520
8637
  return _objectSpread2(_objectSpread2({}, cur), {}, _defineProperty({}, nxt, getValue("".concat(nex.uniqueKey, "_").concat(nxt))));
8521
8638
  }, {});
@@ -13354,6 +13471,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
13354
13471
  setStatusOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.logisticsStatusList) || []);
13355
13472
  setIsInterface(interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.isInterface);
13356
13473
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
13474
+ useEffect(function () {
13475
+ if (!isJdLogisticsCompany(value === null || value === void 0 ? void 0 : value.interceptCompany) && (value === null || value === void 0 ? void 0 : value.interceptLogisticsCustomerCode) !== undefined) {
13476
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13477
+ interceptLogisticsCustomerCode: undefined
13478
+ }));
13479
+ }
13480
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, value === null || value === void 0 ? void 0 : value.interceptLogisticsCustomerCode]);
13357
13481
  //拦截类型切换 需要清空派送地址
13358
13482
  useEffect(function () {
13359
13483
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) return;
@@ -13416,6 +13540,9 @@ var LogisticsInterception = function LogisticsInterception(props) {
13416
13540
  }
13417
13541
  return isShow;
13418
13542
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
13543
+ var showCustomerCode = useMemo(function () {
13544
+ return isJdLogisticsCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
13545
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
13419
13546
  //判断是否能修改物流信息
13420
13547
  var isEdit = useMemo(function () {
13421
13548
  var company = expressInterceptData.find(function (item) {
@@ -13442,6 +13569,9 @@ var LogisticsInterception = function LogisticsInterception(props) {
13442
13569
  });
13443
13570
  });
13444
13571
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
13572
+ var customerCodeOptions = useMemo(function () {
13573
+ return getJdCustomerCodeOptions(LogisticsAddressOptions, value === null || value === void 0 ? void 0 : value.interceptCompany);
13574
+ }, [LogisticsAddressOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
13445
13575
  var returnValue = useMemo(function () {
13446
13576
  var _value$interceptAddre, _value$interceptAddre2, _value$interceptAddre3;
13447
13577
  var uk = LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getUkByInfo({
@@ -13497,9 +13627,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
13497
13627
  // userSecretKey: '12345678',
13498
13628
  // },
13499
13629
  // ];
13500
- var matchKCodeList = LogisticsAddressOptions === null || LogisticsAddressOptions === void 0 ? void 0 : LogisticsAddressOptions.filter(function (item) {
13501
- return item.cpCode === val && item.userKCode;
13502
- });
13503
13630
  newValue = _objectSpread2(_objectSpread2({}, newValue), {}, {
13504
13631
  interceptCompany: val,
13505
13632
  interceptType: (_defaultInterceptType = defaultInterceptType) === null || _defaultInterceptType === void 0 ? void 0 : _defaultInterceptType.value,
@@ -13518,7 +13645,8 @@ var LogisticsInterception = function LogisticsInterception(props) {
13518
13645
  },
13519
13646
  interceptLogisticsApiStatusReason: undefined,
13520
13647
  interceptLogisticsUserKCode: undefined,
13521
- interceptLogisticsUserSecretKey: undefined
13648
+ interceptLogisticsUserSecretKey: undefined,
13649
+ interceptLogisticsCustomerCode: undefined
13522
13650
  });
13523
13651
  }
13524
13652
  if (type === 'interceptLogisticsApiStatus') {
@@ -13599,7 +13727,37 @@ var LogisticsInterception = function LogisticsInterception(props) {
13599
13727
  return _onBlur === null || _onBlur === void 0 ? void 0 : _onBlur((_e$target$value2 = e.target.value) === null || _e$target$value2 === void 0 ? void 0 : _e$target$value2.trim(), 'interceptCode');
13600
13728
  },
13601
13729
  value: value === null || value === void 0 ? void 0 : value.interceptCode
13602
- }))), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Item, {
13730
+ }))), /*#__PURE__*/React.createElement(Item, {
13731
+ label: /*#__PURE__*/React.createElement("span", null, "\u5BA2\u6237\u7F16\u7801", platform === 'pc' ? /*#__PURE__*/React.createElement(React.Fragment, null, "\uFF1A", /*#__PURE__*/React.createElement(Typography.Link, {
13732
+ style: {
13733
+ cursor: 'pointer'
13734
+ },
13735
+ onClick: function onClick() {
13736
+ return onJumpPage && (onJumpPage === null || onJumpPage === void 0 ? void 0 : onJumpPage({
13737
+ type: 'interceptConfig'
13738
+ }));
13739
+ }
13740
+ }, 'K码/EBU码配置>>')) : null),
13741
+ required: showCustomerCode,
13742
+ key: 'interceptLogisticsCustomerCode',
13743
+ hidden: !showCustomerCode
13744
+ }, /*#__PURE__*/React.createElement(Select, {
13745
+ disabled: disabled,
13746
+ placeholder: "\u9009\u62E9\u5BA2\u6237\u7F16\u7801",
13747
+ notFoundContent: "\u6682\u65E0\u5BA2\u6237\u7F16\u7801\u914D\u7F6E\uFF0C\u8BF7\u5148\u524D\u5F80K\u7801/EBU\u7801\u914D\u7F6E>>",
13748
+ showSearch: true,
13749
+ style: {
13750
+ width: '200px'
13751
+ },
13752
+ onChange: function onChange(val) {
13753
+ return changeHandle(val, 'interceptLogisticsCustomerCode');
13754
+ },
13755
+ options: customerCodeOptions,
13756
+ value: value === null || value === void 0 ? void 0 : value.interceptLogisticsCustomerCode,
13757
+ filterOption: function filterOption(input, option) {
13758
+ return option.label.includes(input);
13759
+ }
13760
+ })), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Item, {
13603
13761
  label: /*#__PURE__*/React.createElement("span", null, "\u5BA2\u6237\u7F16\u7801\uFF08K\u7801\uFF09\uFF1A", platform === 'pc' ? /*#__PURE__*/React.createElement(Typography.Link, {
13604
13762
  style: {
13605
13763
  cursor: 'pointer'
@@ -13644,7 +13802,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
13644
13802
  value: value === null || value === void 0 ? void 0 : value.interceptLogisticsUserSecretKey
13645
13803
  }))), /*#__PURE__*/React.createElement(Item, {
13646
13804
  label: '拦截类型',
13647
- required: required,
13805
+ required: required && !showCustomerCode,
13648
13806
  key: 'interceptType'
13649
13807
  }, /*#__PURE__*/React.createElement(Select, {
13650
13808
  disabled: baseFieldDisabled,
@@ -21136,17 +21294,18 @@ var getColumns$2 = function getColumns(_ref) {
21136
21294
  };
21137
21295
 
21138
21296
  var getYesOrNo$4 = function getYesOrNo(val) {
21297
+ var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['是', '否'];
21139
21298
  switch (val) {
21140
21299
  case true:
21141
21300
  case '1':
21142
21301
  case 1:
21143
- return '是';
21302
+ return content[0];
21144
21303
  case false:
21145
21304
  case '0':
21146
21305
  case 0:
21147
21306
  return '否';
21148
21307
  default:
21149
- return null;
21308
+ return content[1];
21150
21309
  }
21151
21310
  };
21152
21311
 
@@ -21345,7 +21504,7 @@ var getColumns$3 = function getColumns(_ref) {
21345
21504
  label: '非赠品',
21346
21505
  value: 0
21347
21506
  }]
21348
- }) : /*#__PURE__*/React.createElement("span", null, isNull(val) ? null : val ? '赠品' : '非赠品');
21507
+ }) : /*#__PURE__*/React.createElement("span", null, getYesOrNo$4(val, ['赠品', '非赠品']));
21349
21508
  }
21350
21509
  }, {
21351
21510
  dataIndex: 'isPackage',
@@ -21577,7 +21736,7 @@ var getColumns$3 = function getColumns(_ref) {
21577
21736
  label: '非赠品',
21578
21737
  value: 0
21579
21738
  }]
21580
- }) : /*#__PURE__*/React.createElement("span", null, isNull(val) ? null : val ? '赠品' : '非赠品');
21739
+ }) : /*#__PURE__*/React.createElement("span", null, getYesOrNo$4(val, ['赠品', '非赠品']));
21581
21740
  }
21582
21741
  }, {
21583
21742
  dataIndex: 'isPackage',
@@ -19,6 +19,7 @@ interface LogisticsInterceptionValueType {
19
19
  interceptLogisticsApiStatusReason: string;
20
20
  interceptLogisticsUserKCode: string;
21
21
  interceptLogisticsUserSecretKey: string;
22
+ interceptLogisticsCustomerCode: string;
22
23
  }
23
24
  interface LogisticsInterceptionProps {
24
25
  value: Partial<LogisticsInterceptionValueType>;
@@ -1 +1 @@
1
- export declare const getYesOrNo: (val: boolean | string | number) => "是" | "否" | null;
1
+ export declare const getYesOrNo: (val: boolean | string | number, content?: string[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.10.9-beta.12",
3
+ "version": "2.10.9-beta.14",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "2.10.9-beta.12",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.10.9-beta.14",
24
24
  "ahooks": "^3.7.4",
25
25
  "ali-react-table": "2.6.1",
26
26
  "bignumber.js": "^9.1.2",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "5a0d12c8caf0912d82e12ed94e64afd3ff746c65"
69
+ "gitHead": "5d3cdbfbc69828ca860a175154f18f17c1165cf1"
70
70
  }