@kmkf-fe-packages/basic-components 2.2.39-beta.35 → 2.2.39-beta.37

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
@@ -23554,19 +23554,24 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
23554
23554
  setTradeGoodsVisible = _useState4[1];
23555
23555
  var getKmSupplier = /*#__PURE__*/function () {
23556
23556
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dataSource) {
23557
+ var _dataSource$filter;
23557
23558
  var systemItemIds, supplierMap;
23558
23559
  return _regeneratorRuntime().wrap(function _callee$(_context) {
23559
23560
  while (1) switch (_context.prev = _context.next) {
23560
23561
  case 0:
23561
- systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
23562
- return item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
23562
+ systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.filter(function (item) {
23563
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
23564
+ }).map(function (item) {
23565
+ return (item === null || item === void 0 ? void 0 : item.sysSkuId) == '-1' ? item === null || item === void 0 ? void 0 : item.sysItemId : "".concat(item === null || item === void 0 ? void 0 : item.sysItemId, "-").concat(item === null || item === void 0 ? void 0 : item.sysSkuId);
23563
23566
  });
23564
23567
  _context.next = 3;
23565
23568
  return servers.KM.getSupplierSingleton(systemItemIds);
23566
23569
  case 3:
23567
23570
  supplierMap = _context.sent;
23568
- dataSource === null || dataSource === void 0 ? void 0 : dataSource.forEach(function (item) {
23569
- var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
23571
+ dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$filter = dataSource.filter(function (item) {
23572
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
23573
+ })) === null || _dataSource$filter === void 0 ? void 0 : _dataSource$filter.forEach(function (item) {
23574
+ var key = (item === null || item === void 0 ? void 0 : item.sysSkuId) == '-1' ? item === null || item === void 0 ? void 0 : item.sysItemId : "".concat(item === null || item === void 0 ? void 0 : item.sysItemId, "-").concat(item === null || item === void 0 ? void 0 : item.sysSkuId);
23570
23575
  var supplierInfo = supplierMap.get(key);
23571
23576
  item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
23572
23577
  item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
@@ -26824,8 +26829,10 @@ var CommonGoods = function CommonGoods(props) {
26824
26829
  var sysItemIdMap = useMemo(function () {
26825
26830
  var map = {};
26826
26831
  if (compType.indexOf('KM') > -1) {
26827
- var _value$kmGoods;
26828
- value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : _value$kmGoods.forEach(function (item) {
26832
+ var _value$kmGoods, _value$kmGoods$filter;
26833
+ value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : (_value$kmGoods$filter = _value$kmGoods.filter(function (item) {
26834
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
26835
+ })) === null || _value$kmGoods$filter === void 0 ? void 0 : _value$kmGoods$filter.forEach(function (item) {
26829
26836
  var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
26830
26837
  map[key] = item;
26831
26838
  });
@@ -27091,9 +27098,8 @@ var CommonGoods = function CommonGoods(props) {
27091
27098
  });
27092
27099
  case 2:
27093
27100
  data = _context4.sent;
27094
- console.log('fetchOriginDataSource', data);
27095
27101
  setOriginDataSource(Array.isArray(data) ? data : []);
27096
- case 5:
27102
+ case 4:
27097
27103
  case "end":
27098
27104
  return _context4.stop();
27099
27105
  }
@@ -27958,12 +27964,95 @@ var PublicReissue = function PublicReissue(props) {
27958
27964
  mode: mode
27959
27965
  }))));
27960
27966
  };
27961
- var getGoodDetails = function getGoodDetails(_ref4) {
27967
+ var sysItemIdMap = useMemo(function () {
27968
+ var map = {};
27969
+ if (type === 'KM_REISSUE_GOODS') {
27970
+ var _value$kmReissueGoods, _value$kmReissueGoods2;
27971
+ value === null || value === void 0 ? void 0 : (_value$kmReissueGoods = value.kmReissueGoods) === null || _value$kmReissueGoods === void 0 ? void 0 : (_value$kmReissueGoods2 = _value$kmReissueGoods.filter(function (item) {
27972
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
27973
+ })) === null || _value$kmReissueGoods2 === void 0 ? void 0 : _value$kmReissueGoods2.forEach(function (item) {
27974
+ var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
27975
+ map[key] = item;
27976
+ });
27977
+ }
27978
+ return map;
27979
+ }, [value === null || value === void 0 ? void 0 : value.kmReissueGoods]);
27980
+ // 用于跟踪已经处理过的 sysItemId,避免重复处理
27981
+ var processedSysItemIdsRef = useRef(new Set());
27982
+ useEffect(function () {
27983
+ var fetchSupplier = /*#__PURE__*/function () {
27984
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sysItemIds) {
27985
+ var _currentValue$kmReiss;
27986
+ var needFetchIds, supplierMap, hasChange, currentValue, kmReissueGoods;
27987
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
27988
+ while (1) switch (_context2.prev = _context2.next) {
27989
+ case 0:
27990
+ if (sysItemIds.length) {
27991
+ _context2.next = 2;
27992
+ break;
27993
+ }
27994
+ return _context2.abrupt("return");
27995
+ case 2:
27996
+ // 过滤出还没有供应商信息的 sysItemId
27997
+ needFetchIds = sysItemIds.filter(function (id) {
27998
+ var item = sysItemIdMap[id];
27999
+ return item && (!item.supplierCode || !item.supplierName);
28000
+ });
28001
+ if (needFetchIds.length) {
28002
+ _context2.next = 5;
28003
+ break;
28004
+ }
28005
+ return _context2.abrupt("return");
28006
+ case 5:
28007
+ _context2.next = 7;
28008
+ return servers.KM.getSupplierSingleton(needFetchIds);
28009
+ case 7:
28010
+ supplierMap = _context2.sent;
28011
+ // 检查是否有实际变化,避免不必要的更新
28012
+ hasChange = false;
28013
+ currentValue = valueRef.current;
28014
+ kmReissueGoods = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$kmReiss = currentValue.kmReissueGoods) === null || _currentValue$kmReiss === void 0 ? void 0 : _currentValue$kmReiss.map(function (item) {
28015
+ var supplierInfo = supplierMap.get(item.sysItemId);
28016
+ var newSupplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
28017
+ var newSupplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
28018
+ // 如果供应商信息有变化,标记需要更新
28019
+ if (newSupplierCode && item.supplierCode !== newSupplierCode || newSupplierName && item.supplierName !== newSupplierName) {
28020
+ hasChange = true;
28021
+ // 标记已处理
28022
+ processedSysItemIdsRef.current.add(item.sysItemId);
28023
+ return _objectSpread2(_objectSpread2({}, item), {}, {
28024
+ supplierCode: newSupplierCode || item.supplierCode,
28025
+ supplierName: newSupplierName || item.supplierName
28026
+ });
28027
+ }
28028
+ return item;
28029
+ }); // 只在有实际变化时才更新
28030
+ if (hasChange && kmReissueGoods) {
28031
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, currentValue), {}, {
28032
+ kmReissueGoods: kmReissueGoods
28033
+ }));
28034
+ }
28035
+ case 12:
28036
+ case "end":
28037
+ return _context2.stop();
28038
+ }
28039
+ }, _callee2);
28040
+ }));
28041
+ return function fetchSupplier(_x2) {
28042
+ return _ref4.apply(this, arguments);
28043
+ };
28044
+ }();
28045
+ var sysItemIds = Object.keys(sysItemIdMap);
28046
+ if (sysItemIds === null || sysItemIds === void 0 ? void 0 : sysItemIds.length) {
28047
+ fetchSupplier(sysItemIds);
28048
+ }
28049
+ }, [sysItemIdMap]);
28050
+ var getGoodDetails = function getGoodDetails(_ref5) {
27962
28051
  var _typeMap$type18, _typeMap$type19, _value$typeMap$type$s6, _typeMap$type20, _typeMap$type21, _typeMap$type22, _typeMap$type23, _typeMap$type24;
27963
- var mode = _ref4.mode,
27964
- sysOrderNo = _ref4.sysOrderNo,
27965
- _ref4$isAllOrders = _ref4.isAllOrders,
27966
- isAllOrders = _ref4$isAllOrders === void 0 ? false : _ref4$isAllOrders;
28052
+ var mode = _ref5.mode,
28053
+ sysOrderNo = _ref5.sysOrderNo,
28054
+ _ref5$isAllOrders = _ref5.isAllOrders,
28055
+ isAllOrders = _ref5$isAllOrders === void 0 ? false : _ref5$isAllOrders;
27967
28056
  var systemOrder = value === null || value === void 0 ? void 0 : value[(_typeMap$type18 = typeMap$2[type]) === null || _typeMap$type18 === void 0 ? void 0 : _typeMap$type18.systemOrder];
27968
28057
  var systemOrderNo = sysOrderNo !== null && sysOrderNo !== void 0 ? sysOrderNo : value === null || value === void 0 ? void 0 : value[(_typeMap$type19 = typeMap$2[type]) === null || _typeMap$type19 === void 0 ? void 0 : _typeMap$type19.systemOrderNo];
27969
28058
  var order = systemOrderNo && ((systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orders) || []).find(function (order) {
package/dist/index.js CHANGED
@@ -23569,19 +23569,24 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
23569
23569
  setTradeGoodsVisible = _useState4[1];
23570
23570
  var getKmSupplier = /*#__PURE__*/function () {
23571
23571
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dataSource) {
23572
+ var _dataSource$filter;
23572
23573
  var systemItemIds, supplierMap;
23573
23574
  return _regeneratorRuntime().wrap(function _callee$(_context) {
23574
23575
  while (1) switch (_context.prev = _context.next) {
23575
23576
  case 0:
23576
- systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
23577
- return item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
23577
+ systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.filter(function (item) {
23578
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
23579
+ }).map(function (item) {
23580
+ return (item === null || item === void 0 ? void 0 : item.sysSkuId) == '-1' ? item === null || item === void 0 ? void 0 : item.sysItemId : "".concat(item === null || item === void 0 ? void 0 : item.sysItemId, "-").concat(item === null || item === void 0 ? void 0 : item.sysSkuId);
23578
23581
  });
23579
23582
  _context.next = 3;
23580
23583
  return kmkfUtils.servers.KM.getSupplierSingleton(systemItemIds);
23581
23584
  case 3:
23582
23585
  supplierMap = _context.sent;
23583
- dataSource === null || dataSource === void 0 ? void 0 : dataSource.forEach(function (item) {
23584
- var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
23586
+ dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$filter = dataSource.filter(function (item) {
23587
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
23588
+ })) === null || _dataSource$filter === void 0 ? void 0 : _dataSource$filter.forEach(function (item) {
23589
+ var key = (item === null || item === void 0 ? void 0 : item.sysSkuId) == '-1' ? item === null || item === void 0 ? void 0 : item.sysItemId : "".concat(item === null || item === void 0 ? void 0 : item.sysItemId, "-").concat(item === null || item === void 0 ? void 0 : item.sysSkuId);
23585
23590
  var supplierInfo = supplierMap.get(key);
23586
23591
  item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
23587
23592
  item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
@@ -26839,8 +26844,10 @@ var CommonGoods = function CommonGoods(props) {
26839
26844
  var sysItemIdMap = React.useMemo(function () {
26840
26845
  var map = {};
26841
26846
  if (compType.indexOf('KM') > -1) {
26842
- var _value$kmGoods;
26843
- value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : _value$kmGoods.forEach(function (item) {
26847
+ var _value$kmGoods, _value$kmGoods$filter;
26848
+ value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : (_value$kmGoods$filter = _value$kmGoods.filter(function (item) {
26849
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
26850
+ })) === null || _value$kmGoods$filter === void 0 ? void 0 : _value$kmGoods$filter.forEach(function (item) {
26844
26851
  var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
26845
26852
  map[key] = item;
26846
26853
  });
@@ -27106,9 +27113,8 @@ var CommonGoods = function CommonGoods(props) {
27106
27113
  });
27107
27114
  case 2:
27108
27115
  data = _context4.sent;
27109
- console.log('fetchOriginDataSource', data);
27110
27116
  setOriginDataSource(Array.isArray(data) ? data : []);
27111
- case 5:
27117
+ case 4:
27112
27118
  case "end":
27113
27119
  return _context4.stop();
27114
27120
  }
@@ -27973,12 +27979,95 @@ var PublicReissue = function PublicReissue(props) {
27973
27979
  mode: mode
27974
27980
  }))));
27975
27981
  };
27976
- var getGoodDetails = function getGoodDetails(_ref4) {
27982
+ var sysItemIdMap = React.useMemo(function () {
27983
+ var map = {};
27984
+ if (type === 'KM_REISSUE_GOODS') {
27985
+ var _value$kmReissueGoods, _value$kmReissueGoods2;
27986
+ value === null || value === void 0 ? void 0 : (_value$kmReissueGoods = value.kmReissueGoods) === null || _value$kmReissueGoods === void 0 ? void 0 : (_value$kmReissueGoods2 = _value$kmReissueGoods.filter(function (item) {
27987
+ return item === null || item === void 0 ? void 0 : item.sysItemId;
27988
+ })) === null || _value$kmReissueGoods2 === void 0 ? void 0 : _value$kmReissueGoods2.forEach(function (item) {
27989
+ var key = item.sysSkuId == '-1' ? item.sysItemId : "".concat(item.sysItemId, "-").concat(item.sysSkuId);
27990
+ map[key] = item;
27991
+ });
27992
+ }
27993
+ return map;
27994
+ }, [value === null || value === void 0 ? void 0 : value.kmReissueGoods]);
27995
+ // 用于跟踪已经处理过的 sysItemId,避免重复处理
27996
+ var processedSysItemIdsRef = React.useRef(new Set());
27997
+ React.useEffect(function () {
27998
+ var fetchSupplier = /*#__PURE__*/function () {
27999
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sysItemIds) {
28000
+ var _currentValue$kmReiss;
28001
+ var needFetchIds, supplierMap, hasChange, currentValue, kmReissueGoods;
28002
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
28003
+ while (1) switch (_context2.prev = _context2.next) {
28004
+ case 0:
28005
+ if (sysItemIds.length) {
28006
+ _context2.next = 2;
28007
+ break;
28008
+ }
28009
+ return _context2.abrupt("return");
28010
+ case 2:
28011
+ // 过滤出还没有供应商信息的 sysItemId
28012
+ needFetchIds = sysItemIds.filter(function (id) {
28013
+ var item = sysItemIdMap[id];
28014
+ return item && (!item.supplierCode || !item.supplierName);
28015
+ });
28016
+ if (needFetchIds.length) {
28017
+ _context2.next = 5;
28018
+ break;
28019
+ }
28020
+ return _context2.abrupt("return");
28021
+ case 5:
28022
+ _context2.next = 7;
28023
+ return kmkfUtils.servers.KM.getSupplierSingleton(needFetchIds);
28024
+ case 7:
28025
+ supplierMap = _context2.sent;
28026
+ // 检查是否有实际变化,避免不必要的更新
28027
+ hasChange = false;
28028
+ currentValue = valueRef.current;
28029
+ kmReissueGoods = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$kmReiss = currentValue.kmReissueGoods) === null || _currentValue$kmReiss === void 0 ? void 0 : _currentValue$kmReiss.map(function (item) {
28030
+ var supplierInfo = supplierMap.get(item.sysItemId);
28031
+ var newSupplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
28032
+ var newSupplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
28033
+ // 如果供应商信息有变化,标记需要更新
28034
+ if (newSupplierCode && item.supplierCode !== newSupplierCode || newSupplierName && item.supplierName !== newSupplierName) {
28035
+ hasChange = true;
28036
+ // 标记已处理
28037
+ processedSysItemIdsRef.current.add(item.sysItemId);
28038
+ return _objectSpread2(_objectSpread2({}, item), {}, {
28039
+ supplierCode: newSupplierCode || item.supplierCode,
28040
+ supplierName: newSupplierName || item.supplierName
28041
+ });
28042
+ }
28043
+ return item;
28044
+ }); // 只在有实际变化时才更新
28045
+ if (hasChange && kmReissueGoods) {
28046
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, currentValue), {}, {
28047
+ kmReissueGoods: kmReissueGoods
28048
+ }));
28049
+ }
28050
+ case 12:
28051
+ case "end":
28052
+ return _context2.stop();
28053
+ }
28054
+ }, _callee2);
28055
+ }));
28056
+ return function fetchSupplier(_x2) {
28057
+ return _ref4.apply(this, arguments);
28058
+ };
28059
+ }();
28060
+ var sysItemIds = Object.keys(sysItemIdMap);
28061
+ if (sysItemIds === null || sysItemIds === void 0 ? void 0 : sysItemIds.length) {
28062
+ fetchSupplier(sysItemIds);
28063
+ }
28064
+ }, [sysItemIdMap]);
28065
+ var getGoodDetails = function getGoodDetails(_ref5) {
27977
28066
  var _typeMap$type18, _typeMap$type19, _value$typeMap$type$s6, _typeMap$type20, _typeMap$type21, _typeMap$type22, _typeMap$type23, _typeMap$type24;
27978
- var mode = _ref4.mode,
27979
- sysOrderNo = _ref4.sysOrderNo,
27980
- _ref4$isAllOrders = _ref4.isAllOrders,
27981
- isAllOrders = _ref4$isAllOrders === void 0 ? false : _ref4$isAllOrders;
28067
+ var mode = _ref5.mode,
28068
+ sysOrderNo = _ref5.sysOrderNo,
28069
+ _ref5$isAllOrders = _ref5.isAllOrders,
28070
+ isAllOrders = _ref5$isAllOrders === void 0 ? false : _ref5$isAllOrders;
27982
28071
  var systemOrder = value === null || value === void 0 ? void 0 : value[(_typeMap$type18 = typeMap$2[type]) === null || _typeMap$type18 === void 0 ? void 0 : _typeMap$type18.systemOrder];
27983
28072
  var systemOrderNo = sysOrderNo !== null && sysOrderNo !== void 0 ? sysOrderNo : value === null || value === void 0 ? void 0 : value[(_typeMap$type19 = typeMap$2[type]) === null || _typeMap$type19 === void 0 ? void 0 : _typeMap$type19.systemOrderNo];
27984
28073
  var order = systemOrderNo && ((systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orders) || []).find(function (order) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.2.39-beta.35",
3
+ "version": "2.2.39-beta.37",
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.2.39-beta.35",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.2.39-beta.37",
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": "9ccdcd6e0486d3094fcb0c8d90010f43bd4589bc"
69
+ "gitHead": "99bdce1877cfe945b3380d91db57fdaa4caaa4b3"
70
70
  }