@kmkf-fe-packages/basic-components 0.2.2-alpha.1 → 0.2.2-alpha.2
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/business/LogisticsInterception/index.d.ts +1 -0
- package/dist/index.esm.js +28 -15
- package/dist/index.js +28 -15
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3122,9 +3122,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3122
3122
|
value = _props$value === void 0 ? {} : _props$value,
|
|
3123
3123
|
_props$logisticsOptio = props.logisticsOptions,
|
|
3124
3124
|
logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
|
|
3125
|
-
required = props.required,
|
|
3125
|
+
_props$required = props.required,
|
|
3126
|
+
required = _props$required === void 0 ? false : _props$required,
|
|
3126
3127
|
onChange = props.onChange,
|
|
3127
|
-
disabled = props.disabled
|
|
3128
|
+
_props$disabled = props.disabled,
|
|
3129
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
3130
|
+
_props$isEditing = props.isEditing,
|
|
3131
|
+
isEditing = _props$isEditing === void 0 ? false : _props$isEditing;
|
|
3128
3132
|
var _useState = useState([]),
|
|
3129
3133
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3130
3134
|
typeOptions = _useState2[0],
|
|
@@ -3133,16 +3137,24 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3133
3137
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3134
3138
|
statusOptions = _useState4[0],
|
|
3135
3139
|
setStatusOptions = _useState4[1];
|
|
3136
|
-
var _useState5 = useState(
|
|
3140
|
+
var _useState5 = useState(false),
|
|
3137
3141
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3138
3142
|
isInterface = _useState6[0],
|
|
3139
3143
|
setIsInterface = _useState6[1];
|
|
3144
|
+
var canEdit = useMemo(function () {
|
|
3145
|
+
//非对接公司可以修改
|
|
3146
|
+
if (!isInterface) return true;
|
|
3147
|
+
//已对接公司在拦截中可以修改
|
|
3148
|
+
var INTERCEPTING = statusOptions.some(function (item) {
|
|
3149
|
+
return item.value === (value === null || value === void 0 ? void 0 : value.interceptStatus) && (item === null || item === void 0 ? void 0 : item.showInterceptionBtn);
|
|
3150
|
+
});
|
|
3151
|
+
return isEditing && (value === null || value === void 0 ? void 0 : value.interceptStatus) ? INTERCEPTING && isEditing : true;
|
|
3152
|
+
}, [value, statusOptions, isInterface, isEditing]);
|
|
3140
3153
|
useEffect(function () {
|
|
3141
|
-
console.log(value === null || value === void 0 ? void 0 : value.interceptCompany);
|
|
3142
3154
|
if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
|
|
3143
3155
|
setTypeOptions([]);
|
|
3144
3156
|
setStatusOptions([]);
|
|
3145
|
-
setIsInterface(
|
|
3157
|
+
setIsInterface(false);
|
|
3146
3158
|
return;
|
|
3147
3159
|
}
|
|
3148
3160
|
var interceptCompany = logisticsOptions.find(function (item) {
|
|
@@ -3158,7 +3170,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3158
3170
|
return (_find = (typeOptions || []).find(function (item) {
|
|
3159
3171
|
return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
|
|
3160
3172
|
})) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
|
|
3161
|
-
}, [value === null || value === void 0 ? void 0 : value.interceptType]);
|
|
3173
|
+
}, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
|
|
3162
3174
|
var changeHandle = function changeHandle(val, type) {
|
|
3163
3175
|
var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
|
|
3164
3176
|
if (type === 'interceptCompany') {
|
|
@@ -3180,7 +3192,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3180
3192
|
required: required,
|
|
3181
3193
|
key: 'logistics'
|
|
3182
3194
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
|
|
3183
|
-
disabled: disabled,
|
|
3195
|
+
disabled: disabled || !canEdit,
|
|
3184
3196
|
placeholder: "\u7269\u6D41\u516C\u53F8",
|
|
3185
3197
|
style: {
|
|
3186
3198
|
width: '200px'
|
|
@@ -3195,7 +3207,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3195
3207
|
return option.label.includes(input);
|
|
3196
3208
|
}
|
|
3197
3209
|
}), /*#__PURE__*/React.createElement(Input, {
|
|
3198
|
-
disabled: disabled,
|
|
3210
|
+
disabled: disabled || !canEdit,
|
|
3199
3211
|
placeholder: "\u7269\u6D41\u5355\u53F7",
|
|
3200
3212
|
onChange: function onChange(e) {
|
|
3201
3213
|
return changeHandle(e.target.value, 'interceptCode');
|
|
@@ -3206,7 +3218,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3206
3218
|
required: required,
|
|
3207
3219
|
key: 'interceptType'
|
|
3208
3220
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
3209
|
-
disabled: disabled,
|
|
3221
|
+
disabled: disabled || !canEdit,
|
|
3210
3222
|
style: {
|
|
3211
3223
|
width: '200px'
|
|
3212
3224
|
},
|
|
@@ -3222,26 +3234,26 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3222
3234
|
}
|
|
3223
3235
|
})), /*#__PURE__*/React.createElement(Item, {
|
|
3224
3236
|
label: '新派送地',
|
|
3225
|
-
required:
|
|
3237
|
+
required: true,
|
|
3226
3238
|
key: 'newAddress',
|
|
3227
|
-
hidden:
|
|
3239
|
+
hidden: !showNewAddress
|
|
3228
3240
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Province, {
|
|
3229
3241
|
value: value === null || value === void 0 ? void 0 : value.interceptAddress,
|
|
3230
3242
|
onChange: function onChange(val) {
|
|
3231
3243
|
return changeHandle(val, 'interceptAddress');
|
|
3232
3244
|
},
|
|
3233
3245
|
options: [],
|
|
3234
|
-
disabled: disabled
|
|
3246
|
+
disabled: disabled || !canEdit
|
|
3235
3247
|
}), /*#__PURE__*/React.createElement(Input, {
|
|
3236
3248
|
value: value === null || value === void 0 ? void 0 : value.interceptDetail,
|
|
3237
|
-
disabled: disabled,
|
|
3249
|
+
disabled: disabled || !canEdit,
|
|
3238
3250
|
placeholder: "\u8BE6\u7EC6\u5730\u5740",
|
|
3239
3251
|
onChange: function onChange(e) {
|
|
3240
3252
|
return changeHandle(e.target.value, 'interceptDetail');
|
|
3241
3253
|
}
|
|
3242
3254
|
})), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
|
|
3243
3255
|
value: value === null || value === void 0 ? void 0 : value.interceptReceiverName,
|
|
3244
|
-
disabled: disabled,
|
|
3256
|
+
disabled: disabled || !canEdit,
|
|
3245
3257
|
style: {
|
|
3246
3258
|
width: '200px'
|
|
3247
3259
|
},
|
|
@@ -3251,7 +3263,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3251
3263
|
}
|
|
3252
3264
|
}), /*#__PURE__*/React.createElement(Input, {
|
|
3253
3265
|
value: value === null || value === void 0 ? void 0 : value.interceptReceiverMobile,
|
|
3254
|
-
disabled: disabled,
|
|
3266
|
+
disabled: disabled || !canEdit,
|
|
3255
3267
|
placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
|
|
3256
3268
|
onChange: function onChange(e) {
|
|
3257
3269
|
return changeHandle(e.target.value, 'interceptReceiverMobile');
|
|
@@ -3275,6 +3287,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3275
3287
|
return option.label.includes(input);
|
|
3276
3288
|
}
|
|
3277
3289
|
}), (value === null || value === void 0 ? void 0 : value.interceptStatus) === 'OTHER' && /*#__PURE__*/React.createElement(Input, {
|
|
3290
|
+
disabled: disabled || canEdit,
|
|
3278
3291
|
style: {
|
|
3279
3292
|
width: '200px'
|
|
3280
3293
|
},
|
package/dist/index.js
CHANGED
|
@@ -3132,9 +3132,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3132
3132
|
value = _props$value === void 0 ? {} : _props$value,
|
|
3133
3133
|
_props$logisticsOptio = props.logisticsOptions,
|
|
3134
3134
|
logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
|
|
3135
|
-
required = props.required,
|
|
3135
|
+
_props$required = props.required,
|
|
3136
|
+
required = _props$required === void 0 ? false : _props$required,
|
|
3136
3137
|
onChange = props.onChange,
|
|
3137
|
-
disabled = props.disabled
|
|
3138
|
+
_props$disabled = props.disabled,
|
|
3139
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
3140
|
+
_props$isEditing = props.isEditing,
|
|
3141
|
+
isEditing = _props$isEditing === void 0 ? false : _props$isEditing;
|
|
3138
3142
|
var _useState = React.useState([]),
|
|
3139
3143
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3140
3144
|
typeOptions = _useState2[0],
|
|
@@ -3143,16 +3147,24 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3143
3147
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3144
3148
|
statusOptions = _useState4[0],
|
|
3145
3149
|
setStatusOptions = _useState4[1];
|
|
3146
|
-
var _useState5 = React.useState(
|
|
3150
|
+
var _useState5 = React.useState(false),
|
|
3147
3151
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3148
3152
|
isInterface = _useState6[0],
|
|
3149
3153
|
setIsInterface = _useState6[1];
|
|
3154
|
+
var canEdit = React.useMemo(function () {
|
|
3155
|
+
//非对接公司可以修改
|
|
3156
|
+
if (!isInterface) return true;
|
|
3157
|
+
//已对接公司在拦截中可以修改
|
|
3158
|
+
var INTERCEPTING = statusOptions.some(function (item) {
|
|
3159
|
+
return item.value === (value === null || value === void 0 ? void 0 : value.interceptStatus) && (item === null || item === void 0 ? void 0 : item.showInterceptionBtn);
|
|
3160
|
+
});
|
|
3161
|
+
return isEditing && (value === null || value === void 0 ? void 0 : value.interceptStatus) ? INTERCEPTING && isEditing : true;
|
|
3162
|
+
}, [value, statusOptions, isInterface, isEditing]);
|
|
3150
3163
|
React.useEffect(function () {
|
|
3151
|
-
console.log(value === null || value === void 0 ? void 0 : value.interceptCompany);
|
|
3152
3164
|
if (!(value === null || value === void 0 ? void 0 : value.interceptCompany)) {
|
|
3153
3165
|
setTypeOptions([]);
|
|
3154
3166
|
setStatusOptions([]);
|
|
3155
|
-
setIsInterface(
|
|
3167
|
+
setIsInterface(false);
|
|
3156
3168
|
return;
|
|
3157
3169
|
}
|
|
3158
3170
|
var interceptCompany = logisticsOptions.find(function (item) {
|
|
@@ -3168,7 +3180,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3168
3180
|
return (_find = (typeOptions || []).find(function (item) {
|
|
3169
3181
|
return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
|
|
3170
3182
|
})) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
|
|
3171
|
-
}, [value === null || value === void 0 ? void 0 : value.interceptType]);
|
|
3183
|
+
}, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
|
|
3172
3184
|
var changeHandle = function changeHandle(val, type) {
|
|
3173
3185
|
var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
|
|
3174
3186
|
if (type === 'interceptCompany') {
|
|
@@ -3190,7 +3202,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3190
3202
|
required: required,
|
|
3191
3203
|
key: 'logistics'
|
|
3192
3204
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
|
|
3193
|
-
disabled: disabled,
|
|
3205
|
+
disabled: disabled || !canEdit,
|
|
3194
3206
|
placeholder: "\u7269\u6D41\u516C\u53F8",
|
|
3195
3207
|
style: {
|
|
3196
3208
|
width: '200px'
|
|
@@ -3205,7 +3217,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3205
3217
|
return option.label.includes(input);
|
|
3206
3218
|
}
|
|
3207
3219
|
}), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
3208
|
-
disabled: disabled,
|
|
3220
|
+
disabled: disabled || !canEdit,
|
|
3209
3221
|
placeholder: "\u7269\u6D41\u5355\u53F7",
|
|
3210
3222
|
onChange: function onChange(e) {
|
|
3211
3223
|
return changeHandle(e.target.value, 'interceptCode');
|
|
@@ -3216,7 +3228,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3216
3228
|
required: required,
|
|
3217
3229
|
key: 'interceptType'
|
|
3218
3230
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
|
|
3219
|
-
disabled: disabled,
|
|
3231
|
+
disabled: disabled || !canEdit,
|
|
3220
3232
|
style: {
|
|
3221
3233
|
width: '200px'
|
|
3222
3234
|
},
|
|
@@ -3232,26 +3244,26 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3232
3244
|
}
|
|
3233
3245
|
})), /*#__PURE__*/React__default['default'].createElement(Item, {
|
|
3234
3246
|
label: '新派送地',
|
|
3235
|
-
required:
|
|
3247
|
+
required: true,
|
|
3236
3248
|
key: 'newAddress',
|
|
3237
|
-
hidden:
|
|
3249
|
+
hidden: !showNewAddress
|
|
3238
3250
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(Province, {
|
|
3239
3251
|
value: value === null || value === void 0 ? void 0 : value.interceptAddress,
|
|
3240
3252
|
onChange: function onChange(val) {
|
|
3241
3253
|
return changeHandle(val, 'interceptAddress');
|
|
3242
3254
|
},
|
|
3243
3255
|
options: [],
|
|
3244
|
-
disabled: disabled
|
|
3256
|
+
disabled: disabled || !canEdit
|
|
3245
3257
|
}), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
3246
3258
|
value: value === null || value === void 0 ? void 0 : value.interceptDetail,
|
|
3247
|
-
disabled: disabled,
|
|
3259
|
+
disabled: disabled || !canEdit,
|
|
3248
3260
|
placeholder: "\u8BE6\u7EC6\u5730\u5740",
|
|
3249
3261
|
onChange: function onChange(e) {
|
|
3250
3262
|
return changeHandle(e.target.value, 'interceptDetail');
|
|
3251
3263
|
}
|
|
3252
3264
|
})), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
3253
3265
|
value: value === null || value === void 0 ? void 0 : value.interceptReceiverName,
|
|
3254
|
-
disabled: disabled,
|
|
3266
|
+
disabled: disabled || !canEdit,
|
|
3255
3267
|
style: {
|
|
3256
3268
|
width: '200px'
|
|
3257
3269
|
},
|
|
@@ -3261,7 +3273,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3261
3273
|
}
|
|
3262
3274
|
}), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
3263
3275
|
value: value === null || value === void 0 ? void 0 : value.interceptReceiverMobile,
|
|
3264
|
-
disabled: disabled,
|
|
3276
|
+
disabled: disabled || !canEdit,
|
|
3265
3277
|
placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
|
|
3266
3278
|
onChange: function onChange(e) {
|
|
3267
3279
|
return changeHandle(e.target.value, 'interceptReceiverMobile');
|
|
@@ -3285,6 +3297,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
|
|
|
3285
3297
|
return option.label.includes(input);
|
|
3286
3298
|
}
|
|
3287
3299
|
}), (value === null || value === void 0 ? void 0 : value.interceptStatus) === 'OTHER' && /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
3300
|
+
disabled: disabled || canEdit,
|
|
3288
3301
|
style: {
|
|
3289
3302
|
width: '200px'
|
|
3290
3303
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "0.2.2-alpha.
|
|
3
|
+
"version": "0.2.2-alpha.2",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "wangzhenggui <jianjia.wzg@raycloud.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"async": "yarn build && yalc push",
|
|
14
14
|
"watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "9b5e231fe191b63e8cba25fffa6e7da93a99eba6",
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|