@kmkf-fe-packages/basic-components 0.23.0 → 0.24.0-alpha.0
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"];
|
|
@@ -9618,8 +9619,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
9618
9619
|
};
|
|
9619
9620
|
|
|
9620
9621
|
var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
9621
|
-
var
|
|
9622
|
-
showField = props.showField,
|
|
9622
|
+
var showField = props.showField,
|
|
9623
9623
|
_props$value = props.value,
|
|
9624
9624
|
value = _props$value === void 0 ? {} : _props$value,
|
|
9625
9625
|
disabled = props.disabled,
|
|
@@ -9750,6 +9750,220 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
|
9750
9750
|
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
9751
|
};
|
|
9752
9752
|
|
|
9753
|
+
var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
9754
|
+
var showField = props.showField,
|
|
9755
|
+
_props$value = props.value,
|
|
9756
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
9757
|
+
disabled = props.disabled,
|
|
9758
|
+
onChange = props.onChange;
|
|
9759
|
+
var _useState = useState([]),
|
|
9760
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9761
|
+
newValue = _useState2[0],
|
|
9762
|
+
setNewValue = _useState2[1];
|
|
9763
|
+
var _useState3 = useState(0),
|
|
9764
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
9765
|
+
changeIndex = _useState4[0],
|
|
9766
|
+
setChangeIndex = _useState4[1];
|
|
9767
|
+
var _useState5 = useState([]),
|
|
9768
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
9769
|
+
initValue = _useState6[0],
|
|
9770
|
+
setInitValue = _useState6[1];
|
|
9771
|
+
var _useState7 = useState([]),
|
|
9772
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
9773
|
+
changeValue = _useState8[0],
|
|
9774
|
+
setChangeValue = _useState8[1];
|
|
9775
|
+
var firstRef = useRef(true);
|
|
9776
|
+
var hasSave = useRef(false);
|
|
9777
|
+
useEffect(function () {
|
|
9778
|
+
if (value.length && firstRef.current) {
|
|
9779
|
+
setInitValue(value);
|
|
9780
|
+
firstRef.current = false;
|
|
9781
|
+
}
|
|
9782
|
+
}, [value]);
|
|
9783
|
+
useDebounceEffect(function () {
|
|
9784
|
+
initHandle({
|
|
9785
|
+
initValue: initValue,
|
|
9786
|
+
value: value
|
|
9787
|
+
});
|
|
9788
|
+
}, [initValue, value], {
|
|
9789
|
+
wait: 500
|
|
9790
|
+
});
|
|
9791
|
+
var initHandle = /*#__PURE__*/function () {
|
|
9792
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9793
|
+
var initValue, value, hasSnapshot, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9794
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9795
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9796
|
+
case 0:
|
|
9797
|
+
initValue = _ref.initValue, value = _ref.value;
|
|
9798
|
+
hasSnapshot = showField && showField.includes('snapshot');
|
|
9799
|
+
initList = initValue.map(function (item) {
|
|
9800
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9801
|
+
return {
|
|
9802
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9803
|
+
trajectoryCode: item.trajectoryCode,
|
|
9804
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9805
|
+
};
|
|
9806
|
+
} else {
|
|
9807
|
+
return {
|
|
9808
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9809
|
+
trajectoryCode: item.trajectoryCode
|
|
9810
|
+
};
|
|
9811
|
+
}
|
|
9812
|
+
});
|
|
9813
|
+
valueList = value.map(function (item) {
|
|
9814
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9815
|
+
return {
|
|
9816
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9817
|
+
trajectoryCode: item.trajectoryCode,
|
|
9818
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9819
|
+
};
|
|
9820
|
+
} else {
|
|
9821
|
+
return {
|
|
9822
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9823
|
+
trajectoryCode: item.trajectoryCode
|
|
9824
|
+
};
|
|
9825
|
+
}
|
|
9826
|
+
});
|
|
9827
|
+
changeList = changeValue.map(function (item) {
|
|
9828
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9829
|
+
return {
|
|
9830
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9831
|
+
trajectoryCode: item.trajectoryCode,
|
|
9832
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9833
|
+
};
|
|
9834
|
+
} else {
|
|
9835
|
+
return {
|
|
9836
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9837
|
+
trajectoryCode: item.trajectoryCode
|
|
9838
|
+
};
|
|
9839
|
+
}
|
|
9840
|
+
}); // 1、初始值没有 传入值有请求快照
|
|
9841
|
+
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9842
|
+
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9843
|
+
console.log('list', initList, valueList, changeList);
|
|
9844
|
+
// console.log('old', initValue, value, changeValue);
|
|
9845
|
+
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9846
|
+
// console.log(
|
|
9847
|
+
// '一样2',
|
|
9848
|
+
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9849
|
+
// );
|
|
9850
|
+
if (!(!initList.length && !valueList.length)) {
|
|
9851
|
+
_context.next = 8;
|
|
9852
|
+
break;
|
|
9853
|
+
}
|
|
9854
|
+
return _context.abrupt("return");
|
|
9855
|
+
case 8:
|
|
9856
|
+
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9857
|
+
_context.next = 14;
|
|
9858
|
+
break;
|
|
9859
|
+
}
|
|
9860
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9861
|
+
prv += next.trajectorySnapshot;
|
|
9862
|
+
return prv;
|
|
9863
|
+
}, '');
|
|
9864
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9865
|
+
prv += next.trajectorySnapshot;
|
|
9866
|
+
return prv;
|
|
9867
|
+
}, '');
|
|
9868
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9869
|
+
hasSave.current = false;
|
|
9870
|
+
setNewValue(value);
|
|
9871
|
+
} else if (!hasSave.current) {
|
|
9872
|
+
hasSave.current = true;
|
|
9873
|
+
setNewValue(initValue);
|
|
9874
|
+
onChange(initValue);
|
|
9875
|
+
}
|
|
9876
|
+
_context.next = 30;
|
|
9877
|
+
break;
|
|
9878
|
+
case 14:
|
|
9879
|
+
if (!(
|
|
9880
|
+
//开启了物流快照才会获取快照信息
|
|
9881
|
+
hasSnapshot && JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9882
|
+
_context.next = 29;
|
|
9883
|
+
break;
|
|
9884
|
+
}
|
|
9885
|
+
hasSave.current = false;
|
|
9886
|
+
hasValue = valueList.some(function (item) {
|
|
9887
|
+
return item.trajectoryCompany && item.trajectoryCode;
|
|
9888
|
+
});
|
|
9889
|
+
listValue = cloneDeep(value);
|
|
9890
|
+
if (!hasValue) {
|
|
9891
|
+
_context.next = 24;
|
|
9892
|
+
break;
|
|
9893
|
+
}
|
|
9894
|
+
requestList = valueList.map(function (item) {
|
|
9895
|
+
if (item.trajectoryCode && item.trajectoryCompany) {
|
|
9896
|
+
return extendRequest('/qy/logistics/logisticsTraceSearch', {
|
|
9897
|
+
method: 'post',
|
|
9898
|
+
data: {
|
|
9899
|
+
mailNo: item.trajectoryCode,
|
|
9900
|
+
cpCode: item.trajectoryCompany,
|
|
9901
|
+
mobile: item.trajectoryPhone
|
|
9902
|
+
}
|
|
9903
|
+
});
|
|
9904
|
+
} else {
|
|
9905
|
+
return new Promise(function (resolve) {
|
|
9906
|
+
resolve({});
|
|
9907
|
+
});
|
|
9908
|
+
}
|
|
9909
|
+
});
|
|
9910
|
+
_context.next = 22;
|
|
9911
|
+
return Promise.allSettled(requestList);
|
|
9912
|
+
case 22:
|
|
9913
|
+
requestValues = _context.sent;
|
|
9914
|
+
listValue = cloneDeep(value).map(function (item, index) {
|
|
9915
|
+
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
9916
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
9917
|
+
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
|
|
9918
|
+
});
|
|
9919
|
+
});
|
|
9920
|
+
case 24:
|
|
9921
|
+
setChangeValue(listValue);
|
|
9922
|
+
setNewValue(listValue);
|
|
9923
|
+
onChange(listValue);
|
|
9924
|
+
_context.next = 30;
|
|
9925
|
+
break;
|
|
9926
|
+
case 29:
|
|
9927
|
+
setNewValue(value);
|
|
9928
|
+
case 30:
|
|
9929
|
+
case "end":
|
|
9930
|
+
return _context.stop();
|
|
9931
|
+
}
|
|
9932
|
+
}, _callee);
|
|
9933
|
+
}));
|
|
9934
|
+
return function initHandle(_x) {
|
|
9935
|
+
return _ref2.apply(this, arguments);
|
|
9936
|
+
};
|
|
9937
|
+
}();
|
|
9938
|
+
var handleChange = function handleChange(val, index) {
|
|
9939
|
+
var newValue = cloneDeep(value);
|
|
9940
|
+
newValue.splice(index, 1, val);
|
|
9941
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
9942
|
+
setChangeValue(newValue);
|
|
9943
|
+
setNewValue(newValue);
|
|
9944
|
+
};
|
|
9945
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, {
|
|
9946
|
+
wrap: true
|
|
9947
|
+
}, (newValue || []).map(function (item, index) {
|
|
9948
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
9949
|
+
style: {
|
|
9950
|
+
color: changeIndex === index ? '#4569d4' : 'black',
|
|
9951
|
+
cursor: 'pointer'
|
|
9952
|
+
},
|
|
9953
|
+
onClick: function onClick() {
|
|
9954
|
+
return setChangeIndex(index);
|
|
9955
|
+
}
|
|
9956
|
+
}, "\u5305\u88F9".concat(index + 1));
|
|
9957
|
+
})), /*#__PURE__*/React.createElement(LogisticsTrajectory, {
|
|
9958
|
+
value: newValue[changeIndex],
|
|
9959
|
+
showField: showField,
|
|
9960
|
+
disabled: disabled,
|
|
9961
|
+
onChange: function onChange(val) {
|
|
9962
|
+
return handleChange(val, changeIndex);
|
|
9963
|
+
}
|
|
9964
|
+
}));
|
|
9965
|
+
};
|
|
9966
|
+
|
|
9753
9967
|
//组件类型的默认值
|
|
9754
9968
|
var typeInitValueMap = {
|
|
9755
9969
|
1: [{
|
|
@@ -12112,4 +12326,4 @@ var CalculationInput = function CalculationInput(props) {
|
|
|
12112
12326
|
}, config === null || config === void 0 ? void 0 : config.unit));
|
|
12113
12327
|
};
|
|
12114
12328
|
|
|
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 };
|
|
12329
|
+
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
|
|
|
@@ -9629,8 +9630,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
9629
9630
|
};
|
|
9630
9631
|
|
|
9631
9632
|
var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
9632
|
-
var
|
|
9633
|
-
showField = props.showField,
|
|
9633
|
+
var showField = props.showField,
|
|
9634
9634
|
_props$value = props.value,
|
|
9635
9635
|
value = _props$value === void 0 ? {} : _props$value,
|
|
9636
9636
|
disabled = props.disabled,
|
|
@@ -9761,6 +9761,220 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
|
|
|
9761
9761
|
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
9762
|
};
|
|
9763
9763
|
|
|
9764
|
+
var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
9765
|
+
var showField = props.showField,
|
|
9766
|
+
_props$value = props.value,
|
|
9767
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
9768
|
+
disabled = props.disabled,
|
|
9769
|
+
onChange = props.onChange;
|
|
9770
|
+
var _useState = React.useState([]),
|
|
9771
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9772
|
+
newValue = _useState2[0],
|
|
9773
|
+
setNewValue = _useState2[1];
|
|
9774
|
+
var _useState3 = React.useState(0),
|
|
9775
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
9776
|
+
changeIndex = _useState4[0],
|
|
9777
|
+
setChangeIndex = _useState4[1];
|
|
9778
|
+
var _useState5 = React.useState([]),
|
|
9779
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
9780
|
+
initValue = _useState6[0],
|
|
9781
|
+
setInitValue = _useState6[1];
|
|
9782
|
+
var _useState7 = React.useState([]),
|
|
9783
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
9784
|
+
changeValue = _useState8[0],
|
|
9785
|
+
setChangeValue = _useState8[1];
|
|
9786
|
+
var firstRef = React.useRef(true);
|
|
9787
|
+
var hasSave = React.useRef(false);
|
|
9788
|
+
React.useEffect(function () {
|
|
9789
|
+
if (value.length && firstRef.current) {
|
|
9790
|
+
setInitValue(value);
|
|
9791
|
+
firstRef.current = false;
|
|
9792
|
+
}
|
|
9793
|
+
}, [value]);
|
|
9794
|
+
ahooks.useDebounceEffect(function () {
|
|
9795
|
+
initHandle({
|
|
9796
|
+
initValue: initValue,
|
|
9797
|
+
value: value
|
|
9798
|
+
});
|
|
9799
|
+
}, [initValue, value], {
|
|
9800
|
+
wait: 500
|
|
9801
|
+
});
|
|
9802
|
+
var initHandle = /*#__PURE__*/function () {
|
|
9803
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9804
|
+
var initValue, value, hasSnapshot, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9805
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9806
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9807
|
+
case 0:
|
|
9808
|
+
initValue = _ref.initValue, value = _ref.value;
|
|
9809
|
+
hasSnapshot = showField && showField.includes('snapshot');
|
|
9810
|
+
initList = initValue.map(function (item) {
|
|
9811
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9812
|
+
return {
|
|
9813
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9814
|
+
trajectoryCode: item.trajectoryCode,
|
|
9815
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9816
|
+
};
|
|
9817
|
+
} else {
|
|
9818
|
+
return {
|
|
9819
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9820
|
+
trajectoryCode: item.trajectoryCode
|
|
9821
|
+
};
|
|
9822
|
+
}
|
|
9823
|
+
});
|
|
9824
|
+
valueList = value.map(function (item) {
|
|
9825
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9826
|
+
return {
|
|
9827
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9828
|
+
trajectoryCode: item.trajectoryCode,
|
|
9829
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9830
|
+
};
|
|
9831
|
+
} else {
|
|
9832
|
+
return {
|
|
9833
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9834
|
+
trajectoryCode: item.trajectoryCode
|
|
9835
|
+
};
|
|
9836
|
+
}
|
|
9837
|
+
});
|
|
9838
|
+
changeList = changeValue.map(function (item) {
|
|
9839
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9840
|
+
return {
|
|
9841
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9842
|
+
trajectoryCode: item.trajectoryCode,
|
|
9843
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9844
|
+
};
|
|
9845
|
+
} else {
|
|
9846
|
+
return {
|
|
9847
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9848
|
+
trajectoryCode: item.trajectoryCode
|
|
9849
|
+
};
|
|
9850
|
+
}
|
|
9851
|
+
}); // 1、初始值没有 传入值有请求快照
|
|
9852
|
+
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9853
|
+
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9854
|
+
console.log('list', initList, valueList, changeList);
|
|
9855
|
+
// console.log('old', initValue, value, changeValue);
|
|
9856
|
+
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9857
|
+
// console.log(
|
|
9858
|
+
// '一样2',
|
|
9859
|
+
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9860
|
+
// );
|
|
9861
|
+
if (!(!initList.length && !valueList.length)) {
|
|
9862
|
+
_context.next = 8;
|
|
9863
|
+
break;
|
|
9864
|
+
}
|
|
9865
|
+
return _context.abrupt("return");
|
|
9866
|
+
case 8:
|
|
9867
|
+
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9868
|
+
_context.next = 14;
|
|
9869
|
+
break;
|
|
9870
|
+
}
|
|
9871
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9872
|
+
prv += next.trajectorySnapshot;
|
|
9873
|
+
return prv;
|
|
9874
|
+
}, '');
|
|
9875
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9876
|
+
prv += next.trajectorySnapshot;
|
|
9877
|
+
return prv;
|
|
9878
|
+
}, '');
|
|
9879
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9880
|
+
hasSave.current = false;
|
|
9881
|
+
setNewValue(value);
|
|
9882
|
+
} else if (!hasSave.current) {
|
|
9883
|
+
hasSave.current = true;
|
|
9884
|
+
setNewValue(initValue);
|
|
9885
|
+
onChange(initValue);
|
|
9886
|
+
}
|
|
9887
|
+
_context.next = 30;
|
|
9888
|
+
break;
|
|
9889
|
+
case 14:
|
|
9890
|
+
if (!(
|
|
9891
|
+
//开启了物流快照才会获取快照信息
|
|
9892
|
+
hasSnapshot && JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9893
|
+
_context.next = 29;
|
|
9894
|
+
break;
|
|
9895
|
+
}
|
|
9896
|
+
hasSave.current = false;
|
|
9897
|
+
hasValue = valueList.some(function (item) {
|
|
9898
|
+
return item.trajectoryCompany && item.trajectoryCode;
|
|
9899
|
+
});
|
|
9900
|
+
listValue = lodash.cloneDeep(value);
|
|
9901
|
+
if (!hasValue) {
|
|
9902
|
+
_context.next = 24;
|
|
9903
|
+
break;
|
|
9904
|
+
}
|
|
9905
|
+
requestList = valueList.map(function (item) {
|
|
9906
|
+
if (item.trajectoryCode && item.trajectoryCompany) {
|
|
9907
|
+
return extendRequest('/qy/logistics/logisticsTraceSearch', {
|
|
9908
|
+
method: 'post',
|
|
9909
|
+
data: {
|
|
9910
|
+
mailNo: item.trajectoryCode,
|
|
9911
|
+
cpCode: item.trajectoryCompany,
|
|
9912
|
+
mobile: item.trajectoryPhone
|
|
9913
|
+
}
|
|
9914
|
+
});
|
|
9915
|
+
} else {
|
|
9916
|
+
return new Promise(function (resolve) {
|
|
9917
|
+
resolve({});
|
|
9918
|
+
});
|
|
9919
|
+
}
|
|
9920
|
+
});
|
|
9921
|
+
_context.next = 22;
|
|
9922
|
+
return Promise.allSettled(requestList);
|
|
9923
|
+
case 22:
|
|
9924
|
+
requestValues = _context.sent;
|
|
9925
|
+
listValue = lodash.cloneDeep(value).map(function (item, index) {
|
|
9926
|
+
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
9927
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
9928
|
+
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
|
|
9929
|
+
});
|
|
9930
|
+
});
|
|
9931
|
+
case 24:
|
|
9932
|
+
setChangeValue(listValue);
|
|
9933
|
+
setNewValue(listValue);
|
|
9934
|
+
onChange(listValue);
|
|
9935
|
+
_context.next = 30;
|
|
9936
|
+
break;
|
|
9937
|
+
case 29:
|
|
9938
|
+
setNewValue(value);
|
|
9939
|
+
case 30:
|
|
9940
|
+
case "end":
|
|
9941
|
+
return _context.stop();
|
|
9942
|
+
}
|
|
9943
|
+
}, _callee);
|
|
9944
|
+
}));
|
|
9945
|
+
return function initHandle(_x) {
|
|
9946
|
+
return _ref2.apply(this, arguments);
|
|
9947
|
+
};
|
|
9948
|
+
}();
|
|
9949
|
+
var handleChange = function handleChange(val, index) {
|
|
9950
|
+
var newValue = lodash.cloneDeep(value);
|
|
9951
|
+
newValue.splice(index, 1, val);
|
|
9952
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
9953
|
+
setChangeValue(newValue);
|
|
9954
|
+
setNewValue(newValue);
|
|
9955
|
+
};
|
|
9956
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Space, {
|
|
9957
|
+
wrap: true
|
|
9958
|
+
}, (newValue || []).map(function (item, index) {
|
|
9959
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
9960
|
+
style: {
|
|
9961
|
+
color: changeIndex === index ? '#4569d4' : 'black',
|
|
9962
|
+
cursor: 'pointer'
|
|
9963
|
+
},
|
|
9964
|
+
onClick: function onClick() {
|
|
9965
|
+
return setChangeIndex(index);
|
|
9966
|
+
}
|
|
9967
|
+
}, "\u5305\u88F9".concat(index + 1));
|
|
9968
|
+
})), /*#__PURE__*/React__default['default'].createElement(LogisticsTrajectory, {
|
|
9969
|
+
value: newValue[changeIndex],
|
|
9970
|
+
showField: showField,
|
|
9971
|
+
disabled: disabled,
|
|
9972
|
+
onChange: function onChange(val) {
|
|
9973
|
+
return handleChange(val, changeIndex);
|
|
9974
|
+
}
|
|
9975
|
+
}));
|
|
9976
|
+
};
|
|
9977
|
+
|
|
9764
9978
|
//组件类型的默认值
|
|
9765
9979
|
var typeInitValueMap = {
|
|
9766
9980
|
1: [{
|
|
@@ -12162,6 +12376,7 @@ exports.Invoice = Invoice;
|
|
|
12162
12376
|
exports.JstGoods = jstGoods;
|
|
12163
12377
|
exports.JstItemList = ItemList;
|
|
12164
12378
|
exports.LogisticsInterception = LogisticsInterception;
|
|
12379
|
+
exports.LogisticsMoreTrajectory = LogisticsMoreTrajectory;
|
|
12165
12380
|
exports.LogisticsTrajectory = LogisticsTrajectory;
|
|
12166
12381
|
exports.MsgStatus = MsgStatus;
|
|
12167
12382
|
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.0",
|
|
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": "3e66526d6aec8eda3092f7c721baef086729337b"
|
|
65
66
|
}
|