@kmkf-fe-packages/basic-components 0.23.0 → 0.24.0-alpha.1
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
|
@@ -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"];
|
|
@@ -7714,7 +7715,10 @@ var ShopNameSelect = function ShopNameSelect(props) {
|
|
|
7714
7715
|
function ApaasAddress(props) {
|
|
7715
7716
|
var value = props.value,
|
|
7716
7717
|
onChange = props.onChange,
|
|
7717
|
-
disabled = props.disabled
|
|
7718
|
+
disabled = props.disabled,
|
|
7719
|
+
_props$showIdentify = props.showIdentify,
|
|
7720
|
+
showIdentify = _props$showIdentify === void 0 ? true : _props$showIdentify,
|
|
7721
|
+
type = props.type;
|
|
7718
7722
|
var changeCity = function changeCity(city) {
|
|
7719
7723
|
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
|
|
7720
7724
|
address: city
|
|
@@ -7726,7 +7730,20 @@ function ApaasAddress(props) {
|
|
|
7726
7730
|
detail: e.target.value
|
|
7727
7731
|
});
|
|
7728
7732
|
};
|
|
7729
|
-
|
|
7733
|
+
var handleParseLogistics = function handleParseLogistics(val) {
|
|
7734
|
+
var params = {
|
|
7735
|
+
detail: val === null || val === void 0 ? void 0 : val.addressDetail,
|
|
7736
|
+
address: []
|
|
7737
|
+
};
|
|
7738
|
+
var addressData = type === 'bs' ? BsAddressData.getInstance() : AddressData.getInstance();
|
|
7739
|
+
if ((val === null || val === void 0 ? void 0 : val.province) && addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province)) {
|
|
7740
|
+
params.address = [addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.city), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
|
|
7741
|
+
}
|
|
7742
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(params);
|
|
7743
|
+
};
|
|
7744
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showIdentify && /*#__PURE__*/React.createElement(ParseLogistics, {
|
|
7745
|
+
onChange: handleParseLogistics
|
|
7746
|
+
}), /*#__PURE__*/React.createElement(Province, {
|
|
7730
7747
|
value: value === null || value === void 0 ? void 0 : value.address,
|
|
7731
7748
|
onChange: changeCity,
|
|
7732
7749
|
disabled: disabled
|
|
@@ -9618,8 +9635,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
9618
9635
|
};
|
|
9619
9636
|
|
|
9620
9637
|
var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
9621
|
-
var
|
|
9622
|
-
showField = props.showField,
|
|
9638
|
+
var showField = props.showField,
|
|
9623
9639
|
_props$value = props.value,
|
|
9624
9640
|
value = _props$value === void 0 ? {} : _props$value,
|
|
9625
9641
|
disabled = props.disabled,
|
|
@@ -9750,6 +9766,220 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
|
9750
9766
|
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);
|
|
9751
9767
|
};
|
|
9752
9768
|
|
|
9769
|
+
var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
9770
|
+
var showField = props.showField,
|
|
9771
|
+
_props$value = props.value,
|
|
9772
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
9773
|
+
disabled = props.disabled,
|
|
9774
|
+
onChange = props.onChange;
|
|
9775
|
+
var _useState = useState([]),
|
|
9776
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9777
|
+
newValue = _useState2[0],
|
|
9778
|
+
setNewValue = _useState2[1];
|
|
9779
|
+
var _useState3 = useState(0),
|
|
9780
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
9781
|
+
changeIndex = _useState4[0],
|
|
9782
|
+
setChangeIndex = _useState4[1];
|
|
9783
|
+
var _useState5 = useState([]),
|
|
9784
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
9785
|
+
initValue = _useState6[0],
|
|
9786
|
+
setInitValue = _useState6[1];
|
|
9787
|
+
var _useState7 = useState([]),
|
|
9788
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
9789
|
+
changeValue = _useState8[0],
|
|
9790
|
+
setChangeValue = _useState8[1];
|
|
9791
|
+
var firstRef = useRef(true);
|
|
9792
|
+
var hasSave = useRef(false);
|
|
9793
|
+
useEffect(function () {
|
|
9794
|
+
if (value.length && firstRef.current) {
|
|
9795
|
+
setInitValue(value);
|
|
9796
|
+
firstRef.current = false;
|
|
9797
|
+
}
|
|
9798
|
+
}, [value]);
|
|
9799
|
+
useDebounceEffect(function () {
|
|
9800
|
+
initHandle({
|
|
9801
|
+
initValue: initValue,
|
|
9802
|
+
value: value
|
|
9803
|
+
});
|
|
9804
|
+
}, [initValue, value], {
|
|
9805
|
+
wait: 500
|
|
9806
|
+
});
|
|
9807
|
+
var initHandle = /*#__PURE__*/function () {
|
|
9808
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9809
|
+
var initValue, value, hasSnapshot, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9810
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9811
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9812
|
+
case 0:
|
|
9813
|
+
initValue = _ref.initValue, value = _ref.value;
|
|
9814
|
+
hasSnapshot = showField && showField.includes('snapshot');
|
|
9815
|
+
initList = initValue.map(function (item) {
|
|
9816
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9817
|
+
return {
|
|
9818
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9819
|
+
trajectoryCode: item.trajectoryCode,
|
|
9820
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9821
|
+
};
|
|
9822
|
+
} else {
|
|
9823
|
+
return {
|
|
9824
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9825
|
+
trajectoryCode: item.trajectoryCode
|
|
9826
|
+
};
|
|
9827
|
+
}
|
|
9828
|
+
});
|
|
9829
|
+
valueList = value.map(function (item) {
|
|
9830
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9831
|
+
return {
|
|
9832
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9833
|
+
trajectoryCode: item.trajectoryCode,
|
|
9834
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9835
|
+
};
|
|
9836
|
+
} else {
|
|
9837
|
+
return {
|
|
9838
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9839
|
+
trajectoryCode: item.trajectoryCode
|
|
9840
|
+
};
|
|
9841
|
+
}
|
|
9842
|
+
});
|
|
9843
|
+
changeList = changeValue.map(function (item) {
|
|
9844
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9845
|
+
return {
|
|
9846
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9847
|
+
trajectoryCode: item.trajectoryCode,
|
|
9848
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9849
|
+
};
|
|
9850
|
+
} else {
|
|
9851
|
+
return {
|
|
9852
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9853
|
+
trajectoryCode: item.trajectoryCode
|
|
9854
|
+
};
|
|
9855
|
+
}
|
|
9856
|
+
}); // 1、初始值没有 传入值有请求快照
|
|
9857
|
+
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9858
|
+
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9859
|
+
console.log('list', initList, valueList, changeList);
|
|
9860
|
+
// console.log('old', initValue, value, changeValue);
|
|
9861
|
+
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9862
|
+
// console.log(
|
|
9863
|
+
// '一样2',
|
|
9864
|
+
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9865
|
+
// );
|
|
9866
|
+
if (!(!initList.length && !valueList.length)) {
|
|
9867
|
+
_context.next = 8;
|
|
9868
|
+
break;
|
|
9869
|
+
}
|
|
9870
|
+
return _context.abrupt("return");
|
|
9871
|
+
case 8:
|
|
9872
|
+
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9873
|
+
_context.next = 14;
|
|
9874
|
+
break;
|
|
9875
|
+
}
|
|
9876
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9877
|
+
prv += next.trajectorySnapshot;
|
|
9878
|
+
return prv;
|
|
9879
|
+
}, '');
|
|
9880
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9881
|
+
prv += next.trajectorySnapshot;
|
|
9882
|
+
return prv;
|
|
9883
|
+
}, '');
|
|
9884
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9885
|
+
hasSave.current = false;
|
|
9886
|
+
setNewValue(value);
|
|
9887
|
+
} else if (!hasSave.current) {
|
|
9888
|
+
hasSave.current = true;
|
|
9889
|
+
setNewValue(initValue);
|
|
9890
|
+
onChange(initValue);
|
|
9891
|
+
}
|
|
9892
|
+
_context.next = 30;
|
|
9893
|
+
break;
|
|
9894
|
+
case 14:
|
|
9895
|
+
if (!(
|
|
9896
|
+
//开启了物流快照才会获取快照信息
|
|
9897
|
+
hasSnapshot && JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9898
|
+
_context.next = 29;
|
|
9899
|
+
break;
|
|
9900
|
+
}
|
|
9901
|
+
hasSave.current = false;
|
|
9902
|
+
hasValue = valueList.some(function (item) {
|
|
9903
|
+
return item.trajectoryCompany && item.trajectoryCode;
|
|
9904
|
+
});
|
|
9905
|
+
listValue = cloneDeep(value);
|
|
9906
|
+
if (!hasValue) {
|
|
9907
|
+
_context.next = 24;
|
|
9908
|
+
break;
|
|
9909
|
+
}
|
|
9910
|
+
requestList = valueList.map(function (item) {
|
|
9911
|
+
if (item.trajectoryCode && item.trajectoryCompany) {
|
|
9912
|
+
return extendRequest('/qy/logistics/logisticsTraceSearch', {
|
|
9913
|
+
method: 'post',
|
|
9914
|
+
data: {
|
|
9915
|
+
mailNo: item.trajectoryCode,
|
|
9916
|
+
cpCode: item.trajectoryCompany,
|
|
9917
|
+
mobile: item.trajectoryPhone
|
|
9918
|
+
}
|
|
9919
|
+
});
|
|
9920
|
+
} else {
|
|
9921
|
+
return new Promise(function (resolve) {
|
|
9922
|
+
resolve({});
|
|
9923
|
+
});
|
|
9924
|
+
}
|
|
9925
|
+
});
|
|
9926
|
+
_context.next = 22;
|
|
9927
|
+
return Promise.allSettled(requestList);
|
|
9928
|
+
case 22:
|
|
9929
|
+
requestValues = _context.sent;
|
|
9930
|
+
listValue = cloneDeep(value).map(function (item, index) {
|
|
9931
|
+
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
9932
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
9933
|
+
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
|
|
9934
|
+
});
|
|
9935
|
+
});
|
|
9936
|
+
case 24:
|
|
9937
|
+
setChangeValue(listValue);
|
|
9938
|
+
setNewValue(listValue);
|
|
9939
|
+
onChange(listValue);
|
|
9940
|
+
_context.next = 30;
|
|
9941
|
+
break;
|
|
9942
|
+
case 29:
|
|
9943
|
+
setNewValue(value);
|
|
9944
|
+
case 30:
|
|
9945
|
+
case "end":
|
|
9946
|
+
return _context.stop();
|
|
9947
|
+
}
|
|
9948
|
+
}, _callee);
|
|
9949
|
+
}));
|
|
9950
|
+
return function initHandle(_x) {
|
|
9951
|
+
return _ref2.apply(this, arguments);
|
|
9952
|
+
};
|
|
9953
|
+
}();
|
|
9954
|
+
var handleChange = function handleChange(val, index) {
|
|
9955
|
+
var newValue = cloneDeep(value);
|
|
9956
|
+
newValue.splice(index, 1, val);
|
|
9957
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
9958
|
+
setChangeValue(newValue);
|
|
9959
|
+
setNewValue(newValue);
|
|
9960
|
+
};
|
|
9961
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, {
|
|
9962
|
+
wrap: true
|
|
9963
|
+
}, (newValue || []).map(function (item, index) {
|
|
9964
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
9965
|
+
style: {
|
|
9966
|
+
color: changeIndex === index ? '#4569d4' : 'black',
|
|
9967
|
+
cursor: 'pointer'
|
|
9968
|
+
},
|
|
9969
|
+
onClick: function onClick() {
|
|
9970
|
+
return setChangeIndex(index);
|
|
9971
|
+
}
|
|
9972
|
+
}, "\u5305\u88F9".concat(index + 1));
|
|
9973
|
+
})), /*#__PURE__*/React.createElement(LogisticsTrajectory, {
|
|
9974
|
+
value: newValue[changeIndex],
|
|
9975
|
+
showField: showField,
|
|
9976
|
+
disabled: disabled,
|
|
9977
|
+
onChange: function onChange(val) {
|
|
9978
|
+
return handleChange(val, changeIndex);
|
|
9979
|
+
}
|
|
9980
|
+
}));
|
|
9981
|
+
};
|
|
9982
|
+
|
|
9753
9983
|
//组件类型的默认值
|
|
9754
9984
|
var typeInitValueMap = {
|
|
9755
9985
|
1: [{
|
|
@@ -12112,4 +12342,4 @@ var CalculationInput = function CalculationInput(props) {
|
|
|
12112
12342
|
}, config === null || config === void 0 ? void 0 : config.unit));
|
|
12113
12343
|
};
|
|
12114
12344
|
|
|
12115
|
-
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 };
|
|
12345
|
+
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
|
|
|
@@ -7725,7 +7726,10 @@ var ShopNameSelect = function ShopNameSelect(props) {
|
|
|
7725
7726
|
function ApaasAddress(props) {
|
|
7726
7727
|
var value = props.value,
|
|
7727
7728
|
onChange = props.onChange,
|
|
7728
|
-
disabled = props.disabled
|
|
7729
|
+
disabled = props.disabled,
|
|
7730
|
+
_props$showIdentify = props.showIdentify,
|
|
7731
|
+
showIdentify = _props$showIdentify === void 0 ? true : _props$showIdentify,
|
|
7732
|
+
type = props.type;
|
|
7729
7733
|
var changeCity = function changeCity(city) {
|
|
7730
7734
|
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
|
|
7731
7735
|
address: city
|
|
@@ -7737,7 +7741,20 @@ function ApaasAddress(props) {
|
|
|
7737
7741
|
detail: e.target.value
|
|
7738
7742
|
});
|
|
7739
7743
|
};
|
|
7740
|
-
|
|
7744
|
+
var handleParseLogistics = function handleParseLogistics(val) {
|
|
7745
|
+
var params = {
|
|
7746
|
+
detail: val === null || val === void 0 ? void 0 : val.addressDetail,
|
|
7747
|
+
address: []
|
|
7748
|
+
};
|
|
7749
|
+
var addressData = type === 'bs' ? kmkfUtils.BsAddressData.getInstance() : kmkfUtils.AddressData.getInstance();
|
|
7750
|
+
if ((val === null || val === void 0 ? void 0 : val.province) && addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province)) {
|
|
7751
|
+
params.address = [addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.city), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
|
|
7752
|
+
}
|
|
7753
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(params);
|
|
7754
|
+
};
|
|
7755
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !disabled && showIdentify && /*#__PURE__*/React__default['default'].createElement(ParseLogistics, {
|
|
7756
|
+
onChange: handleParseLogistics
|
|
7757
|
+
}), /*#__PURE__*/React__default['default'].createElement(Province, {
|
|
7741
7758
|
value: value === null || value === void 0 ? void 0 : value.address,
|
|
7742
7759
|
onChange: changeCity,
|
|
7743
7760
|
disabled: disabled
|
|
@@ -9629,8 +9646,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
9629
9646
|
};
|
|
9630
9647
|
|
|
9631
9648
|
var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
9632
|
-
var
|
|
9633
|
-
showField = props.showField,
|
|
9649
|
+
var showField = props.showField,
|
|
9634
9650
|
_props$value = props.value,
|
|
9635
9651
|
value = _props$value === void 0 ? {} : _props$value,
|
|
9636
9652
|
disabled = props.disabled,
|
|
@@ -9761,6 +9777,220 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
|
9761
9777
|
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);
|
|
9762
9778
|
};
|
|
9763
9779
|
|
|
9780
|
+
var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
9781
|
+
var showField = props.showField,
|
|
9782
|
+
_props$value = props.value,
|
|
9783
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
9784
|
+
disabled = props.disabled,
|
|
9785
|
+
onChange = props.onChange;
|
|
9786
|
+
var _useState = React.useState([]),
|
|
9787
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9788
|
+
newValue = _useState2[0],
|
|
9789
|
+
setNewValue = _useState2[1];
|
|
9790
|
+
var _useState3 = React.useState(0),
|
|
9791
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
9792
|
+
changeIndex = _useState4[0],
|
|
9793
|
+
setChangeIndex = _useState4[1];
|
|
9794
|
+
var _useState5 = React.useState([]),
|
|
9795
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
9796
|
+
initValue = _useState6[0],
|
|
9797
|
+
setInitValue = _useState6[1];
|
|
9798
|
+
var _useState7 = React.useState([]),
|
|
9799
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
9800
|
+
changeValue = _useState8[0],
|
|
9801
|
+
setChangeValue = _useState8[1];
|
|
9802
|
+
var firstRef = React.useRef(true);
|
|
9803
|
+
var hasSave = React.useRef(false);
|
|
9804
|
+
React.useEffect(function () {
|
|
9805
|
+
if (value.length && firstRef.current) {
|
|
9806
|
+
setInitValue(value);
|
|
9807
|
+
firstRef.current = false;
|
|
9808
|
+
}
|
|
9809
|
+
}, [value]);
|
|
9810
|
+
ahooks.useDebounceEffect(function () {
|
|
9811
|
+
initHandle({
|
|
9812
|
+
initValue: initValue,
|
|
9813
|
+
value: value
|
|
9814
|
+
});
|
|
9815
|
+
}, [initValue, value], {
|
|
9816
|
+
wait: 500
|
|
9817
|
+
});
|
|
9818
|
+
var initHandle = /*#__PURE__*/function () {
|
|
9819
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9820
|
+
var initValue, value, hasSnapshot, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9821
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9822
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9823
|
+
case 0:
|
|
9824
|
+
initValue = _ref.initValue, value = _ref.value;
|
|
9825
|
+
hasSnapshot = showField && showField.includes('snapshot');
|
|
9826
|
+
initList = initValue.map(function (item) {
|
|
9827
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9828
|
+
return {
|
|
9829
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9830
|
+
trajectoryCode: item.trajectoryCode,
|
|
9831
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9832
|
+
};
|
|
9833
|
+
} else {
|
|
9834
|
+
return {
|
|
9835
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9836
|
+
trajectoryCode: item.trajectoryCode
|
|
9837
|
+
};
|
|
9838
|
+
}
|
|
9839
|
+
});
|
|
9840
|
+
valueList = value.map(function (item) {
|
|
9841
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9842
|
+
return {
|
|
9843
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9844
|
+
trajectoryCode: item.trajectoryCode,
|
|
9845
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9846
|
+
};
|
|
9847
|
+
} else {
|
|
9848
|
+
return {
|
|
9849
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9850
|
+
trajectoryCode: item.trajectoryCode
|
|
9851
|
+
};
|
|
9852
|
+
}
|
|
9853
|
+
});
|
|
9854
|
+
changeList = changeValue.map(function (item) {
|
|
9855
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9856
|
+
return {
|
|
9857
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9858
|
+
trajectoryCode: item.trajectoryCode,
|
|
9859
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9860
|
+
};
|
|
9861
|
+
} else {
|
|
9862
|
+
return {
|
|
9863
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9864
|
+
trajectoryCode: item.trajectoryCode
|
|
9865
|
+
};
|
|
9866
|
+
}
|
|
9867
|
+
}); // 1、初始值没有 传入值有请求快照
|
|
9868
|
+
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9869
|
+
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9870
|
+
console.log('list', initList, valueList, changeList);
|
|
9871
|
+
// console.log('old', initValue, value, changeValue);
|
|
9872
|
+
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9873
|
+
// console.log(
|
|
9874
|
+
// '一样2',
|
|
9875
|
+
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9876
|
+
// );
|
|
9877
|
+
if (!(!initList.length && !valueList.length)) {
|
|
9878
|
+
_context.next = 8;
|
|
9879
|
+
break;
|
|
9880
|
+
}
|
|
9881
|
+
return _context.abrupt("return");
|
|
9882
|
+
case 8:
|
|
9883
|
+
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9884
|
+
_context.next = 14;
|
|
9885
|
+
break;
|
|
9886
|
+
}
|
|
9887
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9888
|
+
prv += next.trajectorySnapshot;
|
|
9889
|
+
return prv;
|
|
9890
|
+
}, '');
|
|
9891
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9892
|
+
prv += next.trajectorySnapshot;
|
|
9893
|
+
return prv;
|
|
9894
|
+
}, '');
|
|
9895
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9896
|
+
hasSave.current = false;
|
|
9897
|
+
setNewValue(value);
|
|
9898
|
+
} else if (!hasSave.current) {
|
|
9899
|
+
hasSave.current = true;
|
|
9900
|
+
setNewValue(initValue);
|
|
9901
|
+
onChange(initValue);
|
|
9902
|
+
}
|
|
9903
|
+
_context.next = 30;
|
|
9904
|
+
break;
|
|
9905
|
+
case 14:
|
|
9906
|
+
if (!(
|
|
9907
|
+
//开启了物流快照才会获取快照信息
|
|
9908
|
+
hasSnapshot && JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9909
|
+
_context.next = 29;
|
|
9910
|
+
break;
|
|
9911
|
+
}
|
|
9912
|
+
hasSave.current = false;
|
|
9913
|
+
hasValue = valueList.some(function (item) {
|
|
9914
|
+
return item.trajectoryCompany && item.trajectoryCode;
|
|
9915
|
+
});
|
|
9916
|
+
listValue = lodash.cloneDeep(value);
|
|
9917
|
+
if (!hasValue) {
|
|
9918
|
+
_context.next = 24;
|
|
9919
|
+
break;
|
|
9920
|
+
}
|
|
9921
|
+
requestList = valueList.map(function (item) {
|
|
9922
|
+
if (item.trajectoryCode && item.trajectoryCompany) {
|
|
9923
|
+
return extendRequest('/qy/logistics/logisticsTraceSearch', {
|
|
9924
|
+
method: 'post',
|
|
9925
|
+
data: {
|
|
9926
|
+
mailNo: item.trajectoryCode,
|
|
9927
|
+
cpCode: item.trajectoryCompany,
|
|
9928
|
+
mobile: item.trajectoryPhone
|
|
9929
|
+
}
|
|
9930
|
+
});
|
|
9931
|
+
} else {
|
|
9932
|
+
return new Promise(function (resolve) {
|
|
9933
|
+
resolve({});
|
|
9934
|
+
});
|
|
9935
|
+
}
|
|
9936
|
+
});
|
|
9937
|
+
_context.next = 22;
|
|
9938
|
+
return Promise.allSettled(requestList);
|
|
9939
|
+
case 22:
|
|
9940
|
+
requestValues = _context.sent;
|
|
9941
|
+
listValue = lodash.cloneDeep(value).map(function (item, index) {
|
|
9942
|
+
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
9943
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
9944
|
+
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
|
|
9945
|
+
});
|
|
9946
|
+
});
|
|
9947
|
+
case 24:
|
|
9948
|
+
setChangeValue(listValue);
|
|
9949
|
+
setNewValue(listValue);
|
|
9950
|
+
onChange(listValue);
|
|
9951
|
+
_context.next = 30;
|
|
9952
|
+
break;
|
|
9953
|
+
case 29:
|
|
9954
|
+
setNewValue(value);
|
|
9955
|
+
case 30:
|
|
9956
|
+
case "end":
|
|
9957
|
+
return _context.stop();
|
|
9958
|
+
}
|
|
9959
|
+
}, _callee);
|
|
9960
|
+
}));
|
|
9961
|
+
return function initHandle(_x) {
|
|
9962
|
+
return _ref2.apply(this, arguments);
|
|
9963
|
+
};
|
|
9964
|
+
}();
|
|
9965
|
+
var handleChange = function handleChange(val, index) {
|
|
9966
|
+
var newValue = lodash.cloneDeep(value);
|
|
9967
|
+
newValue.splice(index, 1, val);
|
|
9968
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
9969
|
+
setChangeValue(newValue);
|
|
9970
|
+
setNewValue(newValue);
|
|
9971
|
+
};
|
|
9972
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Space, {
|
|
9973
|
+
wrap: true
|
|
9974
|
+
}, (newValue || []).map(function (item, index) {
|
|
9975
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
9976
|
+
style: {
|
|
9977
|
+
color: changeIndex === index ? '#4569d4' : 'black',
|
|
9978
|
+
cursor: 'pointer'
|
|
9979
|
+
},
|
|
9980
|
+
onClick: function onClick() {
|
|
9981
|
+
return setChangeIndex(index);
|
|
9982
|
+
}
|
|
9983
|
+
}, "\u5305\u88F9".concat(index + 1));
|
|
9984
|
+
})), /*#__PURE__*/React__default['default'].createElement(LogisticsTrajectory, {
|
|
9985
|
+
value: newValue[changeIndex],
|
|
9986
|
+
showField: showField,
|
|
9987
|
+
disabled: disabled,
|
|
9988
|
+
onChange: function onChange(val) {
|
|
9989
|
+
return handleChange(val, changeIndex);
|
|
9990
|
+
}
|
|
9991
|
+
}));
|
|
9992
|
+
};
|
|
9993
|
+
|
|
9764
9994
|
//组件类型的默认值
|
|
9765
9995
|
var typeInitValueMap = {
|
|
9766
9996
|
1: [{
|
|
@@ -12162,6 +12392,7 @@ exports.Invoice = Invoice;
|
|
|
12162
12392
|
exports.JstGoods = jstGoods;
|
|
12163
12393
|
exports.JstItemList = ItemList;
|
|
12164
12394
|
exports.LogisticsInterception = LogisticsInterception;
|
|
12395
|
+
exports.LogisticsMoreTrajectory = LogisticsMoreTrajectory;
|
|
12165
12396
|
exports.LogisticsTrajectory = LogisticsTrajectory;
|
|
12166
12397
|
exports.MsgStatus = MsgStatus;
|
|
12167
12398
|
exports.ParseLogistics = ParseLogistics;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.24.0-alpha.1",
|
|
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.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.24.0-alpha.0",
|
|
24
|
+
"ahooks": "^3.7.4",
|
|
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": "
|
|
65
|
+
"gitHead": "265ad70e00afb81994f410ebe9bd77fb57b520b6"
|
|
65
66
|
}
|