@kmkf-fe-packages/basic-components 0.6.3-alpha.22 → 0.6.3-alpha.27

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
@@ -3121,28 +3121,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3121
3121
  _props$isEditing = props.isEditing,
3122
3122
  isEditing = _props$isEditing === void 0 ? false : _props$isEditing,
3123
3123
  logisticsInterceptHandleStatus = props.logisticsInterceptHandleStatus;
3124
- var _useState = useState([]),
3124
+ var _useState = useState(''),
3125
3125
  _useState2 = _slicedToArray(_useState, 2),
3126
- typeOptions = _useState2[0],
3127
- setTypeOptions = _useState2[1];
3126
+ initCompany = _useState2[0],
3127
+ setInitCompany = _useState2[1];
3128
3128
  var _useState3 = useState([]),
3129
3129
  _useState4 = _slicedToArray(_useState3, 2),
3130
- statusOptions = _useState4[0],
3131
- setStatusOptions = _useState4[1];
3132
- var _useState5 = useState(false),
3130
+ typeOptions = _useState4[0],
3131
+ setTypeOptions = _useState4[1];
3132
+ var _useState5 = useState([]),
3133
3133
  _useState6 = _slicedToArray(_useState5, 2),
3134
- isInterface = _useState6[0],
3135
- setIsInterface = _useState6[1];
3136
- var canEdit = useMemo(function () {
3137
- // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3138
- // 非对接公司可以修改组件
3139
- // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3140
- if (!isInterface) return true;
3141
- //已对接公司在拦截中可以修改
3142
- var INTERCEPTING = logisticsInterceptHandleStatus === 'INTERCEPTING';
3143
- return isEditing ? INTERCEPTING : true;
3144
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3134
+ statusOptions = _useState6[0],
3135
+ setStatusOptions = _useState6[1];
3136
+ var _useState7 = useState(false),
3137
+ _useState8 = _slicedToArray(_useState7, 2),
3138
+ isInterface = _useState8[0],
3139
+ setIsInterface = _useState8[1];
3140
+ var firstIn = useRef(true);
3145
3141
  useEffect(function () {
3142
+ //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3143
+ if (firstIn.current && (value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3144
+ setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
3145
+ firstIn.current = false;
3146
+ }
3146
3147
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3147
3148
  setTypeOptions([]);
3148
3149
  setStatusOptions([]);
@@ -3156,6 +3157,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3156
3157
  setStatusOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionStatusList) || []);
3157
3158
  setIsInterface(interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.isInterface);
3158
3159
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3160
+ //拦截类型切换 需要清空新派送地
3159
3161
  useEffect(function () {
3160
3162
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) return;
3161
3163
  var interceptCompany = expressInterceptData.find(function (item) {
@@ -3181,6 +3183,23 @@ var LogisticsInterception = function LogisticsInterception(props) {
3181
3183
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3182
3184
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3183
3185
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3186
+ //判断是否能修改信息
3187
+ var canEdit = useMemo(function () {
3188
+ // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3189
+ // 非对接公司可以修改组件
3190
+ // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3191
+ if (!isInterface) return true;
3192
+ //已对接公司在拦截中可以修改
3193
+ var INTERCEPTING = !logisticsInterceptHandleStatus || logisticsInterceptHandleStatus === 'INTERCEPTING';
3194
+ return isEditing ? INTERCEPTING : true;
3195
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3196
+ //判断是否能修改物流信息
3197
+ var canEditCompany = useMemo(function () {
3198
+ var company = expressInterceptData.find(function (item) {
3199
+ return item.value === initCompany;
3200
+ });
3201
+ return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3202
+ }, [isEditing, initCompany]);
3184
3203
  var changeHandle = function changeHandle(val, type) {
3185
3204
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3186
3205
  if (type === 'interceptCompany') {
@@ -3188,12 +3207,11 @@ var LogisticsInterception = function LogisticsInterception(props) {
3188
3207
  return item.value === val;
3189
3208
  });
3190
3209
  var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3191
- var _item$label;
3192
- 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;
3210
+ return item === null || item === void 0 ? void 0 : item.isDefault;
3193
3211
  });
3194
3212
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3195
3213
  interceptCompany: val,
3196
- interceptType: (returnValue === null || returnValue === void 0 ? void 0 : returnValue.value) || '',
3214
+ interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3197
3215
  interceptAddress: [],
3198
3216
  interceptDetail: undefined,
3199
3217
  interceptReceiverName: undefined,
@@ -3209,7 +3227,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3209
3227
  required: required,
3210
3228
  key: 'logistics'
3211
3229
  }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
3212
- disabled: disabled || !canEdit,
3230
+ disabled: disabled || canEditCompany,
3213
3231
  placeholder: "\u7269\u6D41\u516C\u53F8",
3214
3232
  style: {
3215
3233
  width: '200px'
@@ -3224,7 +3242,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3224
3242
  return option.label.includes(input);
3225
3243
  }
3226
3244
  }), /*#__PURE__*/React.createElement(Input, {
3227
- disabled: disabled || !canEdit,
3245
+ disabled: disabled || canEditCompany,
3228
3246
  placeholder: "\u7269\u6D41\u5355\u53F7",
3229
3247
  onChange: function onChange(e) {
3230
3248
  return changeHandle(e.target.value, 'interceptCode');
package/dist/index.js CHANGED
@@ -3131,28 +3131,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3131
3131
  _props$isEditing = props.isEditing,
3132
3132
  isEditing = _props$isEditing === void 0 ? false : _props$isEditing,
3133
3133
  logisticsInterceptHandleStatus = props.logisticsInterceptHandleStatus;
3134
- var _useState = React.useState([]),
3134
+ var _useState = React.useState(''),
3135
3135
  _useState2 = _slicedToArray(_useState, 2),
3136
- typeOptions = _useState2[0],
3137
- setTypeOptions = _useState2[1];
3136
+ initCompany = _useState2[0],
3137
+ setInitCompany = _useState2[1];
3138
3138
  var _useState3 = React.useState([]),
3139
3139
  _useState4 = _slicedToArray(_useState3, 2),
3140
- statusOptions = _useState4[0],
3141
- setStatusOptions = _useState4[1];
3142
- var _useState5 = React.useState(false),
3140
+ typeOptions = _useState4[0],
3141
+ setTypeOptions = _useState4[1];
3142
+ var _useState5 = React.useState([]),
3143
3143
  _useState6 = _slicedToArray(_useState5, 2),
3144
- isInterface = _useState6[0],
3145
- setIsInterface = _useState6[1];
3146
- var canEdit = React.useMemo(function () {
3147
- // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3148
- // 非对接公司可以修改组件
3149
- // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3150
- if (!isInterface) return true;
3151
- //已对接公司在拦截中可以修改
3152
- var INTERCEPTING = logisticsInterceptHandleStatus === 'INTERCEPTING';
3153
- return isEditing ? INTERCEPTING : true;
3154
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3144
+ statusOptions = _useState6[0],
3145
+ setStatusOptions = _useState6[1];
3146
+ var _useState7 = React.useState(false),
3147
+ _useState8 = _slicedToArray(_useState7, 2),
3148
+ isInterface = _useState8[0],
3149
+ setIsInterface = _useState8[1];
3150
+ var firstIn = React.useRef(true);
3155
3151
  React.useEffect(function () {
3152
+ //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3153
+ if (firstIn.current && (value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3154
+ setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
3155
+ firstIn.current = false;
3156
+ }
3156
3157
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
3157
3158
  setTypeOptions([]);
3158
3159
  setStatusOptions([]);
@@ -3166,6 +3167,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3166
3167
  setStatusOptions((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionStatusList) || []);
3167
3168
  setIsInterface(interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.isInterface);
3168
3169
  }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3170
+ //拦截类型切换 需要清空新派送地
3169
3171
  React.useEffect(function () {
3170
3172
  if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) return;
3171
3173
  var interceptCompany = expressInterceptData.find(function (item) {
@@ -3191,6 +3193,23 @@ var LogisticsInterception = function LogisticsInterception(props) {
3191
3193
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3192
3194
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3193
3195
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3196
+ //判断是否能修改信息
3197
+ var canEdit = React.useMemo(function () {
3198
+ // 已对接公司如果拦截状态为【拦截中】,可以修改物流拦截组件信息,否则该组件不能修改;
3199
+ // 非对接公司可以修改组件
3200
+ // 修改后把工单信息重新提交给快递公司,清空拦截状态的值
3201
+ if (!isInterface) return true;
3202
+ //已对接公司在拦截中可以修改
3203
+ var INTERCEPTING = !logisticsInterceptHandleStatus || logisticsInterceptHandleStatus === 'INTERCEPTING';
3204
+ return isEditing ? INTERCEPTING : true;
3205
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany, statusOptions, isInterface, isEditing]);
3206
+ //判断是否能修改物流信息
3207
+ var canEditCompany = React.useMemo(function () {
3208
+ var company = expressInterceptData.find(function (item) {
3209
+ return item.value === initCompany;
3210
+ });
3211
+ return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3212
+ }, [isEditing, initCompany]);
3194
3213
  var changeHandle = function changeHandle(val, type) {
3195
3214
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3196
3215
  if (type === 'interceptCompany') {
@@ -3198,12 +3217,11 @@ var LogisticsInterception = function LogisticsInterception(props) {
3198
3217
  return item.value === val;
3199
3218
  });
3200
3219
  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;
3220
+ return item === null || item === void 0 ? void 0 : item.isDefault;
3203
3221
  });
3204
3222
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3205
3223
  interceptCompany: val,
3206
- interceptType: (returnValue === null || returnValue === void 0 ? void 0 : returnValue.value) || '',
3224
+ interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3207
3225
  interceptAddress: [],
3208
3226
  interceptDetail: undefined,
3209
3227
  interceptReceiverName: undefined,
@@ -3219,7 +3237,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3219
3237
  required: required,
3220
3238
  key: 'logistics'
3221
3239
  }, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
3222
- disabled: disabled || !canEdit,
3240
+ disabled: disabled || canEditCompany,
3223
3241
  placeholder: "\u7269\u6D41\u516C\u53F8",
3224
3242
  style: {
3225
3243
  width: '200px'
@@ -3234,7 +3252,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3234
3252
  return option.label.includes(input);
3235
3253
  }
3236
3254
  }), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3237
- disabled: disabled || !canEdit,
3255
+ disabled: disabled || canEditCompany,
3238
3256
  placeholder: "\u7269\u6D41\u5355\u53F7",
3239
3257
  onChange: function onChange(e) {
3240
3258
  return changeHandle(e.target.value, 'interceptCode');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.6.3-alpha.22",
3
+ "version": "0.6.3-alpha.27",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "57ad72d0ca4d08a63632f70692eee04fdaa0a946"
45
+ "gitHead": "6568517bf5c889bc02b548d5cf4a0c03dea307ae"
46
46
  }