@kmkf-fe-packages/basic-components 0.7.1-alpha.0 → 0.7.1-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
@@ -3101,7 +3101,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
3101
3101
  _props$disabled = props.disabled,
3102
3102
  disabled = _props$disabled === void 0 ? false : _props$disabled;
3103
3103
  var changeHandle = function changeHandle(val, type) {
3104
- onChange === null || onChange === void 0 ? void 0 : onChange(val, type);
3104
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val)));
3105
3105
  };
3106
3106
  var handleParseLogistics = function handleParseLogistics(val) {
3107
3107
  var params = {
@@ -3150,6 +3150,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
3150
3150
 
3151
3151
  var Item = Form.Item;
3152
3152
  var LogisticsAddress = LogisticsAddressData.getInstance();
3153
+ var address$1 = AddressData.getInstance();
3153
3154
  var LogisticsInterception = function LogisticsInterception(props) {
3154
3155
  var _props$value = props.value,
3155
3156
  value = _props$value === void 0 ? {} : _props$value,
@@ -3157,8 +3158,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3157
3158
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3158
3159
  _props$expressInterce = props.expressInterceptData,
3159
3160
  expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3160
- _props$logisticsAddre = props.logisticsAddressData,
3161
- logisticsAddressData = _props$logisticsAddre === void 0 ? [] : _props$logisticsAddre,
3162
3161
  _props$required = props.required,
3163
3162
  required = _props$required === void 0 ? false : _props$required,
3164
3163
  onChange = props.onChange,
@@ -3184,7 +3183,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3184
3183
  setIsInterface = _useState8[1];
3185
3184
  var firstIn = useRef(true);
3186
3185
  useEffect(function () {
3187
- AddressData.getInstance();
3188
3186
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3189
3187
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3190
3188
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3261,11 +3259,25 @@ var LogisticsInterception = function LogisticsInterception(props) {
3261
3259
  });
3262
3260
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3263
3261
  }, [isEditing, initCompany]);
3262
+ //退回地址列表
3264
3263
  var logisticsAddressOptions = useMemo(function () {
3265
- return logisticsAddressData.filter(function (item) {
3264
+ return ((LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getAddressData()) || []).filter(function (item) {
3266
3265
  return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3267
3266
  });
3268
3267
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3268
+ var returnValue = useMemo(function () {
3269
+ var _value$interceptAddre, _value$interceptAddre2, _value$interceptAddre3;
3270
+ var uk = LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getUkByInfo({
3271
+ cpCode: (value === null || value === void 0 ? void 0 : value.interceptCompany) || '',
3272
+ province: value === null || value === void 0 ? void 0 : (_value$interceptAddre = value.interceptAddress) === null || _value$interceptAddre === void 0 ? void 0 : _value$interceptAddre[0],
3273
+ city: value === null || value === void 0 ? void 0 : (_value$interceptAddre2 = value.interceptAddress) === null || _value$interceptAddre2 === void 0 ? void 0 : _value$interceptAddre2[1],
3274
+ district: value === null || value === void 0 ? void 0 : (_value$interceptAddre3 = value.interceptAddress) === null || _value$interceptAddre3 === void 0 ? void 0 : _value$interceptAddre3[2],
3275
+ detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3276
+ userName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3277
+ mobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3278
+ });
3279
+ return uk;
3280
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, value === null || value === void 0 ? void 0 : value.interceptAddress]);
3269
3281
  //选择回调
3270
3282
  var changeHandle = function changeHandle(val, type) {
3271
3283
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
@@ -3273,13 +3285,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3273
3285
  var interceptCompany = expressInterceptData.find(function (item) {
3274
3286
  return item.value === val;
3275
3287
  });
3276
- var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3288
+ var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3277
3289
  var _item$config3;
3278
3290
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3279
3291
  });
3280
3292
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3281
3293
  interceptCompany: val,
3282
- interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3294
+ interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3283
3295
  interceptSenderMobile: undefined,
3284
3296
  interceptAddress: [],
3285
3297
  interceptDetail: undefined,
@@ -3292,31 +3304,20 @@ var LogisticsInterception = function LogisticsInterception(props) {
3292
3304
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3293
3305
  };
3294
3306
  //智能识别回调
3295
- var changeIdentify = function changeIdentify(val, type) {
3296
- //输入返填
3297
- if (type) {
3298
- var typeMap = {
3299
- address: 'interceptAddress',
3300
- detail: 'interceptDetail',
3301
- receiverName: 'interceptReceiverName',
3302
- receiverMobile: 'interceptReceiverMobile'
3303
- };
3304
- var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, typeMap[type], val));
3305
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3306
- } else {
3307
- //智能识别返填
3308
- var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3309
- interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3310
- interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3311
- interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3312
- interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3313
- });
3314
- onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3315
- }
3307
+ var changeIdentify = function changeIdentify(val) {
3308
+ //智能识别返填
3309
+ var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3310
+ interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3311
+ interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3312
+ interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3313
+ interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3314
+ });
3315
+ onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3316
3316
  };
3317
3317
  //选择退回地址
3318
3318
  var changeReturnAddress = function changeReturnAddress(uk) {
3319
3319
  var item = LogisticsAddress.getItemByUk(uk);
3320
+ console.log(item);
3320
3321
  if (item) {
3321
3322
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3322
3323
  interceptAddress: [item === null || item === void 0 ? void 0 : item.province, item === null || item === void 0 ? void 0 : item.city, item === null || item === void 0 ? void 0 : item.district],
@@ -3389,9 +3390,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3389
3390
  key: 'returnAddress',
3390
3391
  hidden: !showReturnAddress
3391
3392
  }, /*#__PURE__*/React.createElement(Select, {
3392
- options: logisticsAddressOptions,
3393
- onChange: changeReturnAddress
3394
- })), /*#__PURE__*/React.createElement(Item, {
3393
+ disabled: disabled || isEdit,
3394
+ value: returnValue,
3395
+ onChange: changeReturnAddress,
3396
+ placeholder: "\u8BF7\u9009\u62E9\u9000\u56DE\u5730\u5740"
3397
+ }, logisticsAddressOptions.map(function (item) {
3398
+ return /*#__PURE__*/React.createElement(Select.Option, {
3399
+ key: item.uk,
3400
+ value: item.uk
3401
+ }, "".concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.province) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.city) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.district) || '').concat(item.detail, " ").concat(item === null || item === void 0 ? void 0 : item.userName, ":").concat(item === null || item === void 0 ? void 0 : item.mobile));
3402
+ }))), /*#__PURE__*/React.createElement(Item, {
3395
3403
  label: '派送地址',
3396
3404
  required: true,
3397
3405
  key: 'newAddress',
package/dist/index.js CHANGED
@@ -3111,7 +3111,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
3111
3111
  _props$disabled = props.disabled,
3112
3112
  disabled = _props$disabled === void 0 ? false : _props$disabled;
3113
3113
  var changeHandle = function changeHandle(val, type) {
3114
- onChange === null || onChange === void 0 ? void 0 : onChange(val, type);
3114
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val)));
3115
3115
  };
3116
3116
  var handleParseLogistics = function handleParseLogistics(val) {
3117
3117
  var params = {
@@ -3160,6 +3160,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
3160
3160
 
3161
3161
  var Item = antd.Form.Item;
3162
3162
  var LogisticsAddress = kmkfUtils.LogisticsAddressData.getInstance();
3163
+ var address$1 = kmkfUtils.AddressData.getInstance();
3163
3164
  var LogisticsInterception = function LogisticsInterception(props) {
3164
3165
  var _props$value = props.value,
3165
3166
  value = _props$value === void 0 ? {} : _props$value,
@@ -3167,8 +3168,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3167
3168
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3168
3169
  _props$expressInterce = props.expressInterceptData,
3169
3170
  expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3170
- _props$logisticsAddre = props.logisticsAddressData,
3171
- logisticsAddressData = _props$logisticsAddre === void 0 ? [] : _props$logisticsAddre,
3172
3171
  _props$required = props.required,
3173
3172
  required = _props$required === void 0 ? false : _props$required,
3174
3173
  onChange = props.onChange,
@@ -3194,7 +3193,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3194
3193
  setIsInterface = _useState8[1];
3195
3194
  var firstIn = React.useRef(true);
3196
3195
  React.useEffect(function () {
3197
- kmkfUtils.AddressData.getInstance();
3198
3196
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3199
3197
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3200
3198
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3271,11 +3269,25 @@ var LogisticsInterception = function LogisticsInterception(props) {
3271
3269
  });
3272
3270
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3273
3271
  }, [isEditing, initCompany]);
3272
+ //退回地址列表
3274
3273
  var logisticsAddressOptions = React.useMemo(function () {
3275
- return logisticsAddressData.filter(function (item) {
3274
+ return ((LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getAddressData()) || []).filter(function (item) {
3276
3275
  return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3277
3276
  });
3278
3277
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3278
+ var returnValue = React.useMemo(function () {
3279
+ var _value$interceptAddre, _value$interceptAddre2, _value$interceptAddre3;
3280
+ var uk = LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getUkByInfo({
3281
+ cpCode: (value === null || value === void 0 ? void 0 : value.interceptCompany) || '',
3282
+ province: value === null || value === void 0 ? void 0 : (_value$interceptAddre = value.interceptAddress) === null || _value$interceptAddre === void 0 ? void 0 : _value$interceptAddre[0],
3283
+ city: value === null || value === void 0 ? void 0 : (_value$interceptAddre2 = value.interceptAddress) === null || _value$interceptAddre2 === void 0 ? void 0 : _value$interceptAddre2[1],
3284
+ district: value === null || value === void 0 ? void 0 : (_value$interceptAddre3 = value.interceptAddress) === null || _value$interceptAddre3 === void 0 ? void 0 : _value$interceptAddre3[2],
3285
+ detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3286
+ userName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3287
+ mobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3288
+ });
3289
+ return uk;
3290
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, value === null || value === void 0 ? void 0 : value.interceptAddress]);
3279
3291
  //选择回调
3280
3292
  var changeHandle = function changeHandle(val, type) {
3281
3293
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
@@ -3283,13 +3295,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3283
3295
  var interceptCompany = expressInterceptData.find(function (item) {
3284
3296
  return item.value === val;
3285
3297
  });
3286
- var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3298
+ var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3287
3299
  var _item$config3;
3288
3300
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3289
3301
  });
3290
3302
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3291
3303
  interceptCompany: val,
3292
- interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3304
+ interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3293
3305
  interceptSenderMobile: undefined,
3294
3306
  interceptAddress: [],
3295
3307
  interceptDetail: undefined,
@@ -3302,31 +3314,20 @@ var LogisticsInterception = function LogisticsInterception(props) {
3302
3314
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3303
3315
  };
3304
3316
  //智能识别回调
3305
- var changeIdentify = function changeIdentify(val, type) {
3306
- //输入返填
3307
- if (type) {
3308
- var typeMap = {
3309
- address: 'interceptAddress',
3310
- detail: 'interceptDetail',
3311
- receiverName: 'interceptReceiverName',
3312
- receiverMobile: 'interceptReceiverMobile'
3313
- };
3314
- var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, typeMap[type], val));
3315
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3316
- } else {
3317
- //智能识别返填
3318
- var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3319
- interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3320
- interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3321
- interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3322
- interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3323
- });
3324
- onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3325
- }
3317
+ var changeIdentify = function changeIdentify(val) {
3318
+ //智能识别返填
3319
+ var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3320
+ interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3321
+ interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3322
+ interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3323
+ interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3324
+ });
3325
+ onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3326
3326
  };
3327
3327
  //选择退回地址
3328
3328
  var changeReturnAddress = function changeReturnAddress(uk) {
3329
3329
  var item = LogisticsAddress.getItemByUk(uk);
3330
+ console.log(item);
3330
3331
  if (item) {
3331
3332
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3332
3333
  interceptAddress: [item === null || item === void 0 ? void 0 : item.province, item === null || item === void 0 ? void 0 : item.city, item === null || item === void 0 ? void 0 : item.district],
@@ -3399,9 +3400,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3399
3400
  key: 'returnAddress',
3400
3401
  hidden: !showReturnAddress
3401
3402
  }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
3402
- options: logisticsAddressOptions,
3403
- onChange: changeReturnAddress
3404
- })), /*#__PURE__*/React__default['default'].createElement(Item, {
3403
+ disabled: disabled || isEdit,
3404
+ value: returnValue,
3405
+ onChange: changeReturnAddress,
3406
+ placeholder: "\u8BF7\u9009\u62E9\u9000\u56DE\u5730\u5740"
3407
+ }, logisticsAddressOptions.map(function (item) {
3408
+ return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
3409
+ key: item.uk,
3410
+ value: item.uk
3411
+ }, "".concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.province) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.city) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.district) || '').concat(item.detail, " ").concat(item === null || item === void 0 ? void 0 : item.userName, ":").concat(item === null || item === void 0 ? void 0 : item.mobile));
3412
+ }))), /*#__PURE__*/React__default['default'].createElement(Item, {
3405
3413
  label: '派送地址',
3406
3414
  required: true,
3407
3415
  key: 'newAddress',
@@ -15,7 +15,6 @@ interface LogisticsInterceptionProps {
15
15
  value: Partial<LogisticsInterceptionValueType>;
16
16
  logisticsOptions: any[];
17
17
  expressInterceptData: any[];
18
- logisticsAddressData: any[];
19
18
  required: boolean;
20
19
  disabled: boolean;
21
20
  isEditing: boolean;
@@ -6,7 +6,7 @@ interface IdentifyAddressProps {
6
6
  receiverName: string;
7
7
  receiverMobile: string;
8
8
  };
9
- onChange: (value: any, type?: string) => void;
9
+ onChange: (value: any) => void;
10
10
  disabled?: boolean;
11
11
  }
12
12
  declare const IdentifyAddress: (props: IdentifyAddressProps) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.7.1-alpha.0",
3
+ "version": "0.7.1-alpha.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.7.1-alpha.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.1-alpha.1",
24
24
  "umi-request": "^1.4.0"
25
25
  },
26
26
  "devDependencies": {
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "7ad1a590f1f169f979d75636f52a0456343ceeee"
57
+ "gitHead": "aa47b4aa4ce5e954a1312a4f0091daeb88b38336"
58
58
  }