@bit-sun/business-component 4.0.13-alpha.18 → 4.0.13-alpha.19
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/.umirc.ts +9 -9
- package/dist/components/Business/ItemPropertySelector/index.d.ts +3 -0
- package/dist/index.esm.js +739 -448
- package/dist/index.js +740 -449
- package/package.json +1 -1
- package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +192 -0
- package/src/components/Business/SearchSelect/index.md +2 -2
- package/src/components/Business/SearchSelect/utils.ts +1 -1
- package/src/components/Functional/SearchSelect/index.tsx +15 -1
package/package.json
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
4
|
+
import { Input, Select } from 'antd';
|
|
5
|
+
import { request } from 'bssula';
|
|
6
|
+
|
|
7
|
+
const ItemPropertySelector = ({
|
|
8
|
+
onChange,
|
|
9
|
+
value,
|
|
10
|
+
propertyCode,
|
|
11
|
+
name,
|
|
12
|
+
...restProps
|
|
13
|
+
}: any) => {
|
|
14
|
+
|
|
15
|
+
const [source, setSource] = useState([]);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// FIXME: 目前只能通过固定属性编码先获取属性id,再通过属性id去查属性值 @林军
|
|
19
|
+
if (propertyCode) {
|
|
20
|
+
request({
|
|
21
|
+
url: `/items/item/propertyValue/getPropertyValueNoPagerByCode?qp-propertyCode-eq=${propertyCode}&pageSize=5000`,
|
|
22
|
+
method: 'GET',
|
|
23
|
+
converter: ({ data }: any) => {
|
|
24
|
+
const source = (data?.items || []).map(item => ({
|
|
25
|
+
text: item.value,
|
|
26
|
+
value: item.value
|
|
27
|
+
}))
|
|
28
|
+
setSource(source);
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
return;
|
|
32
|
+
request({
|
|
33
|
+
url: `/items/item/property?qp-propertyCode-eq=${propertyCode}`,
|
|
34
|
+
metod: 'GET',
|
|
35
|
+
converter: ({ data }: any) => {
|
|
36
|
+
let propInfo = data?.items?.[0] || {};
|
|
37
|
+
if (propInfo?.dictIs) {
|
|
38
|
+
request({
|
|
39
|
+
url: `/items/bscDict/detailAndFilter/${propInfo?.dictCode}`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
converter: ({ data }: any) => {
|
|
42
|
+
const source = (data?.dictItemResVoList || []).map(item => ({
|
|
43
|
+
text: item.dictItemName,
|
|
44
|
+
value: item.dictItemName
|
|
45
|
+
}))
|
|
46
|
+
setSource(source);
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (propInfo?.id) {
|
|
53
|
+
request({
|
|
54
|
+
url: `/items/item/propertyValue?qp-propertyId-eq=${propInfo?.id}`,
|
|
55
|
+
method: 'GET',
|
|
56
|
+
converter: ({ data }: any) => {
|
|
57
|
+
const source = (data?.items || []).map(item => ({
|
|
58
|
+
text: item.value,
|
|
59
|
+
value: item.value
|
|
60
|
+
}))
|
|
61
|
+
setSource(source);
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}, [propertyCode]);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Select
|
|
73
|
+
{...restProps}
|
|
74
|
+
value={value}
|
|
75
|
+
allowClear
|
|
76
|
+
style={{width: '100%'}}
|
|
77
|
+
onChange={(v: any) => {
|
|
78
|
+
onChange(v);
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{source.map((res) => {
|
|
82
|
+
return <Select.Option value={res.value}>{res.text}</Select.Option>;
|
|
83
|
+
})}
|
|
84
|
+
</Select>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default ItemPropertySelector;
|
|
@@ -628,6 +628,198 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
+
// 新库存商品选择器spu
|
|
632
|
+
if(type === 'spuCommodityWithProperty') {
|
|
633
|
+
selectProps = {
|
|
634
|
+
placeholder: '输入spu编码或名称',
|
|
635
|
+
renderTableColumns: [
|
|
636
|
+
{
|
|
637
|
+
title: 'spu编码',
|
|
638
|
+
dataIndex: 'itemCode',
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
title: 'spu名称',
|
|
642
|
+
dataIndex: 'name',
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
...selectConfigProps,
|
|
646
|
+
}
|
|
647
|
+
requestConfig = {
|
|
648
|
+
url: `/stock/item/doItemPageAll`,
|
|
649
|
+
method: 'POST',
|
|
650
|
+
filter: 'qp-itemCode,name-orGroup,like', // 过滤参数
|
|
651
|
+
mappingTextField: 'name',
|
|
652
|
+
mappingValueField: 'itemCode',
|
|
653
|
+
otherParams: {
|
|
654
|
+
// 'qp-approveStatus-eq': 1, // 审核状态(0.待审批;1.审批通过;2.驳回;3.审批未通过)
|
|
655
|
+
sorter: 'desc-id',
|
|
656
|
+
...(requestConfigProp?.addOtherParams || {}),
|
|
657
|
+
}, // 默认参数
|
|
658
|
+
sourceName: 'itemCode',
|
|
659
|
+
...requestConfigProp,
|
|
660
|
+
}
|
|
661
|
+
tableSearchForm = [
|
|
662
|
+
{ name: 'qp-name-like', label: 'SPU名称' },
|
|
663
|
+
{ name: 'qp-itemCode-like', label: 'SPU编码' },
|
|
664
|
+
{ name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
|
|
665
|
+
type: 'select',
|
|
666
|
+
props: {
|
|
667
|
+
mode: 'multiple',
|
|
668
|
+
notFoundContent: '暂无数据',
|
|
669
|
+
allowClear: true,
|
|
670
|
+
showSearch: true,
|
|
671
|
+
showArrow: true,
|
|
672
|
+
maxTagCount: 1,
|
|
673
|
+
optionFilterProp: 'children',
|
|
674
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
675
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
676
|
+
},
|
|
677
|
+
} },
|
|
678
|
+
{ name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
|
|
679
|
+
type: 'treeSelect',
|
|
680
|
+
props: {
|
|
681
|
+
treeData: [],
|
|
682
|
+
treeCheckable: true,
|
|
683
|
+
showSearch: true,
|
|
684
|
+
allowClear: true,
|
|
685
|
+
showArrow: true,
|
|
686
|
+
treeNodeFilterProp: 'title',
|
|
687
|
+
treeDefaultExpandAll: true,
|
|
688
|
+
maxTagCount: 1,
|
|
689
|
+
placeholder: '请选择',
|
|
690
|
+
style: {
|
|
691
|
+
width: '100%',
|
|
692
|
+
},
|
|
693
|
+
dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
|
|
694
|
+
},
|
|
695
|
+
} },
|
|
696
|
+
{ name: 'qp-classId-in', type: 'select', label: '品类', field: {
|
|
697
|
+
type: 'select',
|
|
698
|
+
props: {
|
|
699
|
+
mode: 'multiple',
|
|
700
|
+
notFoundContent: '暂无数据',
|
|
701
|
+
allowClear: true,
|
|
702
|
+
showSearch: true,
|
|
703
|
+
showArrow: true,
|
|
704
|
+
maxTagCount: 1,
|
|
705
|
+
optionFilterProp: 'children',
|
|
706
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
707
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
708
|
+
},
|
|
709
|
+
} },
|
|
710
|
+
{
|
|
711
|
+
name: 'qp-year-in',
|
|
712
|
+
label: '年份',
|
|
713
|
+
field: {
|
|
714
|
+
type: 'itemPropertySelector',
|
|
715
|
+
props: {
|
|
716
|
+
propertyCode: 'SX0000114',
|
|
717
|
+
mode: 'multiple',
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: 'qp-season-in',
|
|
723
|
+
label: '季节',
|
|
724
|
+
field: {
|
|
725
|
+
type: 'itemPropertySelector',
|
|
726
|
+
props: {
|
|
727
|
+
propertyCode: 'SX0000070',
|
|
728
|
+
mode: 'multiple',
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: 'qp-zzdlbm-in',
|
|
734
|
+
label: '大类',
|
|
735
|
+
field: {
|
|
736
|
+
type: 'itemPropertySelector',
|
|
737
|
+
props: {
|
|
738
|
+
propertyCode: 'SX0000071',
|
|
739
|
+
mode: 'multiple',
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
name: 'qp-zzzlbm-in',
|
|
745
|
+
label: '中类',
|
|
746
|
+
field: {
|
|
747
|
+
type: 'itemPropertySelector',
|
|
748
|
+
props: {
|
|
749
|
+
propertyCode: 'SX0000072',
|
|
750
|
+
mode: 'multiple',
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: 'qp-zzxlbm-in',
|
|
756
|
+
label: '小类',
|
|
757
|
+
field: {
|
|
758
|
+
type: 'itemPropertySelector',
|
|
759
|
+
props: {
|
|
760
|
+
propertyCode: 'SX0000110',
|
|
761
|
+
mode: 'multiple',
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
]
|
|
766
|
+
Promise.all([
|
|
767
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
|
|
768
|
+
pageSize: 5000,
|
|
769
|
+
currentPage: 1,
|
|
770
|
+
'ctl-withAuth': true
|
|
771
|
+
}),
|
|
772
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
|
|
773
|
+
pageSize: 5000,
|
|
774
|
+
currentPage: 1,
|
|
775
|
+
}),
|
|
776
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/class/withProperty`, {
|
|
777
|
+
pageSize: 5000,
|
|
778
|
+
currentPage: 1,
|
|
779
|
+
}),
|
|
780
|
+
]).then((x: any)=>{
|
|
781
|
+
formatSource(x,0, 2, tableSearchForm,['id','name']);
|
|
782
|
+
formatTreeDataSource(x,1, 3, tableSearchForm);
|
|
783
|
+
formatSource(x,2, 4, tableSearchForm,['id','name']);
|
|
784
|
+
})
|
|
785
|
+
modalTableProps = {
|
|
786
|
+
modalTableTitle: '选择SPU',
|
|
787
|
+
tableSearchForm,
|
|
788
|
+
tableColumns: [
|
|
789
|
+
{
|
|
790
|
+
title: '序号',
|
|
791
|
+
dataIndex: 'keyIndex',
|
|
792
|
+
defaultSort: 0,
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
title: 'SPU编码',
|
|
796
|
+
dataIndex: 'itemCode',
|
|
797
|
+
defaultSort: 1,
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
title: 'SPU名称',
|
|
801
|
+
dataIndex: 'name',
|
|
802
|
+
defaultSort: 2,
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
title: '品牌',
|
|
806
|
+
dataIndex: 'brandName',
|
|
807
|
+
defaultSort: 3,
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
title: '类目',
|
|
811
|
+
dataIndex: 'categoryText',
|
|
812
|
+
defaultSort: 4,
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
title: '品类',
|
|
816
|
+
dataIndex: 'className',
|
|
817
|
+
},
|
|
818
|
+
],
|
|
819
|
+
...modalTableBusProps
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
631
823
|
// 商品选择器skc
|
|
632
824
|
if(type === 'skcCommodity') {
|
|
633
825
|
selectProps = {
|
|
@@ -297,7 +297,7 @@ import {BusinessSearchSelect} from '../../../index.ts';
|
|
|
297
297
|
const { TabPane } = Tabs;
|
|
298
298
|
export default () => {
|
|
299
299
|
const selectProps = {
|
|
300
|
-
|
|
300
|
+
mode: 'multiple',
|
|
301
301
|
// maxTagCount: 1,
|
|
302
302
|
// disabled: true
|
|
303
303
|
}
|
|
@@ -317,7 +317,7 @@ export default () => {
|
|
|
317
317
|
},
|
|
318
318
|
// prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
|
|
319
319
|
selectProps,
|
|
320
|
-
selectBusinessType: '
|
|
320
|
+
selectBusinessType: 'spuCommodityWithProperty',
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
const onTabChange = (key) => {
|
|
@@ -79,7 +79,7 @@ const handleDefaultPrefixUrl = (type: string) => {
|
|
|
79
79
|
case 'supplier2': case 'customer2': case 'shopFile2': case 'platCompany': case 'market-channel':
|
|
80
80
|
result = '/channel-manage';
|
|
81
81
|
break;
|
|
82
|
-
case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity': case 'skcCommodity': case 'brand':
|
|
82
|
+
case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity': case 'skcCommodity': case 'brand': case 'spuCommodityWithProperty':
|
|
83
83
|
result = '/items';
|
|
84
84
|
break;
|
|
85
85
|
case 'physicalWarehouse': case 'realWarehouse': case 'virtualWarehouse': case 'channelWarehouse': case 'ownerWarehouse':
|
|
@@ -11,6 +11,7 @@ import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFie
|
|
|
11
11
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
12
12
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
13
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
14
|
+
import ItemPropertySelector from '@/components/Business/ItemPropertySelector';
|
|
14
15
|
|
|
15
16
|
const { Option } = Select;
|
|
16
17
|
|
|
@@ -654,6 +655,19 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
654
655
|
</Col>
|
|
655
656
|
);
|
|
656
657
|
}
|
|
658
|
+
if (i?.type === 'itemPropertySelector' || i?.field?.type === 'itemPropertySelector') {
|
|
659
|
+
return (
|
|
660
|
+
<Col span={ColSpan} key={i.name}>
|
|
661
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
662
|
+
<ItemPropertySelector
|
|
663
|
+
style={{ width: '100%' }}
|
|
664
|
+
placeholder="请选择"
|
|
665
|
+
{...i?.field?.props}
|
|
666
|
+
></ItemPropertySelector>
|
|
667
|
+
</Form.Item>
|
|
668
|
+
</Col>
|
|
669
|
+
);
|
|
670
|
+
}
|
|
657
671
|
if (i?.field?.type === 'multipleQuerySearchSelect') {
|
|
658
672
|
return (
|
|
659
673
|
<Col span={ColSpan} key={i.name}>
|
|
@@ -948,7 +962,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
948
962
|
重置 ctrl+U
|
|
949
963
|
</Button>
|
|
950
964
|
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
951
|
-
{hasMoreQueryFields(modalTableProps)
|
|
965
|
+
{hasMoreQueryFields(modalTableProps)
|
|
952
966
|
? <img onClick={() => {toggleCollapsed()}} style={{
|
|
953
967
|
cursor: 'pointer',
|
|
954
968
|
fontSize: '10px',
|