@kmkf-fe-packages/basic-components 0.6.3-alpha.0 → 0.6.3-alpha.15

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.
@@ -12,10 +12,11 @@ interface LogisticsInterceptionValueType {
12
12
  interface LogisticsInterceptionProps {
13
13
  value: Partial<LogisticsInterceptionValueType>;
14
14
  logisticsOptions: any[];
15
+ expressInterceptData: any[];
15
16
  required: boolean;
16
17
  disabled: boolean;
17
18
  isEditing: boolean;
18
- id: string;
19
+ logisticsInterceptHandleStatus: string;
19
20
  onChange: (value: Partial<LogisticsInterceptionValueType>) => void;
20
21
  }
21
22
  declare const LogisticsInterception: (props: Partial<LogisticsInterceptionProps>) => JSX.Element;
package/dist/index.esm.js CHANGED
@@ -3121,13 +3121,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3121
3121
  value = _props$value === void 0 ? {} : _props$value,
3122
3122
  _props$logisticsOptio = props.logisticsOptions,
3123
3123
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3124
+ _props$expressInterce = props.expressInterceptData,
3125
+ expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3124
3126
  _props$required = props.required,
3125
3127
  required = _props$required === void 0 ? false : _props$required,
3126
3128
  onChange = props.onChange,
3127
3129
  _props$disabled = props.disabled,
3128
3130
  disabled = _props$disabled === void 0 ? false : _props$disabled,
3129
3131
  _props$isEditing = props.isEditing,
3130
- isEditing = _props$isEditing === void 0 ? false : _props$isEditing;
3132
+ isEditing = _props$isEditing === void 0 ? false : _props$isEditing,
3133
+ logisticsInterceptHandleStatus = props.logisticsInterceptHandleStatus;
3131
3134
  var _useState = useState([]),
3132
3135
  _useState2 = _slicedToArray(_useState, 2),
3133
3136
  typeOptions = _useState2[0],
@@ -3141,14 +3144,14 @@ var LogisticsInterception = function LogisticsInterception(props) {
3141
3144
  isInterface = _useState6[0],
3142
3145
  setIsInterface = _useState6[1];
3143
3146
  var canEdit = useMemo(function () {
3144
- //非对接公司可以修改
3147
+ // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3148
+ // 非对接公司可以修改组件
3149
+ // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3145
3150
  if (!isInterface) return true;
3146
3151
  //已对接公司在拦截中可以修改
3147
- var INTERCEPTING = statusOptions.some(function (item) {
3148
- return item.value === (value === null || value === void 0 ? void 0 : value.interceptStatus) && (item === null || item === void 0 ? void 0 : item.showInterceptionBtn);
3149
- });
3150
- return isEditing && (value === null || value === void 0 ? void 0 : value.interceptStatus) ? INTERCEPTING && isEditing : true;
3151
- }, [value, statusOptions, isInterface, isEditing]);
3152
+ var INTERCEPTING = logisticsInterceptHandleStatus === 'INTERCEPTING';
3153
+ return isEditing ? INTERCEPTING : true;
3154
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3152
3155
  useEffect(function () {
3153
3156
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3154
3157
  setTypeOptions([]);
@@ -3156,13 +3159,31 @@ var LogisticsInterception = function LogisticsInterception(props) {
3156
3159
  setIsInterface(false);
3157
3160
  return;
3158
3161
  }
3159
- var interceptCompany = logisticsOptions.find(function (item) {
3160
- return item.expressCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3162
+ var interceptCompany = expressInterceptData.find(function (item) {
3163
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3161
3164
  });
3162
3165
  setTypeOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []);
3163
3166
  setStatusOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionStatusList) || []);
3164
3167
  setIsInterface(interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.isInterface);
3165
3168
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3169
+ useEffect(function () {
3170
+ if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) return;
3171
+ var interceptCompany = expressInterceptData.find(function (item) {
3172
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3173
+ });
3174
+ var showAddress = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).some(function (item) {
3175
+ var _item$config;
3176
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.showAddress);
3177
+ });
3178
+ if (!showAddress) {
3179
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3180
+ interceptAddress: [],
3181
+ interceptDetail: '',
3182
+ interceptReceiverName: '',
3183
+ interceptReceiverMobile: ''
3184
+ }));
3185
+ }
3186
+ }, [value === null || value === void 0 ? void 0 : value.interceptType]);
3166
3187
  //是否展示新地址
3167
3188
  var showNewAddress = useMemo(function () {
3168
3189
  var _find, _find$config;
@@ -3173,14 +3194,21 @@ var LogisticsInterception = function LogisticsInterception(props) {
3173
3194
  var changeHandle = function changeHandle(val, type) {
3174
3195
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3175
3196
  if (type === 'interceptCompany') {
3197
+ var interceptCompany = expressInterceptData.find(function (item) {
3198
+ return item.value === val;
3199
+ });
3200
+ var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3201
+ var _item$label;
3202
+ return (item === null || item === void 0 ? void 0 : item.label) && (item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.indexOf('退回')) > -1;
3203
+ });
3176
3204
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3177
3205
  interceptCompany: val,
3178
- interceptType: 'RETURN',
3206
+ interceptType: (returnValue === null || returnValue === void 0 ? void 0 : returnValue.value) || '',
3179
3207
  interceptAddress: [],
3180
3208
  interceptDetail: '',
3181
3209
  interceptReceiverName: '',
3182
3210
  interceptReceiverMobile: '',
3183
- interceptStatus: '',
3211
+ interceptStatus: undefined,
3184
3212
  interceptOther: ''
3185
3213
  });
3186
3214
  }
@@ -3286,7 +3314,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3286
3314
  return option.label.includes(input);
3287
3315
  }
3288
3316
  }), (value === null || value === void 0 ? void 0 : value.interceptStatus) === 'OTHER' && /*#__PURE__*/React.createElement(Input, {
3289
- disabled: disabled || canEdit,
3317
+ disabled: disabled || !canEdit,
3290
3318
  style: {
3291
3319
  width: '200px'
3292
3320
  },
package/dist/index.js CHANGED
@@ -3131,13 +3131,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3131
3131
  value = _props$value === void 0 ? {} : _props$value,
3132
3132
  _props$logisticsOptio = props.logisticsOptions,
3133
3133
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3134
+ _props$expressInterce = props.expressInterceptData,
3135
+ expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3134
3136
  _props$required = props.required,
3135
3137
  required = _props$required === void 0 ? false : _props$required,
3136
3138
  onChange = props.onChange,
3137
3139
  _props$disabled = props.disabled,
3138
3140
  disabled = _props$disabled === void 0 ? false : _props$disabled,
3139
3141
  _props$isEditing = props.isEditing,
3140
- isEditing = _props$isEditing === void 0 ? false : _props$isEditing;
3142
+ isEditing = _props$isEditing === void 0 ? false : _props$isEditing,
3143
+ logisticsInterceptHandleStatus = props.logisticsInterceptHandleStatus;
3141
3144
  var _useState = React.useState([]),
3142
3145
  _useState2 = _slicedToArray(_useState, 2),
3143
3146
  typeOptions = _useState2[0],
@@ -3151,14 +3154,14 @@ var LogisticsInterception = function LogisticsInterception(props) {
3151
3154
  isInterface = _useState6[0],
3152
3155
  setIsInterface = _useState6[1];
3153
3156
  var canEdit = React.useMemo(function () {
3154
- //非对接公司可以修改
3157
+ // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3158
+ // 非对接公司可以修改组件
3159
+ // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3155
3160
  if (!isInterface) return true;
3156
3161
  //已对接公司在拦截中可以修改
3157
- var INTERCEPTING = statusOptions.some(function (item) {
3158
- return item.value === (value === null || value === void 0 ? void 0 : value.interceptStatus) && (item === null || item === void 0 ? void 0 : item.showInterceptionBtn);
3159
- });
3160
- return isEditing && (value === null || value === void 0 ? void 0 : value.interceptStatus) ? INTERCEPTING && isEditing : true;
3161
- }, [value, statusOptions, isInterface, isEditing]);
3162
+ var INTERCEPTING = logisticsInterceptHandleStatus === 'INTERCEPTING';
3163
+ return isEditing ? INTERCEPTING : true;
3164
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3162
3165
  React.useEffect(function () {
3163
3166
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3164
3167
  setTypeOptions([]);
@@ -3166,13 +3169,31 @@ var LogisticsInterception = function LogisticsInterception(props) {
3166
3169
  setIsInterface(false);
3167
3170
  return;
3168
3171
  }
3169
- var interceptCompany = logisticsOptions.find(function (item) {
3170
- return item.expressCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3172
+ var interceptCompany = expressInterceptData.find(function (item) {
3173
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3171
3174
  });
3172
3175
  setTypeOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []);
3173
3176
  setStatusOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionStatusList) || []);
3174
3177
  setIsInterface(interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.isInterface);
3175
3178
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3179
+ React.useEffect(function () {
3180
+ if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) return;
3181
+ var interceptCompany = expressInterceptData.find(function (item) {
3182
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3183
+ });
3184
+ var showAddress = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).some(function (item) {
3185
+ var _item$config;
3186
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.showAddress);
3187
+ });
3188
+ if (!showAddress) {
3189
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3190
+ interceptAddress: [],
3191
+ interceptDetail: '',
3192
+ interceptReceiverName: '',
3193
+ interceptReceiverMobile: ''
3194
+ }));
3195
+ }
3196
+ }, [value === null || value === void 0 ? void 0 : value.interceptType]);
3176
3197
  //是否展示新地址
3177
3198
  var showNewAddress = React.useMemo(function () {
3178
3199
  var _find, _find$config;
@@ -3183,14 +3204,21 @@ var LogisticsInterception = function LogisticsInterception(props) {
3183
3204
  var changeHandle = function changeHandle(val, type) {
3184
3205
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3185
3206
  if (type === 'interceptCompany') {
3207
+ var interceptCompany = expressInterceptData.find(function (item) {
3208
+ return item.value === val;
3209
+ });
3210
+ var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3211
+ var _item$label;
3212
+ return (item === null || item === void 0 ? void 0 : item.label) && (item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.indexOf('退回')) > -1;
3213
+ });
3186
3214
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3187
3215
  interceptCompany: val,
3188
- interceptType: 'RETURN',
3216
+ interceptType: (returnValue === null || returnValue === void 0 ? void 0 : returnValue.value) || '',
3189
3217
  interceptAddress: [],
3190
3218
  interceptDetail: '',
3191
3219
  interceptReceiverName: '',
3192
3220
  interceptReceiverMobile: '',
3193
- interceptStatus: '',
3221
+ interceptStatus: undefined,
3194
3222
  interceptOther: ''
3195
3223
  });
3196
3224
  }
@@ -3296,7 +3324,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3296
3324
  return option.label.includes(input);
3297
3325
  }
3298
3326
  }), (value === null || value === void 0 ? void 0 : value.interceptStatus) === 'OTHER' && /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3299
- disabled: disabled || canEdit,
3327
+ disabled: disabled || !canEdit,
3300
3328
  style: {
3301
3329
  width: '200px'
3302
3330
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.6.3-alpha.0",
3
+ "version": "0.6.3-alpha.15",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "f2de883a1a57e0ead13d3ee345acaf3dd1b3467d"
40
+ "gitHead": "48cd1f4dc355b1b386299c085845494a7068c374"
41
41
  }