@bit-sun/business-component 1.1.12 → 1.1.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.
- package/dist/index.esm.js +171 -14
- package/dist/index.js +171 -14
- package/package.json +2 -2
- package/src/components/DataValidation/index.tsx +9 -3
- package/src/components/SearchSelect/business/BusinessUtils.ts +112 -3
- package/src/components/SearchSelect/business/index.md +95 -10
- package/src/components/SearchSelect/index.tsx +11 -6
package/dist/index.esm.js
CHANGED
|
@@ -1265,6 +1265,14 @@ function injectCSS(css) {
|
|
|
1265
1265
|
return styleNode;
|
|
1266
1266
|
}
|
|
1267
1267
|
var containerCache = new Map();
|
|
1268
|
+
|
|
1269
|
+
function findExistNode(key) {
|
|
1270
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1271
|
+
var container = getContainer(option);
|
|
1272
|
+
return Array.from(containerCache.get(container).children).find(function (node) {
|
|
1273
|
+
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1268
1276
|
function updateCSS(css, key) {
|
|
1269
1277
|
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1270
1278
|
var container = getContainer(option); // Get real parent
|
|
@@ -1276,9 +1284,7 @@ function updateCSS(css, key) {
|
|
|
1276
1284
|
parentNode.removeChild(placeholderStyle);
|
|
1277
1285
|
}
|
|
1278
1286
|
|
|
1279
|
-
var existNode =
|
|
1280
|
-
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1281
|
-
});
|
|
1287
|
+
var existNode = findExistNode(key, option);
|
|
1282
1288
|
|
|
1283
1289
|
if (existNode) {
|
|
1284
1290
|
var _option$csp3, _option$csp4;
|
|
@@ -1728,13 +1734,18 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1728
1734
|
if (cell) {
|
|
1729
1735
|
cell.fs = 10;
|
|
1730
1736
|
|
|
1731
|
-
if (typeof cell.v === 'number') {
|
|
1732
|
-
cell.v = cell.m;
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
1737
|
if (typeof cell.v === 'string') {
|
|
1736
1738
|
cell.m = cell.v = cell.m.trim();
|
|
1737
1739
|
}
|
|
1740
|
+
|
|
1741
|
+
if (cell && cell.m && cell.m.indexOf('E+') !== -1) {
|
|
1742
|
+
cell.v = cell.v.toString();
|
|
1743
|
+
cell.m = cell.v;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
if (typeof cell.v === 'number') {
|
|
1747
|
+
cell.v = cell.m;
|
|
1748
|
+
}
|
|
1738
1749
|
} // console.log(postion);
|
|
1739
1750
|
|
|
1740
1751
|
},
|
|
@@ -2437,6 +2448,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2437
2448
|
fieldValToParam = _ref.fieldValToParam,
|
|
2438
2449
|
_ref$mappingTextField = _ref.mappingTextField,
|
|
2439
2450
|
mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
|
|
2451
|
+
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
2440
2452
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
2441
2453
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
2442
2454
|
_ref$sourceName = _ref.sourceName,
|
|
@@ -2497,12 +2509,12 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2497
2509
|
popvalue = _useState14[0],
|
|
2498
2510
|
setPopValue = _useState14[1];
|
|
2499
2511
|
|
|
2500
|
-
var _useDebounceFn = useDebounceFn(function () {
|
|
2512
|
+
var _useDebounceFn = useDebounceFn(function (v) {
|
|
2501
2513
|
// 优化搜索参数 支持传多个
|
|
2502
2514
|
var searchParams = {};
|
|
2503
2515
|
|
|
2504
2516
|
if (typeof selectParamsKey === 'string') {
|
|
2505
|
-
searchParams = _defineProperty({}, selectParamsKey, searchValue);
|
|
2517
|
+
searchParams = _defineProperty({}, selectParamsKey, v ? initVal : searchValue);
|
|
2506
2518
|
}
|
|
2507
2519
|
|
|
2508
2520
|
if (Array.isArray(selectParamsKey)) {
|
|
@@ -2623,11 +2635,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2623
2635
|
source = res ? res[keys] ? res[keys].map(function (item) {
|
|
2624
2636
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2625
2637
|
text: item[mappingTextField],
|
|
2638
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
2626
2639
|
value: item[mappingValueField]
|
|
2627
2640
|
});
|
|
2628
2641
|
}) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
|
|
2629
2642
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2630
2643
|
text: item[mappingTextField],
|
|
2644
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
2631
2645
|
value: item[mappingValueField]
|
|
2632
2646
|
});
|
|
2633
2647
|
})) : [];
|
|
@@ -2638,7 +2652,6 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2638
2652
|
if (type === 1) {
|
|
2639
2653
|
var _ctx$form;
|
|
2640
2654
|
|
|
2641
|
-
console.log(sourceName, 'sourceName');
|
|
2642
2655
|
ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
|
|
2643
2656
|
setItems(source);
|
|
2644
2657
|
setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
|
|
@@ -2674,7 +2687,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2674
2687
|
};
|
|
2675
2688
|
|
|
2676
2689
|
useEffect(function () {
|
|
2677
|
-
|
|
2690
|
+
run('init');
|
|
2678
2691
|
}, []);
|
|
2679
2692
|
useEffect(function () {
|
|
2680
2693
|
if (value) {
|
|
@@ -2737,7 +2750,14 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2737
2750
|
|
|
2738
2751
|
var handleOk = function handleOk() {
|
|
2739
2752
|
if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
|
|
2740
|
-
|
|
2753
|
+
var _ctx$form2;
|
|
2754
|
+
|
|
2755
|
+
formaData(popvalue); // 解决选择最后1页的sku,返回后,不显示名称问题
|
|
2756
|
+
|
|
2757
|
+
var source = _.uniqBy(items.concat(popvalue), 'value');
|
|
2758
|
+
|
|
2759
|
+
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
|
|
2760
|
+
setItems(source);
|
|
2741
2761
|
}
|
|
2742
2762
|
|
|
2743
2763
|
setIsModalVisible(false);
|
|
@@ -3036,7 +3056,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3036
3056
|
key: item.value,
|
|
3037
3057
|
label: item.text
|
|
3038
3058
|
}, LightHeightOption({
|
|
3039
|
-
text: "".concat(item.
|
|
3059
|
+
text: "".concat(item.textShowKey, " ").concat(item.text),
|
|
3040
3060
|
filterTxt: searchValue
|
|
3041
3061
|
}));
|
|
3042
3062
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
@@ -3516,7 +3536,144 @@ function commonFun(type, prefixUrl) {
|
|
|
3516
3536
|
};
|
|
3517
3537
|
} // 仓库选择器
|
|
3518
3538
|
|
|
3519
|
-
|
|
3539
|
+
|
|
3540
|
+
if (type === 'physicalWarehouse') {
|
|
3541
|
+
requestConfig = {
|
|
3542
|
+
url: "".concat(prefixUrl.selectPrefix, "/physicalWarehouse"),
|
|
3543
|
+
filter: 'qp-nameAndCode-like',
|
|
3544
|
+
mappingTextField: 'physicalWarehouseName',
|
|
3545
|
+
mappingTextShowKeyField: 'physicalWarehouseCode',
|
|
3546
|
+
mappingValueField: 'id',
|
|
3547
|
+
otherParams: {
|
|
3548
|
+
sorter: 'desc-id'
|
|
3549
|
+
},
|
|
3550
|
+
sourceName: 'warehouseIds'
|
|
3551
|
+
};
|
|
3552
|
+
tableSearchForm = [{
|
|
3553
|
+
name: 'qp-physicalWarehouseName-like',
|
|
3554
|
+
label: '物理仓名称'
|
|
3555
|
+
}, {
|
|
3556
|
+
name: 'qp-physicalWarehouseCode-like',
|
|
3557
|
+
label: '物理仓编码'
|
|
3558
|
+
}, {
|
|
3559
|
+
name: 'qp-physicalWarehouseType-eq',
|
|
3560
|
+
type: 'select',
|
|
3561
|
+
label: '物理仓类型',
|
|
3562
|
+
initialSource: getDictionarySource('SC00002')
|
|
3563
|
+
}, {
|
|
3564
|
+
name: 'qp-companyCode-eq',
|
|
3565
|
+
type: 'select',
|
|
3566
|
+
label: '所属公司',
|
|
3567
|
+
field: {
|
|
3568
|
+
type: 'select',
|
|
3569
|
+
props: {
|
|
3570
|
+
mode: 'multiple',
|
|
3571
|
+
notFoundContent: '暂无数据',
|
|
3572
|
+
allowClear: true,
|
|
3573
|
+
showSearch: true,
|
|
3574
|
+
showArrow: true,
|
|
3575
|
+
maxTagCount: 1,
|
|
3576
|
+
optionFilterProp: 'children',
|
|
3577
|
+
filterOption: function filterOption(input, option) {
|
|
3578
|
+
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}, {
|
|
3583
|
+
name: 'qp-isEnable-eq',
|
|
3584
|
+
type: 'select',
|
|
3585
|
+
label: '物理仓状态',
|
|
3586
|
+
initialSource: getDictionarySource('SC00001')
|
|
3587
|
+
}];
|
|
3588
|
+
Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
|
|
3589
|
+
pageSize: 5000,
|
|
3590
|
+
currentPage: 1,
|
|
3591
|
+
'qp-companyType-eq': 20
|
|
3592
|
+
})]).then(function (x) {
|
|
3593
|
+
formatSource(x, 0, 3, tableSearchForm);
|
|
3594
|
+
});
|
|
3595
|
+
modalTableProps = {
|
|
3596
|
+
modalTableTitle: '选择物理仓',
|
|
3597
|
+
tableSearchForm: tableSearchForm,
|
|
3598
|
+
tableColumns: [{
|
|
3599
|
+
title: '物理仓编码',
|
|
3600
|
+
dataIndex: 'physicalWarehouseCode'
|
|
3601
|
+
}, {
|
|
3602
|
+
title: '物理仓名称',
|
|
3603
|
+
dataIndex: 'physicalWarehouseName'
|
|
3604
|
+
}, {
|
|
3605
|
+
title: '物理仓类型',
|
|
3606
|
+
dataIndex: 'physicalWarehouseType',
|
|
3607
|
+
render: function render(text) {
|
|
3608
|
+
return getDictionaryTextByValue('SC00002', text);
|
|
3609
|
+
}
|
|
3610
|
+
}, {
|
|
3611
|
+
title: '物理仓状态',
|
|
3612
|
+
dataIndex: 'isEnable',
|
|
3613
|
+
render: function render(text) {
|
|
3614
|
+
return getDictionaryTextByValue('SC00001', text);
|
|
3615
|
+
}
|
|
3616
|
+
}, {
|
|
3617
|
+
title: '所属公司',
|
|
3618
|
+
dataIndex: 'companyName'
|
|
3619
|
+
}]
|
|
3620
|
+
};
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
if (type === 'realWarehouse') {
|
|
3624
|
+
requestConfig = {
|
|
3625
|
+
url: "".concat(prefixUrl.selectPrefix, "/realWarehouse"),
|
|
3626
|
+
filter: 'qp-nameAndCode-like',
|
|
3627
|
+
mappingTextField: 'realWarehouseName',
|
|
3628
|
+
mappingTextShowKeyField: 'realWarehouseCode',
|
|
3629
|
+
mappingValueField: 'id',
|
|
3630
|
+
otherParams: {
|
|
3631
|
+
sorter: 'desc-id'
|
|
3632
|
+
},
|
|
3633
|
+
sourceName: 'warehouseIds'
|
|
3634
|
+
};
|
|
3635
|
+
tableSearchForm = [{
|
|
3636
|
+
name: 'qp-realWarehouseName-like',
|
|
3637
|
+
label: '逻辑仓名称'
|
|
3638
|
+
}, {
|
|
3639
|
+
name: 'qp-realWarehouseCode-like',
|
|
3640
|
+
label: '逻辑仓编码'
|
|
3641
|
+
}, {
|
|
3642
|
+
name: 'qp-realWarehouseType-eq',
|
|
3643
|
+
type: 'select',
|
|
3644
|
+
label: '逻辑仓类型',
|
|
3645
|
+
initialSource: getDictionarySource('SC00004')
|
|
3646
|
+
}, {
|
|
3647
|
+
name: 'qp-isEnable-eq',
|
|
3648
|
+
type: 'select',
|
|
3649
|
+
label: '逻辑仓状态',
|
|
3650
|
+
initialSource: getDictionarySource('SC00001')
|
|
3651
|
+
}];
|
|
3652
|
+
modalTableProps = {
|
|
3653
|
+
modalTableTitle: '选择逻辑仓',
|
|
3654
|
+
tableSearchForm: tableSearchForm,
|
|
3655
|
+
tableColumns: [{
|
|
3656
|
+
title: '逻辑仓编码',
|
|
3657
|
+
dataIndex: 'realWarehouseCode'
|
|
3658
|
+
}, {
|
|
3659
|
+
title: '逻辑仓名称',
|
|
3660
|
+
dataIndex: 'realWarehouseName'
|
|
3661
|
+
}, {
|
|
3662
|
+
title: '逻辑仓类型',
|
|
3663
|
+
dataIndex: 'realWarehouseType',
|
|
3664
|
+
render: function render(text) {
|
|
3665
|
+
return getDictionaryTextByValue('SC00004', text);
|
|
3666
|
+
}
|
|
3667
|
+
}, {
|
|
3668
|
+
title: '逻辑仓状态',
|
|
3669
|
+
dataIndex: 'isEnable',
|
|
3670
|
+
render: function render(text) {
|
|
3671
|
+
return getDictionaryTextByValue('SC00001', text);
|
|
3672
|
+
}
|
|
3673
|
+
}]
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3520
3677
|
return {
|
|
3521
3678
|
modalTableProps: modalTableProps,
|
|
3522
3679
|
requestConfig: requestConfig
|
package/dist/index.js
CHANGED
|
@@ -1276,6 +1276,14 @@ function injectCSS(css) {
|
|
|
1276
1276
|
return styleNode;
|
|
1277
1277
|
}
|
|
1278
1278
|
var containerCache = new Map();
|
|
1279
|
+
|
|
1280
|
+
function findExistNode(key) {
|
|
1281
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1282
|
+
var container = getContainer(option);
|
|
1283
|
+
return Array.from(containerCache.get(container).children).find(function (node) {
|
|
1284
|
+
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1279
1287
|
function updateCSS(css, key) {
|
|
1280
1288
|
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1281
1289
|
var container = getContainer(option); // Get real parent
|
|
@@ -1287,9 +1295,7 @@ function updateCSS(css, key) {
|
|
|
1287
1295
|
parentNode.removeChild(placeholderStyle);
|
|
1288
1296
|
}
|
|
1289
1297
|
|
|
1290
|
-
var existNode =
|
|
1291
|
-
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1292
|
-
});
|
|
1298
|
+
var existNode = findExistNode(key, option);
|
|
1293
1299
|
|
|
1294
1300
|
if (existNode) {
|
|
1295
1301
|
var _option$csp3, _option$csp4;
|
|
@@ -1739,13 +1745,18 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1739
1745
|
if (cell) {
|
|
1740
1746
|
cell.fs = 10;
|
|
1741
1747
|
|
|
1742
|
-
if (typeof cell.v === 'number') {
|
|
1743
|
-
cell.v = cell.m;
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
1748
|
if (typeof cell.v === 'string') {
|
|
1747
1749
|
cell.m = cell.v = cell.m.trim();
|
|
1748
1750
|
}
|
|
1751
|
+
|
|
1752
|
+
if (cell && cell.m && cell.m.indexOf('E+') !== -1) {
|
|
1753
|
+
cell.v = cell.v.toString();
|
|
1754
|
+
cell.m = cell.v;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
if (typeof cell.v === 'number') {
|
|
1758
|
+
cell.v = cell.m;
|
|
1759
|
+
}
|
|
1749
1760
|
} // console.log(postion);
|
|
1750
1761
|
|
|
1751
1762
|
},
|
|
@@ -2448,6 +2459,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2448
2459
|
fieldValToParam = _ref.fieldValToParam,
|
|
2449
2460
|
_ref$mappingTextField = _ref.mappingTextField,
|
|
2450
2461
|
mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
|
|
2462
|
+
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
2451
2463
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
2452
2464
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
2453
2465
|
_ref$sourceName = _ref.sourceName,
|
|
@@ -2508,12 +2520,12 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2508
2520
|
popvalue = _useState14[0],
|
|
2509
2521
|
setPopValue = _useState14[1];
|
|
2510
2522
|
|
|
2511
|
-
var _useDebounceFn = ahooks.useDebounceFn(function () {
|
|
2523
|
+
var _useDebounceFn = ahooks.useDebounceFn(function (v) {
|
|
2512
2524
|
// 优化搜索参数 支持传多个
|
|
2513
2525
|
var searchParams = {};
|
|
2514
2526
|
|
|
2515
2527
|
if (typeof selectParamsKey === 'string') {
|
|
2516
|
-
searchParams = _defineProperty({}, selectParamsKey, searchValue);
|
|
2528
|
+
searchParams = _defineProperty({}, selectParamsKey, v ? initVal : searchValue);
|
|
2517
2529
|
}
|
|
2518
2530
|
|
|
2519
2531
|
if (Array.isArray(selectParamsKey)) {
|
|
@@ -2634,11 +2646,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2634
2646
|
source = res ? res[keys] ? res[keys].map(function (item) {
|
|
2635
2647
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2636
2648
|
text: item[mappingTextField],
|
|
2649
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
2637
2650
|
value: item[mappingValueField]
|
|
2638
2651
|
});
|
|
2639
2652
|
}) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
|
|
2640
2653
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2641
2654
|
text: item[mappingTextField],
|
|
2655
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
2642
2656
|
value: item[mappingValueField]
|
|
2643
2657
|
});
|
|
2644
2658
|
})) : [];
|
|
@@ -2649,7 +2663,6 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2649
2663
|
if (type === 1) {
|
|
2650
2664
|
var _ctx$form;
|
|
2651
2665
|
|
|
2652
|
-
console.log(sourceName, 'sourceName');
|
|
2653
2666
|
ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
|
|
2654
2667
|
setItems(source);
|
|
2655
2668
|
setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
|
|
@@ -2685,7 +2698,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2685
2698
|
};
|
|
2686
2699
|
|
|
2687
2700
|
React.useEffect(function () {
|
|
2688
|
-
|
|
2701
|
+
run('init');
|
|
2689
2702
|
}, []);
|
|
2690
2703
|
React.useEffect(function () {
|
|
2691
2704
|
if (value) {
|
|
@@ -2748,7 +2761,14 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2748
2761
|
|
|
2749
2762
|
var handleOk = function handleOk() {
|
|
2750
2763
|
if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
|
|
2751
|
-
|
|
2764
|
+
var _ctx$form2;
|
|
2765
|
+
|
|
2766
|
+
formaData(popvalue); // 解决选择最后1页的sku,返回后,不显示名称问题
|
|
2767
|
+
|
|
2768
|
+
var source = ___default['default'].uniqBy(items.concat(popvalue), 'value');
|
|
2769
|
+
|
|
2770
|
+
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
|
|
2771
|
+
setItems(source);
|
|
2752
2772
|
}
|
|
2753
2773
|
|
|
2754
2774
|
setIsModalVisible(false);
|
|
@@ -3047,7 +3067,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3047
3067
|
key: item.value,
|
|
3048
3068
|
label: item.text
|
|
3049
3069
|
}, LightHeightOption({
|
|
3050
|
-
text: "".concat(item.
|
|
3070
|
+
text: "".concat(item.textShowKey, " ").concat(item.text),
|
|
3051
3071
|
filterTxt: searchValue
|
|
3052
3072
|
}));
|
|
3053
3073
|
})), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
@@ -3527,7 +3547,144 @@ function commonFun(type, prefixUrl) {
|
|
|
3527
3547
|
};
|
|
3528
3548
|
} // 仓库选择器
|
|
3529
3549
|
|
|
3530
|
-
|
|
3550
|
+
|
|
3551
|
+
if (type === 'physicalWarehouse') {
|
|
3552
|
+
requestConfig = {
|
|
3553
|
+
url: "".concat(prefixUrl.selectPrefix, "/physicalWarehouse"),
|
|
3554
|
+
filter: 'qp-nameAndCode-like',
|
|
3555
|
+
mappingTextField: 'physicalWarehouseName',
|
|
3556
|
+
mappingTextShowKeyField: 'physicalWarehouseCode',
|
|
3557
|
+
mappingValueField: 'id',
|
|
3558
|
+
otherParams: {
|
|
3559
|
+
sorter: 'desc-id'
|
|
3560
|
+
},
|
|
3561
|
+
sourceName: 'warehouseIds'
|
|
3562
|
+
};
|
|
3563
|
+
tableSearchForm = [{
|
|
3564
|
+
name: 'qp-physicalWarehouseName-like',
|
|
3565
|
+
label: '物理仓名称'
|
|
3566
|
+
}, {
|
|
3567
|
+
name: 'qp-physicalWarehouseCode-like',
|
|
3568
|
+
label: '物理仓编码'
|
|
3569
|
+
}, {
|
|
3570
|
+
name: 'qp-physicalWarehouseType-eq',
|
|
3571
|
+
type: 'select',
|
|
3572
|
+
label: '物理仓类型',
|
|
3573
|
+
initialSource: getDictionarySource('SC00002')
|
|
3574
|
+
}, {
|
|
3575
|
+
name: 'qp-companyCode-eq',
|
|
3576
|
+
type: 'select',
|
|
3577
|
+
label: '所属公司',
|
|
3578
|
+
field: {
|
|
3579
|
+
type: 'select',
|
|
3580
|
+
props: {
|
|
3581
|
+
mode: 'multiple',
|
|
3582
|
+
notFoundContent: '暂无数据',
|
|
3583
|
+
allowClear: true,
|
|
3584
|
+
showSearch: true,
|
|
3585
|
+
showArrow: true,
|
|
3586
|
+
maxTagCount: 1,
|
|
3587
|
+
optionFilterProp: 'children',
|
|
3588
|
+
filterOption: function filterOption(input, option) {
|
|
3589
|
+
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
}, {
|
|
3594
|
+
name: 'qp-isEnable-eq',
|
|
3595
|
+
type: 'select',
|
|
3596
|
+
label: '物理仓状态',
|
|
3597
|
+
initialSource: getDictionarySource('SC00001')
|
|
3598
|
+
}];
|
|
3599
|
+
Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
|
|
3600
|
+
pageSize: 5000,
|
|
3601
|
+
currentPage: 1,
|
|
3602
|
+
'qp-companyType-eq': 20
|
|
3603
|
+
})]).then(function (x) {
|
|
3604
|
+
formatSource(x, 0, 3, tableSearchForm);
|
|
3605
|
+
});
|
|
3606
|
+
modalTableProps = {
|
|
3607
|
+
modalTableTitle: '选择物理仓',
|
|
3608
|
+
tableSearchForm: tableSearchForm,
|
|
3609
|
+
tableColumns: [{
|
|
3610
|
+
title: '物理仓编码',
|
|
3611
|
+
dataIndex: 'physicalWarehouseCode'
|
|
3612
|
+
}, {
|
|
3613
|
+
title: '物理仓名称',
|
|
3614
|
+
dataIndex: 'physicalWarehouseName'
|
|
3615
|
+
}, {
|
|
3616
|
+
title: '物理仓类型',
|
|
3617
|
+
dataIndex: 'physicalWarehouseType',
|
|
3618
|
+
render: function render(text) {
|
|
3619
|
+
return getDictionaryTextByValue('SC00002', text);
|
|
3620
|
+
}
|
|
3621
|
+
}, {
|
|
3622
|
+
title: '物理仓状态',
|
|
3623
|
+
dataIndex: 'isEnable',
|
|
3624
|
+
render: function render(text) {
|
|
3625
|
+
return getDictionaryTextByValue('SC00001', text);
|
|
3626
|
+
}
|
|
3627
|
+
}, {
|
|
3628
|
+
title: '所属公司',
|
|
3629
|
+
dataIndex: 'companyName'
|
|
3630
|
+
}]
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
if (type === 'realWarehouse') {
|
|
3635
|
+
requestConfig = {
|
|
3636
|
+
url: "".concat(prefixUrl.selectPrefix, "/realWarehouse"),
|
|
3637
|
+
filter: 'qp-nameAndCode-like',
|
|
3638
|
+
mappingTextField: 'realWarehouseName',
|
|
3639
|
+
mappingTextShowKeyField: 'realWarehouseCode',
|
|
3640
|
+
mappingValueField: 'id',
|
|
3641
|
+
otherParams: {
|
|
3642
|
+
sorter: 'desc-id'
|
|
3643
|
+
},
|
|
3644
|
+
sourceName: 'warehouseIds'
|
|
3645
|
+
};
|
|
3646
|
+
tableSearchForm = [{
|
|
3647
|
+
name: 'qp-realWarehouseName-like',
|
|
3648
|
+
label: '逻辑仓名称'
|
|
3649
|
+
}, {
|
|
3650
|
+
name: 'qp-realWarehouseCode-like',
|
|
3651
|
+
label: '逻辑仓编码'
|
|
3652
|
+
}, {
|
|
3653
|
+
name: 'qp-realWarehouseType-eq',
|
|
3654
|
+
type: 'select',
|
|
3655
|
+
label: '逻辑仓类型',
|
|
3656
|
+
initialSource: getDictionarySource('SC00004')
|
|
3657
|
+
}, {
|
|
3658
|
+
name: 'qp-isEnable-eq',
|
|
3659
|
+
type: 'select',
|
|
3660
|
+
label: '逻辑仓状态',
|
|
3661
|
+
initialSource: getDictionarySource('SC00001')
|
|
3662
|
+
}];
|
|
3663
|
+
modalTableProps = {
|
|
3664
|
+
modalTableTitle: '选择逻辑仓',
|
|
3665
|
+
tableSearchForm: tableSearchForm,
|
|
3666
|
+
tableColumns: [{
|
|
3667
|
+
title: '逻辑仓编码',
|
|
3668
|
+
dataIndex: 'realWarehouseCode'
|
|
3669
|
+
}, {
|
|
3670
|
+
title: '逻辑仓名称',
|
|
3671
|
+
dataIndex: 'realWarehouseName'
|
|
3672
|
+
}, {
|
|
3673
|
+
title: '逻辑仓类型',
|
|
3674
|
+
dataIndex: 'realWarehouseType',
|
|
3675
|
+
render: function render(text) {
|
|
3676
|
+
return getDictionaryTextByValue('SC00004', text);
|
|
3677
|
+
}
|
|
3678
|
+
}, {
|
|
3679
|
+
title: '逻辑仓状态',
|
|
3680
|
+
dataIndex: 'isEnable',
|
|
3681
|
+
render: function render(text) {
|
|
3682
|
+
return getDictionaryTextByValue('SC00001', text);
|
|
3683
|
+
}
|
|
3684
|
+
}]
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3531
3688
|
return {
|
|
3532
3689
|
modalTableProps: modalTableProps,
|
|
3533
3690
|
requestConfig: requestConfig
|
package/package.json
CHANGED
|
@@ -173,12 +173,18 @@ class DataValidation extends React.Component {
|
|
|
173
173
|
cellRenderBefore: function (cell, postion, sheetFile, ctx) {
|
|
174
174
|
if (cell) {
|
|
175
175
|
cell.fs = 10;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
176
|
+
|
|
177
|
+
|
|
179
178
|
if (typeof cell.v === 'string') {
|
|
180
179
|
cell.m = cell.v = cell.m.trim();
|
|
181
180
|
}
|
|
181
|
+
if (cell && cell.m && cell.m.indexOf('E+') !== -1) {
|
|
182
|
+
cell.v = cell.v.toString()
|
|
183
|
+
cell.m = cell.v
|
|
184
|
+
}
|
|
185
|
+
if (typeof cell.v === 'number') {
|
|
186
|
+
cell.v = cell.m
|
|
187
|
+
}
|
|
182
188
|
}
|
|
183
189
|
// console.log(postion);
|
|
184
190
|
},
|
|
@@ -346,10 +346,119 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
// 仓库选择器
|
|
349
|
-
if(type === '
|
|
350
|
-
|
|
349
|
+
if(type === 'physicalWarehouse') {
|
|
350
|
+
requestConfig = {
|
|
351
|
+
url: `${prefixUrl.selectPrefix}/physicalWarehouse`,
|
|
352
|
+
filter: 'qp-nameAndCode-like', // 过滤参数
|
|
353
|
+
mappingTextField: 'physicalWarehouseName',
|
|
354
|
+
mappingTextShowKeyField: 'physicalWarehouseCode',
|
|
355
|
+
mappingValueField: 'id',
|
|
356
|
+
otherParams: {
|
|
357
|
+
sorter: 'desc-id'
|
|
358
|
+
}, // 默认参数
|
|
359
|
+
sourceName: 'warehouseIds',
|
|
360
|
+
}
|
|
361
|
+
tableSearchForm = [
|
|
362
|
+
{ name: 'qp-physicalWarehouseName-like', label: '物理仓名称' },
|
|
363
|
+
{ name: 'qp-physicalWarehouseCode-like', label: '物理仓编码' },
|
|
364
|
+
{ name: 'qp-physicalWarehouseType-eq', type: 'select', label: '物理仓类型', initialSource: getDictionarySource('SC00002') },
|
|
365
|
+
{ name: 'qp-companyCode-eq', type: 'select', label: '所属公司', field: {
|
|
366
|
+
type: 'select',
|
|
367
|
+
props: {
|
|
368
|
+
mode: 'multiple',
|
|
369
|
+
notFoundContent: '暂无数据',
|
|
370
|
+
allowClear: true,
|
|
371
|
+
showSearch: true,
|
|
372
|
+
showArrow: true,
|
|
373
|
+
maxTagCount: 1,
|
|
374
|
+
optionFilterProp: 'children',
|
|
375
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
376
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
377
|
+
},
|
|
378
|
+
} },
|
|
379
|
+
{ name: 'qp-isEnable-eq', type: 'select', label: '物理仓状态', initialSource: getDictionarySource('SC00001') },
|
|
380
|
+
]
|
|
381
|
+
Promise.all([
|
|
382
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
|
|
383
|
+
pageSize: 5000,
|
|
384
|
+
currentPage: 1,
|
|
385
|
+
'qp-companyType-eq': 20,
|
|
386
|
+
}),
|
|
387
|
+
]).then((x: any)=>{
|
|
388
|
+
formatSource(x,0, 3, tableSearchForm);
|
|
389
|
+
})
|
|
390
|
+
modalTableProps = {
|
|
391
|
+
modalTableTitle: '选择物理仓',
|
|
392
|
+
tableSearchForm,
|
|
393
|
+
tableColumns: [
|
|
394
|
+
{
|
|
395
|
+
title: '物理仓编码',
|
|
396
|
+
dataIndex: 'physicalWarehouseCode',
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
title: '物理仓名称',
|
|
400
|
+
dataIndex: 'physicalWarehouseName',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
title: '物理仓类型',
|
|
404
|
+
dataIndex: 'physicalWarehouseType',
|
|
405
|
+
render: (text: number) => getDictionaryTextByValue('SC00002', text),
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
title: '物理仓状态',
|
|
409
|
+
dataIndex: 'isEnable',
|
|
410
|
+
render: (text: number) => getDictionaryTextByValue('SC00001', text),
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
title: '所属公司',
|
|
414
|
+
dataIndex: 'companyName',
|
|
415
|
+
},
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if(type === 'realWarehouse') {
|
|
420
|
+
requestConfig = {
|
|
421
|
+
url: `${prefixUrl.selectPrefix}/realWarehouse`,
|
|
422
|
+
filter: 'qp-nameAndCode-like', // 过滤参数
|
|
423
|
+
mappingTextField: 'realWarehouseName',
|
|
424
|
+
mappingTextShowKeyField: 'realWarehouseCode',
|
|
425
|
+
mappingValueField: 'id',
|
|
426
|
+
otherParams: {
|
|
427
|
+
sorter: 'desc-id'
|
|
428
|
+
}, // 默认参数
|
|
429
|
+
sourceName: 'warehouseIds',
|
|
430
|
+
}
|
|
431
|
+
tableSearchForm = [
|
|
432
|
+
{ name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
|
|
433
|
+
{ name: 'qp-realWarehouseCode-like', label: '逻辑仓编码' },
|
|
434
|
+
{ name: 'qp-realWarehouseType-eq', type: 'select', label: '逻辑仓类型', initialSource: getDictionarySource('SC00004') },
|
|
435
|
+
{ name: 'qp-isEnable-eq', type: 'select', label: '逻辑仓状态', initialSource: getDictionarySource('SC00001') },
|
|
436
|
+
]
|
|
437
|
+
modalTableProps = {
|
|
438
|
+
modalTableTitle: '选择逻辑仓',
|
|
439
|
+
tableSearchForm,
|
|
440
|
+
tableColumns: [
|
|
441
|
+
{
|
|
442
|
+
title: '逻辑仓编码',
|
|
443
|
+
dataIndex: 'realWarehouseCode',
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
title: '逻辑仓名称',
|
|
447
|
+
dataIndex: 'realWarehouseName',
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
title: '逻辑仓类型',
|
|
451
|
+
dataIndex: 'realWarehouseType',
|
|
452
|
+
render: (text: number) => getDictionaryTextByValue('SC00004', text),
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
title: '逻辑仓状态',
|
|
456
|
+
dataIndex: 'isEnable',
|
|
457
|
+
render: (text: number) => getDictionaryTextByValue('SC00001', text),
|
|
458
|
+
},
|
|
459
|
+
]
|
|
460
|
+
}
|
|
351
461
|
}
|
|
352
462
|
|
|
353
|
-
console.log(requestConfig, 'requestConfig')
|
|
354
463
|
return { modalTableProps, requestConfig };
|
|
355
464
|
}
|
|
@@ -36,7 +36,7 @@ export default () => {
|
|
|
36
36
|
// mappingTextField: 'name',
|
|
37
37
|
// mappingValueField: 'code',
|
|
38
38
|
// }, // 非必传,业务字段已根据业务默认默认
|
|
39
|
-
|
|
39
|
+
prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
|
|
40
40
|
selectProps, // 非必传
|
|
41
41
|
onChange: (value: any) => {
|
|
42
42
|
console.log(value)
|
|
@@ -73,15 +73,16 @@ export default () => {
|
|
|
73
73
|
console.log(value)
|
|
74
74
|
setValue(value)
|
|
75
75
|
},
|
|
76
|
-
requestConfig: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
76
|
+
// requestConfig: {
|
|
77
|
+
// url: `http://test.i-baby.net/bop/api/sku`,
|
|
78
|
+
// filter: 'qp-nameAndCode-like',
|
|
79
|
+
// mappingValueField: 'skuCode',
|
|
80
|
+
// otherParams: {
|
|
81
|
+
// sorter: 'desc-id'
|
|
82
|
+
// }, // 默认参数
|
|
83
|
+
// sourceName: 'skuCode',
|
|
84
|
+
// },
|
|
85
|
+
prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
|
|
85
86
|
selectProps,
|
|
86
87
|
selectBusinessType: 'skuCommodity',
|
|
87
88
|
};
|
|
@@ -93,4 +94,88 @@ export default () => {
|
|
|
93
94
|
);
|
|
94
95
|
};
|
|
95
96
|
```
|
|
97
|
+
|
|
98
|
+
仓库选择器(物理仓) Select-Warehouse-001:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import React, { useState } from 'react';
|
|
102
|
+
import {BusinessSearchSelect} from '../../../index.ts';
|
|
103
|
+
|
|
104
|
+
export default () => {
|
|
105
|
+
const selectProps = {
|
|
106
|
+
mode: 'multiple',
|
|
107
|
+
maxTagCount: 1,
|
|
108
|
+
// disabled: true
|
|
109
|
+
}
|
|
110
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
111
|
+
const props = {
|
|
112
|
+
value,
|
|
113
|
+
onChange: (value: any) => {
|
|
114
|
+
console.log(value)
|
|
115
|
+
setValue(value)
|
|
116
|
+
},
|
|
117
|
+
// requestConfig: {
|
|
118
|
+
// url: `http://test.i-baby.net/bop/api/physicalWarehouse`,
|
|
119
|
+
// filter: 'qp-nameAndCode-like',
|
|
120
|
+
// mappingTextField: 'physicalWarehouseName',
|
|
121
|
+
// mappingValueField: 'physicalWarehouseCode',
|
|
122
|
+
// otherParams: {
|
|
123
|
+
// sorter: 'desc-id'
|
|
124
|
+
// }, // 默认参数
|
|
125
|
+
// sourceName: 'warehouseIds',
|
|
126
|
+
// },
|
|
127
|
+
prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
|
|
128
|
+
selectProps,
|
|
129
|
+
selectBusinessType: 'physicalWarehouse',
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<div>
|
|
134
|
+
<BusinessSearchSelect {...props} />
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
仓库选择器(逻辑仓) Select-Warehouse-002:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import React, { useState } from 'react';
|
|
144
|
+
import {BusinessSearchSelect} from '../../../index.ts';
|
|
145
|
+
|
|
146
|
+
export default () => {
|
|
147
|
+
const selectProps = {
|
|
148
|
+
mode: 'multiple',
|
|
149
|
+
maxTagCount: 1,
|
|
150
|
+
// disabled: true
|
|
151
|
+
}
|
|
152
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
153
|
+
const props = {
|
|
154
|
+
value,
|
|
155
|
+
onChange: (value: any) => {
|
|
156
|
+
console.log(value)
|
|
157
|
+
setValue(value)
|
|
158
|
+
},
|
|
159
|
+
// requestConfig: {
|
|
160
|
+
// url: `http://test.i-baby.net/bop/api/realWarehouse`,
|
|
161
|
+
// filter: 'qp-nameAndCode-like',
|
|
162
|
+
// mappingTextField: 'realWarehouseName',
|
|
163
|
+
// mappingValueField: 'realWarehouseCode',
|
|
164
|
+
// otherParams: {
|
|
165
|
+
// sorter: 'desc-id'
|
|
166
|
+
// }, // 默认参数
|
|
167
|
+
// sourceName: 'warehouseIds',
|
|
168
|
+
// },
|
|
169
|
+
prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
|
|
170
|
+
selectProps,
|
|
171
|
+
selectBusinessType: 'realWarehouse',
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div>
|
|
176
|
+
<BusinessSearchSelect {...props} />
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
```
|
|
96
181
|
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -20,7 +20,7 @@ const SearchSelect = (props: any) => {
|
|
|
20
20
|
requestConfig,
|
|
21
21
|
ctx,
|
|
22
22
|
} = props;
|
|
23
|
-
const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
|
|
23
|
+
const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
|
|
24
24
|
|
|
25
25
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
26
26
|
const initVal = value || (selectMode ? [] : null);
|
|
@@ -47,11 +47,11 @@ const SearchSelect = (props: any) => {
|
|
|
47
47
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
48
48
|
const [popvalue, setPopValue] = useState(initVal);
|
|
49
49
|
const { run } = useDebounceFn(
|
|
50
|
-
() => {
|
|
50
|
+
(v?: any) => {
|
|
51
51
|
// 优化搜索参数 支持传多个
|
|
52
52
|
let searchParams = {};
|
|
53
53
|
if(typeof selectParamsKey === 'string') {
|
|
54
|
-
searchParams = { [selectParamsKey]: searchValue }
|
|
54
|
+
searchParams = { [selectParamsKey]: v ? initVal : searchValue }
|
|
55
55
|
}
|
|
56
56
|
if(Array.isArray(selectParamsKey)) {
|
|
57
57
|
selectParamsKey.forEach((i: any) => {
|
|
@@ -128,6 +128,7 @@ const SearchSelect = (props: any) => {
|
|
|
128
128
|
return {
|
|
129
129
|
...item,
|
|
130
130
|
text: item[mappingTextField],
|
|
131
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
131
132
|
value: item[mappingValueField],
|
|
132
133
|
};
|
|
133
134
|
})
|
|
@@ -136,6 +137,7 @@ const SearchSelect = (props: any) => {
|
|
|
136
137
|
return {
|
|
137
138
|
...item,
|
|
138
139
|
text: item[mappingTextField],
|
|
140
|
+
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
139
141
|
value: item[mappingValueField],
|
|
140
142
|
};
|
|
141
143
|
})
|
|
@@ -143,7 +145,6 @@ const SearchSelect = (props: any) => {
|
|
|
143
145
|
}
|
|
144
146
|
source = Array.isArray(source) ? source : []
|
|
145
147
|
if(type === 1) {
|
|
146
|
-
console.log(sourceName, 'sourceName')
|
|
147
148
|
ctx?.form?.setFieldSource(sourceName, source)
|
|
148
149
|
setItems(source)
|
|
149
150
|
setItemsTotal(Number(res?.total))
|
|
@@ -171,7 +172,7 @@ const SearchSelect = (props: any) => {
|
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
useEffect(() => {
|
|
174
|
-
|
|
175
|
+
run('init')
|
|
175
176
|
}, [])
|
|
176
177
|
|
|
177
178
|
useEffect(() => {
|
|
@@ -203,6 +204,10 @@ const SearchSelect = (props: any) => {
|
|
|
203
204
|
const handleOk = () => {
|
|
204
205
|
if(popvalue?.length) {
|
|
205
206
|
formaData(popvalue);
|
|
207
|
+
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
208
|
+
const source = _.uniqBy(items.concat(popvalue), 'value')
|
|
209
|
+
ctx?.form?.setFieldSource(sourceName, source)
|
|
210
|
+
setItems(source)
|
|
206
211
|
}
|
|
207
212
|
setIsModalVisible(false);
|
|
208
213
|
};
|
|
@@ -430,7 +435,7 @@ const SearchSelect = (props: any) => {
|
|
|
430
435
|
>
|
|
431
436
|
{items.map(item => (
|
|
432
437
|
<Option key={item.value} label={item.text}>
|
|
433
|
-
{LightHeightOption({ text: `${item.
|
|
438
|
+
{LightHeightOption({ text: `${item.textShowKey} ${item.text}`, filterTxt: searchValue })}
|
|
434
439
|
</Option>
|
|
435
440
|
))}
|
|
436
441
|
</Select>
|