@bit-sun/business-component 1.1.26 → 1.1.27
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/Business/SearchSelect/BusinessUtils.d.ts +3 -21
- package/dist/index.esm.js +122 -108
- package/dist/index.js +122 -108
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.ts +31 -10
- package/src/components/Business/SearchSelect/index.md +4 -7
- package/src/components/Business/SearchSelect/index.tsx +13 -5
- package/src/components/Functional/SearchSelect/index.tsx +69 -66
|
@@ -6,7 +6,7 @@ import { getDictionarySource, getDictionaryTextByValue, loadSelectSource } from
|
|
|
6
6
|
const hasDictSharingType = getDictionarySource('UC000013')?.length;
|
|
7
7
|
const sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013') || sharingType
|
|
8
8
|
|
|
9
|
-
export function commonFun (type?: string, prefixUrl: any) {
|
|
9
|
+
export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: any, modalTableBusProps?:any) {
|
|
10
10
|
// 默认type === 'supplier' 供应商选择器
|
|
11
11
|
let requestConfig = {
|
|
12
12
|
url: `${prefixUrl.selectPrefix}/supplier`,
|
|
@@ -14,6 +14,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
14
14
|
otherParams: {
|
|
15
15
|
sorter: 'desc-id'
|
|
16
16
|
}, // 默认参数
|
|
17
|
+
...requestConfigProp
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/*
|
|
@@ -155,7 +156,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
155
156
|
dataIndex: 'sharingType',
|
|
156
157
|
render: (text: number) => hasDictSharingType ? getDictionaryTextByValue('UC000013', text) : sharingType.find((i: any) => i.value === text)?.text
|
|
157
158
|
},
|
|
158
|
-
]
|
|
159
|
+
],
|
|
160
|
+
...modalTableBusProps,
|
|
159
161
|
}
|
|
160
162
|
let needModalTable = true;
|
|
161
163
|
|
|
@@ -171,6 +173,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
171
173
|
sorter: 'desc-id'
|
|
172
174
|
}, // 默认参数
|
|
173
175
|
sourceName: 'skuCode',
|
|
176
|
+
...requestConfigProp,
|
|
174
177
|
}
|
|
175
178
|
tableSearchForm = [
|
|
176
179
|
{ name: 'qp-name-like', label: 'SKU名称' },
|
|
@@ -279,7 +282,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
279
282
|
title: '条形码',
|
|
280
283
|
dataIndex: 'barCode',
|
|
281
284
|
},
|
|
282
|
-
]
|
|
285
|
+
],
|
|
286
|
+
...modalTableBusProps
|
|
283
287
|
}
|
|
284
288
|
}
|
|
285
289
|
|
|
@@ -296,6 +300,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
296
300
|
sorter: 'desc-id'
|
|
297
301
|
}, // 默认参数
|
|
298
302
|
sourceName: 'warehouseIds',
|
|
303
|
+
...requestConfigProp,
|
|
299
304
|
}
|
|
300
305
|
tableSearchForm = [
|
|
301
306
|
{ name: 'qp-physicalWarehouseName-like', label: '物理仓名称' },
|
|
@@ -346,7 +351,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
346
351
|
title: '所属公司',
|
|
347
352
|
dataIndex: 'companyName',
|
|
348
353
|
},
|
|
349
|
-
]
|
|
354
|
+
],
|
|
355
|
+
...modalTableBusProps
|
|
350
356
|
}
|
|
351
357
|
}
|
|
352
358
|
if(type === 'realWarehouse') {
|
|
@@ -361,6 +367,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
361
367
|
sorter: 'desc-id'
|
|
362
368
|
}, // 默认参数
|
|
363
369
|
sourceName: 'warehouseIds',
|
|
370
|
+
...requestConfigProp,
|
|
364
371
|
}
|
|
365
372
|
tableSearchForm = [
|
|
366
373
|
{ name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
|
|
@@ -384,7 +391,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
384
391
|
dataIndex: 'realWarehouseType',
|
|
385
392
|
render: (text: number) => getDictionaryTextByValue('SC00004', text),
|
|
386
393
|
},
|
|
387
|
-
]
|
|
394
|
+
],
|
|
395
|
+
...modalTableBusProps,
|
|
388
396
|
}
|
|
389
397
|
}
|
|
390
398
|
|
|
@@ -401,6 +409,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
401
409
|
sorter: 'desc-id'
|
|
402
410
|
}, // 默认参数
|
|
403
411
|
sourceName: 'warehouseIds',
|
|
412
|
+
...requestConfigProp,
|
|
404
413
|
}
|
|
405
414
|
needModalTable = false
|
|
406
415
|
}
|
|
@@ -416,6 +425,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
416
425
|
sorter: 'desc-id'
|
|
417
426
|
}, // 默认参数
|
|
418
427
|
sourceName: 'warehouseIds',
|
|
428
|
+
...requestConfigProp,
|
|
419
429
|
}
|
|
420
430
|
needModalTable = false
|
|
421
431
|
}
|
|
@@ -431,6 +441,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
431
441
|
sorter: 'desc-id'
|
|
432
442
|
}, // 默认参数
|
|
433
443
|
sourceName: 'customCode',
|
|
444
|
+
...requestConfigProp,
|
|
434
445
|
}
|
|
435
446
|
tableSearchForm = [
|
|
436
447
|
{ name: 'qp-name-like', label: '客户名称' },
|
|
@@ -528,7 +539,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
528
539
|
dataIndex: 'sharingType',
|
|
529
540
|
render: (text: number) => hasDictSharingType ? getDictionaryTextByValue('UC000013', text) : sharingType.find((i: any) => i.value === text)?.text,
|
|
530
541
|
},
|
|
531
|
-
]
|
|
542
|
+
],
|
|
543
|
+
...modalTableBusProps
|
|
532
544
|
}
|
|
533
545
|
}
|
|
534
546
|
|
|
@@ -543,6 +555,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
543
555
|
sorter: 'desc-id'
|
|
544
556
|
}, // 默认参数
|
|
545
557
|
sourceName: 'code',
|
|
558
|
+
...requestConfigProp,
|
|
546
559
|
}
|
|
547
560
|
tableSearchForm = [
|
|
548
561
|
{ name: 'qp-name-like', label: '店铺名称' },
|
|
@@ -664,7 +677,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
664
677
|
title: '归属核算主体',
|
|
665
678
|
dataIndex: 'accountingName',
|
|
666
679
|
},
|
|
667
|
-
]
|
|
680
|
+
],
|
|
681
|
+
...modalTableBusProps
|
|
668
682
|
}
|
|
669
683
|
}
|
|
670
684
|
|
|
@@ -680,6 +694,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
680
694
|
sorter: 'desc-id'
|
|
681
695
|
}, // 默认参数
|
|
682
696
|
sourceName: 'accountingSubjectCode',
|
|
697
|
+
...requestConfigProp,
|
|
683
698
|
}
|
|
684
699
|
needModalTable = false
|
|
685
700
|
}
|
|
@@ -695,6 +710,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
695
710
|
sorter: 'desc-id'
|
|
696
711
|
}, // 默认参数
|
|
697
712
|
sourceName: 'inventoryOrgCode',
|
|
713
|
+
...requestConfigProp,
|
|
698
714
|
}
|
|
699
715
|
needModalTable = false
|
|
700
716
|
}
|
|
@@ -710,6 +726,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
710
726
|
sorter: 'desc-id'
|
|
711
727
|
}, // 默认参数
|
|
712
728
|
sourceName: 'corporationCompany',
|
|
729
|
+
...requestConfigProp,
|
|
713
730
|
}
|
|
714
731
|
needModalTable = false
|
|
715
732
|
}
|
|
@@ -718,7 +735,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
718
735
|
if(type === 'employee') {
|
|
719
736
|
requestConfig = {
|
|
720
737
|
url: `${prefixUrl.selectPrefix}/employee/v2`,
|
|
721
|
-
filter: 'qp-name
|
|
738
|
+
filter: 'qp-employeeNumber,name-orGroup,like', // 过滤参数
|
|
722
739
|
mappingTextField: 'name',
|
|
723
740
|
mappingTextShowKeyField: 'employeeNumber',
|
|
724
741
|
mappingValueField: 'employeeNumber',
|
|
@@ -727,6 +744,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
727
744
|
sorter: 'desc-id'
|
|
728
745
|
}, // 默认参数
|
|
729
746
|
sourceName: 'employeeNumber',
|
|
747
|
+
...requestConfigProp,
|
|
730
748
|
}
|
|
731
749
|
tableSearchForm = [
|
|
732
750
|
{ name: 'qp-name-like', label: '员工名称' },
|
|
@@ -781,7 +799,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
781
799
|
title: '手机号',
|
|
782
800
|
dataIndex: 'officeTelephone',
|
|
783
801
|
},
|
|
784
|
-
]
|
|
802
|
+
],
|
|
803
|
+
...modalTableBusProps
|
|
785
804
|
}
|
|
786
805
|
}
|
|
787
806
|
|
|
@@ -797,6 +816,7 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
797
816
|
sorter: 'desc-id'
|
|
798
817
|
}, // 默认参数
|
|
799
818
|
sourceName: 'deliveryModeCode',
|
|
819
|
+
...requestConfigProp
|
|
800
820
|
}
|
|
801
821
|
tableSearchForm = [
|
|
802
822
|
{ name: 'qp-name-like', label: '配送方式名称' },
|
|
@@ -880,7 +900,8 @@ export function commonFun (type?: string, prefixUrl: any) {
|
|
|
880
900
|
dataIndex: 'remark',
|
|
881
901
|
title: '备注',
|
|
882
902
|
},
|
|
883
|
-
]
|
|
903
|
+
],
|
|
904
|
+
...modalTableBusProps
|
|
884
905
|
}
|
|
885
906
|
}
|
|
886
907
|
|
|
@@ -177,14 +177,11 @@ export default () => {
|
|
|
177
177
|
setValue(value)
|
|
178
178
|
},
|
|
179
179
|
// requestConfig: {
|
|
180
|
-
// url: `/bop/api/physicalWarehouse`,
|
|
181
|
-
// filter: 'qp-physicalWarehouseName,physicalWarehouseCode-orGroup,like',
|
|
182
|
-
// mappingTextField: 'physicalWarehouseName',
|
|
183
180
|
// mappingValueField: 'physicalWarehouseCode',
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
181
|
+
// sourceName: 'physicalWarehouseCode',
|
|
182
|
+
// },
|
|
183
|
+
// modalTableProps: {
|
|
184
|
+
// modalTableTitle: '选择物理仓-更改title测试',
|
|
188
185
|
// },
|
|
189
186
|
prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
|
|
190
187
|
selectProps,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @Description:
|
|
2
|
+
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2022-05-07 15:17:28
|
|
5
5
|
* @LastEditTime: 2022-05-08 21:01:21
|
|
@@ -15,15 +15,15 @@ const BusinessSearchSelect = (props: any) => {
|
|
|
15
15
|
const businessType = props?.selectBusinessType || 'supplier';
|
|
16
16
|
const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
|
|
17
17
|
|
|
18
|
-
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl);
|
|
18
|
+
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
|
|
19
19
|
const currentProps = useMemo(() => {
|
|
20
20
|
return {
|
|
21
|
-
requestConfig,
|
|
22
21
|
...props,
|
|
22
|
+
requestConfig,
|
|
23
23
|
needModalTable,
|
|
24
24
|
modalTableProps
|
|
25
25
|
}
|
|
26
|
-
}, [])
|
|
26
|
+
}, [props?.value])
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<div>
|
|
@@ -32,4 +32,12 @@ const BusinessSearchSelect = (props: any) => {
|
|
|
32
32
|
);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export default React.memo(BusinessSearchSelect, () =>
|
|
35
|
+
export default React.memo(BusinessSearchSelect, (props, nextProps) => {
|
|
36
|
+
if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
if(props && props.value !== nextProps.value) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
return true
|
|
43
|
+
});
|
|
@@ -12,7 +12,7 @@ const { Option } = Select;
|
|
|
12
12
|
|
|
13
13
|
const SearchSelect = (props: any) => {
|
|
14
14
|
const {
|
|
15
|
-
value,
|
|
15
|
+
value, // 必传
|
|
16
16
|
onChange,
|
|
17
17
|
selectProps={},
|
|
18
18
|
modalTableProps={},
|
|
@@ -300,14 +300,18 @@ const SearchSelect = (props: any) => {
|
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
302
|
|
|
303
|
-
const
|
|
304
|
-
if(
|
|
305
|
-
formaData(
|
|
303
|
+
const handleSelectOver = (selectedValue: any) => {
|
|
304
|
+
if(selectedValue?.length) {
|
|
305
|
+
formaData(selectedValue);
|
|
306
306
|
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
307
|
-
const source = _.uniqBy(items.concat(
|
|
307
|
+
const source = _.uniqBy(items.concat(selectedValue), 'value')
|
|
308
308
|
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
309
309
|
setItems(source)
|
|
310
310
|
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const handleOk = () => {
|
|
314
|
+
handleSelectOver(popvalue)
|
|
311
315
|
handleCancel();
|
|
312
316
|
};
|
|
313
317
|
|
|
@@ -431,6 +435,8 @@ const SearchSelect = (props: any) => {
|
|
|
431
435
|
// 处理单选
|
|
432
436
|
filterRows = selectRows;
|
|
433
437
|
sksResult = selectRows.map((i) => i.value)
|
|
438
|
+
// 单选直接选中 不需要确定
|
|
439
|
+
handleSelectOver(filterRows)
|
|
434
440
|
}
|
|
435
441
|
|
|
436
442
|
setSelectedRowKeys(sksResult)
|
|
@@ -499,77 +505,74 @@ const SearchSelect = (props: any) => {
|
|
|
499
505
|
}
|
|
500
506
|
}
|
|
501
507
|
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return listSelected?.length && listSelected.map((i: any) => (
|
|
508
|
+
const maxTagPlaceholder = (selectedValues) => {
|
|
509
|
+
const onClose = (e: any,item: any) => {
|
|
510
|
+
e.preventDefault();
|
|
511
|
+
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)
|
|
512
|
+
onChange(newValue);
|
|
513
|
+
}
|
|
514
|
+
return (
|
|
515
|
+
<Tooltip title={selectedValues.map((i: any) => (
|
|
511
516
|
<Tag
|
|
512
517
|
closable={true}
|
|
513
518
|
onClose={(e) => onClose(e,i)}
|
|
514
519
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
515
520
|
>
|
|
516
|
-
{i.
|
|
521
|
+
{i.label}
|
|
517
522
|
</Tag>
|
|
518
|
-
))
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
return ''
|
|
523
|
+
))}>
|
|
524
|
+
{`+ ${selectedValues?.length}`}
|
|
525
|
+
</Tooltip>
|
|
526
|
+
)
|
|
523
527
|
}
|
|
524
528
|
|
|
525
529
|
return (
|
|
526
530
|
<div className={'search_select'}>
|
|
527
531
|
<div className="search_select_show" id={`search_select_div_${uniqueValue}`}>
|
|
528
|
-
<
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
<div style={{
|
|
554
|
-
<
|
|
555
|
-
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
556
|
-
</div>
|
|
557
|
-
<div>无匹配结果,请更换其他内容再试</div>
|
|
532
|
+
<Select
|
|
533
|
+
virtual
|
|
534
|
+
labelInValue={labelInValue}
|
|
535
|
+
value={value}
|
|
536
|
+
onChange={onChange}
|
|
537
|
+
dropdownRender={menu => (
|
|
538
|
+
<>
|
|
539
|
+
<Input
|
|
540
|
+
value={searchValue}
|
|
541
|
+
style={{ width: '98%', marginLeft: '1%' }}
|
|
542
|
+
placeholder="请输入"
|
|
543
|
+
onChange={e=> onSearchChange(e)}
|
|
544
|
+
onBlur={onSearchBlur}
|
|
545
|
+
onKeyDown={(e) => {
|
|
546
|
+
// 阻止多选的冒泡
|
|
547
|
+
e.stopPropagation()
|
|
548
|
+
}}
|
|
549
|
+
/>
|
|
550
|
+
<Divider style={{ margin: '8px 0' }} />
|
|
551
|
+
{menu}
|
|
552
|
+
</>
|
|
553
|
+
)}
|
|
554
|
+
notFoundContent={
|
|
555
|
+
fetching ? <Spin size="small" /> :
|
|
556
|
+
<div style={{ textAlign: 'center'}}>
|
|
557
|
+
<div style={{ marginBottom: 16 }}>
|
|
558
|
+
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
558
559
|
</div>
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
560
|
+
<div>无匹配结果,请更换其他内容再试</div>
|
|
561
|
+
</div>
|
|
562
|
+
}
|
|
563
|
+
onPopupScroll={SelectScroll}
|
|
564
|
+
style={{ width: needModalTable?'calc(100% - 30px)':'calc(100%)' }}
|
|
565
|
+
placeholder="请选择"
|
|
566
|
+
maxTagPlaceholder={maxTagPlaceholder}
|
|
567
|
+
{...currentSelectProps}
|
|
568
|
+
getPopupContainer={() => document.getElementById(`search_select_div_${uniqueValue}`)}
|
|
569
|
+
>
|
|
570
|
+
{items.map(item => (
|
|
571
|
+
<Option key={item.value} label={item.text}>
|
|
572
|
+
{LightHeightOption({ text: `${item.textShowKey} ${item.text}`, filterTxt: searchValue })}
|
|
573
|
+
</Option>
|
|
574
|
+
))}
|
|
575
|
+
</Select>
|
|
573
576
|
{needModalTable && (
|
|
574
577
|
<Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">
|
|
575
578
|
<SearchOutlined />
|
|
@@ -583,7 +586,7 @@ const SearchSelect = (props: any) => {
|
|
|
583
586
|
visible={isModalVisible}
|
|
584
587
|
onOk={handleOk}
|
|
585
588
|
onCancel={handleCancel}
|
|
586
|
-
footer={[
|
|
589
|
+
footer={selectMode?[
|
|
587
590
|
<Button key="back" onClick={handleCancel}>
|
|
588
591
|
取消
|
|
589
592
|
</Button>,
|
|
@@ -595,7 +598,7 @@ const SearchSelect = (props: any) => {
|
|
|
595
598
|
>
|
|
596
599
|
确定
|
|
597
600
|
</Button>,
|
|
598
|
-
]}
|
|
601
|
+
]:null}
|
|
599
602
|
>
|
|
600
603
|
<div className={'search_select_wrapper'}>
|
|
601
604
|
<div className={'search_select_wrapper_click_flag'} onClick={() => setCaretLeftFlag(!caretLeftFlag)}>
|