@kmkf-fe-packages/basic-components 0.21.4 → 0.21.6-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,4 +17,5 @@ yarn start
17
17
  - business 快麦工单业务组件
18
18
  - common 公共组件
19
19
  - config 公共方法
20
- - assets 静态资源
20
+ - assets 静态资源
21
+ -
package/dist/index.esm.js CHANGED
@@ -5,8 +5,9 @@ import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
6
  import { AddressData, BsAddressData, request as request$1, ExpressData, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import zhCN from 'antd/lib/locale/zh_CN';
8
- import pubsub from 'pubsub-js';
9
8
  import { cloneDeep } from 'lodash';
9
+ import { useDebounceEffect } from 'ahooks';
10
+ import pubsub from 'pubsub-js';
10
11
 
11
12
  function _iterableToArrayLimit(arr, i) {
12
13
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
@@ -9612,8 +9613,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
9612
9613
  };
9613
9614
 
9614
9615
  var LogisticsTrajectory = function LogisticsTrajectory(props) {
9615
- var options = props.options,
9616
- showField = props.showField,
9616
+ var showField = props.showField,
9617
9617
  _props$value = props.value,
9618
9618
  value = _props$value === void 0 ? {} : _props$value,
9619
9619
  disabled = props.disabled,
@@ -9744,6 +9744,201 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9744
9744
  return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), (value === null || value === void 0 ? void 0 : value.trajectoryCompany) === 'SF' ? LogisticsPhone() : null, showField && showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9745
9745
  };
9746
9746
 
9747
+ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
9748
+ var showField = props.showField,
9749
+ _props$value = props.value,
9750
+ value = _props$value === void 0 ? [] : _props$value,
9751
+ disabled = props.disabled,
9752
+ onChange = props.onChange;
9753
+ var _useState = useState([]),
9754
+ _useState2 = _slicedToArray(_useState, 2),
9755
+ newValue = _useState2[0],
9756
+ setNewValue = _useState2[1];
9757
+ var _useState3 = useState(0),
9758
+ _useState4 = _slicedToArray(_useState3, 2),
9759
+ changeIndex = _useState4[0],
9760
+ setChangeIndex = _useState4[1];
9761
+ var _useState5 = useState([]),
9762
+ _useState6 = _slicedToArray(_useState5, 2),
9763
+ initValue = _useState6[0],
9764
+ setInitValue = _useState6[1];
9765
+ var _useState7 = useState([]),
9766
+ _useState8 = _slicedToArray(_useState7, 2),
9767
+ changeValue = _useState8[0],
9768
+ setChangeValue = _useState8[1];
9769
+ var firstRef = useRef(true);
9770
+ var hasSave = useRef(false);
9771
+ useEffect(function () {
9772
+ if (value.length && firstRef.current) {
9773
+ setInitValue(value);
9774
+ firstRef.current = false;
9775
+ }
9776
+ }, [value]);
9777
+ useDebounceEffect(function () {
9778
+ initHandle({
9779
+ initValue: initValue,
9780
+ value: value
9781
+ });
9782
+ }, [initValue, value], {
9783
+ wait: 500
9784
+ });
9785
+ var initHandle = /*#__PURE__*/function () {
9786
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
9787
+ var initValue, value, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
9788
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9789
+ while (1) switch (_context.prev = _context.next) {
9790
+ case 0:
9791
+ initValue = _ref.initValue, value = _ref.value;
9792
+ initList = initValue.map(function (item) {
9793
+ if (item.trajectoryCompany === 'SF') {
9794
+ return {
9795
+ trajectoryCompany: item.trajectoryCompany,
9796
+ trajectoryCode: item.trajectoryCode,
9797
+ trajectoryPhone: item.trajectoryPhone
9798
+ };
9799
+ } else {
9800
+ return {
9801
+ trajectoryCompany: item.trajectoryCompany,
9802
+ trajectoryCode: item.trajectoryCode
9803
+ };
9804
+ }
9805
+ });
9806
+ valueList = value.map(function (item) {
9807
+ if (item.trajectoryCompany === 'SF') {
9808
+ return {
9809
+ trajectoryCompany: item.trajectoryCompany,
9810
+ trajectoryCode: item.trajectoryCode,
9811
+ trajectoryPhone: item.trajectoryPhone
9812
+ };
9813
+ } else {
9814
+ return {
9815
+ trajectoryCompany: item.trajectoryCompany,
9816
+ trajectoryCode: item.trajectoryCode
9817
+ };
9818
+ }
9819
+ });
9820
+ changeList = changeValue.map(function (item) {
9821
+ if (item.trajectoryCompany === 'SF') {
9822
+ return {
9823
+ trajectoryCompany: item.trajectoryCompany,
9824
+ trajectoryCode: item.trajectoryCode,
9825
+ trajectoryPhone: item.trajectoryPhone
9826
+ };
9827
+ } else {
9828
+ return {
9829
+ trajectoryCompany: item.trajectoryCompany,
9830
+ trajectoryCode: item.trajectoryCode
9831
+ };
9832
+ }
9833
+ }); // 1、初始值没有 传入值有请求快照
9834
+ // 2、初始值有 传入值有 其中有不一样的请求快照
9835
+ // 3、初始值有 传入值有 都一样的返回初始值
9836
+ console.log('list', initList, valueList, changeList);
9837
+ // console.log('old', initValue, value, changeValue);
9838
+ // console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
9839
+ // console.log(
9840
+ // '一样2',
9841
+ // JSON.stringify(changeList) !== JSON.stringify(valueList),
9842
+ // );
9843
+ if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
9844
+ _context.next = 11;
9845
+ break;
9846
+ }
9847
+ initSnapshotList = initValue.reduce(function (prv, next) {
9848
+ prv += next.trajectorySnapshot;
9849
+ return prv;
9850
+ }, '');
9851
+ valueSnapshotList = value.reduce(function (prv, next) {
9852
+ prv += next.trajectorySnapshot;
9853
+ return prv;
9854
+ }, '');
9855
+ if (initSnapshotList === valueSnapshotList) {
9856
+ hasSave.current = false;
9857
+ setNewValue(value);
9858
+ } else if (!hasSave.current) {
9859
+ hasSave.current = true;
9860
+ setNewValue(initValue);
9861
+ onChange(initValue);
9862
+ }
9863
+ _context.next = 24;
9864
+ break;
9865
+ case 11:
9866
+ if (!(JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
9867
+ _context.next = 24;
9868
+ break;
9869
+ }
9870
+ hasSave.current = false;
9871
+ hasValue = valueList.every(function (item) {
9872
+ return item.trajectoryCompany && item.trajectoryCode;
9873
+ });
9874
+ listValue = cloneDeep(value);
9875
+ if (!hasValue) {
9876
+ _context.next = 21;
9877
+ break;
9878
+ }
9879
+ requestList = valueList.map(function (item) {
9880
+ return extendRequest('/qy/logistics/logisticsTraceSearch', {
9881
+ method: 'post',
9882
+ data: {
9883
+ mailNo: item.trajectoryCode,
9884
+ cpCode: item.trajectoryCompany,
9885
+ mobile: item.trajectoryPhone
9886
+ }
9887
+ });
9888
+ });
9889
+ _context.next = 19;
9890
+ return Promise.allSettled(requestList);
9891
+ case 19:
9892
+ requestValues = _context.sent;
9893
+ listValue = cloneDeep(value).map(function (item, index) {
9894
+ var _requestValues$index, _requestValues$index$, _requestValues$index$2;
9895
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9896
+ trajectorySnapshot: (_requestValues$index = requestValues[index]) === null || _requestValues$index === void 0 ? void 0 : (_requestValues$index$ = _requestValues$index.value) === null || _requestValues$index$ === void 0 ? void 0 : (_requestValues$index$2 = _requestValues$index$.data) === null || _requestValues$index$2 === void 0 ? void 0 : _requestValues$index$2.logisticsStatusDesc
9897
+ });
9898
+ });
9899
+ case 21:
9900
+ setChangeValue(listValue);
9901
+ setNewValue(listValue);
9902
+ onChange(listValue);
9903
+ case 24:
9904
+ case "end":
9905
+ return _context.stop();
9906
+ }
9907
+ }, _callee);
9908
+ }));
9909
+ return function initHandle(_x) {
9910
+ return _ref2.apply(this, arguments);
9911
+ };
9912
+ }();
9913
+ var handleChange = function handleChange(val, index) {
9914
+ var newValue = cloneDeep(value);
9915
+ newValue.splice(index, 1, val);
9916
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
9917
+ setChangeValue(newValue);
9918
+ setNewValue(newValue);
9919
+ };
9920
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, {
9921
+ wrap: true
9922
+ }, (newValue || []).map(function (item, index) {
9923
+ return /*#__PURE__*/React.createElement("span", {
9924
+ style: {
9925
+ color: changeIndex === index ? '#4569d4' : 'black',
9926
+ cursor: 'pointer'
9927
+ },
9928
+ onClick: function onClick() {
9929
+ return setChangeIndex(index);
9930
+ }
9931
+ }, "\u5305\u88F9".concat(index + 1));
9932
+ })), /*#__PURE__*/React.createElement(LogisticsTrajectory, {
9933
+ value: newValue[changeIndex],
9934
+ showField: showField,
9935
+ disabled: disabled,
9936
+ onChange: function onChange(val) {
9937
+ return handleChange(val, changeIndex);
9938
+ }
9939
+ }));
9940
+ };
9941
+
9747
9942
  //组件类型的默认值
9748
9943
  var typeInitValueMap = {
9749
9944
  1: [{
@@ -10615,10 +10810,9 @@ var BsGoods = function BsGoods(props) {
10615
10810
  };
10616
10811
  setTableSelect(['2', '4'].includes(data.val));
10617
10812
  if (['1', '3'].includes(data.val)) {
10618
- var _valueRef$current, _valueRef$current2;
10813
+ var _valueRef$current;
10619
10814
  pubsub.publish('selectListReturn', {
10620
10815
  list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.bsGoods) || []),
10621
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode,
10622
10816
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10623
10817
  });
10624
10818
  }
@@ -10633,14 +10827,13 @@ var BsGoods = function BsGoods(props) {
10633
10827
  };
10634
10828
  setTableSelect(['2', '4'].includes(data.val));
10635
10829
  if (['1', '3'].includes(data.val)) {
10636
- var _valueRef$current3, _valueRef$current4;
10830
+ var _valueRef$current2;
10637
10831
  // console.log(
10638
10832
  // 'goods-reissueSelectListReturn',
10639
10833
  // valueRef?.current?.bsGoods,
10640
10834
  // );
10641
10835
  pubsub.publish('reissueSelectListReturn', {
10642
- list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current3 = valueRef.current) === null || _valueRef$current3 === void 0 ? void 0 : _valueRef$current3.bsGoods) || []),
10643
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current4 = valueRef.current) === null || _valueRef$current4 === void 0 ? void 0 : _valueRef$current4.shopCode,
10836
+ list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.bsGoods) || []),
10644
10837
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10645
10838
  });
10646
10839
  }
@@ -10655,10 +10848,9 @@ var BsGoods = function BsGoods(props) {
10655
10848
  };
10656
10849
  setTableSelect(['2', '4'].includes(data.val));
10657
10850
  if (['1', '3'].includes(data.val)) {
10658
- var _valueRef$current5, _valueRef$current6;
10851
+ var _valueRef$current3;
10659
10852
  pubsub.publish('returnSelectListReturn', {
10660
- list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current5 = valueRef.current) === null || _valueRef$current5 === void 0 ? void 0 : _valueRef$current5.bsGoods) || []),
10661
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current6 = valueRef.current) === null || _valueRef$current6 === void 0 ? void 0 : _valueRef$current6.shopCode,
10853
+ list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current3 = valueRef.current) === null || _valueRef$current3 === void 0 ? void 0 : _valueRef$current3.bsGoods) || []),
10662
10854
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10663
10855
  });
10664
10856
  }
@@ -10674,7 +10866,7 @@ var BsGoods = function BsGoods(props) {
10674
10866
  };
10675
10867
  }, [disabled]);
10676
10868
  var _onSelect = function onSelect(list) {
10677
- var _withInfo$current, _withInfo$current2, _valueRef$current7;
10869
+ var _withInfo$current, _withInfo$current2;
10678
10870
  if (disabled) return;
10679
10871
  var newList = cloneDeep(list);
10680
10872
  var typeMap = {
@@ -10690,7 +10882,6 @@ var BsGoods = function BsGoods(props) {
10690
10882
  item.canDelete = true;
10691
10883
  return item;
10692
10884
  }),
10693
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current7 = valueRef.current) === null || _valueRef$current7 === void 0 ? void 0 : _valueRef$current7.shopCode,
10694
10885
  goodValue: withInfo.current.goodValue
10695
10886
  });
10696
10887
  };
@@ -10768,7 +10959,6 @@ var BsExchange = function BsExchange(props) {
10768
10959
  if (disabled) return;
10769
10960
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10770
10961
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
10771
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode,
10772
10962
  bsExchangeReturnGoods: getListHandle(newDataList, valueRef.current)
10773
10963
  }));
10774
10964
  });
@@ -10779,7 +10969,6 @@ var BsExchange = function BsExchange(props) {
10779
10969
  var newValue = _objectSpread2({}, data.goodValue);
10780
10970
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10781
10971
  onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
10782
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode,
10783
10972
  bsExchangeReturnGoods: getListHandle(newDataList, newValue)
10784
10973
  }));
10785
10974
  });
@@ -10973,9 +11162,7 @@ var BsReissue = function BsReissue(props) {
10973
11162
  pubsub.subscribe('reissueSelectList', function (_, data) {
10974
11163
  // console.log('reissueSelectList', data);
10975
11164
  if (disabled) return;
10976
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
10977
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
10978
- });
11165
+ var newValue = _objectSpread2({}, data.goodValue);
10979
11166
  newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10980
11167
  item.money = 0;
10981
11168
  item.share = 0;
@@ -10989,9 +11176,7 @@ var BsReissue = function BsReissue(props) {
10989
11176
  pubsub.subscribe('reissueSelectListReturn', function (_, data) {
10990
11177
  // console.log('reissueSelectListReturn', data);
10991
11178
  if (disabled) return;
10992
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
10993
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
10994
- });
11179
+ var newValue = _objectSpread2({}, data.goodValue);
10995
11180
  newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10996
11181
  item.money = 0;
10997
11182
  item.share = 0;
@@ -11084,9 +11269,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11084
11269
  pubsub.subscribe('returnSelectList', function (_, data) {
11085
11270
  // console.log('returnSelectList', data);
11086
11271
  if (disabled) return;
11087
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
11088
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
11089
- });
11272
+ var newValue = _objectSpread2({}, data.goodValue);
11090
11273
  newValue.bsReturnGoods = (data === null || data === void 0 ? void 0 : data.list) || [];
11091
11274
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
11092
11275
  });
@@ -11095,9 +11278,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11095
11278
  pubsub.subscribe('returnSelectListReturn', function (_, data) {
11096
11279
  // console.log('returnSelectListReturn', data);
11097
11280
  if (disabled) return;
11098
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
11099
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
11100
- });
11281
+ var newValue = _objectSpread2({}, data.goodValue);
11101
11282
  newValue.bsReturnGoods = (data === null || data === void 0 ? void 0 : data.list) || [];
11102
11283
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
11103
11284
  });
@@ -12106,4 +12287,4 @@ var CalculationInput = function CalculationInput(props) {
12106
12287
  }, config === null || config === void 0 ? void 0 : config.unit));
12107
12288
  };
12108
12289
 
12109
- export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$1 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonSystemOrder$1 as CommonMultiStatus, CommonStatus, CommonSystemOrder, ExpressLogistics, Goods, index$2 as GoodsTable, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId, WlnGoods };
12290
+ export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$1 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonSystemOrder$1 as CommonMultiStatus, CommonStatus, CommonSystemOrder, ExpressLogistics, Goods, index$2 as GoodsTable, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId, WlnGoods };
package/dist/index.js CHANGED
@@ -9,8 +9,9 @@ var request = require('umi-request');
9
9
  var reactCopyToClipboard = require('react-copy-to-clipboard');
10
10
  var kmkfUtils = require('@kmkf-fe-packages/kmkf-utils');
11
11
  var zhCN = require('antd/lib/locale/zh_CN');
12
- var pubsub = require('pubsub-js');
13
12
  var lodash = require('lodash');
13
+ var ahooks = require('ahooks');
14
+ var pubsub = require('pubsub-js');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
17
 
@@ -9623,8 +9624,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
9623
9624
  };
9624
9625
 
9625
9626
  var LogisticsTrajectory = function LogisticsTrajectory(props) {
9626
- var options = props.options,
9627
- showField = props.showField,
9627
+ var showField = props.showField,
9628
9628
  _props$value = props.value,
9629
9629
  value = _props$value === void 0 ? {} : _props$value,
9630
9630
  disabled = props.disabled,
@@ -9755,6 +9755,201 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9755
9755
  return /*#__PURE__*/React__default['default'].createElement("div", null, LogisticsCompany(), LogisticsCode(), (value === null || value === void 0 ? void 0 : value.trajectoryCompany) === 'SF' ? LogisticsPhone() : null, showField && showField.includes('snapshot') ? /*#__PURE__*/React__default['default'].createElement(LogisticsSnapshot, null) : null);
9756
9756
  };
9757
9757
 
9758
+ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
9759
+ var showField = props.showField,
9760
+ _props$value = props.value,
9761
+ value = _props$value === void 0 ? [] : _props$value,
9762
+ disabled = props.disabled,
9763
+ onChange = props.onChange;
9764
+ var _useState = React.useState([]),
9765
+ _useState2 = _slicedToArray(_useState, 2),
9766
+ newValue = _useState2[0],
9767
+ setNewValue = _useState2[1];
9768
+ var _useState3 = React.useState(0),
9769
+ _useState4 = _slicedToArray(_useState3, 2),
9770
+ changeIndex = _useState4[0],
9771
+ setChangeIndex = _useState4[1];
9772
+ var _useState5 = React.useState([]),
9773
+ _useState6 = _slicedToArray(_useState5, 2),
9774
+ initValue = _useState6[0],
9775
+ setInitValue = _useState6[1];
9776
+ var _useState7 = React.useState([]),
9777
+ _useState8 = _slicedToArray(_useState7, 2),
9778
+ changeValue = _useState8[0],
9779
+ setChangeValue = _useState8[1];
9780
+ var firstRef = React.useRef(true);
9781
+ var hasSave = React.useRef(false);
9782
+ React.useEffect(function () {
9783
+ if (value.length && firstRef.current) {
9784
+ setInitValue(value);
9785
+ firstRef.current = false;
9786
+ }
9787
+ }, [value]);
9788
+ ahooks.useDebounceEffect(function () {
9789
+ initHandle({
9790
+ initValue: initValue,
9791
+ value: value
9792
+ });
9793
+ }, [initValue, value], {
9794
+ wait: 500
9795
+ });
9796
+ var initHandle = /*#__PURE__*/function () {
9797
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
9798
+ var initValue, value, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
9799
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9800
+ while (1) switch (_context.prev = _context.next) {
9801
+ case 0:
9802
+ initValue = _ref.initValue, value = _ref.value;
9803
+ initList = initValue.map(function (item) {
9804
+ if (item.trajectoryCompany === 'SF') {
9805
+ return {
9806
+ trajectoryCompany: item.trajectoryCompany,
9807
+ trajectoryCode: item.trajectoryCode,
9808
+ trajectoryPhone: item.trajectoryPhone
9809
+ };
9810
+ } else {
9811
+ return {
9812
+ trajectoryCompany: item.trajectoryCompany,
9813
+ trajectoryCode: item.trajectoryCode
9814
+ };
9815
+ }
9816
+ });
9817
+ valueList = value.map(function (item) {
9818
+ if (item.trajectoryCompany === 'SF') {
9819
+ return {
9820
+ trajectoryCompany: item.trajectoryCompany,
9821
+ trajectoryCode: item.trajectoryCode,
9822
+ trajectoryPhone: item.trajectoryPhone
9823
+ };
9824
+ } else {
9825
+ return {
9826
+ trajectoryCompany: item.trajectoryCompany,
9827
+ trajectoryCode: item.trajectoryCode
9828
+ };
9829
+ }
9830
+ });
9831
+ changeList = changeValue.map(function (item) {
9832
+ if (item.trajectoryCompany === 'SF') {
9833
+ return {
9834
+ trajectoryCompany: item.trajectoryCompany,
9835
+ trajectoryCode: item.trajectoryCode,
9836
+ trajectoryPhone: item.trajectoryPhone
9837
+ };
9838
+ } else {
9839
+ return {
9840
+ trajectoryCompany: item.trajectoryCompany,
9841
+ trajectoryCode: item.trajectoryCode
9842
+ };
9843
+ }
9844
+ }); // 1、初始值没有 传入值有请求快照
9845
+ // 2、初始值有 传入值有 其中有不一样的请求快照
9846
+ // 3、初始值有 传入值有 都一样的返回初始值
9847
+ console.log('list', initList, valueList, changeList);
9848
+ // console.log('old', initValue, value, changeValue);
9849
+ // console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
9850
+ // console.log(
9851
+ // '一样2',
9852
+ // JSON.stringify(changeList) !== JSON.stringify(valueList),
9853
+ // );
9854
+ if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
9855
+ _context.next = 11;
9856
+ break;
9857
+ }
9858
+ initSnapshotList = initValue.reduce(function (prv, next) {
9859
+ prv += next.trajectorySnapshot;
9860
+ return prv;
9861
+ }, '');
9862
+ valueSnapshotList = value.reduce(function (prv, next) {
9863
+ prv += next.trajectorySnapshot;
9864
+ return prv;
9865
+ }, '');
9866
+ if (initSnapshotList === valueSnapshotList) {
9867
+ hasSave.current = false;
9868
+ setNewValue(value);
9869
+ } else if (!hasSave.current) {
9870
+ hasSave.current = true;
9871
+ setNewValue(initValue);
9872
+ onChange(initValue);
9873
+ }
9874
+ _context.next = 24;
9875
+ break;
9876
+ case 11:
9877
+ if (!(JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
9878
+ _context.next = 24;
9879
+ break;
9880
+ }
9881
+ hasSave.current = false;
9882
+ hasValue = valueList.every(function (item) {
9883
+ return item.trajectoryCompany && item.trajectoryCode;
9884
+ });
9885
+ listValue = lodash.cloneDeep(value);
9886
+ if (!hasValue) {
9887
+ _context.next = 21;
9888
+ break;
9889
+ }
9890
+ requestList = valueList.map(function (item) {
9891
+ return extendRequest('/qy/logistics/logisticsTraceSearch', {
9892
+ method: 'post',
9893
+ data: {
9894
+ mailNo: item.trajectoryCode,
9895
+ cpCode: item.trajectoryCompany,
9896
+ mobile: item.trajectoryPhone
9897
+ }
9898
+ });
9899
+ });
9900
+ _context.next = 19;
9901
+ return Promise.allSettled(requestList);
9902
+ case 19:
9903
+ requestValues = _context.sent;
9904
+ listValue = lodash.cloneDeep(value).map(function (item, index) {
9905
+ var _requestValues$index, _requestValues$index$, _requestValues$index$2;
9906
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9907
+ trajectorySnapshot: (_requestValues$index = requestValues[index]) === null || _requestValues$index === void 0 ? void 0 : (_requestValues$index$ = _requestValues$index.value) === null || _requestValues$index$ === void 0 ? void 0 : (_requestValues$index$2 = _requestValues$index$.data) === null || _requestValues$index$2 === void 0 ? void 0 : _requestValues$index$2.logisticsStatusDesc
9908
+ });
9909
+ });
9910
+ case 21:
9911
+ setChangeValue(listValue);
9912
+ setNewValue(listValue);
9913
+ onChange(listValue);
9914
+ case 24:
9915
+ case "end":
9916
+ return _context.stop();
9917
+ }
9918
+ }, _callee);
9919
+ }));
9920
+ return function initHandle(_x) {
9921
+ return _ref2.apply(this, arguments);
9922
+ };
9923
+ }();
9924
+ var handleChange = function handleChange(val, index) {
9925
+ var newValue = lodash.cloneDeep(value);
9926
+ newValue.splice(index, 1, val);
9927
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
9928
+ setChangeValue(newValue);
9929
+ setNewValue(newValue);
9930
+ };
9931
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Space, {
9932
+ wrap: true
9933
+ }, (newValue || []).map(function (item, index) {
9934
+ return /*#__PURE__*/React__default['default'].createElement("span", {
9935
+ style: {
9936
+ color: changeIndex === index ? '#4569d4' : 'black',
9937
+ cursor: 'pointer'
9938
+ },
9939
+ onClick: function onClick() {
9940
+ return setChangeIndex(index);
9941
+ }
9942
+ }, "\u5305\u88F9".concat(index + 1));
9943
+ })), /*#__PURE__*/React__default['default'].createElement(LogisticsTrajectory, {
9944
+ value: newValue[changeIndex],
9945
+ showField: showField,
9946
+ disabled: disabled,
9947
+ onChange: function onChange(val) {
9948
+ return handleChange(val, changeIndex);
9949
+ }
9950
+ }));
9951
+ };
9952
+
9758
9953
  //组件类型的默认值
9759
9954
  var typeInitValueMap = {
9760
9955
  1: [{
@@ -10626,10 +10821,9 @@ var BsGoods = function BsGoods(props) {
10626
10821
  };
10627
10822
  setTableSelect(['2', '4'].includes(data.val));
10628
10823
  if (['1', '3'].includes(data.val)) {
10629
- var _valueRef$current, _valueRef$current2;
10824
+ var _valueRef$current;
10630
10825
  pubsub__default['default'].publish('selectListReturn', {
10631
10826
  list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.bsGoods) || []),
10632
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode,
10633
10827
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10634
10828
  });
10635
10829
  }
@@ -10644,14 +10838,13 @@ var BsGoods = function BsGoods(props) {
10644
10838
  };
10645
10839
  setTableSelect(['2', '4'].includes(data.val));
10646
10840
  if (['1', '3'].includes(data.val)) {
10647
- var _valueRef$current3, _valueRef$current4;
10841
+ var _valueRef$current2;
10648
10842
  // console.log(
10649
10843
  // 'goods-reissueSelectListReturn',
10650
10844
  // valueRef?.current?.bsGoods,
10651
10845
  // );
10652
10846
  pubsub__default['default'].publish('reissueSelectListReturn', {
10653
- list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current3 = valueRef.current) === null || _valueRef$current3 === void 0 ? void 0 : _valueRef$current3.bsGoods) || []),
10654
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current4 = valueRef.current) === null || _valueRef$current4 === void 0 ? void 0 : _valueRef$current4.shopCode,
10847
+ list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.bsGoods) || []),
10655
10848
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10656
10849
  });
10657
10850
  }
@@ -10666,10 +10859,9 @@ var BsGoods = function BsGoods(props) {
10666
10859
  };
10667
10860
  setTableSelect(['2', '4'].includes(data.val));
10668
10861
  if (['1', '3'].includes(data.val)) {
10669
- var _valueRef$current5, _valueRef$current6;
10862
+ var _valueRef$current3;
10670
10863
  pubsub__default['default'].publish('returnSelectListReturn', {
10671
- list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current5 = valueRef.current) === null || _valueRef$current5 === void 0 ? void 0 : _valueRef$current5.bsGoods) || []),
10672
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current6 = valueRef.current) === null || _valueRef$current6 === void 0 ? void 0 : _valueRef$current6.shopCode,
10864
+ list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current3 = valueRef.current) === null || _valueRef$current3 === void 0 ? void 0 : _valueRef$current3.bsGoods) || []),
10673
10865
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
10674
10866
  });
10675
10867
  }
@@ -10685,7 +10877,7 @@ var BsGoods = function BsGoods(props) {
10685
10877
  };
10686
10878
  }, [disabled]);
10687
10879
  var _onSelect = function onSelect(list) {
10688
- var _withInfo$current, _withInfo$current2, _valueRef$current7;
10880
+ var _withInfo$current, _withInfo$current2;
10689
10881
  if (disabled) return;
10690
10882
  var newList = lodash.cloneDeep(list);
10691
10883
  var typeMap = {
@@ -10701,7 +10893,6 @@ var BsGoods = function BsGoods(props) {
10701
10893
  item.canDelete = true;
10702
10894
  return item;
10703
10895
  }),
10704
- shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current7 = valueRef.current) === null || _valueRef$current7 === void 0 ? void 0 : _valueRef$current7.shopCode,
10705
10896
  goodValue: withInfo.current.goodValue
10706
10897
  });
10707
10898
  };
@@ -10779,7 +10970,6 @@ var BsExchange = function BsExchange(props) {
10779
10970
  if (disabled) return;
10780
10971
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10781
10972
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
10782
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode,
10783
10973
  bsExchangeReturnGoods: getListHandle(newDataList, valueRef.current)
10784
10974
  }));
10785
10975
  });
@@ -10790,7 +10980,6 @@ var BsExchange = function BsExchange(props) {
10790
10980
  var newValue = _objectSpread2({}, data.goodValue);
10791
10981
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10792
10982
  onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
10793
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode,
10794
10983
  bsExchangeReturnGoods: getListHandle(newDataList, newValue)
10795
10984
  }));
10796
10985
  });
@@ -10984,9 +11173,7 @@ var BsReissue = function BsReissue(props) {
10984
11173
  pubsub__default['default'].subscribe('reissueSelectList', function (_, data) {
10985
11174
  // console.log('reissueSelectList', data);
10986
11175
  if (disabled) return;
10987
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
10988
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
10989
- });
11176
+ var newValue = _objectSpread2({}, data.goodValue);
10990
11177
  newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10991
11178
  item.money = 0;
10992
11179
  item.share = 0;
@@ -11000,9 +11187,7 @@ var BsReissue = function BsReissue(props) {
11000
11187
  pubsub__default['default'].subscribe('reissueSelectListReturn', function (_, data) {
11001
11188
  // console.log('reissueSelectListReturn', data);
11002
11189
  if (disabled) return;
11003
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
11004
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
11005
- });
11190
+ var newValue = _objectSpread2({}, data.goodValue);
11006
11191
  newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
11007
11192
  item.money = 0;
11008
11193
  item.share = 0;
@@ -11095,9 +11280,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11095
11280
  pubsub__default['default'].subscribe('returnSelectList', function (_, data) {
11096
11281
  // console.log('returnSelectList', data);
11097
11282
  if (disabled) return;
11098
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
11099
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
11100
- });
11283
+ var newValue = _objectSpread2({}, data.goodValue);
11101
11284
  newValue.bsReturnGoods = (data === null || data === void 0 ? void 0 : data.list) || [];
11102
11285
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
11103
11286
  });
@@ -11106,9 +11289,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11106
11289
  pubsub__default['default'].subscribe('returnSelectListReturn', function (_, data) {
11107
11290
  // console.log('returnSelectListReturn', data);
11108
11291
  if (disabled) return;
11109
- var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
11110
- shopCode: data === null || data === void 0 ? void 0 : data.shopCode
11111
- });
11292
+ var newValue = _objectSpread2({}, data.goodValue);
11112
11293
  newValue.bsReturnGoods = (data === null || data === void 0 ? void 0 : data.list) || [];
11113
11294
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
11114
11295
  });
@@ -12156,6 +12337,7 @@ exports.Invoice = Invoice;
12156
12337
  exports.JstGoods = jstGoods;
12157
12338
  exports.JstItemList = ItemList;
12158
12339
  exports.LogisticsInterception = LogisticsInterception;
12340
+ exports.LogisticsMoreTrajectory = LogisticsMoreTrajectory;
12159
12341
  exports.LogisticsTrajectory = LogisticsTrajectory;
12160
12342
  exports.MsgStatus = MsgStatus;
12161
12343
  exports.ParseLogistics = ParseLogistics;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const LogisticsMoreTrajectory: (props: any) => React.JSX.Element;
3
+ export default LogisticsMoreTrajectory;
@@ -33,6 +33,7 @@ export { default as Status } from './business/Status';
33
33
  export { default as Payment } from './business/Payment';
34
34
  export { default as LogisticsInterception } from './business/LogisticsInterception';
35
35
  export { default as LogisticsTrajectory } from './business/LogisticsTrajectory';
36
+ export { default as LogisticsMoreTrajectory } from './business/LogisticsMoreTrajectory';
36
37
  export { default as Goods } from './common/Goods';
37
38
  export { default as JstGoods } from './jst/Goods';
38
39
  export { default as JstItemList } from './jst/ItemList';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.21.4",
3
+ "version": "0.21.6-alpha.3",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,8 @@
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": "^0.21.4",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.21.6-alpha.3",
24
+ "ahooks": "^3.7.8",
24
25
  "lodash": "^4.17.21",
25
26
  "pubsub-js": "^1.9.4",
26
27
  "react-copy-to-clipboard": "^5.1.0",
@@ -61,5 +62,5 @@
61
62
  "publishConfig": {
62
63
  "access": "public"
63
64
  },
64
- "gitHead": "510c76d8426f214eb5653d9e75a59fa44e318939"
65
+ "gitHead": "82b6320bc9ae14f532b5aa543d0e6040900c5d78"
65
66
  }