@kmkf-fe-packages/basic-components 2.2.39-beta.21 → 2.2.39-beta.25

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
@@ -21726,6 +21726,16 @@ var getColumns$6 = function getColumns(_ref) {
21726
21726
  title: "\u5546\u54C1\u7C7B\u578B",
21727
21727
  width: 150,
21728
21728
  render: renderTextEllipsis
21729
+ }, {
21730
+ dataIndex: 'supplierName',
21731
+ title: "\u4F9B\u5E94\u5546\u540D\u79F0",
21732
+ width: 150,
21733
+ render: renderTextEllipsis
21734
+ }, {
21735
+ dataIndex: 'supplierCode',
21736
+ title: "\u4F9B\u5E94\u5546\u7F16\u7801",
21737
+ width: 150,
21738
+ render: renderTextEllipsis
21729
21739
  }].map(function (item) {
21730
21740
  return _objectSpread2(_objectSpread2({}, item), {}, {
21731
21741
  align: 'center',
@@ -21853,6 +21863,16 @@ var getColumns$6 = function getColumns(_ref) {
21853
21863
  title: "\u5546\u54C1\u7C7B\u578B",
21854
21864
  width: 150,
21855
21865
  render: renderTextEllipsis
21866
+ }, {
21867
+ dataIndex: 'supplierName',
21868
+ title: "\u4F9B\u5E94\u5546\u540D\u79F0",
21869
+ width: 150,
21870
+ render: renderTextEllipsis
21871
+ }, {
21872
+ dataIndex: 'supplierCode',
21873
+ title: "\u4F9B\u5E94\u5546\u7F16\u7801",
21874
+ width: 150,
21875
+ render: renderTextEllipsis
21856
21876
  }, {
21857
21877
  dataIndex: 'sysPicPath',
21858
21878
  title: "\u5546\u54C1\u56FE\u7247",
@@ -23525,23 +23545,75 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
23525
23545
  _useState4 = _slicedToArray(_useState3, 2),
23526
23546
  tradeGoodsVisible = _useState4[0],
23527
23547
  setTradeGoodsVisible = _useState4[1];
23528
- var openModal = function openModal() {
23529
- if (validSystemOrder) {
23530
- message.warning('请选择补发系统单');
23531
- return;
23532
- }
23533
- if (getDataSourceAsync && !(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length)) {
23534
- getDataSourceAsync().then(function () {
23535
- setTradeGoodsVisible(true);
23536
- });
23537
- } else {
23538
- setTradeGoodsVisible(true);
23539
- }
23540
- // 补发直接传入的是systemNo
23541
- if (isShowSelect && isReissueType) {
23542
- setSelectSystemNo(selectedSystemOrders || []);
23543
- }
23544
- };
23548
+ var getKmSupplier = /*#__PURE__*/function () {
23549
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dataSource) {
23550
+ var systemItemIds, supplierMap;
23551
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
23552
+ while (1) switch (_context.prev = _context.next) {
23553
+ case 0:
23554
+ systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
23555
+ return item.sysItemId;
23556
+ });
23557
+ _context.next = 3;
23558
+ return servers.KM.getSupplierSingleton(systemItemIds);
23559
+ case 3:
23560
+ supplierMap = _context.sent;
23561
+ dataSource === null || dataSource === void 0 ? void 0 : dataSource.forEach(function (item) {
23562
+ var supplierInfo = supplierMap.get(item.sysItemId);
23563
+ item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
23564
+ item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
23565
+ });
23566
+ case 5:
23567
+ case "end":
23568
+ return _context.stop();
23569
+ }
23570
+ }, _callee);
23571
+ }));
23572
+ return function getKmSupplier(_x) {
23573
+ return _ref2.apply(this, arguments);
23574
+ };
23575
+ }();
23576
+ var openModal = /*#__PURE__*/function () {
23577
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
23578
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
23579
+ while (1) switch (_context2.prev = _context2.next) {
23580
+ case 0:
23581
+ if (!validSystemOrder) {
23582
+ _context2.next = 3;
23583
+ break;
23584
+ }
23585
+ message.warning('请选择补发系统单');
23586
+ return _context2.abrupt("return");
23587
+ case 3:
23588
+ if (!(getDataSourceAsync && !(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length))) {
23589
+ _context2.next = 6;
23590
+ break;
23591
+ }
23592
+ _context2.next = 6;
23593
+ return getDataSourceAsync();
23594
+ case 6:
23595
+ if (!['KM_GOODS', 'KM_REISSUE_GOODS'].includes(type)) {
23596
+ _context2.next = 9;
23597
+ break;
23598
+ }
23599
+ _context2.next = 9;
23600
+ return getKmSupplier(dataSource);
23601
+ case 9:
23602
+ setTradeGoodsVisible(true);
23603
+ // 补发直接传入的是systemNo
23604
+ if (isShowSelect && isReissueType) {
23605
+ setSelectSystemNo(selectedSystemOrders || []);
23606
+ }
23607
+ case 11:
23608
+ case "end":
23609
+ return _context2.stop();
23610
+ }
23611
+ }, _callee2);
23612
+ }));
23613
+ return function openModal() {
23614
+ return _ref3.apply(this, arguments);
23615
+ };
23616
+ }();
23545
23617
  var closeModal = function closeModal() {
23546
23618
  return setTradeGoodsVisible(false);
23547
23619
  };
@@ -23865,9 +23937,9 @@ var GoodItem$1 = function GoodItem(props) {
23865
23937
  var COLUMNS_INFO = COLUMNS_MAP(text);
23866
23938
  return COLUMNS_INFO(type);
23867
23939
  };
23868
- var getShowFilterColumns = useCallback(function (_ref2) {
23869
- var showHeader = _ref2.showHeader,
23870
- initBaseInfoColumns = _ref2.initBaseInfoColumns;
23940
+ var getShowFilterColumns = useCallback(function (_ref4) {
23941
+ var showHeader = _ref4.showHeader,
23942
+ initBaseInfoColumns = _ref4.initBaseInfoColumns;
23871
23943
  var baseInfoColumns = [];
23872
23944
  var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === 'string';
23873
23945
  var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === '[object Object]';
@@ -26710,7 +26782,7 @@ var componentMap$2 = {
26710
26782
  }
26711
26783
  };
26712
26784
  var CommonGoods = function CommonGoods(props) {
26713
- var _componentMap$compTyp5, _withInfo$current3, _withInfo$current4, _componentMap$compTyp7;
26785
+ var _withInfo$current3, _withInfo$current4, _componentMap$compTyp6;
26714
26786
  var value = props.value,
26715
26787
  disabled = props.disabled,
26716
26788
  onChange = props.onChange,
@@ -26726,6 +26798,10 @@ var CommonGoods = function CommonGoods(props) {
26726
26798
  _useState2 = _slicedToArray(_useState, 2),
26727
26799
  tableSelect = _useState2[0],
26728
26800
  setTableSelect = _useState2[1];
26801
+ var _useState3 = useState([]),
26802
+ _useState4 = _slicedToArray(_useState3, 2),
26803
+ originDataSource = _useState4[0],
26804
+ setOriginDataSource = _useState4[1];
26729
26805
  var withInfo = useRef(null);
26730
26806
  var valueRef = useRef(null);
26731
26807
  var tokens = useRef([]);
@@ -26737,10 +26813,90 @@ var CommonGoods = function CommonGoods(props) {
26737
26813
  compType.indexOf('WDT') > -1 && getWdtOrderList(value === null || value === void 0 ? void 0 : value.orderNo);
26738
26814
  }
26739
26815
  }, [value]);
26816
+ var sysItemIdMap = useMemo(function () {
26817
+ var map = {};
26818
+ if (compType.indexOf('KM') > -1) {
26819
+ var _value$kmGoods;
26820
+ value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : _value$kmGoods.forEach(function (item) {
26821
+ map[item.sysItemId] = item;
26822
+ });
26823
+ }
26824
+ return map;
26825
+ }, [value === null || value === void 0 ? void 0 : value.kmGoods]);
26826
+ // 用于跟踪已经处理过的 sysItemId,避免重复处理
26827
+ var processedSysItemIdsRef = useRef(new Set());
26828
+ useEffect(function () {
26829
+ var fetchSupplier = /*#__PURE__*/function () {
26830
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sysItemIds) {
26831
+ var _currentValue$kmGoods;
26832
+ var needFetchIds, supplierMap, hasChange, currentValue, kmGoods;
26833
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
26834
+ while (1) switch (_context.prev = _context.next) {
26835
+ case 0:
26836
+ if (sysItemIds.length) {
26837
+ _context.next = 2;
26838
+ break;
26839
+ }
26840
+ return _context.abrupt("return");
26841
+ case 2:
26842
+ // 过滤出还没有供应商信息的 sysItemId
26843
+ needFetchIds = sysItemIds.filter(function (id) {
26844
+ var item = sysItemIdMap[id];
26845
+ return item && (!item.supplierCode || !item.supplierName);
26846
+ });
26847
+ if (needFetchIds.length) {
26848
+ _context.next = 5;
26849
+ break;
26850
+ }
26851
+ return _context.abrupt("return");
26852
+ case 5:
26853
+ _context.next = 7;
26854
+ return servers.KM.getSupplierSingleton(needFetchIds);
26855
+ case 7:
26856
+ supplierMap = _context.sent;
26857
+ // 检查是否有实际变化,避免不必要的更新
26858
+ hasChange = false;
26859
+ currentValue = valueRef.current;
26860
+ kmGoods = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$kmGoods = currentValue.kmGoods) === null || _currentValue$kmGoods === void 0 ? void 0 : _currentValue$kmGoods.map(function (item) {
26861
+ var supplierInfo = supplierMap.get(item.sysItemId);
26862
+ var newSupplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
26863
+ var newSupplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
26864
+ // 如果供应商信息有变化,标记需要更新
26865
+ if (newSupplierCode && item.supplierCode !== newSupplierCode || newSupplierName && item.supplierName !== newSupplierName) {
26866
+ hasChange = true;
26867
+ // 标记已处理
26868
+ processedSysItemIdsRef.current.add(item.sysItemId);
26869
+ return _objectSpread2(_objectSpread2({}, item), {}, {
26870
+ supplierCode: newSupplierCode || item.supplierCode,
26871
+ supplierName: newSupplierName || item.supplierName
26872
+ });
26873
+ }
26874
+ return item;
26875
+ }); // 只在有实际变化时才更新
26876
+ if (hasChange && kmGoods) {
26877
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, currentValue), {}, {
26878
+ kmGoods: kmGoods
26879
+ }));
26880
+ }
26881
+ case 12:
26882
+ case "end":
26883
+ return _context.stop();
26884
+ }
26885
+ }, _callee);
26886
+ }));
26887
+ return function fetchSupplier(_x) {
26888
+ return _ref.apply(this, arguments);
26889
+ };
26890
+ }();
26891
+ var sysItemIds = Object.keys(sysItemIdMap);
26892
+ if (sysItemIds === null || sysItemIds === void 0 ? void 0 : sysItemIds.length) {
26893
+ fetchSupplier(sysItemIds);
26894
+ }
26895
+ }, [sysItemIdMap]);
26740
26896
  var getWdtOrderList = /*#__PURE__*/function () {
26741
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(orderNo) {
26742
- return _regeneratorRuntime().wrap(function _callee$(_context) {
26743
- while (1) switch (_context.prev = _context.next) {
26897
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderNo) {
26898
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
26899
+ while (1) switch (_context2.prev = _context2.next) {
26744
26900
  case 0:
26745
26901
  wdtUtils.getWdtOrderListSingleton(orderNo).then(function (data) {
26746
26902
  var orders = ((data === null || data === void 0 ? void 0 : data.trades) || []).filter(function (trade) {
@@ -26753,12 +26909,12 @@ var CommonGoods = function CommonGoods(props) {
26753
26909
  });
26754
26910
  case 1:
26755
26911
  case "end":
26756
- return _context.stop();
26912
+ return _context2.stop();
26757
26913
  }
26758
- }, _callee);
26914
+ }, _callee2);
26759
26915
  }));
26760
- return function getWdtOrderList(_x) {
26761
- return _ref.apply(this, arguments);
26916
+ return function getWdtOrderList(_x2) {
26917
+ return _ref2.apply(this, arguments);
26762
26918
  };
26763
26919
  }();
26764
26920
  useEffect(function () {
@@ -26864,8 +27020,8 @@ var CommonGoods = function CommonGoods(props) {
26864
27020
  mode: isStrict
26865
27021
  }))));
26866
27022
  };
26867
- var getGoodDetails = function getGoodDetails(_ref2) {
26868
- var mode = _ref2.mode;
27023
+ var getGoodDetails = function getGoodDetails(_ref3) {
27024
+ var mode = _ref3.mode;
26869
27025
  var updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
26870
27026
  if (!updateHandle) return [];
26871
27027
  var goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.orders) || [], {
@@ -26877,44 +27033,150 @@ var CommonGoods = function CommonGoods(props) {
26877
27033
  return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp = componentMap$2[compType]) === null || _componentMap$compTyp === void 0 ? void 0 : _componentMap$compTyp.goodDetailOrderNo]) === orderNo;
26878
27034
  }) : goodDetails;
26879
27035
  };
27036
+ var getKmSupplier = /*#__PURE__*/function () {
27037
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(list) {
27038
+ var systemItemIds, supplierMap;
27039
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
27040
+ while (1) switch (_context3.prev = _context3.next) {
27041
+ case 0:
27042
+ systemItemIds = list === null || list === void 0 ? void 0 : list.map(function (item) {
27043
+ return item.sysItemId;
27044
+ });
27045
+ _context3.next = 3;
27046
+ return servers.KM.getSupplierSingleton(systemItemIds);
27047
+ case 3:
27048
+ supplierMap = _context3.sent;
27049
+ list === null || list === void 0 ? void 0 : list.forEach(function (item) {
27050
+ var supplierInfo = supplierMap.get(item.sysItemId);
27051
+ item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
27052
+ item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
27053
+ });
27054
+ case 5:
27055
+ case "end":
27056
+ return _context3.stop();
27057
+ }
27058
+ }, _callee3);
27059
+ }));
27060
+ return function getKmSupplier(_x3) {
27061
+ return _ref4.apply(this, arguments);
27062
+ };
27063
+ }();
26880
27064
  // 找到该订单号下所有商品
26881
- var getAllTradeGoodsDetails = function getAllTradeGoodsDetails(_ref3) {
26882
- var mode = _ref3.mode;
26883
- var updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
26884
- if (!updateHandle) return [];
26885
- var goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.allOrders) || [], {
26886
- orderBackGoodsLevel: props.orderBackGoodsLevel
26887
- });
26888
- var orderNo = value === null || value === void 0 ? void 0 : value.orderNo;
26889
- return mode ? goodDetails.filter(function (goodItem) {
26890
- var _componentMap$compTyp2;
26891
- return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp2 = componentMap$2[compType]) === null || _componentMap$compTyp2 === void 0 ? void 0 : _componentMap$compTyp2.goodDetailOrderNo]) === orderNo;
26892
- }) : goodDetails;
26893
- };
26894
- var selectedGoodsChange = useCallback(function (skuList) {
26895
- var _componentMap$compTyp3, _componentMap$compTyp4, _uniqBy;
26896
- var newValue = _objectSpread2({}, value);
26897
- var isStrict = value.isStrict;
26898
- // 原订单商品
26899
- var originTradeGoodList = getAllTradeGoodsDetails({
26900
- mode: isStrict
26901
- }) || [];
26902
- // 当前选中的所有商品【包含了原订单+商品库】
26903
- var currentSelectGoodList = (value === null || value === void 0 ? void 0 : value["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp3 = componentMap$2[compType]) === null || _componentMap$compTyp3 === void 0 ? void 0 : _componentMap$compTyp3.key)]) || [];
26904
- newValue["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp4 = componentMap$2[compType]) === null || _componentMap$compTyp4 === void 0 ? void 0 : _componentMap$compTyp4.key)] = (_uniqBy = uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
26905
- return skuList.includes(item.uuid);
26906
- });
26907
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
26908
- }, [value === null || value === void 0 ? void 0 : value["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp5 = componentMap$2[compType]) === null || _componentMap$compTyp5 === void 0 ? void 0 : _componentMap$compTyp5.key)], value === null || value === void 0 ? void 0 : value.isStrict]);
27065
+ var getAllTradeGoodsDetails = /*#__PURE__*/function () {
27066
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
27067
+ var mode, updateHandle, goodDetails, orderNo;
27068
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
27069
+ while (1) switch (_context4.prev = _context4.next) {
27070
+ case 0:
27071
+ mode = _ref5.mode;
27072
+ updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
27073
+ if (updateHandle) {
27074
+ _context4.next = 4;
27075
+ break;
27076
+ }
27077
+ return _context4.abrupt("return", []);
27078
+ case 4:
27079
+ goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.allOrders) || [], {
27080
+ orderBackGoodsLevel: props.orderBackGoodsLevel
27081
+ });
27082
+ orderNo = value === null || value === void 0 ? void 0 : value.orderNo;
27083
+ if (!['KM_GOODS', 'KM_REISSUE_GOODS'].includes(compType)) {
27084
+ _context4.next = 9;
27085
+ break;
27086
+ }
27087
+ _context4.next = 9;
27088
+ return getKmSupplier(goodDetails);
27089
+ case 9:
27090
+ return _context4.abrupt("return", mode ? goodDetails.filter(function (goodItem) {
27091
+ var _componentMap$compTyp2;
27092
+ return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp2 = componentMap$2[compType]) === null || _componentMap$compTyp2 === void 0 ? void 0 : _componentMap$compTyp2.goodDetailOrderNo]) === orderNo;
27093
+ }) : goodDetails);
27094
+ case 10:
27095
+ case "end":
27096
+ return _context4.stop();
27097
+ }
27098
+ }, _callee4);
27099
+ }));
27100
+ return function getAllTradeGoodsDetails(_x4) {
27101
+ return _ref6.apply(this, arguments);
27102
+ };
27103
+ }();
27104
+ // 异步获取 originDataSource
27105
+ useEffect(function () {
27106
+ var fetchOriginDataSource = /*#__PURE__*/function () {
27107
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
27108
+ var data;
27109
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
27110
+ while (1) switch (_context5.prev = _context5.next) {
27111
+ case 0:
27112
+ _context5.next = 2;
27113
+ return getAllTradeGoodsDetails({
27114
+ mode: value === null || value === void 0 ? void 0 : value.isStrict
27115
+ });
27116
+ case 2:
27117
+ data = _context5.sent;
27118
+ console.log('fetchOriginDataSource', data);
27119
+ setOriginDataSource(Array.isArray(data) ? data : []);
27120
+ case 5:
27121
+ case "end":
27122
+ return _context5.stop();
27123
+ }
27124
+ }, _callee5);
27125
+ }));
27126
+ return function fetchOriginDataSource() {
27127
+ return _ref7.apply(this, arguments);
27128
+ };
27129
+ }();
27130
+ fetchOriginDataSource();
27131
+ }, [value === null || value === void 0 ? void 0 : value.allOrders, value === null || value === void 0 ? void 0 : value.isStrict, value === null || value === void 0 ? void 0 : value.orderNo, compType]);
27132
+ var selectedGoodsChange = /*#__PURE__*/function () {
27133
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(skuList) {
27134
+ var _valueRef$current9, _componentMap$compTyp3, _componentMap$compTyp4, _uniqBy;
27135
+ var newValue, isStrict, originTradeGoodList, currentSelectGoodList;
27136
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
27137
+ while (1) switch (_context6.prev = _context6.next) {
27138
+ case 0:
27139
+ newValue = _objectSpread2({}, valueRef.current);
27140
+ isStrict = valueRef.current.isStrict; // 原订单商品
27141
+ _context6.next = 4;
27142
+ return getAllTradeGoodsDetails({
27143
+ mode: isStrict
27144
+ });
27145
+ case 4:
27146
+ _context6.t0 = _context6.sent;
27147
+ if (_context6.t0) {
27148
+ _context6.next = 7;
27149
+ break;
27150
+ }
27151
+ _context6.t0 = [];
27152
+ case 7:
27153
+ originTradeGoodList = _context6.t0;
27154
+ // 当前选中的所有商品【包含了原订单+商品库】
27155
+ currentSelectGoodList = ((_valueRef$current9 = valueRef.current) === null || _valueRef$current9 === void 0 ? void 0 : _valueRef$current9["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp3 = componentMap$2[compType]) === null || _componentMap$compTyp3 === void 0 ? void 0 : _componentMap$compTyp3.key)]) || [];
27156
+ newValue["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp4 = componentMap$2[compType]) === null || _componentMap$compTyp4 === void 0 ? void 0 : _componentMap$compTyp4.key)] = (_uniqBy = uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
27157
+ return skuList.includes(item.uuid);
27158
+ });
27159
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
27160
+ case 11:
27161
+ case "end":
27162
+ return _context6.stop();
27163
+ }
27164
+ }, _callee6);
27165
+ }));
27166
+ return function selectedGoodsChange(_x5) {
27167
+ return _ref8.apply(this, arguments);
27168
+ };
27169
+ }();
26909
27170
  // 商品信息组件暂存后 重新编辑,此时需要重新获取订单下所有系统自订单的商品信息
26910
27171
  var getDataSourceAsync = function getDataSourceAsync() {
26911
- var _componentMap$compTyp6;
26912
- return (value === null || value === void 0 ? void 0 : value.orderNo) ? (_componentMap$compTyp6 = componentMap$2[compType]) === null || _componentMap$compTyp6 === void 0 ? void 0 : _componentMap$compTyp6.getOrderList(value === null || value === void 0 ? void 0 : value.orderNo).then(function (data) {
27172
+ var _componentMap$compTyp5;
27173
+ return (value === null || value === void 0 ? void 0 : value.orderNo) ? (_componentMap$compTyp5 = componentMap$2[compType]) === null || _componentMap$compTyp5 === void 0 ? void 0 : _componentMap$compTyp5.getOrderList(value === null || value === void 0 ? void 0 : value.orderNo).then(function (data) {
26913
27174
  var list = processAllOrders({
26914
27175
  data: data,
26915
27176
  orderNo: value === null || value === void 0 ? void 0 : value.orderNo,
26916
27177
  type: compType
26917
27178
  });
27179
+ console.log('getDataSourceAsync', list);
26918
27180
  onChange(_objectSpread2(_objectSpread2({}, valueRef.current), {}, {
26919
27181
  allOrders: list || []
26920
27182
  }));
@@ -26942,11 +27204,9 @@ var CommonGoods = function CommonGoods(props) {
26942
27204
  isStrict: value === null || value === void 0 ? void 0 : value.isStrict,
26943
27205
  systemOrders: value === null || value === void 0 ? void 0 : value.allOrders,
26944
27206
  selectedSystemOrders: value === null || value === void 0 ? void 0 : value.orders,
26945
- showChangeBtn: (_componentMap$compTyp7 = componentMap$2[compType]) === null || _componentMap$compTyp7 === void 0 ? void 0 : _componentMap$compTyp7.showChangeBtn,
27207
+ showChangeBtn: (_componentMap$compTyp6 = componentMap$2[compType]) === null || _componentMap$compTyp6 === void 0 ? void 0 : _componentMap$compTyp6.showChangeBtn,
26946
27208
  tradeGoods: {
26947
- originDataSource: getAllTradeGoodsDetails({
26948
- mode: value === null || value === void 0 ? void 0 : value.isStrict
26949
- }),
27209
+ originDataSource: originDataSource,
26950
27210
  getDataSourceAsync: getDataSourceAsync,
26951
27211
  selectedGoodsChange: selectedGoodsChange
26952
27212
  }
package/dist/index.js CHANGED
@@ -21741,6 +21741,16 @@ var getColumns$6 = function getColumns(_ref) {
21741
21741
  title: "\u5546\u54C1\u7C7B\u578B",
21742
21742
  width: 150,
21743
21743
  render: renderTextEllipsis
21744
+ }, {
21745
+ dataIndex: 'supplierName',
21746
+ title: "\u4F9B\u5E94\u5546\u540D\u79F0",
21747
+ width: 150,
21748
+ render: renderTextEllipsis
21749
+ }, {
21750
+ dataIndex: 'supplierCode',
21751
+ title: "\u4F9B\u5E94\u5546\u7F16\u7801",
21752
+ width: 150,
21753
+ render: renderTextEllipsis
21744
21754
  }].map(function (item) {
21745
21755
  return _objectSpread2(_objectSpread2({}, item), {}, {
21746
21756
  align: 'center',
@@ -21868,6 +21878,16 @@ var getColumns$6 = function getColumns(_ref) {
21868
21878
  title: "\u5546\u54C1\u7C7B\u578B",
21869
21879
  width: 150,
21870
21880
  render: renderTextEllipsis
21881
+ }, {
21882
+ dataIndex: 'supplierName',
21883
+ title: "\u4F9B\u5E94\u5546\u540D\u79F0",
21884
+ width: 150,
21885
+ render: renderTextEllipsis
21886
+ }, {
21887
+ dataIndex: 'supplierCode',
21888
+ title: "\u4F9B\u5E94\u5546\u7F16\u7801",
21889
+ width: 150,
21890
+ render: renderTextEllipsis
21871
21891
  }, {
21872
21892
  dataIndex: 'sysPicPath',
21873
21893
  title: "\u5546\u54C1\u56FE\u7247",
@@ -23540,23 +23560,75 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
23540
23560
  _useState4 = _slicedToArray(_useState3, 2),
23541
23561
  tradeGoodsVisible = _useState4[0],
23542
23562
  setTradeGoodsVisible = _useState4[1];
23543
- var openModal = function openModal() {
23544
- if (validSystemOrder) {
23545
- antd.message.warning('请选择补发系统单');
23546
- return;
23547
- }
23548
- if (getDataSourceAsync && !(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length)) {
23549
- getDataSourceAsync().then(function () {
23550
- setTradeGoodsVisible(true);
23551
- });
23552
- } else {
23553
- setTradeGoodsVisible(true);
23554
- }
23555
- // 补发直接传入的是systemNo
23556
- if (isShowSelect && isReissueType) {
23557
- setSelectSystemNo(selectedSystemOrders || []);
23558
- }
23559
- };
23563
+ var getKmSupplier = /*#__PURE__*/function () {
23564
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dataSource) {
23565
+ var systemItemIds, supplierMap;
23566
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
23567
+ while (1) switch (_context.prev = _context.next) {
23568
+ case 0:
23569
+ systemItemIds = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
23570
+ return item.sysItemId;
23571
+ });
23572
+ _context.next = 3;
23573
+ return kmkfUtils.servers.KM.getSupplierSingleton(systemItemIds);
23574
+ case 3:
23575
+ supplierMap = _context.sent;
23576
+ dataSource === null || dataSource === void 0 ? void 0 : dataSource.forEach(function (item) {
23577
+ var supplierInfo = supplierMap.get(item.sysItemId);
23578
+ item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
23579
+ item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
23580
+ });
23581
+ case 5:
23582
+ case "end":
23583
+ return _context.stop();
23584
+ }
23585
+ }, _callee);
23586
+ }));
23587
+ return function getKmSupplier(_x) {
23588
+ return _ref2.apply(this, arguments);
23589
+ };
23590
+ }();
23591
+ var openModal = /*#__PURE__*/function () {
23592
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
23593
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
23594
+ while (1) switch (_context2.prev = _context2.next) {
23595
+ case 0:
23596
+ if (!validSystemOrder) {
23597
+ _context2.next = 3;
23598
+ break;
23599
+ }
23600
+ antd.message.warning('请选择补发系统单');
23601
+ return _context2.abrupt("return");
23602
+ case 3:
23603
+ if (!(getDataSourceAsync && !(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length))) {
23604
+ _context2.next = 6;
23605
+ break;
23606
+ }
23607
+ _context2.next = 6;
23608
+ return getDataSourceAsync();
23609
+ case 6:
23610
+ if (!['KM_GOODS', 'KM_REISSUE_GOODS'].includes(type)) {
23611
+ _context2.next = 9;
23612
+ break;
23613
+ }
23614
+ _context2.next = 9;
23615
+ return getKmSupplier(dataSource);
23616
+ case 9:
23617
+ setTradeGoodsVisible(true);
23618
+ // 补发直接传入的是systemNo
23619
+ if (isShowSelect && isReissueType) {
23620
+ setSelectSystemNo(selectedSystemOrders || []);
23621
+ }
23622
+ case 11:
23623
+ case "end":
23624
+ return _context2.stop();
23625
+ }
23626
+ }, _callee2);
23627
+ }));
23628
+ return function openModal() {
23629
+ return _ref3.apply(this, arguments);
23630
+ };
23631
+ }();
23560
23632
  var closeModal = function closeModal() {
23561
23633
  return setTradeGoodsVisible(false);
23562
23634
  };
@@ -23880,9 +23952,9 @@ var GoodItem$1 = function GoodItem(props) {
23880
23952
  var COLUMNS_INFO = COLUMNS_MAP(text);
23881
23953
  return COLUMNS_INFO(type);
23882
23954
  };
23883
- var getShowFilterColumns = React.useCallback(function (_ref2) {
23884
- var showHeader = _ref2.showHeader,
23885
- initBaseInfoColumns = _ref2.initBaseInfoColumns;
23955
+ var getShowFilterColumns = React.useCallback(function (_ref4) {
23956
+ var showHeader = _ref4.showHeader,
23957
+ initBaseInfoColumns = _ref4.initBaseInfoColumns;
23886
23958
  var baseInfoColumns = [];
23887
23959
  var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === 'string';
23888
23960
  var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === '[object Object]';
@@ -26725,7 +26797,7 @@ var componentMap$2 = {
26725
26797
  }
26726
26798
  };
26727
26799
  var CommonGoods = function CommonGoods(props) {
26728
- var _componentMap$compTyp5, _withInfo$current3, _withInfo$current4, _componentMap$compTyp7;
26800
+ var _withInfo$current3, _withInfo$current4, _componentMap$compTyp6;
26729
26801
  var value = props.value,
26730
26802
  disabled = props.disabled,
26731
26803
  onChange = props.onChange,
@@ -26741,6 +26813,10 @@ var CommonGoods = function CommonGoods(props) {
26741
26813
  _useState2 = _slicedToArray(_useState, 2),
26742
26814
  tableSelect = _useState2[0],
26743
26815
  setTableSelect = _useState2[1];
26816
+ var _useState3 = React.useState([]),
26817
+ _useState4 = _slicedToArray(_useState3, 2),
26818
+ originDataSource = _useState4[0],
26819
+ setOriginDataSource = _useState4[1];
26744
26820
  var withInfo = React.useRef(null);
26745
26821
  var valueRef = React.useRef(null);
26746
26822
  var tokens = React.useRef([]);
@@ -26752,10 +26828,90 @@ var CommonGoods = function CommonGoods(props) {
26752
26828
  compType.indexOf('WDT') > -1 && getWdtOrderList(value === null || value === void 0 ? void 0 : value.orderNo);
26753
26829
  }
26754
26830
  }, [value]);
26831
+ var sysItemIdMap = React.useMemo(function () {
26832
+ var map = {};
26833
+ if (compType.indexOf('KM') > -1) {
26834
+ var _value$kmGoods;
26835
+ value === null || value === void 0 ? void 0 : (_value$kmGoods = value.kmGoods) === null || _value$kmGoods === void 0 ? void 0 : _value$kmGoods.forEach(function (item) {
26836
+ map[item.sysItemId] = item;
26837
+ });
26838
+ }
26839
+ return map;
26840
+ }, [value === null || value === void 0 ? void 0 : value.kmGoods]);
26841
+ // 用于跟踪已经处理过的 sysItemId,避免重复处理
26842
+ var processedSysItemIdsRef = React.useRef(new Set());
26843
+ React.useEffect(function () {
26844
+ var fetchSupplier = /*#__PURE__*/function () {
26845
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sysItemIds) {
26846
+ var _currentValue$kmGoods;
26847
+ var needFetchIds, supplierMap, hasChange, currentValue, kmGoods;
26848
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
26849
+ while (1) switch (_context.prev = _context.next) {
26850
+ case 0:
26851
+ if (sysItemIds.length) {
26852
+ _context.next = 2;
26853
+ break;
26854
+ }
26855
+ return _context.abrupt("return");
26856
+ case 2:
26857
+ // 过滤出还没有供应商信息的 sysItemId
26858
+ needFetchIds = sysItemIds.filter(function (id) {
26859
+ var item = sysItemIdMap[id];
26860
+ return item && (!item.supplierCode || !item.supplierName);
26861
+ });
26862
+ if (needFetchIds.length) {
26863
+ _context.next = 5;
26864
+ break;
26865
+ }
26866
+ return _context.abrupt("return");
26867
+ case 5:
26868
+ _context.next = 7;
26869
+ return kmkfUtils.servers.KM.getSupplierSingleton(needFetchIds);
26870
+ case 7:
26871
+ supplierMap = _context.sent;
26872
+ // 检查是否有实际变化,避免不必要的更新
26873
+ hasChange = false;
26874
+ currentValue = valueRef.current;
26875
+ kmGoods = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$kmGoods = currentValue.kmGoods) === null || _currentValue$kmGoods === void 0 ? void 0 : _currentValue$kmGoods.map(function (item) {
26876
+ var supplierInfo = supplierMap.get(item.sysItemId);
26877
+ var newSupplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
26878
+ var newSupplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
26879
+ // 如果供应商信息有变化,标记需要更新
26880
+ if (newSupplierCode && item.supplierCode !== newSupplierCode || newSupplierName && item.supplierName !== newSupplierName) {
26881
+ hasChange = true;
26882
+ // 标记已处理
26883
+ processedSysItemIdsRef.current.add(item.sysItemId);
26884
+ return _objectSpread2(_objectSpread2({}, item), {}, {
26885
+ supplierCode: newSupplierCode || item.supplierCode,
26886
+ supplierName: newSupplierName || item.supplierName
26887
+ });
26888
+ }
26889
+ return item;
26890
+ }); // 只在有实际变化时才更新
26891
+ if (hasChange && kmGoods) {
26892
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, currentValue), {}, {
26893
+ kmGoods: kmGoods
26894
+ }));
26895
+ }
26896
+ case 12:
26897
+ case "end":
26898
+ return _context.stop();
26899
+ }
26900
+ }, _callee);
26901
+ }));
26902
+ return function fetchSupplier(_x) {
26903
+ return _ref.apply(this, arguments);
26904
+ };
26905
+ }();
26906
+ var sysItemIds = Object.keys(sysItemIdMap);
26907
+ if (sysItemIds === null || sysItemIds === void 0 ? void 0 : sysItemIds.length) {
26908
+ fetchSupplier(sysItemIds);
26909
+ }
26910
+ }, [sysItemIdMap]);
26755
26911
  var getWdtOrderList = /*#__PURE__*/function () {
26756
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(orderNo) {
26757
- return _regeneratorRuntime().wrap(function _callee$(_context) {
26758
- while (1) switch (_context.prev = _context.next) {
26912
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderNo) {
26913
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
26914
+ while (1) switch (_context2.prev = _context2.next) {
26759
26915
  case 0:
26760
26916
  wdtUtils.getWdtOrderListSingleton(orderNo).then(function (data) {
26761
26917
  var orders = ((data === null || data === void 0 ? void 0 : data.trades) || []).filter(function (trade) {
@@ -26768,12 +26924,12 @@ var CommonGoods = function CommonGoods(props) {
26768
26924
  });
26769
26925
  case 1:
26770
26926
  case "end":
26771
- return _context.stop();
26927
+ return _context2.stop();
26772
26928
  }
26773
- }, _callee);
26929
+ }, _callee2);
26774
26930
  }));
26775
- return function getWdtOrderList(_x) {
26776
- return _ref.apply(this, arguments);
26931
+ return function getWdtOrderList(_x2) {
26932
+ return _ref2.apply(this, arguments);
26777
26933
  };
26778
26934
  }();
26779
26935
  React.useEffect(function () {
@@ -26879,8 +27035,8 @@ var CommonGoods = function CommonGoods(props) {
26879
27035
  mode: isStrict
26880
27036
  }))));
26881
27037
  };
26882
- var getGoodDetails = function getGoodDetails(_ref2) {
26883
- var mode = _ref2.mode;
27038
+ var getGoodDetails = function getGoodDetails(_ref3) {
27039
+ var mode = _ref3.mode;
26884
27040
  var updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
26885
27041
  if (!updateHandle) return [];
26886
27042
  var goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.orders) || [], {
@@ -26892,44 +27048,150 @@ var CommonGoods = function CommonGoods(props) {
26892
27048
  return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp = componentMap$2[compType]) === null || _componentMap$compTyp === void 0 ? void 0 : _componentMap$compTyp.goodDetailOrderNo]) === orderNo;
26893
27049
  }) : goodDetails;
26894
27050
  };
27051
+ var getKmSupplier = /*#__PURE__*/function () {
27052
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(list) {
27053
+ var systemItemIds, supplierMap;
27054
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
27055
+ while (1) switch (_context3.prev = _context3.next) {
27056
+ case 0:
27057
+ systemItemIds = list === null || list === void 0 ? void 0 : list.map(function (item) {
27058
+ return item.sysItemId;
27059
+ });
27060
+ _context3.next = 3;
27061
+ return kmkfUtils.servers.KM.getSupplierSingleton(systemItemIds);
27062
+ case 3:
27063
+ supplierMap = _context3.sent;
27064
+ list === null || list === void 0 ? void 0 : list.forEach(function (item) {
27065
+ var supplierInfo = supplierMap.get(item.sysItemId);
27066
+ item.supplierCode = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierCode;
27067
+ item.supplierName = supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.supplierName;
27068
+ });
27069
+ case 5:
27070
+ case "end":
27071
+ return _context3.stop();
27072
+ }
27073
+ }, _callee3);
27074
+ }));
27075
+ return function getKmSupplier(_x3) {
27076
+ return _ref4.apply(this, arguments);
27077
+ };
27078
+ }();
26895
27079
  // 找到该订单号下所有商品
26896
- var getAllTradeGoodsDetails = function getAllTradeGoodsDetails(_ref3) {
26897
- var mode = _ref3.mode;
26898
- var updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
26899
- if (!updateHandle) return [];
26900
- var goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.allOrders) || [], {
26901
- orderBackGoodsLevel: props.orderBackGoodsLevel
26902
- });
26903
- var orderNo = value === null || value === void 0 ? void 0 : value.orderNo;
26904
- return mode ? goodDetails.filter(function (goodItem) {
26905
- var _componentMap$compTyp2;
26906
- return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp2 = componentMap$2[compType]) === null || _componentMap$compTyp2 === void 0 ? void 0 : _componentMap$compTyp2.goodDetailOrderNo]) === orderNo;
26907
- }) : goodDetails;
26908
- };
26909
- var selectedGoodsChange = React.useCallback(function (skuList) {
26910
- var _componentMap$compTyp3, _componentMap$compTyp4, _uniqBy;
26911
- var newValue = _objectSpread2({}, value);
26912
- var isStrict = value.isStrict;
26913
- // 原订单商品
26914
- var originTradeGoodList = getAllTradeGoodsDetails({
26915
- mode: isStrict
26916
- }) || [];
26917
- // 当前选中的所有商品【包含了原订单+商品库】
26918
- var currentSelectGoodList = (value === null || value === void 0 ? void 0 : value["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp3 = componentMap$2[compType]) === null || _componentMap$compTyp3 === void 0 ? void 0 : _componentMap$compTyp3.key)]) || [];
26919
- newValue["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp4 = componentMap$2[compType]) === null || _componentMap$compTyp4 === void 0 ? void 0 : _componentMap$compTyp4.key)] = (_uniqBy = lodash.uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
26920
- return skuList.includes(item.uuid);
26921
- });
26922
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
26923
- }, [value === null || value === void 0 ? void 0 : value["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp5 = componentMap$2[compType]) === null || _componentMap$compTyp5 === void 0 ? void 0 : _componentMap$compTyp5.key)], value === null || value === void 0 ? void 0 : value.isStrict]);
27080
+ var getAllTradeGoodsDetails = /*#__PURE__*/function () {
27081
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
27082
+ var mode, updateHandle, goodDetails, orderNo;
27083
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
27084
+ while (1) switch (_context4.prev = _context4.next) {
27085
+ case 0:
27086
+ mode = _ref5.mode;
27087
+ updateHandle = componentMap$2[compType].eventNameMap['updateGoodsHandle'];
27088
+ if (updateHandle) {
27089
+ _context4.next = 4;
27090
+ break;
27091
+ }
27092
+ return _context4.abrupt("return", []);
27093
+ case 4:
27094
+ goodDetails = updateHandle((value === null || value === void 0 ? void 0 : value.allOrders) || [], {
27095
+ orderBackGoodsLevel: props.orderBackGoodsLevel
27096
+ });
27097
+ orderNo = value === null || value === void 0 ? void 0 : value.orderNo;
27098
+ if (!['KM_GOODS', 'KM_REISSUE_GOODS'].includes(compType)) {
27099
+ _context4.next = 9;
27100
+ break;
27101
+ }
27102
+ _context4.next = 9;
27103
+ return getKmSupplier(goodDetails);
27104
+ case 9:
27105
+ return _context4.abrupt("return", mode ? goodDetails.filter(function (goodItem) {
27106
+ var _componentMap$compTyp2;
27107
+ return !orderNo || (goodItem === null || goodItem === void 0 ? void 0 : goodItem[(_componentMap$compTyp2 = componentMap$2[compType]) === null || _componentMap$compTyp2 === void 0 ? void 0 : _componentMap$compTyp2.goodDetailOrderNo]) === orderNo;
27108
+ }) : goodDetails);
27109
+ case 10:
27110
+ case "end":
27111
+ return _context4.stop();
27112
+ }
27113
+ }, _callee4);
27114
+ }));
27115
+ return function getAllTradeGoodsDetails(_x4) {
27116
+ return _ref6.apply(this, arguments);
27117
+ };
27118
+ }();
27119
+ // 异步获取 originDataSource
27120
+ React.useEffect(function () {
27121
+ var fetchOriginDataSource = /*#__PURE__*/function () {
27122
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
27123
+ var data;
27124
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
27125
+ while (1) switch (_context5.prev = _context5.next) {
27126
+ case 0:
27127
+ _context5.next = 2;
27128
+ return getAllTradeGoodsDetails({
27129
+ mode: value === null || value === void 0 ? void 0 : value.isStrict
27130
+ });
27131
+ case 2:
27132
+ data = _context5.sent;
27133
+ console.log('fetchOriginDataSource', data);
27134
+ setOriginDataSource(Array.isArray(data) ? data : []);
27135
+ case 5:
27136
+ case "end":
27137
+ return _context5.stop();
27138
+ }
27139
+ }, _callee5);
27140
+ }));
27141
+ return function fetchOriginDataSource() {
27142
+ return _ref7.apply(this, arguments);
27143
+ };
27144
+ }();
27145
+ fetchOriginDataSource();
27146
+ }, [value === null || value === void 0 ? void 0 : value.allOrders, value === null || value === void 0 ? void 0 : value.isStrict, value === null || value === void 0 ? void 0 : value.orderNo, compType]);
27147
+ var selectedGoodsChange = /*#__PURE__*/function () {
27148
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(skuList) {
27149
+ var _valueRef$current9, _componentMap$compTyp3, _componentMap$compTyp4, _uniqBy;
27150
+ var newValue, isStrict, originTradeGoodList, currentSelectGoodList;
27151
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
27152
+ while (1) switch (_context6.prev = _context6.next) {
27153
+ case 0:
27154
+ newValue = _objectSpread2({}, valueRef.current);
27155
+ isStrict = valueRef.current.isStrict; // 原订单商品
27156
+ _context6.next = 4;
27157
+ return getAllTradeGoodsDetails({
27158
+ mode: isStrict
27159
+ });
27160
+ case 4:
27161
+ _context6.t0 = _context6.sent;
27162
+ if (_context6.t0) {
27163
+ _context6.next = 7;
27164
+ break;
27165
+ }
27166
+ _context6.t0 = [];
27167
+ case 7:
27168
+ originTradeGoodList = _context6.t0;
27169
+ // 当前选中的所有商品【包含了原订单+商品库】
27170
+ currentSelectGoodList = ((_valueRef$current9 = valueRef.current) === null || _valueRef$current9 === void 0 ? void 0 : _valueRef$current9["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp3 = componentMap$2[compType]) === null || _componentMap$compTyp3 === void 0 ? void 0 : _componentMap$compTyp3.key)]) || [];
27171
+ newValue["".concat(componentMap$2 === null || componentMap$2 === void 0 ? void 0 : (_componentMap$compTyp4 = componentMap$2[compType]) === null || _componentMap$compTyp4 === void 0 ? void 0 : _componentMap$compTyp4.key)] = (_uniqBy = lodash.uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
27172
+ return skuList.includes(item.uuid);
27173
+ });
27174
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
27175
+ case 11:
27176
+ case "end":
27177
+ return _context6.stop();
27178
+ }
27179
+ }, _callee6);
27180
+ }));
27181
+ return function selectedGoodsChange(_x5) {
27182
+ return _ref8.apply(this, arguments);
27183
+ };
27184
+ }();
26924
27185
  // 商品信息组件暂存后 重新编辑,此时需要重新获取订单下所有系统自订单的商品信息
26925
27186
  var getDataSourceAsync = function getDataSourceAsync() {
26926
- var _componentMap$compTyp6;
26927
- return (value === null || value === void 0 ? void 0 : value.orderNo) ? (_componentMap$compTyp6 = componentMap$2[compType]) === null || _componentMap$compTyp6 === void 0 ? void 0 : _componentMap$compTyp6.getOrderList(value === null || value === void 0 ? void 0 : value.orderNo).then(function (data) {
27187
+ var _componentMap$compTyp5;
27188
+ return (value === null || value === void 0 ? void 0 : value.orderNo) ? (_componentMap$compTyp5 = componentMap$2[compType]) === null || _componentMap$compTyp5 === void 0 ? void 0 : _componentMap$compTyp5.getOrderList(value === null || value === void 0 ? void 0 : value.orderNo).then(function (data) {
26928
27189
  var list = processAllOrders({
26929
27190
  data: data,
26930
27191
  orderNo: value === null || value === void 0 ? void 0 : value.orderNo,
26931
27192
  type: compType
26932
27193
  });
27194
+ console.log('getDataSourceAsync', list);
26933
27195
  onChange(_objectSpread2(_objectSpread2({}, valueRef.current), {}, {
26934
27196
  allOrders: list || []
26935
27197
  }));
@@ -26957,11 +27219,9 @@ var CommonGoods = function CommonGoods(props) {
26957
27219
  isStrict: value === null || value === void 0 ? void 0 : value.isStrict,
26958
27220
  systemOrders: value === null || value === void 0 ? void 0 : value.allOrders,
26959
27221
  selectedSystemOrders: value === null || value === void 0 ? void 0 : value.orders,
26960
- showChangeBtn: (_componentMap$compTyp7 = componentMap$2[compType]) === null || _componentMap$compTyp7 === void 0 ? void 0 : _componentMap$compTyp7.showChangeBtn,
27222
+ showChangeBtn: (_componentMap$compTyp6 = componentMap$2[compType]) === null || _componentMap$compTyp6 === void 0 ? void 0 : _componentMap$compTyp6.showChangeBtn,
26961
27223
  tradeGoods: {
26962
- originDataSource: getAllTradeGoodsDetails({
26963
- mode: value === null || value === void 0 ? void 0 : value.isStrict
26964
- }),
27224
+ originDataSource: originDataSource,
26965
27225
  getDataSourceAsync: getDataSourceAsync,
26966
27226
  selectedGoodsChange: selectedGoodsChange
26967
27227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.2.39-beta.21",
3
+ "version": "2.2.39-beta.25",
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.19",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.2.39-beta.25",
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": "e5cb0a5969aada0f09cd5025a8ea6f967a3a3630"
69
+ "gitHead": "0e114e7d44d95ca335cef155e45a9da066253b1f"
70
70
  }