@bit-sun/business-component 2.2.25 → 2.2.26
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
|
@@ -9881,6 +9881,22 @@ var loadSelectSource = function loadSelectSource(url, params) {
|
|
|
9881
9881
|
});
|
|
9882
9882
|
});
|
|
9883
9883
|
};
|
|
9884
|
+
var checkSpuMatchCode = function checkSpuMatchCode(data) {
|
|
9885
|
+
return new Promise(function (resolve, reject) {
|
|
9886
|
+
axios.post("/stock/rwFrontRecordSkcDetail/checkSpuMatchCode", data).then(function (result) {
|
|
9887
|
+
var _result3, _result4;
|
|
9888
|
+
result = result.data;
|
|
9889
|
+
if (((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.status) && result.status !== '0' || ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.code) && result.code !== '000000') {
|
|
9890
|
+
message.error(result.msg);
|
|
9891
|
+
reject(false);
|
|
9892
|
+
return;
|
|
9893
|
+
}
|
|
9894
|
+
resolve(result);
|
|
9895
|
+
}).catch(function (err) {
|
|
9896
|
+
reject(err);
|
|
9897
|
+
});
|
|
9898
|
+
});
|
|
9899
|
+
};
|
|
9884
9900
|
var ResizeableTitle = function ResizeableTitle(props) {
|
|
9885
9901
|
var onResize = props.onResize,
|
|
9886
9902
|
width = props.width,
|
|
@@ -10121,6 +10137,87 @@ var AddSelect = function AddSelect(props) {
|
|
|
10121
10137
|
setShowToChooseColumns = _useState46[1];
|
|
10122
10138
|
var codeToChoose = tableCodeList[0] || initTableCode[businessType][0];
|
|
10123
10139
|
var codeSelected = tableCodeList[1] || initTableCode[businessType][1];
|
|
10140
|
+
var checkSelectChange = /*#__PURE__*/function () {
|
|
10141
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(bType, tList, recordKey, recordItem, selectItem, changeValue) {
|
|
10142
|
+
var result;
|
|
10143
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10144
|
+
while (1) {
|
|
10145
|
+
switch (_context.prev = _context.next) {
|
|
10146
|
+
case 0:
|
|
10147
|
+
if (!(bType == 'skc' && tList.some(function (i) {
|
|
10148
|
+
return i[recordKey] == recordItem[recordKey] && i[selectItem.dataIndex] == changeValue;
|
|
10149
|
+
}))) {
|
|
10150
|
+
_context.next = 3;
|
|
10151
|
+
break;
|
|
10152
|
+
}
|
|
10153
|
+
message.warning('相同skc配码不可设置相同哦');
|
|
10154
|
+
return _context.abrupt("return", false);
|
|
10155
|
+
case 3:
|
|
10156
|
+
if (!(bType == 'spu')) {
|
|
10157
|
+
_context.next = 26;
|
|
10158
|
+
break;
|
|
10159
|
+
}
|
|
10160
|
+
if (!(selectItem.dataIndex == 'colorName' && tList.some(function (i) {
|
|
10161
|
+
return i[recordKey] == recordItem[recordKey] && i.selectPropertyGroupCode == recordItem.selectPropertyGroupCode && i[selectItem.dataIndex] == changeValue;
|
|
10162
|
+
}))) {
|
|
10163
|
+
_context.next = 7;
|
|
10164
|
+
break;
|
|
10165
|
+
}
|
|
10166
|
+
message.warning('相同商品相同配码颜色不可设置相同哦');
|
|
10167
|
+
return _context.abrupt("return", false);
|
|
10168
|
+
case 7:
|
|
10169
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode' && !recordItem.colorName)) {
|
|
10170
|
+
_context.next = 10;
|
|
10171
|
+
break;
|
|
10172
|
+
}
|
|
10173
|
+
message.warning('请先选择颜色!');
|
|
10174
|
+
return _context.abrupt("return", false);
|
|
10175
|
+
case 10:
|
|
10176
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode' && tList.some(function (i) {
|
|
10177
|
+
return i[recordKey] == recordItem[recordKey] && i.colorName == recordItem.colorName && i[selectItem.dataIndex] == changeValue;
|
|
10178
|
+
}))) {
|
|
10179
|
+
_context.next = 13;
|
|
10180
|
+
break;
|
|
10181
|
+
}
|
|
10182
|
+
message.warning('相同商品相同颜色配码不可设置相同哦');
|
|
10183
|
+
return _context.abrupt("return", false);
|
|
10184
|
+
case 13:
|
|
10185
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode')) {
|
|
10186
|
+
_context.next = 26;
|
|
10187
|
+
break;
|
|
10188
|
+
}
|
|
10189
|
+
result = true;
|
|
10190
|
+
_context.prev = 15;
|
|
10191
|
+
_context.next = 18;
|
|
10192
|
+
return checkSpuMatchCode({
|
|
10193
|
+
skcCode: recordItem[recordKey],
|
|
10194
|
+
matchingCode: changeValue,
|
|
10195
|
+
ext1: recordItem.colorName
|
|
10196
|
+
});
|
|
10197
|
+
case 18:
|
|
10198
|
+
result = _context.sent;
|
|
10199
|
+
result = true;
|
|
10200
|
+
_context.next = 25;
|
|
10201
|
+
break;
|
|
10202
|
+
case 22:
|
|
10203
|
+
_context.prev = 22;
|
|
10204
|
+
_context.t0 = _context["catch"](15);
|
|
10205
|
+
result = typeof _context.t0 == 'boolean' ? _context.t0 : false;
|
|
10206
|
+
case 25:
|
|
10207
|
+
return _context.abrupt("return", result);
|
|
10208
|
+
case 26:
|
|
10209
|
+
return _context.abrupt("return", true);
|
|
10210
|
+
case 27:
|
|
10211
|
+
case "end":
|
|
10212
|
+
return _context.stop();
|
|
10213
|
+
}
|
|
10214
|
+
}
|
|
10215
|
+
}, _callee, null, [[15, 22]]);
|
|
10216
|
+
}));
|
|
10217
|
+
return function checkSelectChange(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
10218
|
+
return _ref4.apply(this, arguments);
|
|
10219
|
+
};
|
|
10220
|
+
}();
|
|
10124
10221
|
useEffect(function () {
|
|
10125
10222
|
setTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns);
|
|
10126
10223
|
}, [modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns]);
|
|
@@ -10270,40 +10367,55 @@ var AddSelect = function AddSelect(props) {
|
|
|
10270
10367
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
10271
10368
|
render: function render(text, record, index) {
|
|
10272
10369
|
var _item$dataSource;
|
|
10273
|
-
if ((_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) {
|
|
10370
|
+
if ((item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) || (item === null || item === void 0 ? void 0 : item.dataSourceCode)) {
|
|
10371
|
+
var _item$dataSourceMappi, _item$dataSourceMappi2;
|
|
10372
|
+
var dataSourceList = item.dataSource || (record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode]) || [];
|
|
10373
|
+
var selectKey = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi = item.dataSourceMapping) === null || _item$dataSourceMappi === void 0 ? void 0 : _item$dataSourceMappi[0]) || 'code';
|
|
10374
|
+
var selectText = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi2 = item.dataSourceMapping) === null || _item$dataSourceMappi2 === void 0 ? void 0 : _item$dataSourceMappi2[1]) || 'name';
|
|
10274
10375
|
return /*#__PURE__*/React.createElement(Select, {
|
|
10275
10376
|
value: text || null,
|
|
10276
|
-
onChange: function
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10377
|
+
onChange: function () {
|
|
10378
|
+
var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(value) {
|
|
10379
|
+
var isConformToTheRules, newPopValue;
|
|
10380
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
10381
|
+
while (1) {
|
|
10382
|
+
switch (_context2.prev = _context2.next) {
|
|
10383
|
+
case 0:
|
|
10384
|
+
_context2.next = 2;
|
|
10385
|
+
return checkSelectChange(businessType, popvalue, mappingValueField, record, item, value);
|
|
10386
|
+
case 2:
|
|
10387
|
+
isConformToTheRules = _context2.sent;
|
|
10388
|
+
if (isConformToTheRules) {
|
|
10389
|
+
record[item.dataIndex] = value;
|
|
10390
|
+
} else {
|
|
10391
|
+
record[item.dataIndex] = null;
|
|
10392
|
+
}
|
|
10393
|
+
newPopValue = popvalue.map(function (i, innerIndex) {
|
|
10394
|
+
if (innerIndex == index) {
|
|
10395
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
10396
|
+
}
|
|
10397
|
+
return i;
|
|
10398
|
+
});
|
|
10399
|
+
setPopValue(newPopValue);
|
|
10400
|
+
case 6:
|
|
10401
|
+
case "end":
|
|
10402
|
+
return _context2.stop();
|
|
10403
|
+
}
|
|
10285
10404
|
}
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
return
|
|
10405
|
+
}, _callee2);
|
|
10406
|
+
}));
|
|
10407
|
+
function onChange(_x7) {
|
|
10408
|
+
return _onChange.apply(this, arguments);
|
|
10290
10409
|
}
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
if (innerIndex == index) {
|
|
10294
|
-
i[item.dataIndex] = record[item.dataIndex];
|
|
10295
|
-
}
|
|
10296
|
-
return i;
|
|
10297
|
-
});
|
|
10298
|
-
setPopValue(newPopValue);
|
|
10299
|
-
},
|
|
10410
|
+
return onChange;
|
|
10411
|
+
}(),
|
|
10300
10412
|
style: {
|
|
10301
10413
|
width: '160px'
|
|
10302
10414
|
}
|
|
10303
|
-
},
|
|
10415
|
+
}, dataSourceList.map(function (item) {
|
|
10304
10416
|
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
10305
|
-
value: item
|
|
10306
|
-
}, item
|
|
10417
|
+
value: item[selectKey]
|
|
10418
|
+
}, item[selectText]);
|
|
10307
10419
|
}));
|
|
10308
10420
|
}
|
|
10309
10421
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -10432,10 +10544,10 @@ var AddSelect = function AddSelect(props) {
|
|
|
10432
10544
|
currentPage: currentPage
|
|
10433
10545
|
}, otherParams), fixedParam), params);
|
|
10434
10546
|
axios.get("".concat(url, "?").concat(stringify(queryParams))).then(function (result) {
|
|
10435
|
-
var
|
|
10547
|
+
var _result5, _result6;
|
|
10436
10548
|
setFetching(false);
|
|
10437
10549
|
result = result.data;
|
|
10438
|
-
if (((
|
|
10550
|
+
if (((_result5 = result) === null || _result5 === void 0 ? void 0 : _result5.status) && result.status !== '0' || ((_result6 = result) === null || _result6 === void 0 ? void 0 : _result6.code) && result.code !== '000000') {
|
|
10439
10551
|
message.error(result.msg);
|
|
10440
10552
|
return;
|
|
10441
10553
|
}
|
|
@@ -10680,10 +10792,11 @@ var AddSelect = function AddSelect(props) {
|
|
|
10680
10792
|
getData(_objectSpread2(_objectSpread2({}, params), {}, {
|
|
10681
10793
|
pageSize: tableInitPageSize
|
|
10682
10794
|
}), 2);
|
|
10683
|
-
if (selectMode) {
|
|
10684
|
-
|
|
10685
|
-
}
|
|
10795
|
+
// if (selectMode) {
|
|
10796
|
+
// getData(params)
|
|
10797
|
+
// }
|
|
10686
10798
|
};
|
|
10799
|
+
|
|
10687
10800
|
var onResetTable = function onResetTable() {
|
|
10688
10801
|
form.resetFields();
|
|
10689
10802
|
setTableFormParams({});
|
|
@@ -10861,8 +10974,8 @@ var AddSelect = function AddSelect(props) {
|
|
|
10861
10974
|
});
|
|
10862
10975
|
}, [tableColumns]);
|
|
10863
10976
|
var handleResize = function handleResize(arr, index, callback) {
|
|
10864
|
-
return function (_,
|
|
10865
|
-
var size =
|
|
10977
|
+
return function (_, _ref5) {
|
|
10978
|
+
var size = _ref5.size;
|
|
10866
10979
|
var newColumns = arr.map(function (col) {
|
|
10867
10980
|
return _objectSpread2({}, col);
|
|
10868
10981
|
});
|
|
@@ -14221,14 +14334,9 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
|
|
|
14221
14334
|
},
|
|
14222
14335
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14223
14336
|
onSaveCallback: parProps.onSaveCallback,
|
|
14224
|
-
businessType: 'sku'
|
|
14225
|
-
|
|
14226
|
-
// console.log('save call', rows);
|
|
14227
|
-
// // return Promise.resolve(true);
|
|
14228
|
-
// // return Promise.reject('FAILE')
|
|
14229
|
-
// }
|
|
14337
|
+
businessType: 'sku',
|
|
14338
|
+
isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
|
|
14230
14339
|
};
|
|
14231
|
-
|
|
14232
14340
|
var modalTableProps = {
|
|
14233
14341
|
modalTableTitle: '选择商品',
|
|
14234
14342
|
tableSearchForm: [{
|
|
@@ -14519,8 +14627,9 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
|
|
|
14519
14627
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14520
14628
|
onSaveCallback: parProps.onSaveCallback,
|
|
14521
14629
|
businessType: 'skc',
|
|
14522
|
-
isAllowRepeatedSelect: true
|
|
14630
|
+
isAllowRepeatedSelect: (parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect) !== undefined ? !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect) : true // 默认开启一行选多次
|
|
14523
14631
|
};
|
|
14632
|
+
|
|
14524
14633
|
var modalTableProps = {
|
|
14525
14634
|
modalTableTitle: '选择商品',
|
|
14526
14635
|
tableSearchForm: [{
|
|
@@ -14713,6 +14822,25 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14713
14822
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
14714
14823
|
value = _useState8[0],
|
|
14715
14824
|
setValue = _useState8[1];
|
|
14825
|
+
var _useState9 = useState([]),
|
|
14826
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
14827
|
+
propertyList = _useState10[0],
|
|
14828
|
+
setPropertyList = _useState10[1];
|
|
14829
|
+
useEffect(function () {
|
|
14830
|
+
if (parProps === null || parProps === void 0 ? void 0 : parProps.isSingleColor) {
|
|
14831
|
+
// type: 1 尺码组; 2 配码组
|
|
14832
|
+
axios.get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1").then(function (result) {
|
|
14833
|
+
var _result3, _result4;
|
|
14834
|
+
result = result.data;
|
|
14835
|
+
if (((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.status) && result.status !== '0' || ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.code) && result.code !== '000000') {
|
|
14836
|
+
message.error(result.msg);
|
|
14837
|
+
return;
|
|
14838
|
+
}
|
|
14839
|
+
var data = result.data || [];
|
|
14840
|
+
setPropertyList(data);
|
|
14841
|
+
}).catch(function (err) {});
|
|
14842
|
+
}
|
|
14843
|
+
}, []);
|
|
14716
14844
|
//注⚠️:自定义过表头的请记得传tableCodeList参数
|
|
14717
14845
|
var initialSelectColumn = [{
|
|
14718
14846
|
title: '商品编码',
|
|
@@ -14731,6 +14859,19 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14731
14859
|
}, text);
|
|
14732
14860
|
},
|
|
14733
14861
|
dataIndex: 'name'
|
|
14862
|
+
}, {
|
|
14863
|
+
title: '颜色',
|
|
14864
|
+
dataIndex: 'colorName',
|
|
14865
|
+
width: 200,
|
|
14866
|
+
isSelectItem: true,
|
|
14867
|
+
dataSourceCode: 'colorValues',
|
|
14868
|
+
dataSourceMapping: ['value', 'value']
|
|
14869
|
+
}, {
|
|
14870
|
+
title: '配码',
|
|
14871
|
+
dataIndex: 'selectPropertyGroupCode',
|
|
14872
|
+
width: 160,
|
|
14873
|
+
isSelectItem: true,
|
|
14874
|
+
dataSource: propertyList
|
|
14734
14875
|
}, {
|
|
14735
14876
|
title: '数量',
|
|
14736
14877
|
width: 100,
|
|
@@ -14773,14 +14914,9 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14773
14914
|
},
|
|
14774
14915
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14775
14916
|
onSaveCallback: parProps.onSaveCallback,
|
|
14776
|
-
businessType: 'spu'
|
|
14777
|
-
|
|
14778
|
-
// console.log('save call', rows);
|
|
14779
|
-
// // return Promise.resolve(true);
|
|
14780
|
-
// // return Promise.reject('FAILE')
|
|
14781
|
-
// }
|
|
14917
|
+
businessType: 'spu',
|
|
14918
|
+
isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
|
|
14782
14919
|
};
|
|
14783
|
-
|
|
14784
14920
|
var modalTableProps = {
|
|
14785
14921
|
modalTableTitle: '选择商品',
|
|
14786
14922
|
tableSearchForm: [{
|
package/dist/index.js
CHANGED
|
@@ -9899,6 +9899,22 @@ var loadSelectSource = function loadSelectSource(url, params) {
|
|
|
9899
9899
|
});
|
|
9900
9900
|
});
|
|
9901
9901
|
};
|
|
9902
|
+
var checkSpuMatchCode = function checkSpuMatchCode(data) {
|
|
9903
|
+
return new Promise(function (resolve, reject) {
|
|
9904
|
+
axios__default['default'].post("/stock/rwFrontRecordSkcDetail/checkSpuMatchCode", data).then(function (result) {
|
|
9905
|
+
var _result3, _result4;
|
|
9906
|
+
result = result.data;
|
|
9907
|
+
if (((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.status) && result.status !== '0' || ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.code) && result.code !== '000000') {
|
|
9908
|
+
antd.message.error(result.msg);
|
|
9909
|
+
reject(false);
|
|
9910
|
+
return;
|
|
9911
|
+
}
|
|
9912
|
+
resolve(result);
|
|
9913
|
+
}).catch(function (err) {
|
|
9914
|
+
reject(err);
|
|
9915
|
+
});
|
|
9916
|
+
});
|
|
9917
|
+
};
|
|
9902
9918
|
var ResizeableTitle = function ResizeableTitle(props) {
|
|
9903
9919
|
var onResize = props.onResize,
|
|
9904
9920
|
width = props.width,
|
|
@@ -10139,6 +10155,87 @@ var AddSelect = function AddSelect(props) {
|
|
|
10139
10155
|
setShowToChooseColumns = _useState46[1];
|
|
10140
10156
|
var codeToChoose = tableCodeList[0] || initTableCode[businessType][0];
|
|
10141
10157
|
var codeSelected = tableCodeList[1] || initTableCode[businessType][1];
|
|
10158
|
+
var checkSelectChange = /*#__PURE__*/function () {
|
|
10159
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(bType, tList, recordKey, recordItem, selectItem, changeValue) {
|
|
10160
|
+
var result;
|
|
10161
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10162
|
+
while (1) {
|
|
10163
|
+
switch (_context.prev = _context.next) {
|
|
10164
|
+
case 0:
|
|
10165
|
+
if (!(bType == 'skc' && tList.some(function (i) {
|
|
10166
|
+
return i[recordKey] == recordItem[recordKey] && i[selectItem.dataIndex] == changeValue;
|
|
10167
|
+
}))) {
|
|
10168
|
+
_context.next = 3;
|
|
10169
|
+
break;
|
|
10170
|
+
}
|
|
10171
|
+
antd.message.warning('相同skc配码不可设置相同哦');
|
|
10172
|
+
return _context.abrupt("return", false);
|
|
10173
|
+
case 3:
|
|
10174
|
+
if (!(bType == 'spu')) {
|
|
10175
|
+
_context.next = 26;
|
|
10176
|
+
break;
|
|
10177
|
+
}
|
|
10178
|
+
if (!(selectItem.dataIndex == 'colorName' && tList.some(function (i) {
|
|
10179
|
+
return i[recordKey] == recordItem[recordKey] && i.selectPropertyGroupCode == recordItem.selectPropertyGroupCode && i[selectItem.dataIndex] == changeValue;
|
|
10180
|
+
}))) {
|
|
10181
|
+
_context.next = 7;
|
|
10182
|
+
break;
|
|
10183
|
+
}
|
|
10184
|
+
antd.message.warning('相同商品相同配码颜色不可设置相同哦');
|
|
10185
|
+
return _context.abrupt("return", false);
|
|
10186
|
+
case 7:
|
|
10187
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode' && !recordItem.colorName)) {
|
|
10188
|
+
_context.next = 10;
|
|
10189
|
+
break;
|
|
10190
|
+
}
|
|
10191
|
+
antd.message.warning('请先选择颜色!');
|
|
10192
|
+
return _context.abrupt("return", false);
|
|
10193
|
+
case 10:
|
|
10194
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode' && tList.some(function (i) {
|
|
10195
|
+
return i[recordKey] == recordItem[recordKey] && i.colorName == recordItem.colorName && i[selectItem.dataIndex] == changeValue;
|
|
10196
|
+
}))) {
|
|
10197
|
+
_context.next = 13;
|
|
10198
|
+
break;
|
|
10199
|
+
}
|
|
10200
|
+
antd.message.warning('相同商品相同颜色配码不可设置相同哦');
|
|
10201
|
+
return _context.abrupt("return", false);
|
|
10202
|
+
case 13:
|
|
10203
|
+
if (!(selectItem.dataIndex == 'selectPropertyGroupCode')) {
|
|
10204
|
+
_context.next = 26;
|
|
10205
|
+
break;
|
|
10206
|
+
}
|
|
10207
|
+
result = true;
|
|
10208
|
+
_context.prev = 15;
|
|
10209
|
+
_context.next = 18;
|
|
10210
|
+
return checkSpuMatchCode({
|
|
10211
|
+
skcCode: recordItem[recordKey],
|
|
10212
|
+
matchingCode: changeValue,
|
|
10213
|
+
ext1: recordItem.colorName
|
|
10214
|
+
});
|
|
10215
|
+
case 18:
|
|
10216
|
+
result = _context.sent;
|
|
10217
|
+
result = true;
|
|
10218
|
+
_context.next = 25;
|
|
10219
|
+
break;
|
|
10220
|
+
case 22:
|
|
10221
|
+
_context.prev = 22;
|
|
10222
|
+
_context.t0 = _context["catch"](15);
|
|
10223
|
+
result = typeof _context.t0 == 'boolean' ? _context.t0 : false;
|
|
10224
|
+
case 25:
|
|
10225
|
+
return _context.abrupt("return", result);
|
|
10226
|
+
case 26:
|
|
10227
|
+
return _context.abrupt("return", true);
|
|
10228
|
+
case 27:
|
|
10229
|
+
case "end":
|
|
10230
|
+
return _context.stop();
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
}, _callee, null, [[15, 22]]);
|
|
10234
|
+
}));
|
|
10235
|
+
return function checkSelectChange(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
10236
|
+
return _ref4.apply(this, arguments);
|
|
10237
|
+
};
|
|
10238
|
+
}();
|
|
10142
10239
|
React.useEffect(function () {
|
|
10143
10240
|
setTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns);
|
|
10144
10241
|
}, [modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns]);
|
|
@@ -10288,40 +10385,55 @@ var AddSelect = function AddSelect(props) {
|
|
|
10288
10385
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
10289
10386
|
render: function render(text, record, index) {
|
|
10290
10387
|
var _item$dataSource;
|
|
10291
|
-
if ((_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) {
|
|
10388
|
+
if ((item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) || (item === null || item === void 0 ? void 0 : item.dataSourceCode)) {
|
|
10389
|
+
var _item$dataSourceMappi, _item$dataSourceMappi2;
|
|
10390
|
+
var dataSourceList = item.dataSource || (record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode]) || [];
|
|
10391
|
+
var selectKey = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi = item.dataSourceMapping) === null || _item$dataSourceMappi === void 0 ? void 0 : _item$dataSourceMappi[0]) || 'code';
|
|
10392
|
+
var selectText = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi2 = item.dataSourceMapping) === null || _item$dataSourceMappi2 === void 0 ? void 0 : _item$dataSourceMappi2[1]) || 'name';
|
|
10292
10393
|
return /*#__PURE__*/React__default['default'].createElement(antd.Select, {
|
|
10293
10394
|
value: text || null,
|
|
10294
|
-
onChange: function
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10395
|
+
onChange: function () {
|
|
10396
|
+
var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(value) {
|
|
10397
|
+
var isConformToTheRules, newPopValue;
|
|
10398
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
10399
|
+
while (1) {
|
|
10400
|
+
switch (_context2.prev = _context2.next) {
|
|
10401
|
+
case 0:
|
|
10402
|
+
_context2.next = 2;
|
|
10403
|
+
return checkSelectChange(businessType, popvalue, mappingValueField, record, item, value);
|
|
10404
|
+
case 2:
|
|
10405
|
+
isConformToTheRules = _context2.sent;
|
|
10406
|
+
if (isConformToTheRules) {
|
|
10407
|
+
record[item.dataIndex] = value;
|
|
10408
|
+
} else {
|
|
10409
|
+
record[item.dataIndex] = null;
|
|
10410
|
+
}
|
|
10411
|
+
newPopValue = popvalue.map(function (i, innerIndex) {
|
|
10412
|
+
if (innerIndex == index) {
|
|
10413
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
10414
|
+
}
|
|
10415
|
+
return i;
|
|
10416
|
+
});
|
|
10417
|
+
setPopValue(newPopValue);
|
|
10418
|
+
case 6:
|
|
10419
|
+
case "end":
|
|
10420
|
+
return _context2.stop();
|
|
10421
|
+
}
|
|
10303
10422
|
}
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
return
|
|
10423
|
+
}, _callee2);
|
|
10424
|
+
}));
|
|
10425
|
+
function onChange(_x7) {
|
|
10426
|
+
return _onChange.apply(this, arguments);
|
|
10308
10427
|
}
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
if (innerIndex == index) {
|
|
10312
|
-
i[item.dataIndex] = record[item.dataIndex];
|
|
10313
|
-
}
|
|
10314
|
-
return i;
|
|
10315
|
-
});
|
|
10316
|
-
setPopValue(newPopValue);
|
|
10317
|
-
},
|
|
10428
|
+
return onChange;
|
|
10429
|
+
}(),
|
|
10318
10430
|
style: {
|
|
10319
10431
|
width: '160px'
|
|
10320
10432
|
}
|
|
10321
|
-
},
|
|
10433
|
+
}, dataSourceList.map(function (item) {
|
|
10322
10434
|
return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
|
|
10323
|
-
value: item
|
|
10324
|
-
}, item
|
|
10435
|
+
value: item[selectKey]
|
|
10436
|
+
}, item[selectText]);
|
|
10325
10437
|
}));
|
|
10326
10438
|
}
|
|
10327
10439
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
@@ -10450,10 +10562,10 @@ var AddSelect = function AddSelect(props) {
|
|
|
10450
10562
|
currentPage: currentPage
|
|
10451
10563
|
}, otherParams), fixedParam), params);
|
|
10452
10564
|
axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams))).then(function (result) {
|
|
10453
|
-
var
|
|
10565
|
+
var _result5, _result6;
|
|
10454
10566
|
setFetching(false);
|
|
10455
10567
|
result = result.data;
|
|
10456
|
-
if (((
|
|
10568
|
+
if (((_result5 = result) === null || _result5 === void 0 ? void 0 : _result5.status) && result.status !== '0' || ((_result6 = result) === null || _result6 === void 0 ? void 0 : _result6.code) && result.code !== '000000') {
|
|
10457
10569
|
antd.message.error(result.msg);
|
|
10458
10570
|
return;
|
|
10459
10571
|
}
|
|
@@ -10698,10 +10810,11 @@ var AddSelect = function AddSelect(props) {
|
|
|
10698
10810
|
getData(_objectSpread2(_objectSpread2({}, params), {}, {
|
|
10699
10811
|
pageSize: tableInitPageSize
|
|
10700
10812
|
}), 2);
|
|
10701
|
-
if (selectMode) {
|
|
10702
|
-
|
|
10703
|
-
}
|
|
10813
|
+
// if (selectMode) {
|
|
10814
|
+
// getData(params)
|
|
10815
|
+
// }
|
|
10704
10816
|
};
|
|
10817
|
+
|
|
10705
10818
|
var onResetTable = function onResetTable() {
|
|
10706
10819
|
form.resetFields();
|
|
10707
10820
|
setTableFormParams({});
|
|
@@ -10879,8 +10992,8 @@ var AddSelect = function AddSelect(props) {
|
|
|
10879
10992
|
});
|
|
10880
10993
|
}, [tableColumns]);
|
|
10881
10994
|
var handleResize = function handleResize(arr, index, callback) {
|
|
10882
|
-
return function (_,
|
|
10883
|
-
var size =
|
|
10995
|
+
return function (_, _ref5) {
|
|
10996
|
+
var size = _ref5.size;
|
|
10884
10997
|
var newColumns = arr.map(function (col) {
|
|
10885
10998
|
return _objectSpread2({}, col);
|
|
10886
10999
|
});
|
|
@@ -14239,14 +14352,9 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
|
|
|
14239
14352
|
},
|
|
14240
14353
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14241
14354
|
onSaveCallback: parProps.onSaveCallback,
|
|
14242
|
-
businessType: 'sku'
|
|
14243
|
-
|
|
14244
|
-
// console.log('save call', rows);
|
|
14245
|
-
// // return Promise.resolve(true);
|
|
14246
|
-
// // return Promise.reject('FAILE')
|
|
14247
|
-
// }
|
|
14355
|
+
businessType: 'sku',
|
|
14356
|
+
isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
|
|
14248
14357
|
};
|
|
14249
|
-
|
|
14250
14358
|
var modalTableProps = {
|
|
14251
14359
|
modalTableTitle: '选择商品',
|
|
14252
14360
|
tableSearchForm: [{
|
|
@@ -14537,8 +14645,9 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
|
|
|
14537
14645
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14538
14646
|
onSaveCallback: parProps.onSaveCallback,
|
|
14539
14647
|
businessType: 'skc',
|
|
14540
|
-
isAllowRepeatedSelect: true
|
|
14648
|
+
isAllowRepeatedSelect: (parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect) !== undefined ? !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect) : true // 默认开启一行选多次
|
|
14541
14649
|
};
|
|
14650
|
+
|
|
14542
14651
|
var modalTableProps = {
|
|
14543
14652
|
modalTableTitle: '选择商品',
|
|
14544
14653
|
tableSearchForm: [{
|
|
@@ -14731,6 +14840,25 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14731
14840
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
14732
14841
|
value = _useState8[0],
|
|
14733
14842
|
setValue = _useState8[1];
|
|
14843
|
+
var _useState9 = React.useState([]),
|
|
14844
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
14845
|
+
propertyList = _useState10[0],
|
|
14846
|
+
setPropertyList = _useState10[1];
|
|
14847
|
+
React.useEffect(function () {
|
|
14848
|
+
if (parProps === null || parProps === void 0 ? void 0 : parProps.isSingleColor) {
|
|
14849
|
+
// type: 1 尺码组; 2 配码组
|
|
14850
|
+
axios__default['default'].get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1").then(function (result) {
|
|
14851
|
+
var _result3, _result4;
|
|
14852
|
+
result = result.data;
|
|
14853
|
+
if (((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.status) && result.status !== '0' || ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.code) && result.code !== '000000') {
|
|
14854
|
+
antd.message.error(result.msg);
|
|
14855
|
+
return;
|
|
14856
|
+
}
|
|
14857
|
+
var data = result.data || [];
|
|
14858
|
+
setPropertyList(data);
|
|
14859
|
+
}).catch(function (err) {});
|
|
14860
|
+
}
|
|
14861
|
+
}, []);
|
|
14734
14862
|
//注⚠️:自定义过表头的请记得传tableCodeList参数
|
|
14735
14863
|
var initialSelectColumn = [{
|
|
14736
14864
|
title: '商品编码',
|
|
@@ -14749,6 +14877,19 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14749
14877
|
}, text);
|
|
14750
14878
|
},
|
|
14751
14879
|
dataIndex: 'name'
|
|
14880
|
+
}, {
|
|
14881
|
+
title: '颜色',
|
|
14882
|
+
dataIndex: 'colorName',
|
|
14883
|
+
width: 200,
|
|
14884
|
+
isSelectItem: true,
|
|
14885
|
+
dataSourceCode: 'colorValues',
|
|
14886
|
+
dataSourceMapping: ['value', 'value']
|
|
14887
|
+
}, {
|
|
14888
|
+
title: '配码',
|
|
14889
|
+
dataIndex: 'selectPropertyGroupCode',
|
|
14890
|
+
width: 160,
|
|
14891
|
+
isSelectItem: true,
|
|
14892
|
+
dataSource: propertyList
|
|
14752
14893
|
}, {
|
|
14753
14894
|
title: '数量',
|
|
14754
14895
|
width: 100,
|
|
@@ -14791,14 +14932,9 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14791
14932
|
},
|
|
14792
14933
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
14793
14934
|
onSaveCallback: parProps.onSaveCallback,
|
|
14794
|
-
businessType: 'spu'
|
|
14795
|
-
|
|
14796
|
-
// console.log('save call', rows);
|
|
14797
|
-
// // return Promise.resolve(true);
|
|
14798
|
-
// // return Promise.reject('FAILE')
|
|
14799
|
-
// }
|
|
14935
|
+
businessType: 'spu',
|
|
14936
|
+
isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
|
|
14800
14937
|
};
|
|
14801
|
-
|
|
14802
14938
|
var modalTableProps = {
|
|
14803
14939
|
modalTableTitle: '选择商品',
|
|
14804
14940
|
tableSearchForm: [{
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@ export default () => {
|
|
|
76
76
|
const config = {
|
|
77
77
|
buttonText: 'context',
|
|
78
78
|
buttonProps: { disabled: false },
|
|
79
|
+
// isAllowRepeatedSelect: false,
|
|
79
80
|
beforeShowModal: () => {
|
|
80
81
|
return Promise.resolve(true);
|
|
81
82
|
// return Promise.reject('校验有误');
|
|
@@ -108,7 +109,7 @@ export default () => {
|
|
|
108
109
|
const config = {
|
|
109
110
|
buttonText: 'context',
|
|
110
111
|
buttonProps: { disabled: false },
|
|
111
|
-
exceptColumns: ['count', 'categoryText', 'className'],
|
|
112
|
+
exceptColumns: ['colorName','selectPropertyGroupCode','count', 'categoryText', 'className'],
|
|
112
113
|
tableCodeList: [null,'spuSelect-tableSelectedItemPartCode_ItemLabel'],
|
|
113
114
|
beforeShowModal: () => {
|
|
114
115
|
return Promise.resolve(true);
|
|
@@ -127,3 +128,34 @@ export default () => {
|
|
|
127
128
|
);
|
|
128
129
|
};
|
|
129
130
|
```
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import React, { useState } from 'react';
|
|
134
|
+
import { Tabs } from 'antd';
|
|
135
|
+
import { AddSpuSelect } from '../../../index.ts';
|
|
136
|
+
|
|
137
|
+
export default () => {
|
|
138
|
+
const config = {
|
|
139
|
+
buttonText: '添加商品(单色配码)',
|
|
140
|
+
buttonProps: { disabled: false },
|
|
141
|
+
isSingleColor: true,
|
|
142
|
+
isAllowRepeatedSelect: true,
|
|
143
|
+
exceptColumns: ['ownOrgSignName', 'brandName', 'categoryText', 'className'],
|
|
144
|
+
tableCodeList: [null,'spuSelect-tableSelectedItemPartCode_ItemMatchingColor'],
|
|
145
|
+
beforeShowModal: () => {
|
|
146
|
+
return Promise.resolve(true);
|
|
147
|
+
// return Promise.reject('校验有误');
|
|
148
|
+
},
|
|
149
|
+
onSaveCallback: (rows) => {
|
|
150
|
+
console.log('save call', rows);
|
|
151
|
+
return Promise.resolve(true);
|
|
152
|
+
// return Promise.reject('FAILE')
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return (
|
|
156
|
+
<div>
|
|
157
|
+
<AddSpuSelect {...config} />
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
```
|
|
@@ -149,12 +149,8 @@ export const AddSkuSelect = (parProps: any) => {
|
|
|
149
149
|
},
|
|
150
150
|
beforeShowModal: parProps?.beforeShowModal,
|
|
151
151
|
onSaveCallback: parProps.onSaveCallback,
|
|
152
|
-
businessType: 'sku'
|
|
153
|
-
|
|
154
|
-
// console.log('save call', rows);
|
|
155
|
-
// // return Promise.resolve(true);
|
|
156
|
-
// // return Promise.reject('FAILE')
|
|
157
|
-
// }
|
|
152
|
+
businessType: 'sku',
|
|
153
|
+
isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
|
|
158
154
|
};
|
|
159
155
|
const modalTableProps = {
|
|
160
156
|
modalTableTitle: '选择商品',
|
|
@@ -436,7 +432,7 @@ export const AddSkcSelect = (parProps: any) => {
|
|
|
436
432
|
beforeShowModal: parProps?.beforeShowModal,
|
|
437
433
|
onSaveCallback: parProps.onSaveCallback,
|
|
438
434
|
businessType: 'skc',
|
|
439
|
-
isAllowRepeatedSelect: true
|
|
435
|
+
isAllowRepeatedSelect: parProps?.isAllowRepeatedSelect!==undefined ? !!parProps?.isAllowRepeatedSelect : true, // 默认开启一行选多次
|
|
440
436
|
};
|
|
441
437
|
const modalTableProps = {
|
|
442
438
|
modalTableTitle: '选择商品',
|
|
@@ -608,6 +604,23 @@ export const AddSpuSelect = (parProps: any) => {
|
|
|
608
604
|
mode: 'multiple',
|
|
609
605
|
}
|
|
610
606
|
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
607
|
+
const [propertyList, setPropertyList] = useState([]);
|
|
608
|
+
|
|
609
|
+
useEffect(() => {
|
|
610
|
+
if(parProps?.isSingleColor) {
|
|
611
|
+
// type: 1 尺码组; 2 配码组
|
|
612
|
+
axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
|
|
613
|
+
result = result.data;
|
|
614
|
+
if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
|
|
615
|
+
message.error(result.msg);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const data = result.data || [];
|
|
619
|
+
setPropertyList(data)
|
|
620
|
+
}).catch((err) => {});
|
|
621
|
+
}
|
|
622
|
+
},[])
|
|
623
|
+
|
|
611
624
|
//注⚠️:自定义过表头的请记得传tableCodeList参数
|
|
612
625
|
const initialSelectColumn = [
|
|
613
626
|
{
|
|
@@ -628,6 +641,21 @@ export const AddSpuSelect = (parProps: any) => {
|
|
|
628
641
|
),
|
|
629
642
|
dataIndex: 'name',
|
|
630
643
|
},
|
|
644
|
+
{
|
|
645
|
+
title: '颜色',
|
|
646
|
+
dataIndex: 'colorName',
|
|
647
|
+
width: 200,
|
|
648
|
+
isSelectItem: true,
|
|
649
|
+
dataSourceCode: 'colorValues',
|
|
650
|
+
dataSourceMapping: ['value', 'value']
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
title: '配码',
|
|
654
|
+
dataIndex: 'selectPropertyGroupCode',
|
|
655
|
+
width: 160,
|
|
656
|
+
isSelectItem: true,
|
|
657
|
+
dataSource: propertyList,
|
|
658
|
+
},
|
|
631
659
|
{
|
|
632
660
|
title: '数量',
|
|
633
661
|
width: 100,
|
|
@@ -677,11 +705,7 @@ export const AddSpuSelect = (parProps: any) => {
|
|
|
677
705
|
beforeShowModal: parProps?.beforeShowModal,
|
|
678
706
|
onSaveCallback: parProps.onSaveCallback,
|
|
679
707
|
businessType: 'spu',
|
|
680
|
-
|
|
681
|
-
// console.log('save call', rows);
|
|
682
|
-
// // return Promise.resolve(true);
|
|
683
|
-
// // return Promise.reject('FAILE')
|
|
684
|
-
// }
|
|
708
|
+
isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
|
|
685
709
|
};
|
|
686
710
|
const modalTableProps = {
|
|
687
711
|
modalTableTitle: '选择商品',
|
|
@@ -34,6 +34,24 @@ const loadSelectSource = (url: string, params?: any) => {
|
|
|
34
34
|
})
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const checkSpuMatchCode = (data: any) => {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
axios.post(`/stock/rwFrontRecordSkcDetail/checkSpuMatchCode`,data)
|
|
40
|
+
.then((result: any) => {
|
|
41
|
+
result = result.data;
|
|
42
|
+
if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
|
|
43
|
+
message.error(result.msg);
|
|
44
|
+
reject(false);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
resolve(result);
|
|
48
|
+
})
|
|
49
|
+
.catch((err) => {
|
|
50
|
+
reject(err);
|
|
51
|
+
});
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
37
55
|
const ResizeableTitle = (props) => {
|
|
38
56
|
const { onResize, width, ...restProps } = props;
|
|
39
57
|
|
|
@@ -180,6 +198,38 @@ const AddSelect = (props: any) => {
|
|
|
180
198
|
const codeToChoose = tableCodeList[0] || initTableCode[businessType][0];
|
|
181
199
|
const codeSelected = tableCodeList[1] || initTableCode[businessType][1];
|
|
182
200
|
|
|
201
|
+
const checkSelectChange = async (bType: string, tList: any, recordKey: string, recordItem: any, selectItem: any, changeValue: string) => {
|
|
202
|
+
if(bType == 'skc' && tList.some((i: any) => i[recordKey] == recordItem[recordKey] && i[selectItem.dataIndex] == changeValue)) {
|
|
203
|
+
message.warning('相同skc配码不可设置相同哦')
|
|
204
|
+
return false
|
|
205
|
+
}
|
|
206
|
+
if(bType == 'spu') {
|
|
207
|
+
if(selectItem.dataIndex == 'colorName' && tList.some((i: any) => i[recordKey] == recordItem[recordKey] && i.selectPropertyGroupCode == recordItem.selectPropertyGroupCode && i[selectItem.dataIndex] == changeValue)){
|
|
208
|
+
message.warning('相同商品相同配码颜色不可设置相同哦')
|
|
209
|
+
return false
|
|
210
|
+
}
|
|
211
|
+
if(selectItem.dataIndex == 'selectPropertyGroupCode' && !recordItem.colorName) {
|
|
212
|
+
message.warning('请先选择颜色!')
|
|
213
|
+
return false
|
|
214
|
+
}
|
|
215
|
+
if(selectItem.dataIndex == 'selectPropertyGroupCode'&& tList.some((i: any) => i[recordKey] == recordItem[recordKey] && i.colorName == recordItem.colorName && i[selectItem.dataIndex] == changeValue)){
|
|
216
|
+
message.warning('相同商品相同颜色配码不可设置相同哦')
|
|
217
|
+
return false
|
|
218
|
+
}
|
|
219
|
+
if(selectItem.dataIndex == 'selectPropertyGroupCode') {
|
|
220
|
+
let result = true
|
|
221
|
+
try {
|
|
222
|
+
result = await checkSpuMatchCode({ skcCode: recordItem[recordKey], matchingCode: changeValue, ext1: recordItem.colorName });
|
|
223
|
+
result = true
|
|
224
|
+
} catch (e) {
|
|
225
|
+
result = typeof e == 'boolean' ? e : false
|
|
226
|
+
}
|
|
227
|
+
return result
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return true
|
|
231
|
+
}
|
|
232
|
+
|
|
183
233
|
useEffect(() => {
|
|
184
234
|
setTableColumns(modalTableProps?.tableColumns)
|
|
185
235
|
}, [modalTableProps?.tableColumns])
|
|
@@ -324,24 +374,20 @@ const AddSelect = (props: any) => {
|
|
|
324
374
|
return {
|
|
325
375
|
...item,
|
|
326
376
|
render: (text, record, index) => {
|
|
327
|
-
if (item
|
|
377
|
+
if (item?.dataSource?.length || item?.dataSourceCode) {
|
|
378
|
+
const dataSourceList = item.dataSource || record?.[item?.dataSourceCode] || [];
|
|
379
|
+
const selectKey = item?.dataSourceMapping?.[0] || 'code';
|
|
380
|
+
const selectText = item?.dataSourceMapping?.[1] || 'name';
|
|
328
381
|
return (
|
|
329
382
|
<Select
|
|
330
383
|
value={text || null}
|
|
331
|
-
onChange={(value) => {
|
|
332
|
-
|
|
333
|
-
|
|
384
|
+
onChange={async (value) => {
|
|
385
|
+
const isConformToTheRules = await checkSelectChange(businessType,popvalue,mappingValueField,record,item,value)
|
|
386
|
+
if(isConformToTheRules) {
|
|
387
|
+
record[item.dataIndex] = value
|
|
388
|
+
} else {
|
|
334
389
|
record[item.dataIndex] = null;
|
|
335
|
-
const newPopValue = popvalue.map((i: any, innerIndex: number) => {
|
|
336
|
-
if(innerIndex == index) {
|
|
337
|
-
i[item.dataIndex] = record[item.dataIndex]
|
|
338
|
-
}
|
|
339
|
-
return i
|
|
340
|
-
})
|
|
341
|
-
setPopValue(newPopValue)
|
|
342
|
-
return false
|
|
343
390
|
}
|
|
344
|
-
record[item.dataIndex] = value
|
|
345
391
|
const newPopValue = popvalue.map((i: any, innerIndex: number) => {
|
|
346
392
|
if(innerIndex == index) {
|
|
347
393
|
i[item.dataIndex] = record[item.dataIndex]
|
|
@@ -352,8 +398,8 @@ const AddSelect = (props: any) => {
|
|
|
352
398
|
}}
|
|
353
399
|
style={{width: '160px'}}
|
|
354
400
|
>
|
|
355
|
-
{
|
|
356
|
-
return <Select.Option value={item
|
|
401
|
+
{dataSourceList.map((item: any) => {
|
|
402
|
+
return <Select.Option value={item[selectKey]}>{item[selectText]}</Select.Option>
|
|
357
403
|
})}
|
|
358
404
|
</Select>
|
|
359
405
|
)
|
|
@@ -798,9 +844,9 @@ const AddSelect = (props: any) => {
|
|
|
798
844
|
const params = form.getFieldsValue();
|
|
799
845
|
setTableFormParams(params);
|
|
800
846
|
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
801
|
-
if (selectMode) {
|
|
802
|
-
|
|
803
|
-
}
|
|
847
|
+
// if (selectMode) {
|
|
848
|
+
// getData(params)
|
|
849
|
+
// }
|
|
804
850
|
}
|
|
805
851
|
|
|
806
852
|
const onResetTable = () => {
|