@bit-sun/business-component 1.2.3 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.umirc.ts +31 -16
- package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +1 -1
- package/dist/components/Business/SearchSelect/common.d.ts +5 -1
- package/dist/components/Business/SearchSelect/utils.d.ts +2 -1
- package/dist/components/Business/TreeSearchSelect/index.d.ts +3 -0
- package/dist/components/Business/TreeSearchSelect/utils.d.ts +2 -0
- package/dist/components/Functional/AddSelect/index.d.ts +3 -0
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1876 -89
- package/dist/index.js +1877 -87
- package/dist/utils/CheckOneUser/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Business/CommodityEntry/index.md +2 -2
- package/src/components/Business/CommodityEntry/index.tsx +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.ts +85 -6
- package/src/components/Business/SearchSelect/common.ts +20 -1
- package/src/components/Business/SearchSelect/index.md +60 -30
- package/src/components/Business/SearchSelect/index.tsx +2 -1
- package/src/components/Business/SearchSelect/utils.ts +27 -2
- package/src/components/Business/TreeSearchSelect/index.md +126 -0
- package/src/components/Business/TreeSearchSelect/index.tsx +34 -0
- package/src/components/Business/TreeSearchSelect/utils.ts +60 -0
- package/src/components/Functional/AddSelect/index.less +275 -0
- package/src/components/Functional/AddSelect/index.md +118 -0
- package/src/components/Functional/AddSelect/index.tsx +795 -0
- package/src/components/Functional/SearchSelect/index.tsx +24 -7
- package/src/components/Functional/TreeSearchSelect/index.md +47 -0
- package/src/components/Functional/TreeSearchSelect/index.tsx +148 -0
- package/src/index.ts +8 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { handleDefaultProps } from './utils';
|
|
3
|
+
import TreeSearchSelect from '@/components/Functional/TreeSearchSelect';
|
|
4
|
+
|
|
5
|
+
const MemoTreeSearchSelect = React.memo(TreeSearchSelect)
|
|
6
|
+
|
|
7
|
+
const BusinessTreeSearchSelect = (props: any) => {
|
|
8
|
+
const businessType = props?.businessType || 'department';
|
|
9
|
+
|
|
10
|
+
const handleBusinessProps = handleDefaultProps(businessType);
|
|
11
|
+
|
|
12
|
+
const currentProps = useMemo(() => {
|
|
13
|
+
return {
|
|
14
|
+
...handleBusinessProps,
|
|
15
|
+
...props,
|
|
16
|
+
}
|
|
17
|
+
}, [props?.value])
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div>
|
|
21
|
+
<MemoTreeSearchSelect {...currentProps} />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default React.memo(BusinessTreeSearchSelect, (props, nextProps) => {
|
|
27
|
+
if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
if(props && props.value !== nextProps.value) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
return true
|
|
34
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const handleDefaultProps = (type: string) => {
|
|
2
|
+
let result = {};
|
|
3
|
+
switch (type){
|
|
4
|
+
case 'department':
|
|
5
|
+
result = {
|
|
6
|
+
treeCheckable: true,
|
|
7
|
+
isChoose: true,
|
|
8
|
+
remoteSource: {
|
|
9
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
10
|
+
initialParams: { 'orgViewCode': 'administrative-organization-view' },
|
|
11
|
+
resKeyValue: ['code', 'name'],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
break;
|
|
15
|
+
case 'sales-organization':
|
|
16
|
+
result = {
|
|
17
|
+
isChoose: true,
|
|
18
|
+
remoteSource: {
|
|
19
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
20
|
+
initialParams: { 'orgViewCode': 'sales-organizational-view' },
|
|
21
|
+
resKeyValue: ['code', 'name'],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
break;
|
|
25
|
+
case 'purchase-organization':
|
|
26
|
+
result = {
|
|
27
|
+
isChoose: true,
|
|
28
|
+
remoteSource: {
|
|
29
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
30
|
+
initialParams: { 'orgViewCode': 'purchase-organizational-view' },
|
|
31
|
+
resKeyValue: ['code', 'name'],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
break;
|
|
35
|
+
case 'stock-organization':
|
|
36
|
+
result = {
|
|
37
|
+
isChoose: true,
|
|
38
|
+
remoteSource: {
|
|
39
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
40
|
+
initialParams: { 'orgViewCode': 'stock-organizational-view' },
|
|
41
|
+
resKeyValue: ['code', 'name'],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
result = {
|
|
47
|
+
treeCheckable: true,
|
|
48
|
+
isChoose: true,
|
|
49
|
+
remoteSource: {
|
|
50
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
51
|
+
initialParams: { 'orgViewCode': 'administrative-organization-view' },
|
|
52
|
+
resKeyValue: ['code', 'name'],
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
break
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { handleDefaultProps }
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
.add_select {
|
|
2
|
+
&_show {
|
|
3
|
+
display: flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&_expand_button {
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 30px;
|
|
9
|
+
color: #ffffff;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
|
|
12
|
+
span {
|
|
13
|
+
position: absolute;
|
|
14
|
+
height: 20px;
|
|
15
|
+
line-height: 14px;
|
|
16
|
+
left: 50%;
|
|
17
|
+
top: 50%;
|
|
18
|
+
transform: translate(-50%, -50%);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&_header {
|
|
23
|
+
border-bottom: 1px solid #D9D9D9;
|
|
24
|
+
height: 24px;
|
|
25
|
+
height: 40px;
|
|
26
|
+
font-family: PingFangSC-Medium;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
font-size: 18px;
|
|
29
|
+
color: #000000;
|
|
30
|
+
letter-spacing: 0;
|
|
31
|
+
line-height: 40px;
|
|
32
|
+
margin-bottom: 10px;
|
|
33
|
+
padding-left: 10px;
|
|
34
|
+
|
|
35
|
+
& > span {
|
|
36
|
+
margin-left: 20px;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
color: #666666;
|
|
40
|
+
letter-spacing: 0;
|
|
41
|
+
line-height: 40px;
|
|
42
|
+
|
|
43
|
+
& > span {
|
|
44
|
+
color: #ff0000;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&_close {
|
|
49
|
+
span {
|
|
50
|
+
position: absolute;
|
|
51
|
+
color: black !important;
|
|
52
|
+
right: 10px;
|
|
53
|
+
top: 10px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&_wrapper {
|
|
59
|
+
position: relative;
|
|
60
|
+
display: flex;
|
|
61
|
+
// min-height: 60vh;
|
|
62
|
+
max-height: 60vh;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
margin: 5px 10px;
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
.ant-table-pagination.ant-pagination {
|
|
69
|
+
margin: 5px;
|
|
70
|
+
padding-right: 5px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ant-checkbox-wrapper {
|
|
74
|
+
justify-content: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ant-table-thead {
|
|
78
|
+
th {
|
|
79
|
+
height: 20px !important;
|
|
80
|
+
padding: 0px 8px !important;
|
|
81
|
+
font-size: 12px !important;
|
|
82
|
+
font-weight: 600 !important;
|
|
83
|
+
line-height: 20px !important;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ant-modal-body {
|
|
88
|
+
padding: 10px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ant-table-wrapper {
|
|
92
|
+
padding: 0px !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.row-class {
|
|
96
|
+
height: 24px;
|
|
97
|
+
|
|
98
|
+
td {
|
|
99
|
+
font-size: 12px !important;
|
|
100
|
+
height: 24px !important;
|
|
101
|
+
padding: 0px 8px !important;
|
|
102
|
+
line-height: 20px !important;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ant-table-body {
|
|
107
|
+
height: 240px;
|
|
108
|
+
overflow-y: auto !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ant-row.ant-form-item {
|
|
112
|
+
margin-bottom: 10px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&_click_flag {
|
|
116
|
+
position: absolute;
|
|
117
|
+
z-index: 10;
|
|
118
|
+
&_arrow {
|
|
119
|
+
transform: rotate(0deg);
|
|
120
|
+
transition: transform 0.5s;
|
|
121
|
+
}
|
|
122
|
+
&_arrow_1 {
|
|
123
|
+
transform: rotate(-180deg);
|
|
124
|
+
transition: transform 0.5s;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&_left {
|
|
129
|
+
flex-basis: 298px;
|
|
130
|
+
width: 298px;
|
|
131
|
+
overflow-y: hidden;
|
|
132
|
+
//background-color: yellow;
|
|
133
|
+
transition: all 0.3s;
|
|
134
|
+
margin-right: 10px;
|
|
135
|
+
border: 1px solid #D9D9D9;
|
|
136
|
+
border-radius: 5px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&_left1 {
|
|
140
|
+
width: 0;
|
|
141
|
+
height: 0;
|
|
142
|
+
transition: all 0.3s;
|
|
143
|
+
display: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&_right {
|
|
147
|
+
width: 872px;
|
|
148
|
+
//background-color: pink;
|
|
149
|
+
border: 1px solid #D9D9D9;
|
|
150
|
+
border-radius: 5px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&_right1 {
|
|
154
|
+
width: 100%;
|
|
155
|
+
margin-left: 10px;
|
|
156
|
+
//background-color: green;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&_right, &_right1 {
|
|
160
|
+
overflow-x: auto;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.select_list_columns {
|
|
164
|
+
height: 272px;
|
|
165
|
+
overflow-y: auto;
|
|
166
|
+
border-bottom: 1px solid #D9D9D9;
|
|
167
|
+
|
|
168
|
+
&_tips {
|
|
169
|
+
background: #eee;
|
|
170
|
+
padding: 6px 20px;
|
|
171
|
+
margin-bottom: 10px;
|
|
172
|
+
}
|
|
173
|
+
&_formItems {
|
|
174
|
+
padding: 10px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
.select_list_searchButton {
|
|
178
|
+
display: flex;
|
|
179
|
+
margin: 10px;
|
|
180
|
+
justify-content: flex-end;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.select_list_button_space {
|
|
184
|
+
margin-right: 10px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.select_list_selectTips {
|
|
188
|
+
display: flex;
|
|
189
|
+
justify-content: space-between;
|
|
190
|
+
height: 24px;
|
|
191
|
+
font-size: 12px;
|
|
192
|
+
line-height: 24px;
|
|
193
|
+
background: #F7F8FB;
|
|
194
|
+
padding: 0 5px;
|
|
195
|
+
border-bottom: 1px solid #D9D9D9;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.select_list_selectAll {
|
|
199
|
+
position: relative;
|
|
200
|
+
top: -40px;
|
|
201
|
+
left: 20px;
|
|
202
|
+
width: 160px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&_wrapper_select {
|
|
207
|
+
margin-top: 4px;
|
|
208
|
+
border: 1px solid #D9D9D9;
|
|
209
|
+
border-radius: 5px;
|
|
210
|
+
margin: 5px 10px;
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
.ant-table-pagination.ant-pagination {
|
|
214
|
+
margin: 9px;
|
|
215
|
+
padding-right: 5px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ant-modal-body {
|
|
219
|
+
padding: 10px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.ant-table-wrapper {
|
|
223
|
+
padding: 0px !important;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.ant-table-thead {
|
|
227
|
+
th {
|
|
228
|
+
height: 23px !important;
|
|
229
|
+
padding: 0px 8px !important;
|
|
230
|
+
font-size: 12px !important;
|
|
231
|
+
font-weight: 600 !important;
|
|
232
|
+
line-height: 23px !important;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.ant-modal-close-x {
|
|
237
|
+
height: 30px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.row-class {
|
|
241
|
+
height: 30px;
|
|
242
|
+
|
|
243
|
+
td {
|
|
244
|
+
font-size: 12px !important;
|
|
245
|
+
height: 30px !important;
|
|
246
|
+
padding: 4px 8px !important;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.ant-table-body {
|
|
251
|
+
height: 200px;
|
|
252
|
+
overflow-y: auto !important;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.ant-row.ant-form-item {
|
|
256
|
+
margin-bottom: 10px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.ant-input-number-input {
|
|
260
|
+
height: auto;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.select_list_selectTips {
|
|
264
|
+
display: flex;
|
|
265
|
+
justify-content: space-between;
|
|
266
|
+
height: 24px;
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
line-height: 24px;
|
|
269
|
+
background: #F7F8FB;
|
|
270
|
+
padding: 0 3px;
|
|
271
|
+
|
|
272
|
+
border-bottom: 1px solid #D9D9D9;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 功能组件
|
|
7
|
+
order: 0
|
|
8
|
+
title: 添加选择器
|
|
9
|
+
order: 3
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## AddSelect
|
|
13
|
+
|
|
14
|
+
Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { AddSelect } from '../../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
const selectProps = {
|
|
22
|
+
mode: 'multiple',
|
|
23
|
+
}
|
|
24
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
25
|
+
const props = {
|
|
26
|
+
value,
|
|
27
|
+
// labelInValue: true, // 非必填 默认为false
|
|
28
|
+
requestConfig: {
|
|
29
|
+
url: `/items/sku/pager/v2`,
|
|
30
|
+
filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
|
|
31
|
+
otherParams: {}, // 默认参数
|
|
32
|
+
mappingTextField: 'name',
|
|
33
|
+
mappingValueField: 'skuCode',
|
|
34
|
+
},
|
|
35
|
+
selectProps,
|
|
36
|
+
onChange: (value: any) => {
|
|
37
|
+
console.log(value)
|
|
38
|
+
setValue(value)
|
|
39
|
+
},
|
|
40
|
+
onSaveCallback: (rows) => {
|
|
41
|
+
console.log('save call', rows);
|
|
42
|
+
// return Promise.resolve(true);
|
|
43
|
+
// return Promise.reject('FAILE')
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const DictionaryUC000013 = [{ text: '共享', value: '10' }, { text: '私有', value: '20' }]
|
|
47
|
+
const modalTableProps = {
|
|
48
|
+
modalTableTitle: '选择商品',
|
|
49
|
+
tableSearchForm: [
|
|
50
|
+
{ name: 'qp-name-like', label: 'SKU名称' }, // field: { type: 'input', props: { placeholder: '8888'}}
|
|
51
|
+
{ name: 'qp-code-like', label: 'SKU编码' },
|
|
52
|
+
],
|
|
53
|
+
tableColumns: [
|
|
54
|
+
{
|
|
55
|
+
title: '商品编码',
|
|
56
|
+
width: 150,
|
|
57
|
+
dataIndex: 'skuCode',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: '商品名称',
|
|
61
|
+
width: 250,
|
|
62
|
+
dataIndex: 'name',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: '归属集团',
|
|
66
|
+
width: 150,
|
|
67
|
+
dataIndex: 'conglomerateName',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: '归属法人公司',
|
|
71
|
+
width: 150,
|
|
72
|
+
dataIndex: 'legalCompanyName',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
selectColumn: [
|
|
76
|
+
{
|
|
77
|
+
title: '商品编码',
|
|
78
|
+
width: 150,
|
|
79
|
+
dataIndex: 'skuCode',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: '商品名称',
|
|
83
|
+
width: 250,
|
|
84
|
+
dataIndex: 'name',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: '数量',
|
|
88
|
+
width: 150,
|
|
89
|
+
isInputItem: true,
|
|
90
|
+
dataIndex: 'count',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: '价格',
|
|
94
|
+
width: 150,
|
|
95
|
+
dataIndex: 'price',
|
|
96
|
+
isInputItem: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: '折扣',
|
|
100
|
+
width: 150,
|
|
101
|
+
dataIndex: 'sales',
|
|
102
|
+
isInputItem: true,
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div>
|
|
109
|
+
<AddSelect
|
|
110
|
+
{...props}
|
|
111
|
+
modalTableProps={modalTableProps}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|