@bit-sun/business-component 2.4.13 → 2.4.15-alpha.1
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/components/Functional/BsAntdSula/index.d 6.ts +1 -0
- package/dist/index.esm.js +4 -2
- package/dist/index.js +4 -2
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +4 -0
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +4 -0
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.ts +67 -0
- package/src/components/Functional/TreeSearchSelect/index.tsx +29 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BsCascader } from './BsCascader';
|
package/dist/index.esm.js
CHANGED
|
@@ -10190,12 +10190,14 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
|
|
|
10190
10190
|
_remoteSource$initial = remoteSource.initialParams,
|
|
10191
10191
|
initialParams = _remoteSource$initial === void 0 ? {} : _remoteSource$initial,
|
|
10192
10192
|
_remoteSource$treeChi = remoteSource.treeChildrenRoom,
|
|
10193
|
-
treeChildrenRoom = _remoteSource$treeChi === void 0 ? 'children' : _remoteSource$treeChi
|
|
10193
|
+
treeChildrenRoom = _remoteSource$treeChi === void 0 ? 'children' : _remoteSource$treeChi,
|
|
10194
|
+
_remoteSource$special = remoteSource.specialBracket,
|
|
10195
|
+
specialBracket = _remoteSource$special === void 0 ? false : _remoteSource$special;
|
|
10194
10196
|
var mapSearchTree = function mapSearchTree(treeDataItem) {
|
|
10195
10197
|
var haveChildren = Array.isArray(treeDataItem[treeChildrenRoom]) && treeDataItem[treeChildrenRoom].length > 0; // 盘算是否为父节点
|
|
10196
10198
|
var isRoot = (treeDataItem === null || treeDataItem === void 0 ? void 0 : treeDataItem.id) == '0'; // 判断是否为根节点
|
|
10197
10199
|
return {
|
|
10198
|
-
title: treeDataItem[resKeyValue[1]],
|
|
10200
|
+
title: specialBracket ? "\u3010".concat(treeDataItem[resKeyValue[0]], "\u3011").concat(treeDataItem[resKeyValue[1]]) : treeDataItem[resKeyValue[1]],
|
|
10199
10201
|
key: treeDataItem[resKeyValue[0]],
|
|
10200
10202
|
value: treeDataItem[resKeyValue[0]],
|
|
10201
10203
|
parentId: treeDataItem.parent,
|
package/dist/index.js
CHANGED
|
@@ -10210,12 +10210,14 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
|
|
|
10210
10210
|
_remoteSource$initial = remoteSource.initialParams,
|
|
10211
10211
|
initialParams = _remoteSource$initial === void 0 ? {} : _remoteSource$initial,
|
|
10212
10212
|
_remoteSource$treeChi = remoteSource.treeChildrenRoom,
|
|
10213
|
-
treeChildrenRoom = _remoteSource$treeChi === void 0 ? 'children' : _remoteSource$treeChi
|
|
10213
|
+
treeChildrenRoom = _remoteSource$treeChi === void 0 ? 'children' : _remoteSource$treeChi,
|
|
10214
|
+
_remoteSource$special = remoteSource.specialBracket,
|
|
10215
|
+
specialBracket = _remoteSource$special === void 0 ? false : _remoteSource$special;
|
|
10214
10216
|
var mapSearchTree = function mapSearchTree(treeDataItem) {
|
|
10215
10217
|
var haveChildren = Array.isArray(treeDataItem[treeChildrenRoom]) && treeDataItem[treeChildrenRoom].length > 0; // 盘算是否为父节点
|
|
10216
10218
|
var isRoot = (treeDataItem === null || treeDataItem === void 0 ? void 0 : treeDataItem.id) == '0'; // 判断是否为根节点
|
|
10217
10219
|
return {
|
|
10218
|
-
title: treeDataItem[resKeyValue[1]],
|
|
10220
|
+
title: specialBracket ? "\u3010".concat(treeDataItem[resKeyValue[0]], "\u3011").concat(treeDataItem[resKeyValue[1]]) : treeDataItem[resKeyValue[1]],
|
|
10219
10221
|
key: treeDataItem[resKeyValue[0]],
|
|
10220
10222
|
value: treeDataItem[resKeyValue[0]],
|
|
10221
10223
|
parentId: treeDataItem.parent,
|
package/package.json
CHANGED
|
@@ -1832,5 +1832,72 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
|
+
// 销售渠道选择器
|
|
1836
|
+
if(type === 'market-channel') {
|
|
1837
|
+
requestConfig = {
|
|
1838
|
+
url: `${prefixUrl.selectPrefix}/channelInfo`,
|
|
1839
|
+
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
1840
|
+
mappingTextField: 'name',
|
|
1841
|
+
mappingTextShowKeyField: 'code',
|
|
1842
|
+
mappingValueField: 'code',
|
|
1843
|
+
otherParams: {
|
|
1844
|
+
'qp-type-eq': 1, //销售渠道类型
|
|
1845
|
+
'qp-isMain-eq': 1,
|
|
1846
|
+
'qp-status-eq': 10, // 10启用 20禁用
|
|
1847
|
+
sorter: 'desc-id',
|
|
1848
|
+
}, // 默认参数
|
|
1849
|
+
sourceName: 'marketChannelCode',
|
|
1850
|
+
...requestConfigProp
|
|
1851
|
+
}
|
|
1852
|
+
tableSearchForm = [
|
|
1853
|
+
{ name: 'qp-name-like', label: '销售渠道名称' },
|
|
1854
|
+
{ name: 'qp-code-like', label: '销售渠道编码' },
|
|
1855
|
+
{ name: 'qp-salesOrgCode-in', type: 'select', label: '所属销售组织', field: {
|
|
1856
|
+
type: 'select',
|
|
1857
|
+
props: {
|
|
1858
|
+
mode: 'multiple',
|
|
1859
|
+
notFoundContent: '暂无数据',
|
|
1860
|
+
allowClear: true,
|
|
1861
|
+
showSearch: true,
|
|
1862
|
+
showArrow: true,
|
|
1863
|
+
maxTagCount: 1,
|
|
1864
|
+
optionFilterProp: 'children',
|
|
1865
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
1866
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1867
|
+
},
|
|
1868
|
+
} },
|
|
1869
|
+
]
|
|
1870
|
+
Promise.all([
|
|
1871
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/orgView/getTree/sales-organizational-view`, {
|
|
1872
|
+
'qp-employeeCode-eq': getEmployeeCode(),
|
|
1873
|
+
'qp-realOrg-eq': true,
|
|
1874
|
+
'qp-status-eq': 10
|
|
1875
|
+
}),
|
|
1876
|
+
]).then((x: any)=>{
|
|
1877
|
+
formatSource(x, 0, 2, tableSearchForm);
|
|
1878
|
+
})
|
|
1879
|
+
modalTableProps = {
|
|
1880
|
+
modalTableTitle: '选择销售渠道',
|
|
1881
|
+
tableSearchForm,
|
|
1882
|
+
tableColumns: [
|
|
1883
|
+
{
|
|
1884
|
+
title: '销售渠道编码',
|
|
1885
|
+
dataIndex: 'code',
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
title: '销售渠道名称',
|
|
1889
|
+
dataIndex: 'name',
|
|
1890
|
+
render: (text: any) => handleTextOverflow(text),
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
title: '所属销售组织',
|
|
1894
|
+
dataIndex: 'salesOrgCodeName',
|
|
1895
|
+
render: (text: any) => handleTextOverflow(text),
|
|
1896
|
+
},
|
|
1897
|
+
],
|
|
1898
|
+
...modalTableBusProps
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1835
1902
|
return { modalTableProps, requestConfig, needModalTable };
|
|
1836
1903
|
}
|
|
@@ -41,26 +41,29 @@ const TreeSearchSelect = (props: any) => {
|
|
|
41
41
|
resKeyValue = ['id', 'name'],
|
|
42
42
|
initialParams = {},
|
|
43
43
|
treeChildrenRoom = 'children',// 树状结构的子集容器 默认为 'children'
|
|
44
|
+
specialBracket = false
|
|
44
45
|
} = remoteSource;
|
|
45
46
|
|
|
46
47
|
const mapSearchTree = (treeDataItem: any) => {
|
|
47
48
|
const haveChildren = Array.isArray(treeDataItem[treeChildrenRoom]) && treeDataItem[treeChildrenRoom].length > 0; // 盘算是否为父节点
|
|
48
49
|
const isRoot = treeDataItem?.id == '0'; // 判断是否为根节点
|
|
49
50
|
return {
|
|
50
|
-
title:
|
|
51
|
+
title: specialBracket
|
|
52
|
+
? `【${treeDataItem[resKeyValue[0]]}】${treeDataItem[resKeyValue[1]]}`
|
|
53
|
+
: treeDataItem[resKeyValue[1]],
|
|
51
54
|
key: treeDataItem[resKeyValue[0]],
|
|
52
55
|
value: treeDataItem[resKeyValue[0]],
|
|
53
56
|
parentId: treeDataItem.parent,
|
|
54
57
|
data: { ...treeDataItem },
|
|
55
58
|
isLeaf: !haveChildren,
|
|
56
|
-
disabled: isDisabled(haveChildren,isRoot),
|
|
59
|
+
disabled: isDisabled(haveChildren, isRoot),
|
|
57
60
|
children: haveChildren ? treeDataItem[treeChildrenRoom].map((i: any) => mapSearchTree(i)) : [],
|
|
58
61
|
};
|
|
59
62
|
};
|
|
60
63
|
|
|
61
|
-
const isDisabled = (isParent: boolean,isRoot: boolean) => {
|
|
64
|
+
const isDisabled = (isParent: boolean, isRoot: boolean) => {
|
|
62
65
|
if (isChoose) {
|
|
63
|
-
if(rootDisabled && isRoot){
|
|
66
|
+
if (rootDisabled && isRoot) {
|
|
64
67
|
return rootDisabled
|
|
65
68
|
}
|
|
66
69
|
return false;
|
|
@@ -74,11 +77,11 @@ const TreeSearchSelect = (props: any) => {
|
|
|
74
77
|
[`${paramsKey}`]: q,
|
|
75
78
|
...initialParams,
|
|
76
79
|
}
|
|
77
|
-
axios.get(`${url}?${stringify(paramsData)}`, {headers}).then(async (res: any) => {
|
|
80
|
+
axios.get(`${url}?${stringify(paramsData)}`, { headers }).then(async (res: any) => {
|
|
78
81
|
const resData = res?.data || [];
|
|
79
82
|
let coverData;
|
|
80
83
|
|
|
81
|
-
if(judgeIsRequestSuccess(resData)) {
|
|
84
|
+
if (judgeIsRequestSuccess(resData)) {
|
|
82
85
|
const { data } = resData;
|
|
83
86
|
if (remoteSource.converter) {
|
|
84
87
|
coverData = await remoteSource.converter({ data: [data] })
|
|
@@ -97,14 +100,14 @@ const TreeSearchSelect = (props: any) => {
|
|
|
97
100
|
|
|
98
101
|
const formatData = (value: any) => {
|
|
99
102
|
if (labelInValue) {
|
|
100
|
-
const formatResult = multiple||treeCheckable ? value.map((i: any) => ({...i, key: i.value})) : { ...value, key: value?.value };
|
|
103
|
+
const formatResult = multiple || treeCheckable ? value.map((i: any) => ({ ...i, key: i.value })) : { ...value, key: value?.value };
|
|
101
104
|
return formatResult
|
|
102
105
|
} else {
|
|
103
|
-
const formatResult = multiple||treeCheckable ? value.map((i: any) => (i?.value || i)) : (_.get(value?.[0], 'value') || value)
|
|
106
|
+
const formatResult = multiple || treeCheckable ? value.map((i: any) => (i?.value || i)) : (_.get(value?.[0], 'value') || value)
|
|
104
107
|
return formatResult
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
|
-
const parallelData = (data: any,result: any) => {
|
|
110
|
+
const parallelData = (data: any, result: any) => {
|
|
108
111
|
data.forEach((i: any) => {
|
|
109
112
|
result.push(i);
|
|
110
113
|
if (i[treeChildrenRoom]) {
|
|
@@ -113,31 +116,31 @@ const TreeSearchSelect = (props: any) => {
|
|
|
113
116
|
});
|
|
114
117
|
return result;
|
|
115
118
|
}
|
|
116
|
-
const getSelectItem = (tData: any,selectValue: any) => {
|
|
117
|
-
const handleList = tData||[];
|
|
119
|
+
const getSelectItem = (tData: any, selectValue: any) => {
|
|
120
|
+
const handleList = tData || [];
|
|
118
121
|
let result = [];
|
|
119
|
-
if(labelInValue) {
|
|
120
|
-
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
121
|
-
if(handleList.some((s: any) => s.key == i.value)){
|
|
122
|
+
if (labelInValue) {
|
|
123
|
+
result = multiple || treeCheckable ? (selectValue?.map((i: any) => {
|
|
124
|
+
if (handleList.some((s: any) => s.key == i.value)) {
|
|
122
125
|
return handleList.find((s: any) => s.key == i.value)
|
|
123
126
|
}
|
|
124
|
-
}) || []) : (handleList?.find((s: any) => s.key == selectValue?.value)||{})
|
|
127
|
+
}) || []) : (handleList?.find((s: any) => s.key == selectValue?.value) || {})
|
|
125
128
|
} else {
|
|
126
129
|
const cValue = _.get(selectValue?.[0], 'value', selectValue);
|
|
127
|
-
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
128
|
-
if(handleList.some((s: any) => s.key == i)){
|
|
130
|
+
result = multiple || treeCheckable ? (selectValue?.map((i: any) => {
|
|
131
|
+
if (handleList.some((s: any) => s.key == i)) {
|
|
129
132
|
return handleList.find((s: any) => s.key == i)
|
|
130
133
|
}
|
|
131
|
-
}) || []) : (handleList?.find((s: any) => s.key == cValue)||{})
|
|
134
|
+
}) || []) : (handleList?.find((s: any) => s.key == cValue) || {})
|
|
132
135
|
}
|
|
133
136
|
return result;
|
|
134
137
|
}
|
|
135
138
|
const handleChange = (data: any, dataName: any) => {
|
|
136
139
|
const handleData = formatData(data);
|
|
137
140
|
// 获取选中树节点当条数据,并返回给调用业务
|
|
138
|
-
const parallelTreeData = parallelData(treeData,[])
|
|
139
|
-
const currentItem = getSelectItem(parallelTreeData,data)
|
|
140
|
-
onChange(handleData,data,currentItem,parallelTreeData);
|
|
141
|
+
const parallelTreeData = parallelData(treeData, [])
|
|
142
|
+
const currentItem = getSelectItem(parallelTreeData, data)
|
|
143
|
+
onChange(handleData, data, currentItem, parallelTreeData);
|
|
141
144
|
onChangeName && onChangeName(dataName);
|
|
142
145
|
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
143
146
|
ctx?.form?.setFieldValue(ctx.name, handleData);
|
|
@@ -148,17 +151,17 @@ const TreeSearchSelect = (props: any) => {
|
|
|
148
151
|
}, []);
|
|
149
152
|
|
|
150
153
|
const maxTagPlaceholder = (selectedValues: any) => {
|
|
151
|
-
const onClose = (e: any,item: any) => {
|
|
154
|
+
const onClose = (e: any, item: any) => {
|
|
152
155
|
e.preventDefault();
|
|
153
|
-
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value): JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
154
|
-
const newValueName = labelInValue ? null: JSON.parse(JSON.stringify(valueName)).filter((i: any) => i !== item.label)
|
|
156
|
+
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value) : JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
157
|
+
const newValueName = labelInValue ? null : JSON.parse(JSON.stringify(valueName)).filter((i: any) => i !== item.label)
|
|
155
158
|
handleChange(newValue, newValueName);
|
|
156
159
|
}
|
|
157
160
|
return (
|
|
158
161
|
<Tooltip title={selectedValues.map((i: any) => (
|
|
159
162
|
<Tag
|
|
160
163
|
closable={true}
|
|
161
|
-
onClose={(e) => onClose(e,i)}
|
|
164
|
+
onClose={(e) => onClose(e, i)}
|
|
162
165
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
163
166
|
>
|
|
164
167
|
{i.label}
|
|
@@ -190,7 +193,7 @@ const TreeSearchSelect = (props: any) => {
|
|
|
190
193
|
multiple={multiple} // 支持多选(当设置 treeCheckable 时自动变为 true)
|
|
191
194
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
192
195
|
onChange={handleChange}
|
|
193
|
-
disabled={disabled || mode==='view' || ctx?.mode === 'view'}
|
|
196
|
+
disabled={disabled || mode === 'view' || ctx?.mode === 'view'}
|
|
194
197
|
getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || document.body}
|
|
195
198
|
>
|
|
196
199
|
</TreeSelect>
|