@bit-sun/business-component 1.2.3 → 2.0.0

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.
@@ -47,17 +47,19 @@ export default () => {
47
47
  // mappingTextField: 'name',
48
48
  // mappingValueField: 'code',
49
49
  // }, // 非必传,业务字段已根据业务默认默认
50
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
50
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
51
51
  selectProps, // 非必传
52
52
  onChange: (value: any) => {
53
53
  console.log(value)
54
54
  setValue(value)
55
55
  },
56
56
  selectBusinessType: 'supplier',
57
+ disabled: true,
57
58
  };
58
59
 
59
60
  const props2 = {
60
- prefixUrl: { selectPrefix: '/channel/api', formSelectFix: '/channel/api' },
61
+ ...props,
62
+ // prefixUrl: { selectPrefix: '/channel-manage/', formSelectFix: '/channel-manage/' },
61
63
  selectBusinessType: 'supplier2',
62
64
  }
63
65
 
@@ -133,7 +135,7 @@ export default () => {
133
135
  // }, // 默认参数
134
136
  // sourceName: 'skuCode',
135
137
  // },
136
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
138
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
137
139
  selectProps,
138
140
  selectBusinessType: 'skuCommodity',
139
141
  };
@@ -290,7 +292,7 @@ export default () => {
290
292
  console.log(value)
291
293
  setValue(value)
292
294
  },
293
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
295
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
294
296
  selectProps,
295
297
  selectBusinessType: 'spuCommodity',
296
298
  };
@@ -323,7 +325,7 @@ export default () => {
323
325
  ## 仓库选择器(物理仓) Select-Warehouse-001
324
326
 
325
327
  ```tsx
326
- import React, { useState } from 'react';
328
+ import React, { useState, useEffect } from 'react';
327
329
  import { Tabs } from 'antd';
328
330
  import {BusinessSearchSelect} from '../../../index.ts';
329
331
 
@@ -343,21 +345,30 @@ export default () => {
343
345
  const [ tabKey, setTabKey ] = useState('single')
344
346
  const [value, setValue] = useState(selectProps?.mode ? [] : null);
345
347
 
348
+ useEffect(() => {
349
+ if(tabKey === 'multiple') {
350
+ setValue(['1540295745870573570', '1540173160826613762'])
351
+ }
352
+ },[tabKey])
353
+
346
354
  const props = {
347
355
  value,
348
356
  onChange: (value: any) => {
349
357
  console.log(value)
350
358
  setValue(value)
351
359
  },
352
- // requestConfig: {
353
- // mappingValueField: 'physicalWarehouseCode',
354
- // sourceName: 'physicalWarehouseCode',
355
- // },
360
+ requestConfig: {
361
+ // mappingValueField: 'physicalWarehouseCode',
362
+ // sourceName: 'physicalWarehouseCode',
363
+ filterInit: 'qp-id-in'
364
+ },
356
365
  // modalTableProps: {
357
366
  // modalTableTitle: '选择物理仓-更改title测试',
367
+ // needModalTable: false
358
368
  // },
359
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
369
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
360
370
  selectProps,
371
+ // labelInValue: true,
361
372
  selectBusinessType: 'physicalWarehouse',
362
373
  };
363
374
 
@@ -424,7 +435,7 @@ export default () => {
424
435
  // }, // 默认参数
425
436
  // sourceName: 'warehouseIds',
426
437
  // },
427
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
438
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
428
439
  selectProps,
429
440
  selectBusinessType: 'realWarehouse',
430
441
  };
@@ -492,7 +503,7 @@ export default () => {
492
503
  // }, // 默认参数
493
504
  // sourceName: 'warehouseIds',
494
505
  // },
495
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
506
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
496
507
  selectProps,
497
508
  selectBusinessType: 'virtualWarehouse',
498
509
  };
@@ -560,7 +571,7 @@ export default () => {
560
571
  // }, // 默认参数
561
572
  // sourceName: 'warehouseIds',
562
573
  // },
563
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
574
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
564
575
  selectProps,
565
576
  selectBusinessType: 'channelWarehouse',
566
577
  };
@@ -629,13 +640,14 @@ export default () => {
629
640
  // }, // 默认参数
630
641
  // sourceName: 'customerCode',
631
642
  // },
632
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
643
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
633
644
  selectProps,
634
645
  selectBusinessType: 'customer',
635
646
  };
636
647
 
637
648
  const props2 = {
638
- prefixUrl: { selectPrefix: '/channel/api', formSelectFix: '/channel/api' },
649
+ ...props,
650
+ // prefixUrl: { selectPrefix: '/channel-manage/', formSelectFix: '/channel-manage/' },
639
651
  selectBusinessType: 'customer2',
640
652
  }
641
653
 
@@ -713,11 +725,17 @@ export default () => {
713
725
  // }, // 默认参数
714
726
  // sourceName: 'code',
715
727
  // },
716
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
728
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
717
729
  selectProps,
718
730
  selectBusinessType: 'shopFile',
719
731
  };
720
732
 
733
+ const props2 = {
734
+ ...props,
735
+ // prefixUrl: { selectPrefix: '/channel-manage/', formSelectFix: '/channel-manage/' },
736
+ selectBusinessType: 'shopFile2',
737
+ }
738
+
721
739
  const onTabChange = (key) => {
722
740
  setTabKey(key)
723
741
  setValue(key === 'single' ? null: [])
@@ -728,12 +746,22 @@ export default () => {
728
746
  <Tabs onChange={onTabChange} activeKey={tabKey}>
729
747
  <TabPane tab='单选' key='single'>
730
748
  {tabKey === 'single' && (
731
- <BusinessSearchSelect {...props} />
749
+ <>
750
+ <span>版本1:支持英伦项目...</span>
751
+ <BusinessSearchSelect {...props} />
752
+ <span>版本2:支持麦克英孚项目...</span>
753
+ <BusinessSearchSelect {...props2} />
754
+ </>
732
755
  )}
733
756
  </TabPane>
734
757
  <TabPane tab='多选' key='multiple'>
735
758
  {tabKey === 'multiple' && (
736
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
759
+ <>
760
+ <span>版本1:支持英伦项目...</span>
761
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
762
+ <span>版本2:支持麦克英孚项目...</span>
763
+ <BusinessSearchSelect {...props2} selectProps={selectPropsMultiple} />
764
+ </>
737
765
  )}
738
766
  </TabPane>
739
767
  </Tabs>
@@ -782,7 +810,7 @@ export default () => {
782
810
  // }, // 默认参数
783
811
  // sourceName: 'accountingCode',
784
812
  // },
785
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
813
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
786
814
  selectProps,
787
815
  selectBusinessType: 'accountingSubject',
788
816
  };
@@ -851,28 +879,30 @@ export default () => {
851
879
  // }, // 默认参数
852
880
  // sourceName: 'inventoryOrgCode',
853
881
  // },
854
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
882
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
855
883
  selectProps,
856
884
  selectBusinessType: 'inventoryOrg',
857
885
  };
858
886
 
887
+ const props2 = {
888
+ ...props,
889
+ selectBusinessType: 'inventoryOrg2',
890
+ }
891
+
859
892
  const onTabChange = (key) => {
860
893
  setTabKey(key)
861
894
  setValue(key === 'single' ? null: [])
862
895
  }
863
896
 
864
897
  return (
898
+
865
899
  <div>
866
900
  <Tabs onChange={onTabChange} activeKey={tabKey}>
867
901
  <TabPane tab='单选' key='single'>
868
- {tabKey === 'single' && (
869
- <BusinessSearchSelect {...props} />
870
- )}
902
+ {tabKey === 'single' && <BusinessSearchSelect {...props} />}
871
903
  </TabPane>
872
904
  <TabPane tab='多选' key='multiple'>
873
- {tabKey === 'multiple' && (
874
- <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
875
- )}
905
+ {tabKey === 'multiple' && <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />}
876
906
  </TabPane>
877
907
  </Tabs>
878
908
  </div>
@@ -921,7 +951,7 @@ export default () => {
921
951
  // }, // 默认参数
922
952
  // sourceName: 'companyCode',
923
953
  // },
924
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
954
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
925
955
  selectProps,
926
956
  selectBusinessType: 'corporationCompany',
927
957
  };
@@ -990,14 +1020,14 @@ export default () => {
990
1020
  // }, // 默认参数
991
1021
  // sourceName: 'code',
992
1022
  // },
993
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
1023
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
994
1024
  selectProps,
995
1025
  selectBusinessType: 'employee',
996
1026
  };
997
1027
 
998
1028
  const props2 = {
999
1029
  ...props,
1000
- prefixUrl: { selectPrefix: '/user/api', formSelectFix: '/user/api' },
1030
+ // prefixUrl: { selectPrefix: '/user/api', formSelectFix: '/user/api' },
1001
1031
  selectBusinessType: 'employee2',
1002
1032
  }
1003
1033
 
@@ -1075,7 +1105,7 @@ export default () => {
1075
1105
  // }, // 默认参数
1076
1106
  // sourceName: 'deliveryModeCode',
1077
1107
  // },
1078
- prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
1108
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
1079
1109
  selectProps,
1080
1110
  selectBusinessType: 'deliveryMode',
1081
1111
  };
@@ -7,13 +7,14 @@
7
7
  */
8
8
  import React, { useMemo } from 'react';
9
9
  import { commonFun } from './BusinessUtils';
10
+ import { handleDefaultPrefixUrl } from './utils';
10
11
  import SearchSelect from '@/components/Functional/SearchSelect';
11
12
 
12
13
  const MemoSearchSelect = React.memo(SearchSelect)
13
14
 
14
15
  const BusinessSearchSelect = (props: any) => {
15
16
  const businessType = props?.selectBusinessType || 'supplier';
16
- const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
17
+ const prefixUrl = props?.prefixUrl || { selectPrefix: handleDefaultPrefixUrl(businessType), formSelectFix: handleDefaultPrefixUrl(businessType) };
17
18
 
18
19
  const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
19
20
  const currentProps = useMemo(() => {
@@ -59,7 +59,7 @@ const loadSelectSource = (url: string, params?: any) => {
59
59
  .get(`${url}?${stringify(params)}`)
60
60
  .then((result: any) => {
61
61
  result = result.data;
62
- if ((result.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
62
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
63
63
  message.error(result.msg);
64
64
  return;
65
65
  }
@@ -71,4 +71,29 @@ const loadSelectSource = (url: string, params?: any) => {
71
71
  })
72
72
  };
73
73
 
74
- export { getDictionarySource, getDictionaryTextByValue, loadSelectSource }
74
+ const handleDefaultPrefixUrl = (type: string) => {
75
+ let result;
76
+ switch (type){
77
+ case 'supplier2': case 'customer2': case 'shopFile2':
78
+ result = '/channel-manage';
79
+ break;
80
+ case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity':
81
+ result = '/items';
82
+ break;
83
+ case 'physicalWarehouse': case 'realWarehouse': case 'virtualWarehouse': case 'channelWarehouse':
84
+ result = '/stock';
85
+ break;
86
+ case 'inventoryOrg2': case 'purchaseOrg': case 'salesOrg': case 'employee2':
87
+ result = '/user';
88
+ break;
89
+ case 'deliveryMode':
90
+ result = '/basic';
91
+ break;
92
+ default:
93
+ result = '/bop/api';
94
+ break
95
+ }
96
+ return result;
97
+ };
98
+
99
+ export { getDictionarySource, getDictionaryTextByValue, loadSelectSource, handleDefaultPrefixUrl }
@@ -7,7 +7,7 @@ import axios from 'axios';
7
7
  import { stringify } from 'querystring';
8
8
  import _ from "loadsh"
9
9
  import './index.less';
10
- import { BusinessSearchSelect } from '@/index';
10
+ import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
11
 
12
12
  const { Option } = Select;
13
13
 
@@ -33,6 +33,7 @@ const SearchSelect = (props: any) => {
33
33
  const tableInitPageSize = 10 // 弹框默认分页 条数
34
34
  const currentPage = 1
35
35
  const selectParamsKey = requestConfig?.filter || 'qp-codeAndName-like'
36
+ const selectParamsInitKey = requestConfig?.filterInit || selectParamsKey
36
37
  const currentSelectProps = {
37
38
  ...selectProps,
38
39
  // 以下属性不可更改----设计配置项
@@ -57,7 +58,7 @@ const SearchSelect = (props: any) => {
57
58
  // 优化搜索参数 支持传多个
58
59
  let searchParams = {};
59
60
  if(typeof selectParamsKey === 'string') {
60
- searchParams = { [selectParamsKey]: v ? initVal : searchValue }
61
+ searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
61
62
  }
62
63
  if(Array.isArray(selectParamsKey)) {
63
64
  selectParamsKey.forEach((i: any) => {
@@ -205,7 +206,7 @@ const SearchSelect = (props: any) => {
205
206
  .then((result: any) => {
206
207
  setFetching(false)
207
208
  result = result.data;
208
- if (result.status !== '0') {
209
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
209
210
  message.error(result.msg);
210
211
  return;
211
212
  }
@@ -310,7 +311,6 @@ const SearchSelect = (props: any) => {
310
311
  useEffect(() => {
311
312
  if(value) {
312
313
  setPopValue(value);
313
- onChange(value);
314
314
  }
315
315
  }, [value]);
316
316
 
@@ -356,7 +356,7 @@ const SearchSelect = (props: any) => {
356
356
 
357
357
  const formaData = (value) => {
358
358
  if(labelInValue) {
359
- const formatResult = value.map((i: any) => ({ key: i.code, label: i.name, value: i.code }))
359
+ const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
360
360
  onChange(selectMode ? formatResult : formatResult[0])
361
361
  } else {
362
362
  const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
@@ -511,6 +511,9 @@ const SearchSelect = (props: any) => {
511
511
  onChange: (sks, srs) => {
512
512
  onChangeSelectedKeys(sks, srs)
513
513
  },
514
+ getCheckboxProps: () => ({
515
+ disabled: selectProps?.disabled || props?.disabled,
516
+ }),
514
517
  };
515
518
 
516
519
  const onDoubleClickSelect = (e, record) => {
@@ -546,7 +549,7 @@ const SearchSelect = (props: any) => {
546
549
  )
547
550
  }
548
551
 
549
- if(i?.type === 'businessSearchSelect') {
552
+ if(i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
550
553
  return (
551
554
  <div>
552
555
  <Form.Item name={i.name} label={i.label} key={i.name}>
@@ -556,6 +559,20 @@ const SearchSelect = (props: any) => {
556
559
  )
557
560
  }
558
561
 
562
+ if (i?.type === 'multipleQueryInput' || i?.field?.type === 'multipleQueryInput') {
563
+ return (
564
+ <div>
565
+ <Form.Item name={i.name} label={i.label} key={i.name}>
566
+ <QueryMutipleInput onValueChange={(value) => {
567
+ form.setFieldsValue({
568
+ [i.name]: value
569
+ })
570
+ }} />
571
+ </Form.Item>
572
+ </div>
573
+ );
574
+ }
575
+
559
576
  // 默认type是input
560
577
  return (
561
578
  <Form.Item name={i.name} label={i.label} key={i.name}>
@@ -702,7 +719,7 @@ const SearchSelect = (props: any) => {
702
719
  };
703
720
  }}
704
721
  />
705
- {selectMode ? <div className={'select_list_selectAll'}><Checkbox indeterminate={indeterminate} checked={checkedAll} onChange={onChangeCheckAll} /> 全选所有页面</div> : ''}
722
+ {selectMode ? <div className={'select_list_selectAll'}><Checkbox indeterminate={indeterminate} checked={checkedAll} onChange={onChangeCheckAll} disabled={selectProps?.disabled || props?.disabled} /> 全选所有页面</div> : ''}
706
723
  </div>
707
724
  </div>
708
725
  </div>
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import axios from 'axios';
12
12
  const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
13
13
 
14
14
  axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
15
+ axios.defaults.headers.common['x-tenant-id'] = resposne?.tenantId || '1';
15
16
 
16
17
  export { default as DataValidation } from './components/Functional/DataValidation';
17
18
  export { default as DataImport } from './components/Functional/DataImport';