@bit-sun/business-component 1.1.28 → 1.1.31

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.
Files changed (33) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +4 -4
  3. package/.gitlab-ci.yml +174 -174
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +28 -28
  7. package/README.md +27 -27
  8. package/dist/index.esm.js +3586 -1922
  9. package/dist/index.js +3588 -1924
  10. package/dist/utils/CheckOneUser/index.d.ts +1 -1
  11. package/docs/index.md +21 -21
  12. package/package.json +50 -50
  13. package/src/components/Business/CommodityEntry/index.md +69 -69
  14. package/src/components/Business/CommodityEntry/index.tsx +75 -75
  15. package/src/components/Business/SearchSelect/BusinessUtils.ts +948 -909
  16. package/src/components/Business/SearchSelect/common.ts +34 -34
  17. package/src/components/Business/SearchSelect/index.md +1004 -903
  18. package/src/components/Business/SearchSelect/index.tsx +43 -43
  19. package/src/components/Business/SearchSelect/utils.ts +74 -74
  20. package/src/components/Functional/DataValidation/index.less +63 -63
  21. package/src/components/Functional/DataValidation/index.md +38 -38
  22. package/src/components/Functional/DataValidation/index.tsx +666 -661
  23. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  24. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  25. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  26. package/src/components/Functional/SearchSelect/index.less +115 -115
  27. package/src/components/Functional/SearchSelect/index.md +141 -141
  28. package/src/components/Functional/SearchSelect/index.tsx +714 -653
  29. package/src/index.ts +21 -21
  30. package/src/utils/CheckOneUser/index.md +39 -39
  31. package/src/utils/CheckOneUser/index.ts +51 -51
  32. package/tsconfig.json +29 -29
  33. package/typings.d.ts +2 -2
@@ -1,903 +1,1004 @@
1
- ---
2
- nav:
3
- title: '组件'
4
- order: 1
5
- group:
6
- title: 业务组件
7
- order: 1
8
- title: 业务档案选择器
9
- order: 1
10
- ---
11
-
12
- # BusinessSearchSelect
13
-
14
-
15
- ## 供应商选择器 Select-GYS-001
16
-
17
- ```tsx
18
- import React, { useState } from 'react';
19
- import { Tabs } from 'antd';
20
- import {BusinessSearchSelect} from '../../../index.ts';
21
-
22
- const { TabPane } = Tabs;
23
-
24
- export default () => {
25
- // selectBusinessType 必传(不传默认为供应商选择器)
26
-
27
- const selectProps = {
28
- // mode: 'multiple',
29
- // maxTagCount: 1,
30
- // disabled: true
31
- }
32
- const selectPropsMultiple = {
33
- mode: 'multiple',
34
- maxTagCount: 1,
35
- }
36
-
37
- const [ tabKey, setTabKey ] = useState('single')
38
- const [value, setValue] = useState(null);
39
-
40
- const props = {
41
- value,
42
- // labelInValue: true, // 非必填 默认为false
43
- // requestConfig: {
44
- // url: `/bop/api/supplier`,
45
- // filter: 'qp-name,code-orGroup,like', // 过滤参数
46
- // otherParams: {}, // 默认参数
47
- // mappingTextField: 'name',
48
- // mappingValueField: 'code',
49
- // }, // 非必传,业务字段已根据业务默认默认
50
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
51
- selectProps, // 非必传
52
- onChange: (value: any) => {
53
- console.log(value)
54
- setValue(value)
55
- },
56
- selectBusinessType: 'supplier',
57
- };
58
-
59
- const onTabChange = (key) => {
60
- setTabKey(key)
61
- setValue(key === 'single' ? null: [])
62
- }
63
-
64
- return (
65
- <div>
66
- <Tabs onChange={onTabChange} activeKey={tabKey}>
67
- <TabPane tab='单选' key='single'>
68
- {tabKey === 'single' && (
69
- <BusinessSearchSelect {...props} />
70
- )}
71
- </TabPane>
72
- <TabPane tab='多选' key='multiple'>
73
- {tabKey === 'multiple' && (
74
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
75
- )}
76
- </TabPane>
77
- </Tabs>
78
- </div>
79
- );
80
- };
81
- ```
82
-
83
-
84
- ## 商品SKU选择器 Select-SKU-001
85
-
86
- ```tsx
87
- import React, { useState } from 'react';
88
- import { Tabs } from 'antd';
89
- import {BusinessSearchSelect} from '../../../index.ts';
90
-
91
- const { TabPane } = Tabs;
92
- export default () => {
93
- const selectProps = {
94
- // mode: 'multiple',
95
- // maxTagCount: 1,
96
- // disabled: true
97
- }
98
- const selectPropsMultiple = {
99
- mode: 'multiple',
100
- maxTagCount: 1,
101
- }
102
-
103
- const [ tabKey, setTabKey ] = useState('single')
104
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
105
-
106
- const props = {
107
- value,
108
- onChange: (value: any) => {
109
- console.log(value)
110
- setValue(value)
111
- },
112
- // requestConfig: {
113
- // url: `/bop/api/sku`,
114
- // filter: 'qp-name,skuCode-orGroup,like',
115
- // mappingValueField: 'skuCode',
116
- // otherParams: {
117
- // sorter: 'desc-id'
118
- // }, // 默认参数
119
- // sourceName: 'skuCode',
120
- // },
121
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
122
- selectProps,
123
- selectBusinessType: 'skuCommodity',
124
- };
125
-
126
- const onTabChange = (key) => {
127
- setTabKey(key)
128
- setValue(key === 'single' ? null: [])
129
- }
130
-
131
- return (
132
- <div>
133
- <Tabs onChange={onTabChange} activeKey={tabKey}>
134
- <TabPane tab='单选' key='single'>
135
- {tabKey === 'single' && (
136
- <BusinessSearchSelect {...props} />
137
- )}
138
- </TabPane>
139
- <TabPane tab='多选' key='multiple'>
140
- {tabKey === 'multiple' && (
141
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
142
- )}
143
- </TabPane>
144
- </Tabs>
145
- </div>
146
- );
147
- };
148
- ```
149
-
150
- ## 仓库选择器(物理仓) Select-Warehouse-001
151
-
152
- ```tsx
153
- import React, { useState } from 'react';
154
- import { Tabs } from 'antd';
155
- import {BusinessSearchSelect} from '../../../index.ts';
156
-
157
- const { TabPane } = Tabs;
158
-
159
- export default () => {
160
- const selectProps = {
161
- // mode: 'multiple',
162
- // maxTagCount: 1,
163
- // disabled: true
164
- }
165
- const selectPropsMultiple = {
166
- mode: 'multiple',
167
- maxTagCount: 1,
168
- }
169
-
170
- const [ tabKey, setTabKey ] = useState('single')
171
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
172
-
173
- const props = {
174
- value,
175
- onChange: (value: any) => {
176
- console.log(value)
177
- setValue(value)
178
- },
179
- // requestConfig: {
180
- // mappingValueField: 'physicalWarehouseCode',
181
- // sourceName: 'physicalWarehouseCode',
182
- // },
183
- // modalTableProps: {
184
- // modalTableTitle: '选择物理仓-更改title测试',
185
- // },
186
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
187
- selectProps,
188
- selectBusinessType: 'physicalWarehouse',
189
- };
190
-
191
- const onTabChange = (key) => {
192
- setTabKey(key)
193
- setValue(key === 'single' ? null: [])
194
- }
195
-
196
- return (
197
- <div>
198
- <Tabs onChange={onTabChange} activeKey={tabKey}>
199
- <TabPane tab='单选' key='single'>
200
- {tabKey === 'single' && (
201
- <BusinessSearchSelect {...props} />
202
- )}
203
- </TabPane>
204
- <TabPane tab='多选' key='multiple'>
205
- {tabKey === 'multiple' && (
206
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
207
- )}
208
- </TabPane>
209
- </Tabs>
210
- </div>
211
- );
212
- };
213
- ```
214
-
215
- ## 仓库选择器(逻辑仓) Select-Warehouse-002
216
-
217
- ```tsx
218
- import React, { useState } from 'react';
219
- import { Tabs } from 'antd';
220
- import {BusinessSearchSelect} from '../../../index.ts';
221
-
222
- const { TabPane } = Tabs;
223
-
224
- export default () => {
225
- const selectProps = {
226
- // mode: 'multiple',
227
- // maxTagCount: 1,
228
- // disabled: true
229
- }
230
- const selectPropsMultiple = {
231
- mode: 'multiple',
232
- maxTagCount: 1,
233
- }
234
-
235
- const [ tabKey, setTabKey ] = useState('single')
236
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
237
-
238
- const props = {
239
- value,
240
- onChange: (value: any) => {
241
- console.log(value)
242
- setValue(value)
243
- },
244
- // requestConfig: {
245
- // url: `/bop/api/realWarehouse`,
246
- // filter: 'qp-realWarehouseName,realWarehouseCode-orGroup,like',
247
- // mappingTextField: 'realWarehouseName',
248
- // mappingValueField: 'realWarehouseCode',
249
- // otherParams: {
250
- // sorter: 'desc-id'
251
- // }, // 默认参数
252
- // sourceName: 'warehouseIds',
253
- // },
254
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
255
- selectProps,
256
- selectBusinessType: 'realWarehouse',
257
- };
258
-
259
- const onTabChange = (key) => {
260
- setTabKey(key)
261
- setValue(key === 'single' ? null: [])
262
- }
263
-
264
- return (
265
- <div>
266
- <Tabs onChange={onTabChange} activeKey={tabKey}>
267
- <TabPane tab='单选' key='single'>
268
- {tabKey === 'single' && (
269
- <BusinessSearchSelect {...props} />
270
- )}
271
- </TabPane>
272
- <TabPane tab='多选' key='multiple'>
273
- {tabKey === 'multiple' && (
274
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
275
- )}
276
- </TabPane>
277
- </Tabs>
278
- </div>
279
- );
280
- };
281
- ```
282
-
283
- ## 仓库选择器(虚拟仓) Select-Warehouse-003
284
-
285
- ```tsx
286
- import React, { useState } from 'react';
287
- import { Tabs } from 'antd';
288
- import {BusinessSearchSelect} from '../../../index.ts';
289
-
290
- const { TabPane } = Tabs;
291
-
292
- export default () => {
293
- const selectProps = {
294
- // mode: 'multiple',
295
- // maxTagCount: 1,
296
- // disabled: true
297
- }
298
- const selectPropsMultiple = {
299
- mode: 'multiple',
300
- maxTagCount: 1,
301
- }
302
-
303
- const [ tabKey, setTabKey ] = useState('single')
304
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
305
-
306
- const props = {
307
- value,
308
- onChange: (value: any) => {
309
- console.log(value)
310
- setValue(value)
311
- },
312
- // requestConfig: {
313
- // url: `/bop/api/virtualWarehouse`,
314
- // filter: 'qp-virtualWarehouseName,virtualWarehouseCode-orGroup,like',
315
- // mappingTextField: 'virtualWarehouseName',
316
- // mappingValueField: 'virtualWarehouseCode',
317
- // otherParams: {
318
- // sorter: 'desc-id'
319
- // }, // 默认参数
320
- // sourceName: 'warehouseIds',
321
- // },
322
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
323
- selectProps,
324
- selectBusinessType: 'virtualWarehouse',
325
- };
326
-
327
- const onTabChange = (key) => {
328
- setTabKey(key)
329
- setValue(key === 'single' ? null: [])
330
- }
331
-
332
- return (
333
- <div>
334
- <Tabs onChange={onTabChange} activeKey={tabKey}>
335
- <TabPane tab='单选' key='single'>
336
- {tabKey === 'single' && (
337
- <BusinessSearchSelect {...props} />
338
- )}
339
- </TabPane>
340
- <TabPane tab='多选' key='multiple'>
341
- {tabKey === 'multiple' && (
342
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
343
- )}
344
- </TabPane>
345
- </Tabs>
346
- </div>
347
- );
348
- };
349
- ```
350
-
351
- ## 仓库选择器(渠道仓) Select-Warehouse-004
352
-
353
- ```tsx
354
- import React, { useState } from 'react';
355
- import { Tabs } from 'antd';
356
- import {BusinessSearchSelect} from '../../../index.ts';
357
-
358
- const { TabPane } = Tabs;
359
-
360
- export default () => {
361
- const selectProps = {
362
- // mode: 'multiple',
363
- // maxTagCount: 1,
364
- // disabled: true
365
- }
366
- const selectPropsMultiple = {
367
- mode: 'multiple',
368
- maxTagCount: 1,
369
- }
370
-
371
- const [ tabKey, setTabKey ] = useState('single')
372
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
373
-
374
- const props = {
375
- value,
376
- onChange: (value: any) => {
377
- console.log(value)
378
- setValue(value)
379
- },
380
- // requestConfig: {
381
- // url: `/bop/api/channelWarehouse`,
382
- // filter: 'qp-channelWarehouseName,channelWarehouseCode-orGroup,like',
383
- // mappingTextField: 'channelWarehouseName',
384
- // mappingValueField: 'channelWarehouseCode',
385
- // otherParams: {
386
- // sorter: 'desc-id'
387
- // }, // 默认参数
388
- // sourceName: 'warehouseIds',
389
- // },
390
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
391
- selectProps,
392
- selectBusinessType: 'channelWarehouse',
393
- };
394
-
395
- const onTabChange = (key) => {
396
- setTabKey(key)
397
- setValue(key === 'single' ? null: [])
398
- }
399
-
400
- return (
401
- <div>
402
- <Tabs onChange={onTabChange} activeKey={tabKey}>
403
- <TabPane tab='单选' key='single'>
404
- {tabKey === 'single' && (
405
- <BusinessSearchSelect {...props} />
406
- )}
407
- </TabPane>
408
- <TabPane tab='多选' key='multiple'>
409
- {tabKey === 'multiple' && (
410
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
411
- )}
412
- </TabPane>
413
- </Tabs>
414
- </div>
415
- );
416
- };
417
- ```
418
-
419
-
420
- ## 客户选择器 Select-KH-001
421
-
422
- ```tsx
423
- import React, { useState } from 'react';
424
- import { Tabs } from 'antd';
425
- import {BusinessSearchSelect} from '../../../index.ts';
426
-
427
- const { TabPane } = Tabs;
428
-
429
- export default () => {
430
- const selectProps = {
431
- // mode: 'multiple',
432
- // maxTagCount: 1,
433
- // disabled: true
434
- }
435
- const selectPropsMultiple = {
436
- mode: 'multiple',
437
- maxTagCount: 1,
438
- }
439
-
440
- const [ tabKey, setTabKey ] = useState('single')
441
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
442
-
443
- const props = {
444
- value,
445
- onChange: (value: any) => {
446
- console.log(value)
447
- setValue(value)
448
- },
449
- // requestConfig: {
450
- // url: `/bop/api/customer`,
451
- // filter: 'qp-name,code-orGroup,like', // 过滤参数
452
- // mappingTextField: 'name',
453
- // mappingValueField: 'code',
454
- // otherParams: {
455
- // sorter: 'desc-id'
456
- // }, // 默认参数
457
- // sourceName: 'customerCode',
458
- // },
459
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
460
- selectProps,
461
- selectBusinessType: 'customer',
462
- };
463
-
464
- const onTabChange = (key) => {
465
- setTabKey(key)
466
- setValue(key === 'single' ? null: [])
467
- }
468
-
469
- return (
470
- <div>
471
- <Tabs onChange={onTabChange} activeKey={tabKey}>
472
- <TabPane tab='单选' key='single'>
473
- {tabKey === 'single' && (
474
- <BusinessSearchSelect {...props} />
475
- )}
476
- </TabPane>
477
- <TabPane tab='多选' key='multiple'>
478
- {tabKey === 'multiple' && (
479
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
480
- )}
481
- </TabPane>
482
- </Tabs>
483
- </div>
484
- );
485
- };
486
- ```
487
-
488
-
489
- ## 店铺选择器 Select-DP-001
490
-
491
- ```tsx
492
- import React, { useState } from 'react';
493
- import { Tabs } from 'antd';
494
- import {BusinessSearchSelect} from '../../../index.ts';
495
-
496
- const { TabPane } = Tabs;
497
-
498
- export default () => {
499
- const selectProps = {
500
- // mode: 'multiple',
501
- // maxTagCount: 1,
502
- // disabled: true
503
- }
504
- const selectPropsMultiple = {
505
- mode: 'multiple',
506
- maxTagCount: 1,
507
- }
508
-
509
- const [ tabKey, setTabKey ] = useState('single')
510
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
511
-
512
- const props = {
513
- value,
514
- onChange: (value: any) => {
515
- console.log(value)
516
- setValue(value)
517
- },
518
- // requestConfig: {
519
- // url: `/bop/api/store`,
520
- // filter: 'qp-name,code-orGroup,like',,
521
- // mappingTextField: 'name',
522
- // mappingValueField: 'code',
523
- // otherParams: {
524
- // sorter: 'desc-id'
525
- // }, // 默认参数
526
- // sourceName: 'code',
527
- // },
528
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
529
- selectProps,
530
- selectBusinessType: 'shopFile',
531
- };
532
-
533
- const onTabChange = (key) => {
534
- setTabKey(key)
535
- setValue(key === 'single' ? null: [])
536
- }
537
-
538
- return (
539
- <div>
540
- <Tabs onChange={onTabChange} activeKey={tabKey}>
541
- <TabPane tab='单选' key='single'>
542
- {tabKey === 'single' && (
543
- <BusinessSearchSelect {...props} />
544
- )}
545
- </TabPane>
546
- <TabPane tab='多选' key='multiple'>
547
- {tabKey === 'multiple' && (
548
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
549
- )}
550
- </TabPane>
551
- </Tabs>
552
- </div>
553
- );
554
- };
555
- ```
556
-
557
-
558
- ## 核算主体选择器 Select-HSZT-001
559
-
560
- ```tsx
561
- import React, { useState } from 'react';
562
- import { Tabs } from 'antd';
563
- import {BusinessSearchSelect} from '../../../index.ts';
564
-
565
- const { TabPane } = Tabs;
566
-
567
- export default () => {
568
- const selectProps = {
569
- // mode: 'multiple',
570
- // maxTagCount: 1,
571
- // disabled: true
572
- }
573
- const selectPropsMultiple = {
574
- mode: 'multiple',
575
- maxTagCount: 1,
576
- }
577
-
578
- const [ tabKey, setTabKey ] = useState('single')
579
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
580
-
581
- const props = {
582
- value,
583
- onChange: (value: any) => {
584
- console.log(value)
585
- setValue(value)
586
- },
587
- // requestConfig: {
588
- // url: `/bop/api/accountingSubject`,
589
- // filter: 'qp-name,code-orGroup,like',
590
- // mappingTextField: 'name',
591
- // mappingValueField: 'code',
592
- // otherParams: {
593
- // sorter: 'desc-id'
594
- // }, // 默认参数
595
- // sourceName: 'accountingCode',
596
- // },
597
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
598
- selectProps,
599
- selectBusinessType: 'accountingSubject',
600
- };
601
-
602
- const onTabChange = (key) => {
603
- setTabKey(key)
604
- setValue(key === 'single' ? null: [])
605
- }
606
-
607
- return (
608
- <div>
609
- <Tabs onChange={onTabChange} activeKey={tabKey}>
610
- <TabPane tab='单选' key='single'>
611
- {tabKey === 'single' && (
612
- <BusinessSearchSelect {...props} />
613
- )}
614
- </TabPane>
615
- <TabPane tab='多选' key='multiple'>
616
- {tabKey === 'multiple' && (
617
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
618
- )}
619
- </TabPane>
620
- </Tabs>
621
- </div>
622
- );
623
- };
624
- ```
625
-
626
-
627
- ## 库存组织选择器 Select-KCZZ-001
628
-
629
- ```tsx
630
- import React, { useState } from 'react';
631
- import { Tabs } from 'antd';
632
- import {BusinessSearchSelect} from '../../../index.ts';
633
-
634
- const { TabPane } = Tabs;
635
-
636
- export default () => {
637
- const selectProps = {
638
- // mode: 'multiple',
639
- // maxTagCount: 1,
640
- // disabled: true
641
- }
642
- const selectPropsMultiple = {
643
- mode: 'multiple',
644
- maxTagCount: 1,
645
- }
646
-
647
- const [ tabKey, setTabKey ] = useState('single')
648
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
649
-
650
- const props = {
651
- value,
652
- onChange: (value: any) => {
653
- console.log(value)
654
- setValue(value)
655
- },
656
- // requestConfig: {
657
- // url: `/bop/api/inventoryOrg`,
658
- // filter: 'qp-name,code-orGroup,like',
659
- // mappingTextField: 'name',
660
- // mappingValueField: 'code',
661
- // otherParams: {
662
- // sorter: 'desc-id'
663
- // }, // 默认参数
664
- // sourceName: 'inventoryOrgCode',
665
- // },
666
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
667
- selectProps,
668
- selectBusinessType: 'inventoryOrg',
669
- };
670
-
671
- const onTabChange = (key) => {
672
- setTabKey(key)
673
- setValue(key === 'single' ? null: [])
674
- }
675
-
676
- return (
677
- <div>
678
- <Tabs onChange={onTabChange} activeKey={tabKey}>
679
- <TabPane tab='单选' key='single'>
680
- {tabKey === 'single' && (
681
- <BusinessSearchSelect {...props} />
682
- )}
683
- </TabPane>
684
- <TabPane tab='多选' key='multiple'>
685
- {tabKey === 'multiple' && (
686
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
687
- )}
688
- </TabPane>
689
- </Tabs>
690
- </div>
691
- );
692
- };
693
- ```
694
-
695
-
696
- ## 法人公司选择器 Select-FRGS-001
697
-
698
- ```tsx
699
- import React, { useState } from 'react';
700
- import { Tabs } from 'antd';
701
- import {BusinessSearchSelect} from '../../../index.ts';
702
-
703
- const { TabPane } = Tabs;
704
-
705
- export default () => {
706
- const selectProps = {
707
- // mode: 'multiple',
708
- // maxTagCount: 1,
709
- // disabled: true
710
- }
711
- const selectPropsMultiple = {
712
- mode: 'multiple',
713
- maxTagCount: 1,
714
- }
715
-
716
- const [ tabKey, setTabKey ] = useState('single')
717
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
718
-
719
- const props = {
720
- value,
721
- onChange: (value: any) => {
722
- console.log(value)
723
- setValue(value)
724
- },
725
- // requestConfig: {
726
- // url: `/bop/api/company`,
727
- // filter: 'qp-name,code-orGroup,like',
728
- // mappingTextField: 'name',
729
- // mappingValueField: 'code',
730
- // otherParams: {
731
- // 'qp-companyType-eq': '20',
732
- // sorter: 'desc-id'
733
- // }, // 默认参数
734
- // sourceName: 'companyCode',
735
- // },
736
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
737
- selectProps,
738
- selectBusinessType: 'corporationCompany',
739
- };
740
-
741
- const onTabChange = (key) => {
742
- setTabKey(key)
743
- setValue(key === 'single' ? null: [])
744
- }
745
-
746
- return (
747
- <div>
748
- <Tabs onChange={onTabChange} activeKey={tabKey}>
749
- <TabPane tab='单选' key='single'>
750
- {tabKey === 'single' && (
751
- <BusinessSearchSelect {...props} />
752
- )}
753
- </TabPane>
754
- <TabPane tab='多选' key='multiple'>
755
- {tabKey === 'multiple' && (
756
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
757
- )}
758
- </TabPane>
759
- </Tabs>
760
- </div>
761
- );
762
- };
763
- ```
764
-
765
-
766
- ## 员工选择器 Select-YG-001
767
-
768
- ```tsx
769
- import React, { useState } from 'react';
770
- import { Tabs } from 'antd';
771
- import {BusinessSearchSelect} from '../../../index.ts';
772
-
773
- const { TabPane } = Tabs;
774
-
775
- export default () => {
776
- const selectProps = {
777
- // mode: 'multiple',
778
- // maxTagCount: 1,
779
- // disabled: true
780
- }
781
- const selectPropsMultiple = {
782
- mode: 'multiple',
783
- maxTagCount: 1,
784
- }
785
-
786
- const [ tabKey, setTabKey ] = useState('single')
787
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
788
-
789
- const props = {
790
- value,
791
- onChange: (value: any) => {
792
- console.log(value)
793
- setValue(value)
794
- },
795
- // requestConfig: {
796
- // url: `/bop/api/employee`,
797
- // filter: 'qp-name,code-orGroup,like',
798
- // mappingTextField: 'name',
799
- // mappingValueField: 'code',
800
- // otherParams: {
801
- // sorter: 'desc-id'
802
- // }, // 默认参数
803
- // sourceName: 'code',
804
- // },
805
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
806
- selectProps,
807
- selectBusinessType: 'employee',
808
- };
809
-
810
- const onTabChange = (key) => {
811
- setTabKey(key)
812
- setValue(key === 'single' ? null: [])
813
- }
814
-
815
- return (
816
- <div>
817
- <Tabs onChange={onTabChange} activeKey={tabKey}>
818
- <TabPane tab='单选' key='single'>
819
- {tabKey === 'single' && (
820
- <BusinessSearchSelect {...props} />
821
- )}
822
- </TabPane>
823
- <TabPane tab='多选' key='multiple'>
824
- {tabKey === 'multiple' && (
825
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
826
- )}
827
- </TabPane>
828
- </Tabs>
829
- </div>
830
- );
831
- };
832
- ```
833
-
834
-
835
- ## 配送方式选择器 Select-PSFS-001
836
-
837
- ```tsx
838
- import React, { useState } from 'react';
839
- import { Tabs } from 'antd';
840
- import {BusinessSearchSelect} from '../../../index.ts';
841
-
842
- const { TabPane } = Tabs;
843
-
844
- export default () => {
845
- const selectProps = {
846
- // mode: 'multiple',
847
- // maxTagCount: 1,
848
- // disabled: true
849
- }
850
- const selectPropsMultiple = {
851
- mode: 'multiple',
852
- maxTagCount: 1,
853
- }
854
-
855
- const [ tabKey, setTabKey ] = useState('single')
856
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
857
-
858
- const props = {
859
- value,
860
- onChange: (value: any) => {
861
- console.log(value)
862
- setValue(value)
863
- },
864
- // requestConfig: {
865
- // url: `/bop/api/getDeliveryModeCodeNameMap`,
866
- // filter: 'qp-name,code-orGroup,like',
867
- // mappingTextField: 'name',
868
- // mappingValueField: 'code',
869
- // otherParams: {
870
- // sorter: 'desc-id'
871
- // }, // 默认参数
872
- // sourceName: 'deliveryModeCode',
873
- // },
874
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
875
- selectProps,
876
- selectBusinessType: 'deliveryMode',
877
- };
878
-
879
- const onTabChange = (key) => {
880
- setTabKey(key)
881
- setValue(key === 'single' ? null: [])
882
- }
883
-
884
- return (
885
- <div>
886
- <Tabs onChange={onTabChange} activeKey={tabKey}>
887
- <TabPane tab='单选' key='single'>
888
- {tabKey === 'single' && (
889
- <BusinessSearchSelect {...props} />
890
- )}
891
- </TabPane>
892
- <TabPane tab='多选' key='multiple'>
893
- {tabKey === 'multiple' && (
894
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
895
- )}
896
- </TabPane>
897
- </Tabs>
898
- </div>
899
- );
900
- };
901
- ```
902
-
903
- More skills for writing demo: https://d.umijs.org/guide/demo-principle
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 业务组件
7
+ order: 1
8
+ title: 业务档案选择器
9
+ order: 1
10
+ ---
11
+
12
+ # BusinessSearchSelect
13
+
14
+
15
+ ## 供应商选择器 Select-GYS-001
16
+
17
+ ```tsx
18
+ import React, { useState } from 'react';
19
+ import { Tabs } from 'antd';
20
+ import {BusinessSearchSelect} from '../../../index.ts';
21
+
22
+ const { TabPane } = Tabs;
23
+
24
+ export default () => {
25
+ // selectBusinessType 必传(不传默认为供应商选择器)
26
+
27
+ const selectProps = {
28
+ // mode: 'multiple',
29
+ // maxTagCount: 1,
30
+ // disabled: true
31
+ }
32
+ const selectPropsMultiple = {
33
+ mode: 'multiple',
34
+ maxTagCount: 1,
35
+ }
36
+
37
+ const [ tabKey, setTabKey ] = useState('single')
38
+ const [value, setValue] = useState(null);
39
+
40
+ const props = {
41
+ value,
42
+ // labelInValue: true, // 非必填 默认为false
43
+ // requestConfig: {
44
+ // url: `/bop/api/supplier`,
45
+ // filter: 'qp-name,code-orGroup,like', // 过滤参数
46
+ // otherParams: {}, // 默认参数
47
+ // mappingTextField: 'name',
48
+ // mappingValueField: 'code',
49
+ // }, // 非必传,业务字段已根据业务默认默认
50
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
51
+ selectProps, // 非必传
52
+ onChange: (value: any) => {
53
+ console.log(value)
54
+ setValue(value)
55
+ },
56
+ selectBusinessType: 'supplier',
57
+ };
58
+
59
+ const onTabChange = (key) => {
60
+ setTabKey(key)
61
+ setValue(key === 'single' ? null: [])
62
+ }
63
+
64
+ return (
65
+ <div>
66
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
67
+ <TabPane tab='单选' key='single'>
68
+ {tabKey === 'single' && (
69
+ <BusinessSearchSelect {...props} />
70
+ )}
71
+ </TabPane>
72
+ <TabPane tab='多选' key='multiple'>
73
+ {tabKey === 'multiple' && (
74
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
75
+ )}
76
+ </TabPane>
77
+ </Tabs>
78
+ </div>
79
+ );
80
+ };
81
+ ```
82
+
83
+
84
+ ## 商品SKU选择器 Select-SKU-001
85
+
86
+ ```tsx
87
+ import React, { useState } from 'react';
88
+ import { Tabs } from 'antd';
89
+ import {BusinessSearchSelect} from '../../../index.ts';
90
+
91
+ const { TabPane } = Tabs;
92
+ export default () => {
93
+ const selectProps = {
94
+ // mode: 'multiple',
95
+ // maxTagCount: 1,
96
+ // disabled: true
97
+ }
98
+ const selectPropsMultiple = {
99
+ mode: 'multiple',
100
+ maxTagCount: 1,
101
+ }
102
+
103
+ const [ tabKey, setTabKey ] = useState('single')
104
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
105
+
106
+ const props = {
107
+ value,
108
+ onChange: (value: any) => {
109
+ console.log(value)
110
+ setValue(value)
111
+ },
112
+ // requestConfig: {
113
+ // url: `/bop/api/sku/pager/v2`,
114
+ // filter: 'skuCodeAndSkuName',
115
+ // mappingValueField: 'skuCode',
116
+ // otherParams: {
117
+ // sorter: 'desc-id'
118
+ // }, // 默认参数
119
+ // sourceName: 'skuCode',
120
+ // },
121
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
122
+ selectProps,
123
+ selectBusinessType: 'skuCommodity',
124
+ };
125
+
126
+ const onTabChange = (key) => {
127
+ setTabKey(key)
128
+ setValue(key === 'single' ? null: [])
129
+ }
130
+
131
+ return (
132
+ <div>
133
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
134
+ <TabPane tab='单选' key='single'>
135
+ {tabKey === 'single' && (
136
+ <BusinessSearchSelect {...props} />
137
+ )}
138
+ </TabPane>
139
+ <TabPane tab='多选' key='multiple'>
140
+ {tabKey === 'multiple' && (
141
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
142
+ )}
143
+ </TabPane>
144
+ </Tabs>
145
+ </div>
146
+ );
147
+ };
148
+ ```
149
+
150
+ [comment]: <> (## 商品规格选择器 Select-SPGG-001)
151
+
152
+ [comment]: <> (```tsx)
153
+
154
+ [comment]: <> (import React, { useState } from 'react';)
155
+
156
+ [comment]: <> (import { Tabs } from 'antd';)
157
+
158
+ [comment]: <> (import {BusinessSearchSelect} from '../../../index.ts';)
159
+
160
+ [comment]: <> (const { TabPane } = Tabs;)
161
+
162
+ [comment]: <> (export default &#40;&#41; => {)
163
+
164
+ [comment]: <> ( const selectProps = {)
165
+
166
+ [comment]: <> ( // mode: 'multiple',)
167
+
168
+ [comment]: <> ( // maxTagCount: 1,)
169
+
170
+ [comment]: <> ( // disabled: true)
171
+
172
+ [comment]: <> ( })
173
+
174
+ [comment]: <> ( const selectPropsMultiple = {)
175
+
176
+ [comment]: <> ( mode: 'multiple',)
177
+
178
+ [comment]: <> ( maxTagCount: 1,)
179
+
180
+ [comment]: <> ( })
181
+
182
+ [comment]: <> ( const [ tabKey, setTabKey ] = useState&#40;'single'&#41;)
183
+
184
+ [comment]: <> ( const [value, setValue] = useState&#40;selectProps?.mode ? [] : null&#41;;)
185
+
186
+ [comment]: <> ( const props = {)
187
+
188
+ [comment]: <> ( value,)
189
+
190
+ [comment]: <> ( onChange: &#40;value: any&#41; => {)
191
+
192
+ [comment]: <> ( console.log&#40;value&#41;)
193
+
194
+ [comment]: <> ( setValue&#40;value&#41;)
195
+
196
+ [comment]: <> ( },)
197
+
198
+ [comment]: <> ( prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },)
199
+
200
+ [comment]: <> ( selectProps,)
201
+
202
+ [comment]: <> ( selectBusinessType: 'skuPropertyValue',)
203
+
204
+ [comment]: <> ( };)
205
+
206
+ [comment]: <> ( const onTabChange = &#40;key&#41; => {)
207
+
208
+ [comment]: <> ( setTabKey&#40;key&#41;)
209
+
210
+ [comment]: <> ( setValue&#40;key === 'single' ? null: []&#41;)
211
+
212
+ [comment]: <> ( })
213
+
214
+ [comment]: <> ( return &#40;)
215
+
216
+ [comment]: <> ( <div>)
217
+
218
+ [comment]: <> ( <Tabs onChange={onTabChange} activeKey={tabKey}>)
219
+
220
+ [comment]: <> ( <TabPane tab='单选' key='single'>)
221
+
222
+ [comment]: <> ( {tabKey === 'single' && &#40;)
223
+
224
+ [comment]: <> ( <BusinessSearchSelect {...props} />)
225
+
226
+ [comment]: <> ( &#41;})
227
+
228
+ [comment]: <> ( </TabPane>)
229
+
230
+ [comment]: <> ( <TabPane tab='多选' key='multiple'>)
231
+
232
+ [comment]: <> ( {tabKey === 'multiple' && &#40;)
233
+
234
+ [comment]: <> ( <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />)
235
+
236
+ [comment]: <> ( &#41;})
237
+
238
+ [comment]: <> ( </TabPane>)
239
+
240
+ [comment]: <> ( </Tabs>)
241
+
242
+ [comment]: <> ( </div>)
243
+
244
+ [comment]: <> ( &#41;;)
245
+
246
+ [comment]: <> (};)
247
+
248
+ [comment]: <> (```)
249
+
250
+
251
+ ## 仓库选择器(物理仓) Select-Warehouse-001
252
+
253
+ ```tsx
254
+ import React, { useState } from 'react';
255
+ import { Tabs } from 'antd';
256
+ import {BusinessSearchSelect} from '../../../index.ts';
257
+
258
+ const { TabPane } = Tabs;
259
+
260
+ export default () => {
261
+ const selectProps = {
262
+ // mode: 'multiple',
263
+ // maxTagCount: 1,
264
+ // disabled: true
265
+ }
266
+ const selectPropsMultiple = {
267
+ mode: 'multiple',
268
+ maxTagCount: 1,
269
+ }
270
+
271
+ const [ tabKey, setTabKey ] = useState('single')
272
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
273
+
274
+ const props = {
275
+ value,
276
+ onChange: (value: any) => {
277
+ console.log(value)
278
+ setValue(value)
279
+ },
280
+ // requestConfig: {
281
+ // mappingValueField: 'physicalWarehouseCode',
282
+ // sourceName: 'physicalWarehouseCode',
283
+ // },
284
+ // modalTableProps: {
285
+ // modalTableTitle: '选择物理仓-更改title测试',
286
+ // },
287
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
288
+ selectProps,
289
+ selectBusinessType: 'physicalWarehouse',
290
+ };
291
+
292
+ const onTabChange = (key) => {
293
+ setTabKey(key)
294
+ setValue(key === 'single' ? null: [])
295
+ }
296
+
297
+ return (
298
+ <div>
299
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
300
+ <TabPane tab='单选' key='single'>
301
+ {tabKey === 'single' && (
302
+ <BusinessSearchSelect {...props} />
303
+ )}
304
+ </TabPane>
305
+ <TabPane tab='多选' key='multiple'>
306
+ {tabKey === 'multiple' && (
307
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
308
+ )}
309
+ </TabPane>
310
+ </Tabs>
311
+ </div>
312
+ );
313
+ };
314
+ ```
315
+
316
+ ## 仓库选择器(逻辑仓) Select-Warehouse-002
317
+
318
+ ```tsx
319
+ import React, { useState } from 'react';
320
+ import { Tabs } from 'antd';
321
+ import {BusinessSearchSelect} from '../../../index.ts';
322
+
323
+ const { TabPane } = Tabs;
324
+
325
+ export default () => {
326
+ const selectProps = {
327
+ // mode: 'multiple',
328
+ // maxTagCount: 1,
329
+ // disabled: true
330
+ }
331
+ const selectPropsMultiple = {
332
+ mode: 'multiple',
333
+ maxTagCount: 1,
334
+ }
335
+
336
+ const [ tabKey, setTabKey ] = useState('single')
337
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
338
+
339
+ const props = {
340
+ value,
341
+ onChange: (value: any) => {
342
+ console.log(value)
343
+ setValue(value)
344
+ },
345
+ // requestConfig: {
346
+ // url: `/bop/api/realWarehouse`,
347
+ // filter: 'qp-realWarehouseName,realWarehouseCode-orGroup,like',
348
+ // mappingTextField: 'realWarehouseName',
349
+ // mappingValueField: 'realWarehouseCode',
350
+ // otherParams: {
351
+ // sorter: 'desc-id'
352
+ // }, // 默认参数
353
+ // sourceName: 'warehouseIds',
354
+ // },
355
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
356
+ selectProps,
357
+ selectBusinessType: 'realWarehouse',
358
+ };
359
+
360
+ const onTabChange = (key) => {
361
+ setTabKey(key)
362
+ setValue(key === 'single' ? null: [])
363
+ }
364
+
365
+ return (
366
+ <div>
367
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
368
+ <TabPane tab='单选' key='single'>
369
+ {tabKey === 'single' && (
370
+ <BusinessSearchSelect {...props} />
371
+ )}
372
+ </TabPane>
373
+ <TabPane tab='多选' key='multiple'>
374
+ {tabKey === 'multiple' && (
375
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
376
+ )}
377
+ </TabPane>
378
+ </Tabs>
379
+ </div>
380
+ );
381
+ };
382
+ ```
383
+
384
+ ## 仓库选择器(虚拟仓) Select-Warehouse-003
385
+
386
+ ```tsx
387
+ import React, { useState } from 'react';
388
+ import { Tabs } from 'antd';
389
+ import {BusinessSearchSelect} from '../../../index.ts';
390
+
391
+ const { TabPane } = Tabs;
392
+
393
+ export default () => {
394
+ const selectProps = {
395
+ // mode: 'multiple',
396
+ // maxTagCount: 1,
397
+ // disabled: true
398
+ }
399
+ const selectPropsMultiple = {
400
+ mode: 'multiple',
401
+ maxTagCount: 1,
402
+ }
403
+
404
+ const [ tabKey, setTabKey ] = useState('single')
405
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
406
+
407
+ const props = {
408
+ value,
409
+ onChange: (value: any) => {
410
+ console.log(value)
411
+ setValue(value)
412
+ },
413
+ // requestConfig: {
414
+ // url: `/bop/api/virtualWarehouse`,
415
+ // filter: 'qp-virtualWarehouseName,virtualWarehouseCode-orGroup,like',
416
+ // mappingTextField: 'virtualWarehouseName',
417
+ // mappingValueField: 'virtualWarehouseCode',
418
+ // otherParams: {
419
+ // sorter: 'desc-id'
420
+ // }, // 默认参数
421
+ // sourceName: 'warehouseIds',
422
+ // },
423
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
424
+ selectProps,
425
+ selectBusinessType: 'virtualWarehouse',
426
+ };
427
+
428
+ const onTabChange = (key) => {
429
+ setTabKey(key)
430
+ setValue(key === 'single' ? null: [])
431
+ }
432
+
433
+ return (
434
+ <div>
435
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
436
+ <TabPane tab='单选' key='single'>
437
+ {tabKey === 'single' && (
438
+ <BusinessSearchSelect {...props} />
439
+ )}
440
+ </TabPane>
441
+ <TabPane tab='多选' key='multiple'>
442
+ {tabKey === 'multiple' && (
443
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
444
+ )}
445
+ </TabPane>
446
+ </Tabs>
447
+ </div>
448
+ );
449
+ };
450
+ ```
451
+
452
+ ## 仓库选择器(渠道仓) Select-Warehouse-004
453
+
454
+ ```tsx
455
+ import React, { useState } from 'react';
456
+ import { Tabs } from 'antd';
457
+ import {BusinessSearchSelect} from '../../../index.ts';
458
+
459
+ const { TabPane } = Tabs;
460
+
461
+ export default () => {
462
+ const selectProps = {
463
+ // mode: 'multiple',
464
+ // maxTagCount: 1,
465
+ // disabled: true
466
+ }
467
+ const selectPropsMultiple = {
468
+ mode: 'multiple',
469
+ maxTagCount: 1,
470
+ }
471
+
472
+ const [ tabKey, setTabKey ] = useState('single')
473
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
474
+
475
+ const props = {
476
+ value,
477
+ onChange: (value: any) => {
478
+ console.log(value)
479
+ setValue(value)
480
+ },
481
+ // requestConfig: {
482
+ // url: `/bop/api/channelWarehouse`,
483
+ // filter: 'qp-channelWarehouseName,channelWarehouseCode-orGroup,like',
484
+ // mappingTextField: 'channelWarehouseName',
485
+ // mappingValueField: 'channelWarehouseCode',
486
+ // otherParams: {
487
+ // sorter: 'desc-id'
488
+ // }, // 默认参数
489
+ // sourceName: 'warehouseIds',
490
+ // },
491
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
492
+ selectProps,
493
+ selectBusinessType: 'channelWarehouse',
494
+ };
495
+
496
+ const onTabChange = (key) => {
497
+ setTabKey(key)
498
+ setValue(key === 'single' ? null: [])
499
+ }
500
+
501
+ return (
502
+ <div>
503
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
504
+ <TabPane tab='单选' key='single'>
505
+ {tabKey === 'single' && (
506
+ <BusinessSearchSelect {...props} />
507
+ )}
508
+ </TabPane>
509
+ <TabPane tab='多选' key='multiple'>
510
+ {tabKey === 'multiple' && (
511
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
512
+ )}
513
+ </TabPane>
514
+ </Tabs>
515
+ </div>
516
+ );
517
+ };
518
+ ```
519
+
520
+
521
+ ## 客户选择器 Select-KH-001
522
+
523
+ ```tsx
524
+ import React, { useState } from 'react';
525
+ import { Tabs } from 'antd';
526
+ import {BusinessSearchSelect} from '../../../index.ts';
527
+
528
+ const { TabPane } = Tabs;
529
+
530
+ export default () => {
531
+ const selectProps = {
532
+ // mode: 'multiple',
533
+ // maxTagCount: 1,
534
+ // disabled: true
535
+ }
536
+ const selectPropsMultiple = {
537
+ mode: 'multiple',
538
+ maxTagCount: 1,
539
+ }
540
+
541
+ const [ tabKey, setTabKey ] = useState('single')
542
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
543
+
544
+ const props = {
545
+ value,
546
+ onChange: (value: any) => {
547
+ console.log(value)
548
+ setValue(value)
549
+ },
550
+ // requestConfig: {
551
+ // url: `/bop/api/customer`,
552
+ // filter: 'qp-name,code-orGroup,like', // 过滤参数
553
+ // mappingTextField: 'name',
554
+ // mappingValueField: 'code',
555
+ // otherParams: {
556
+ // sorter: 'desc-id'
557
+ // }, // 默认参数
558
+ // sourceName: 'customerCode',
559
+ // },
560
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
561
+ selectProps,
562
+ selectBusinessType: 'customer',
563
+ };
564
+
565
+ const onTabChange = (key) => {
566
+ setTabKey(key)
567
+ setValue(key === 'single' ? null: [])
568
+ }
569
+
570
+ return (
571
+ <div>
572
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
573
+ <TabPane tab='单选' key='single'>
574
+ {tabKey === 'single' && (
575
+ <BusinessSearchSelect {...props} />
576
+ )}
577
+ </TabPane>
578
+ <TabPane tab='多选' key='multiple'>
579
+ {tabKey === 'multiple' && (
580
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
581
+ )}
582
+ </TabPane>
583
+ </Tabs>
584
+ </div>
585
+ );
586
+ };
587
+ ```
588
+
589
+
590
+ ## 店铺选择器 Select-DP-001
591
+
592
+ ```tsx
593
+ import React, { useState } from 'react';
594
+ import { Tabs } from 'antd';
595
+ import {BusinessSearchSelect} from '../../../index.ts';
596
+
597
+ const { TabPane } = Tabs;
598
+
599
+ export default () => {
600
+ const selectProps = {
601
+ // mode: 'multiple',
602
+ // maxTagCount: 1,
603
+ // disabled: true
604
+ }
605
+ const selectPropsMultiple = {
606
+ mode: 'multiple',
607
+ maxTagCount: 1,
608
+ }
609
+
610
+ const [ tabKey, setTabKey ] = useState('single')
611
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
612
+
613
+ const props = {
614
+ value,
615
+ onChange: (value: any) => {
616
+ console.log(value)
617
+ setValue(value)
618
+ },
619
+ // requestConfig: {
620
+ // url: `/bop/api/store`,
621
+ // filter: 'qp-name,code-orGroup,like',,
622
+ // mappingTextField: 'name',
623
+ // mappingValueField: 'code',
624
+ // otherParams: {
625
+ // sorter: 'desc-id'
626
+ // }, // 默认参数
627
+ // sourceName: 'code',
628
+ // },
629
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
630
+ selectProps,
631
+ selectBusinessType: 'shopFile',
632
+ };
633
+
634
+ const onTabChange = (key) => {
635
+ setTabKey(key)
636
+ setValue(key === 'single' ? null: [])
637
+ }
638
+
639
+ return (
640
+ <div>
641
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
642
+ <TabPane tab='单选' key='single'>
643
+ {tabKey === 'single' && (
644
+ <BusinessSearchSelect {...props} />
645
+ )}
646
+ </TabPane>
647
+ <TabPane tab='多选' key='multiple'>
648
+ {tabKey === 'multiple' && (
649
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
650
+ )}
651
+ </TabPane>
652
+ </Tabs>
653
+ </div>
654
+ );
655
+ };
656
+ ```
657
+
658
+
659
+ ## 核算主体选择器 Select-HSZT-001
660
+
661
+ ```tsx
662
+ import React, { useState } from 'react';
663
+ import { Tabs } from 'antd';
664
+ import {BusinessSearchSelect} from '../../../index.ts';
665
+
666
+ const { TabPane } = Tabs;
667
+
668
+ export default () => {
669
+ const selectProps = {
670
+ // mode: 'multiple',
671
+ // maxTagCount: 1,
672
+ // disabled: true
673
+ }
674
+ const selectPropsMultiple = {
675
+ mode: 'multiple',
676
+ maxTagCount: 1,
677
+ }
678
+
679
+ const [ tabKey, setTabKey ] = useState('single')
680
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
681
+
682
+ const props = {
683
+ value,
684
+ onChange: (value: any) => {
685
+ console.log(value)
686
+ setValue(value)
687
+ },
688
+ // requestConfig: {
689
+ // url: `/bop/api/accountingSubject`,
690
+ // filter: 'qp-name,code-orGroup,like',
691
+ // mappingTextField: 'name',
692
+ // mappingValueField: 'code',
693
+ // otherParams: {
694
+ // sorter: 'desc-id'
695
+ // }, // 默认参数
696
+ // sourceName: 'accountingCode',
697
+ // },
698
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
699
+ selectProps,
700
+ selectBusinessType: 'accountingSubject',
701
+ };
702
+
703
+ const onTabChange = (key) => {
704
+ setTabKey(key)
705
+ setValue(key === 'single' ? null: [])
706
+ }
707
+
708
+ return (
709
+ <div>
710
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
711
+ <TabPane tab='单选' key='single'>
712
+ {tabKey === 'single' && (
713
+ <BusinessSearchSelect {...props} />
714
+ )}
715
+ </TabPane>
716
+ <TabPane tab='多选' key='multiple'>
717
+ {tabKey === 'multiple' && (
718
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
719
+ )}
720
+ </TabPane>
721
+ </Tabs>
722
+ </div>
723
+ );
724
+ };
725
+ ```
726
+
727
+
728
+ ## 库存组织选择器 Select-KCZZ-001
729
+
730
+ ```tsx
731
+ import React, { useState } from 'react';
732
+ import { Tabs } from 'antd';
733
+ import {BusinessSearchSelect} from '../../../index.ts';
734
+
735
+ const { TabPane } = Tabs;
736
+
737
+ export default () => {
738
+ const selectProps = {
739
+ // mode: 'multiple',
740
+ // maxTagCount: 1,
741
+ // disabled: true
742
+ }
743
+ const selectPropsMultiple = {
744
+ mode: 'multiple',
745
+ maxTagCount: 1,
746
+ }
747
+
748
+ const [ tabKey, setTabKey ] = useState('single')
749
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
750
+
751
+ const props = {
752
+ value,
753
+ onChange: (value: any) => {
754
+ console.log(value)
755
+ setValue(value)
756
+ },
757
+ // requestConfig: {
758
+ // url: `/bop/api/inventoryOrg`,
759
+ // filter: 'qp-name,code-orGroup,like',
760
+ // mappingTextField: 'name',
761
+ // mappingValueField: 'code',
762
+ // otherParams: {
763
+ // sorter: 'desc-id'
764
+ // }, // 默认参数
765
+ // sourceName: 'inventoryOrgCode',
766
+ // },
767
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
768
+ selectProps,
769
+ selectBusinessType: 'inventoryOrg',
770
+ };
771
+
772
+ const onTabChange = (key) => {
773
+ setTabKey(key)
774
+ setValue(key === 'single' ? null: [])
775
+ }
776
+
777
+ return (
778
+ <div>
779
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
780
+ <TabPane tab='单选' key='single'>
781
+ {tabKey === 'single' && (
782
+ <BusinessSearchSelect {...props} />
783
+ )}
784
+ </TabPane>
785
+ <TabPane tab='多选' key='multiple'>
786
+ {tabKey === 'multiple' && (
787
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
788
+ )}
789
+ </TabPane>
790
+ </Tabs>
791
+ </div>
792
+ );
793
+ };
794
+ ```
795
+
796
+
797
+ ## 法人公司选择器 Select-FRGS-001
798
+
799
+ ```tsx
800
+ import React, { useState } from 'react';
801
+ import { Tabs } from 'antd';
802
+ import {BusinessSearchSelect} from '../../../index.ts';
803
+
804
+ const { TabPane } = Tabs;
805
+
806
+ export default () => {
807
+ const selectProps = {
808
+ // mode: 'multiple',
809
+ // maxTagCount: 1,
810
+ // disabled: true
811
+ }
812
+ const selectPropsMultiple = {
813
+ mode: 'multiple',
814
+ maxTagCount: 1,
815
+ }
816
+
817
+ const [ tabKey, setTabKey ] = useState('single')
818
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
819
+
820
+ const props = {
821
+ value,
822
+ onChange: (value: any) => {
823
+ console.log(value)
824
+ setValue(value)
825
+ },
826
+ // requestConfig: {
827
+ // url: `/bop/api/company`,
828
+ // filter: 'qp-name,code-orGroup,like',
829
+ // mappingTextField: 'name',
830
+ // mappingValueField: 'code',
831
+ // otherParams: {
832
+ // 'qp-companyType-eq': '20',
833
+ // sorter: 'desc-id'
834
+ // }, // 默认参数
835
+ // sourceName: 'companyCode',
836
+ // },
837
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
838
+ selectProps,
839
+ selectBusinessType: 'corporationCompany',
840
+ };
841
+
842
+ const onTabChange = (key) => {
843
+ setTabKey(key)
844
+ setValue(key === 'single' ? null: [])
845
+ }
846
+
847
+ return (
848
+ <div>
849
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
850
+ <TabPane tab='单选' key='single'>
851
+ {tabKey === 'single' && (
852
+ <BusinessSearchSelect {...props} />
853
+ )}
854
+ </TabPane>
855
+ <TabPane tab='多选' key='multiple'>
856
+ {tabKey === 'multiple' && (
857
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
858
+ )}
859
+ </TabPane>
860
+ </Tabs>
861
+ </div>
862
+ );
863
+ };
864
+ ```
865
+
866
+
867
+ ## 员工选择器 Select-YG-001
868
+
869
+ ```tsx
870
+ import React, { useState } from 'react';
871
+ import { Tabs } from 'antd';
872
+ import {BusinessSearchSelect} from '../../../index.ts';
873
+
874
+ const { TabPane } = Tabs;
875
+
876
+ export default () => {
877
+ const selectProps = {
878
+ // mode: 'multiple',
879
+ // maxTagCount: 1,
880
+ // disabled: true
881
+ }
882
+ const selectPropsMultiple = {
883
+ mode: 'multiple',
884
+ maxTagCount: 1,
885
+ }
886
+
887
+ const [ tabKey, setTabKey ] = useState('single')
888
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
889
+
890
+ const props = {
891
+ value,
892
+ onChange: (value: any) => {
893
+ console.log(value)
894
+ setValue(value)
895
+ },
896
+ // requestConfig: {
897
+ // url: `/bop/api/employee`,
898
+ // filter: 'qp-name,code-orGroup,like',
899
+ // mappingTextField: 'name',
900
+ // mappingValueField: 'code',
901
+ // otherParams: {
902
+ // sorter: 'desc-id'
903
+ // }, // 默认参数
904
+ // sourceName: 'code',
905
+ // },
906
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
907
+ selectProps,
908
+ selectBusinessType: 'employee',
909
+ };
910
+
911
+ const onTabChange = (key) => {
912
+ setTabKey(key)
913
+ setValue(key === 'single' ? null: [])
914
+ }
915
+
916
+ return (
917
+ <div>
918
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
919
+ <TabPane tab='单选' key='single'>
920
+ {tabKey === 'single' && (
921
+ <BusinessSearchSelect {...props} />
922
+ )}
923
+ </TabPane>
924
+ <TabPane tab='多选' key='multiple'>
925
+ {tabKey === 'multiple' && (
926
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
927
+ )}
928
+ </TabPane>
929
+ </Tabs>
930
+ </div>
931
+ );
932
+ };
933
+ ```
934
+
935
+
936
+ ## 配送方式选择器 Select-PSFS-001
937
+
938
+ ```tsx
939
+ import React, { useState } from 'react';
940
+ import { Tabs } from 'antd';
941
+ import {BusinessSearchSelect} from '../../../index.ts';
942
+
943
+ const { TabPane } = Tabs;
944
+
945
+ export default () => {
946
+ const selectProps = {
947
+ // mode: 'multiple',
948
+ // maxTagCount: 1,
949
+ // disabled: true
950
+ }
951
+ const selectPropsMultiple = {
952
+ mode: 'multiple',
953
+ maxTagCount: 1,
954
+ }
955
+
956
+ const [ tabKey, setTabKey ] = useState('single')
957
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
958
+
959
+ const props = {
960
+ value,
961
+ onChange: (value: any) => {
962
+ console.log(value)
963
+ setValue(value)
964
+ },
965
+ // requestConfig: {
966
+ // url: `/bop/api/getDeliveryModeCodeNameMap`,
967
+ // filter: 'qp-name,code-orGroup,like',
968
+ // mappingTextField: 'name',
969
+ // mappingValueField: 'code',
970
+ // otherParams: {
971
+ // sorter: 'desc-id'
972
+ // }, // 默认参数
973
+ // sourceName: 'deliveryModeCode',
974
+ // },
975
+ prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
976
+ selectProps,
977
+ selectBusinessType: 'deliveryMode',
978
+ };
979
+
980
+ const onTabChange = (key) => {
981
+ setTabKey(key)
982
+ setValue(key === 'single' ? null: [])
983
+ }
984
+
985
+ return (
986
+ <div>
987
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
988
+ <TabPane tab='单选' key='single'>
989
+ {tabKey === 'single' && (
990
+ <BusinessSearchSelect {...props} />
991
+ )}
992
+ </TabPane>
993
+ <TabPane tab='多选' key='multiple'>
994
+ {tabKey === 'multiple' && (
995
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
996
+ )}
997
+ </TabPane>
998
+ </Tabs>
999
+ </div>
1000
+ );
1001
+ };
1002
+ ```
1003
+
1004
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle