@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.
Files changed (30) hide show
  1. package/.umirc.ts +31 -16
  2. package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +1 -1
  3. package/dist/components/Business/SearchSelect/common.d.ts +5 -1
  4. package/dist/components/Business/SearchSelect/utils.d.ts +2 -1
  5. package/dist/components/Business/TreeSearchSelect/index.d.ts +3 -0
  6. package/dist/components/Business/TreeSearchSelect/utils.d.ts +2 -0
  7. package/dist/components/Functional/AddSelect/index.d.ts +3 -0
  8. package/dist/components/Functional/TreeSearchSelect/index.d.ts +2 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.esm.js +1876 -89
  11. package/dist/index.js +1877 -87
  12. package/dist/utils/CheckOneUser/index.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/src/components/Business/CommodityEntry/index.md +2 -2
  15. package/src/components/Business/CommodityEntry/index.tsx +1 -1
  16. package/src/components/Business/SearchSelect/BusinessUtils.ts +85 -6
  17. package/src/components/Business/SearchSelect/common.ts +20 -1
  18. package/src/components/Business/SearchSelect/index.md +60 -30
  19. package/src/components/Business/SearchSelect/index.tsx +2 -1
  20. package/src/components/Business/SearchSelect/utils.ts +27 -2
  21. package/src/components/Business/TreeSearchSelect/index.md +126 -0
  22. package/src/components/Business/TreeSearchSelect/index.tsx +34 -0
  23. package/src/components/Business/TreeSearchSelect/utils.ts +60 -0
  24. package/src/components/Functional/AddSelect/index.less +275 -0
  25. package/src/components/Functional/AddSelect/index.md +118 -0
  26. package/src/components/Functional/AddSelect/index.tsx +795 -0
  27. package/src/components/Functional/SearchSelect/index.tsx +24 -7
  28. package/src/components/Functional/TreeSearchSelect/index.md +47 -0
  29. package/src/components/Functional/TreeSearchSelect/index.tsx +148 -0
  30. package/src/index.ts +8 -0
@@ -1,2 +1,2 @@
1
- declare const _default: (storageKeyString: string, seconds?: number, tipsCallFunction?: (() => {}) | undefined) => void;
1
+ declare const _default: (storageKeyString: string, seconds?: number, tipsCallFunction?: () => {}) => void;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.2.3",
3
+ "version": "2.0.2",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -21,11 +21,11 @@ export default () => {
21
21
  const [choosedSku, setChoosedSku] = useState([]);
22
22
 
23
23
  const callbackHideModal = () => {
24
- alert('关闭弹窗处理函数回调,可以处理刷新表格等操作(非必传)')
24
+ console.log('关闭弹窗处理函数回调,可以处理刷新表格等操作(非必传)')
25
25
  }
26
26
 
27
27
  const callbackHandleOk = (resultData, callback) => {
28
- alert('确定操作,可获取到成功录入的商品,做一系列操作')
28
+ console.log('确定操作,可获取到成功录入的商品,做一系列操作')
29
29
  console.log(resultData)
30
30
  // 一般拿到导入数据是做请求接口操作
31
31
  // import {request} from "bssula";
@@ -12,7 +12,7 @@ const CommodityEntry = (props: any) => {
12
12
  callbackHideModal,
13
13
  callbackHandleOk,
14
14
  columns=["skuCode", "quantity", "price"],
15
- validDataUrl="/bop/api/recordDetailImport/check"
15
+ validDataUrl="/items/api/recordDetailImport/check"
16
16
  } = props;
17
17
 
18
18
  const [modalProps, setModalProps]: any = useState({
@@ -1,6 +1,6 @@
1
1
  // 此文件用于 处理业务组件 所用到的公共方法
2
2
  // @ts-nocheck
3
- import { shopFileType, arrivalPaySupportList, sharingType } from './common';
3
+ import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type } from './common';
4
4
  import { getDictionarySource, getDictionaryTextByValue, loadSelectSource } from './utils';
5
5
 
6
6
  const hasDictSharingType = getDictionarySource('UC000013')?.length;
@@ -27,7 +27,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
27
27
  * */
28
28
  const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
29
29
  const data = reData && reData[position]?.data;
30
- const list = Array.isArray(data) ? data :(data?.items || data?.list || []);
30
+ const list = Array.isArray(data) ? data :(data?.items || data?.list || data?.children || []);
31
31
  const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
32
32
  changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
33
33
  }
@@ -63,7 +63,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
63
63
  tableColumns: [],
64
64
  ...modalTableBusProps,
65
65
  }
66
- let needModalTable = true;
66
+ let needModalTable = modalTableBusProps?.needModalTable !== undefined ? modalTableBusProps?.needModalTable : true;
67
67
 
68
68
  // 供应商选择器
69
69
  if(type === 'supplier') {
@@ -243,7 +243,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
243
243
  mappingTextShowTextField: ['name', 'propertyNameAndValue'],
244
244
  otherParams: {
245
245
  'qp-approveStatus-eq': 1,
246
- 'qp-type-eq': 10, // 查唯一国际条码
246
+ // 'qp-type-eq': 10, // 查唯一国际条码【有些项目不需要必须要有国际条码,故注释,需要的项目自己定义otherParams补充上这个条件】
247
247
  sorter: 'desc-id'
248
248
  }, // 默认参数
249
249
  sourceName: 'skuCode',
@@ -251,7 +251,12 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
251
251
  }
252
252
  tableSearchForm = requestConfig.url.includes('v2') ? [
253
253
  requestConfig.url.includes('v2') ? { name: 'qp-skuName-like', label: 'SKU名称' } : { name: 'qp-name-like', label: 'SKU名称' },
254
- { name: 'qp-skuCode-like', label: 'SKU编码' },
254
+ { name: 'qp-skuCode-in', label: 'SKU编码', field: {
255
+ type: 'multipleQueryInput',
256
+ props: {
257
+ ...(requestConfigProp?.skuCodeValueRequestConfig || {}),
258
+ },
259
+ }},
255
260
  requestConfig.url.includes('v2') ? { name: 'qp-code-like', label: '国际条码' } : { name: 'qp-barCode-like', label: '国际条码'},
256
261
  { name: 'qp-itemName-like', label: '所属SPU名称' },
257
262
  { name: 'qp-itemCode-like', label: '所属SPU编码' },
@@ -316,7 +321,12 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
316
321
  } },
317
322
  ] : [
318
323
  { name: 'qp-name-like', label: 'SKU名称' },
319
- { name: 'qp-skuCode-like', label: 'SKU编码' },
324
+ { name: 'qp-skuCode-in', label: 'SKU编码', field: {
325
+ type: 'multipleQueryInput',
326
+ props: {
327
+ ...(requestConfigProp?.skuCodeValueRequestConfig || {}),
328
+ },
329
+ }},
320
330
  { name: 'qp-barCode-like', label: '国际条码'},
321
331
  { name: 'qp-itemName-like', label: '所属SPU名称' },
322
332
  { name: 'qp-itemCode-like', label: '所属SPU编码' },
@@ -371,6 +381,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
371
381
  loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
372
382
  pageSize: 5000,
373
383
  currentPage: 1,
384
+ 'ctl-withAuth': true
374
385
  }),
375
386
  loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
376
387
  pageSize: 5000,
@@ -539,6 +550,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
539
550
  loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
540
551
  pageSize: 5000,
541
552
  currentPage: 1,
553
+ 'ctl-withAuth': true
542
554
  }),
543
555
  loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
544
556
  pageSize: 5000,
@@ -750,6 +762,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
750
762
  mappingTextField: 'name',
751
763
  mappingValueField: 'code',
752
764
  otherParams: {
765
+ 'qp-status-eq': 10,
753
766
  sorter: 'desc-id'
754
767
  }, // 默认参数
755
768
  sourceName: 'customCode',
@@ -1069,6 +1082,71 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1069
1082
  ...modalTableBusProps
1070
1083
  }
1071
1084
  }
1085
+ if(type === 'shopFile2') {
1086
+ requestConfig = {
1087
+ url: `${prefixUrl.selectPrefix}/store/page`,
1088
+ filter: 'qp-name,code-orGroup,like', // 过滤参数
1089
+ mappingTextField: 'name',
1090
+ mappingValueField: 'code',
1091
+ otherParams: {
1092
+ sorter: 'desc-id'
1093
+ }, // 默认参数
1094
+ sourceName: 'code',
1095
+ ...requestConfigProp,
1096
+ }
1097
+ tableSearchForm = [
1098
+ { name: 'qp-name-like', label: '商店名称' },
1099
+ { name: 'qp-code-like', label: '商店编码' },
1100
+ { name: 'qp-type-in', type: 'select', label: '商店类型', initialSource: shopFile2Type },
1101
+ { name: 'qp-orgCode-in', type: 'select', label: '所属销售组织', field: {
1102
+ type: 'select',
1103
+ props: {
1104
+ mode: 'multiple',
1105
+ notFoundContent: '暂无数据',
1106
+ allowClear: true,
1107
+ showSearch: true,
1108
+ showArrow: true,
1109
+ maxTagCount: 1,
1110
+ optionFilterProp: 'children',
1111
+ filterOption: (input: string, option: { props: { children: string } }) =>
1112
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
1113
+ },
1114
+ } },
1115
+ ]
1116
+ Promise.all([
1117
+ loadSelectSource(`${prefixUrl.formSelectFix}/orgView/getTree/sales-organizational-view`, {
1118
+ 'qp-employeeCode-eq': JSON.parse(localStorage.getItem('userInfo') || '{}')?.employeeResVo?.employeeNumber,
1119
+ 'qp-realOrg-eq': true,
1120
+ 'qp-status-eq': 10
1121
+ }),
1122
+ ]).then((x: any)=>{
1123
+ formatSource(x,0, 3, tableSearchForm);
1124
+ })
1125
+ modalTableProps = {
1126
+ modalTableTitle: '选择商店',
1127
+ tableSearchForm,
1128
+ tableColumns: [
1129
+ {
1130
+ title: '商店编码',
1131
+ dataIndex: 'code',
1132
+ },
1133
+ {
1134
+ title: '商店名称',
1135
+ dataIndex: 'name',
1136
+ },
1137
+ {
1138
+ title: '商店类型',
1139
+ dataIndex: 'type',
1140
+ render: (text: number) => shopFile2Type.find((i: any) => i.value === text)?.text,
1141
+ },
1142
+ {
1143
+ title: '所属销售组织',
1144
+ dataIndex: 'orgName',
1145
+ },
1146
+ ],
1147
+ ...modalTableBusProps
1148
+ }
1149
+ }
1072
1150
 
1073
1151
  // 核算主体选择器(无弹窗)
1074
1152
  if(type === 'accountingSubject') {
@@ -1102,6 +1180,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1102
1180
  }
1103
1181
  needModalTable = false
1104
1182
  }
1183
+
1105
1184
  // 法人公司选择器(无弹窗)
1106
1185
  if(type === 'corporationCompany') {
1107
1186
  requestConfig = {
@@ -9,6 +9,25 @@ const shopFileType = [
9
9
  }
10
10
  ]
11
11
 
12
+ const shopFile2Type = [
13
+ {
14
+ text: "第三方线上",
15
+ value: 'online',
16
+ },
17
+ {
18
+ text: "线下",
19
+ value: 'offline',
20
+ },
21
+ {
22
+ text: "自营B2B",
23
+ value: 'B2B',
24
+ },
25
+ {
26
+ text: "自营B2C",
27
+ value: 'B2C',
28
+ }
29
+ ]
30
+
12
31
  const arrivalPaySupportList = [
13
32
  {
14
33
  text: "支持",
@@ -31,4 +50,4 @@ const sharingType = [
31
50
  }
32
51
  ]
33
52
 
34
- export { shopFileType, arrivalPaySupportList, sharingType }
53
+ export { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type }
@@ -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 }
@@ -0,0 +1,126 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 业务组件
7
+ order: 1
8
+ title: 树型业务选择器
9
+ order: 2
10
+ ---
11
+
12
+ ## BusinessTreeSearchSelect
13
+
14
+ Demo
15
+
16
+ 部门选择器:
17
+
18
+ ```tsx
19
+ import React, { useState } from 'react';
20
+ import { BusinessTreeSearchSelect } from '../../../index';
21
+
22
+ export default () => {
23
+
24
+ const [value, setValue] = useState();
25
+
26
+ const props = {
27
+ mode: 'create',
28
+ value,
29
+ onChange: (v) => {
30
+ setValue(v)
31
+ },
32
+ businessType: 'department'
33
+ };
34
+
35
+ return (
36
+ <div>
37
+ <BusinessTreeSearchSelect {...props} />
38
+ </div>
39
+ );
40
+ };
41
+ ```
42
+
43
+
44
+ 销售组织选择器:
45
+
46
+ ```tsx
47
+ import React, { useState } from 'react';
48
+ import { BusinessTreeSearchSelect } from '../../../index';
49
+
50
+ export default () => {
51
+
52
+ const [value, setValue] = useState();
53
+
54
+ const props = {
55
+ mode: 'create',
56
+ value,
57
+ onChange: (v) => {
58
+ setValue(v)
59
+ },
60
+ businessType: 'sales-organization'
61
+ };
62
+
63
+ return (
64
+ <div>
65
+ <BusinessTreeSearchSelect {...props} />
66
+ </div>
67
+ );
68
+ };
69
+ ```
70
+
71
+ 采购组织选择器:
72
+
73
+ ```tsx
74
+ import React, { useState } from 'react';
75
+ import { BusinessTreeSearchSelect } from '../../../index';
76
+
77
+ export default () => {
78
+
79
+ const [value, setValue] = useState();
80
+
81
+ const props = {
82
+ mode: 'create',
83
+ value,
84
+ onChange: (v) => {
85
+ setValue(v)
86
+ },
87
+ businessType: 'purchase-organization'
88
+ };
89
+
90
+ return (
91
+ <div>
92
+ <BusinessTreeSearchSelect {...props} />
93
+ </div>
94
+ );
95
+ };
96
+ ```
97
+
98
+ 库存组织选择器:
99
+
100
+ ```tsx
101
+ import React, { useState } from 'react';
102
+ import { BusinessTreeSearchSelect } from '../../../index';
103
+
104
+ export default () => {
105
+
106
+ const [value, setValue] = useState();
107
+
108
+ const props = {
109
+ mode: 'create',
110
+ value,
111
+ isChoose: false, // 控制是否父节点可选中,默认不可选中
112
+ onChange: (v) => {
113
+ setValue(v)
114
+ },
115
+ businessType: 'stock-organization'
116
+ };
117
+
118
+ return (
119
+ <div>
120
+ <BusinessTreeSearchSelect {...props} />
121
+ </div>
122
+ );
123
+ };
124
+ ```
125
+
126
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle