@bit-sun/business-component 2.0.12 → 2.0.13

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 (68) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +4 -4
  3. package/.gitlab-ci.yml +174 -135
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +74 -90
  7. package/README.md +27 -27
  8. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  9. package/dist/components/Functional/SearchSelect/index.d.ts +1 -2
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.esm.js +6794 -7350
  12. package/dist/index.js +6793 -7348
  13. package/docs/index.md +21 -21
  14. package/package.json +51 -60
  15. package/src/components/Business/AddSelectBusiness/index.md +41 -41
  16. package/src/components/Business/AddSelectBusiness/index.tsx +288 -300
  17. package/src/components/Business/CommodityEntry/index.md +69 -69
  18. package/src/components/Business/CommodityEntry/index.tsx +78 -78
  19. package/src/components/Business/SearchSelect/BusinessUtils.ts +1445 -1445
  20. package/src/components/Business/SearchSelect/common.ts +53 -53
  21. package/src/components/Business/SearchSelect/index.md +1137 -1136
  22. package/src/components/Business/SearchSelect/index.tsx +44 -49
  23. package/src/components/Business/SearchSelect/utils.ts +99 -99
  24. package/src/components/Business/TreeSearchSelect/index.md +126 -126
  25. package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
  26. package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
  27. package/src/components/Functional/AddSelect/index.less +367 -352
  28. package/src/components/Functional/AddSelect/index.md +120 -120
  29. package/src/components/Functional/AddSelect/index.tsx +952 -896
  30. package/src/components/Functional/BillEntry/index.less +371 -371
  31. package/src/components/Functional/BillEntry/index.md +37 -37
  32. package/src/components/Functional/BillEntry/index.tsx +547 -561
  33. package/src/components/Functional/DataImport/index.less +63 -63
  34. package/src/components/Functional/DataImport/index.md +44 -44
  35. package/src/components/Functional/DataImport/index.tsx +689 -689
  36. package/src/components/Functional/DataValidation/index.less +63 -63
  37. package/src/components/Functional/DataValidation/index.md +38 -38
  38. package/src/components/Functional/DataValidation/index.tsx +680 -680
  39. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  40. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  41. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  42. package/src/components/Functional/SearchSelect/index.less +115 -115
  43. package/src/components/Functional/SearchSelect/index.md +141 -141
  44. package/src/components/Functional/SearchSelect/index.tsx +732 -791
  45. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  46. package/src/components/Functional/TreeSearchSelect/index.tsx +149 -149
  47. package/src/index.ts +22 -22
  48. package/src/utils/CheckOneUser/index.md +39 -39
  49. package/src/utils/CheckOneUser/index.ts +51 -51
  50. package/src/utils/requestUtils.ts +32 -32
  51. package/tsconfig.json +29 -29
  52. package/typings.d.ts +2 -2
  53. package/Dockerfile +0 -11
  54. package/dist/app.d.ts +0 -0
  55. package/dist/components/sulaQueryTable/BsSulaQueryTable.d.ts +0 -2
  56. package/dist/components/sulaQueryTable/draggableTable.d.ts +0 -22
  57. package/dist/components/sulaQueryTable/statusComponent.d.ts +0 -2
  58. package/dist/components/sulaQueryTable/utils.d.ts +0 -41
  59. package/nginx.conf +0 -43
  60. package/src/app.tsx +0 -3
  61. package/src/components/sulaQueryTable/BsSulaQueryTable.tsx +0 -368
  62. package/src/components/sulaQueryTable/draggableTable.tsx +0 -111
  63. package/src/components/sulaQueryTable/index.md +0 -271
  64. package/src/components/sulaQueryTable/status-component.less +0 -8
  65. package/src/components/sulaQueryTable/statusComponent.tsx +0 -42
  66. package/src/components/sulaQueryTable/utils.less +0 -48
  67. package/src/components/sulaQueryTable/utils.tsx +0 -336
  68. package/src/global.less +0 -97
@@ -1,49 +1,44 @@
1
- /*
2
- * @Description:
3
- * @Author: rodchen
4
- * @Date: 2022-05-07 15:17:28
5
- * @LastEditTime: 2022-08-10 19:40:16
6
- * @LastEditors: Sirius-kk
7
- */
8
- import React, { useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
9
- import { commonFun } from './BusinessUtils';
10
- import { handleDefaultPrefixUrl } from './utils';
11
- import SearchSelect from '@/components/Functional/SearchSelect';
12
-
13
- const MemoSearchSelect = React.memo(SearchSelect)
14
-
15
- const BusinessSearchSelect = forwardRef((props: any, ref: any) => {
16
- const businessType = props?.selectBusinessType || 'supplier';
17
- const prefixUrl = props?.prefixUrl || { selectPrefix: handleDefaultPrefixUrl(businessType), formSelectFix: handleDefaultPrefixUrl(businessType) };
18
- const innerRef = useRef();
19
-
20
- const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl, props?.requestConfig || {}, props?.modalTableProps || {});
21
- const currentProps = useMemo(() => {
22
- return {
23
- ...props,
24
- requestConfig,
25
- needModalTable,
26
- modalTableProps
27
- }
28
- }, [props?.value]);
29
-
30
- useImperativeHandle(ref, () => ({
31
- getRef: () => innerRef,
32
- }))
33
-
34
- return (
35
- <div>
36
- <MemoSearchSelect {...currentProps} ref={innerRef} />
37
- </div>
38
- );
39
- });
40
-
41
- export default React.memo(BusinessSearchSelect, (props, nextProps) => {
42
- if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
43
- return false
44
- }
45
- if (props && props.value !== nextProps.value) {
46
- return false
47
- }
48
- return true
49
- });
1
+ /*
2
+ * @Description:
3
+ * @Author: rodchen
4
+ * @Date: 2022-05-07 15:17:28
5
+ * @LastEditTime: 2022-05-08 21:01:21
6
+ * @LastEditors: rodchen
7
+ */
8
+ import React, { useMemo } from 'react';
9
+ import { commonFun } from './BusinessUtils';
10
+ import { handleDefaultPrefixUrl } from './utils';
11
+ import SearchSelect from '@/components/Functional/SearchSelect';
12
+
13
+ const MemoSearchSelect = React.memo(SearchSelect)
14
+
15
+ const BusinessSearchSelect = (props: any) => {
16
+ const businessType = props?.selectBusinessType || 'supplier';
17
+ const prefixUrl = props?.prefixUrl || { selectPrefix: handleDefaultPrefixUrl(businessType), formSelectFix: handleDefaultPrefixUrl(businessType) };
18
+
19
+ const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
20
+ const currentProps = useMemo(() => {
21
+ return {
22
+ ...props,
23
+ requestConfig,
24
+ needModalTable,
25
+ modalTableProps
26
+ }
27
+ }, [props?.value])
28
+
29
+ return (
30
+ <div>
31
+ <MemoSearchSelect {...currentProps} />
32
+ </div>
33
+ );
34
+ };
35
+
36
+ export default React.memo(BusinessSearchSelect, (props, nextProps) => {
37
+ if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
38
+ return false
39
+ }
40
+ if(props && props.value !== nextProps.value) {
41
+ return false
42
+ }
43
+ return true
44
+ });
@@ -1,99 +1,99 @@
1
- import axios from 'axios';
2
- import { message } from 'antd';
3
- import { stringify } from 'querystring';
4
-
5
- const getDicData = (dicCode: string) => {
6
- let dicData = {};
7
- let dictionaryData;
8
- if (!dictionaryData) {
9
- let storageDic = localStorage.getItem('dicData')
10
- ? JSON.parse(localStorage.getItem('dicData') || '{}')
11
- : {};
12
- dicData = storageDic[dicCode];
13
- } else {
14
- dicData = dictionaryData[dicCode];
15
- }
16
- // @ts-ignore
17
- if (!dicData || !dicData.length) {
18
- // throw new Error(`当前没有${dicCode}字典值`);
19
- }
20
- return dicData
21
- }
22
-
23
- const getDictionarySource = (dicCode: string, needConvertInterger = false) => {
24
- let dicData = getDicData(dicCode);
25
-
26
- try {
27
- if (needConvertInterger) {
28
- // @ts-ignore
29
- dicData = dicData.map((item: { text: string; value: string }) => ({
30
- ...item,
31
- value: parseFloat(item.value),
32
- }));
33
- }
34
- } catch (e) {}
35
- return dicData;
36
- };
37
-
38
- const getDictionaryTextByValue = (dicCode: string, value: string | number) => {
39
- let dicData = getDicData(dicCode);
40
-
41
- if (value === undefined) return '';
42
-
43
- // @ts-ignore
44
- const dicItemArray = dicData?.filter(
45
- (item: { value: string }) => item.value === value.toString(),
46
- );
47
-
48
- if (!dicItemArray?.length) {
49
- // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
50
- return value;
51
- }
52
-
53
- return dicItemArray[0].text;
54
- };
55
-
56
- const loadSelectSource = (url: string, params?: any) => {
57
- return new Promise((resolve, reject) => {
58
- axios
59
- .get(`${url}?${stringify(params)}`)
60
- .then((result: any) => {
61
- result = result.data;
62
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
63
- message.error(result.msg);
64
- return;
65
- }
66
- resolve(result);
67
- })
68
- .catch((err) => {
69
- reject(err);
70
- });
71
- })
72
- };
73
-
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 }
1
+ import axios from 'axios';
2
+ import { message } from 'antd';
3
+ import { stringify } from 'querystring';
4
+
5
+ const getDicData = (dicCode: string) => {
6
+ let dicData = {};
7
+ let dictionaryData;
8
+ if (!dictionaryData) {
9
+ let storageDic = localStorage.getItem('dicData')
10
+ ? JSON.parse(localStorage.getItem('dicData') || '{}')
11
+ : {};
12
+ dicData = storageDic[dicCode];
13
+ } else {
14
+ dicData = dictionaryData[dicCode];
15
+ }
16
+ // @ts-ignore
17
+ if (!dicData || !dicData.length) {
18
+ // throw new Error(`当前没有${dicCode}字典值`);
19
+ }
20
+ return dicData
21
+ }
22
+
23
+ const getDictionarySource = (dicCode: string, needConvertInterger = false) => {
24
+ let dicData = getDicData(dicCode);
25
+
26
+ try {
27
+ if (needConvertInterger) {
28
+ // @ts-ignore
29
+ dicData = dicData.map((item: { text: string; value: string }) => ({
30
+ ...item,
31
+ value: parseFloat(item.value),
32
+ }));
33
+ }
34
+ } catch (e) {}
35
+ return dicData;
36
+ };
37
+
38
+ const getDictionaryTextByValue = (dicCode: string, value: string | number) => {
39
+ let dicData = getDicData(dicCode);
40
+
41
+ if (value === undefined) return '';
42
+
43
+ // @ts-ignore
44
+ const dicItemArray = dicData?.filter(
45
+ (item: { value: string }) => item.value === value.toString(),
46
+ );
47
+
48
+ if (!dicItemArray?.length) {
49
+ // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
50
+ return value;
51
+ }
52
+
53
+ return dicItemArray[0].text;
54
+ };
55
+
56
+ const loadSelectSource = (url: string, params?: any) => {
57
+ return new Promise((resolve, reject) => {
58
+ axios
59
+ .get(`${url}?${stringify(params)}`)
60
+ .then((result: any) => {
61
+ result = result.data;
62
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
63
+ message.error(result.msg);
64
+ return;
65
+ }
66
+ resolve(result);
67
+ })
68
+ .catch((err) => {
69
+ reject(err);
70
+ });
71
+ })
72
+ };
73
+
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 }
@@ -1,126 +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
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
@@ -1,34 +1,34 @@
1
- import React, { useMemo } from 'react';
2
- import { handleDefaultProps } from './utils';
3
- import TreeSearchSelect from '@/components/Functional/TreeSearchSelect';
4
-
5
- const MemoTreeSearchSelect = React.memo(TreeSearchSelect)
6
-
7
- const BusinessTreeSearchSelect = (props: any) => {
8
- const businessType = props?.businessType || 'department';
9
-
10
- const handleBusinessProps = handleDefaultProps(businessType);
11
-
12
- const currentProps = useMemo(() => {
13
- return {
14
- ...handleBusinessProps,
15
- ...props,
16
- }
17
- }, [props?.value])
18
-
19
- return (
20
- <div>
21
- <MemoTreeSearchSelect {...currentProps} />
22
- </div>
23
- );
24
- };
25
-
26
- export default React.memo(BusinessTreeSearchSelect, (props, nextProps) => {
27
- if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
28
- return false
29
- }
30
- if(props && props.value !== nextProps.value) {
31
- return false
32
- }
33
- return true
34
- });
1
+ import React, { useMemo } from 'react';
2
+ import { handleDefaultProps } from './utils';
3
+ import TreeSearchSelect from '@/components/Functional/TreeSearchSelect';
4
+
5
+ const MemoTreeSearchSelect = React.memo(TreeSearchSelect)
6
+
7
+ const BusinessTreeSearchSelect = (props: any) => {
8
+ const businessType = props?.businessType || 'department';
9
+
10
+ const handleBusinessProps = handleDefaultProps(businessType);
11
+
12
+ const currentProps = useMemo(() => {
13
+ return {
14
+ ...handleBusinessProps,
15
+ ...props,
16
+ }
17
+ }, [props?.value])
18
+
19
+ return (
20
+ <div>
21
+ <MemoTreeSearchSelect {...currentProps} />
22
+ </div>
23
+ );
24
+ };
25
+
26
+ export default React.memo(BusinessTreeSearchSelect, (props, nextProps) => {
27
+ if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
28
+ return false
29
+ }
30
+ if(props && props.value !== nextProps.value) {
31
+ return false
32
+ }
33
+ return true
34
+ });