@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.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.gitlab-ci.yml +174 -135
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -90
- package/README.md +27 -27
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +6794 -7350
- package/dist/index.js +6793 -7348
- package/docs/index.md +21 -21
- package/package.json +51 -60
- package/src/components/Business/AddSelectBusiness/index.md +41 -41
- package/src/components/Business/AddSelectBusiness/index.tsx +288 -300
- package/src/components/Business/CommodityEntry/index.md +69 -69
- package/src/components/Business/CommodityEntry/index.tsx +78 -78
- package/src/components/Business/SearchSelect/BusinessUtils.ts +1445 -1445
- package/src/components/Business/SearchSelect/common.ts +53 -53
- package/src/components/Business/SearchSelect/index.md +1137 -1136
- package/src/components/Business/SearchSelect/index.tsx +44 -49
- package/src/components/Business/SearchSelect/utils.ts +99 -99
- package/src/components/Business/TreeSearchSelect/index.md +126 -126
- package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
- package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
- package/src/components/Functional/AddSelect/index.less +367 -352
- package/src/components/Functional/AddSelect/index.md +120 -120
- package/src/components/Functional/AddSelect/index.tsx +952 -896
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +37 -37
- package/src/components/Functional/BillEntry/index.tsx +547 -561
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +689 -689
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +38 -38
- package/src/components/Functional/DataValidation/index.tsx +680 -680
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +732 -791
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +149 -149
- package/src/index.ts +22 -22
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/requestUtils.ts +32 -32
- package/tsconfig.json +29 -29
- package/typings.d.ts +2 -2
- package/Dockerfile +0 -11
- package/dist/app.d.ts +0 -0
- package/dist/components/sulaQueryTable/BsSulaQueryTable.d.ts +0 -2
- package/dist/components/sulaQueryTable/draggableTable.d.ts +0 -22
- package/dist/components/sulaQueryTable/statusComponent.d.ts +0 -2
- package/dist/components/sulaQueryTable/utils.d.ts +0 -41
- package/nginx.conf +0 -43
- package/src/app.tsx +0 -3
- package/src/components/sulaQueryTable/BsSulaQueryTable.tsx +0 -368
- package/src/components/sulaQueryTable/draggableTable.tsx +0 -111
- package/src/components/sulaQueryTable/index.md +0 -271
- package/src/components/sulaQueryTable/status-component.less +0 -8
- package/src/components/sulaQueryTable/statusComponent.tsx +0 -42
- package/src/components/sulaQueryTable/utils.less +0 -48
- package/src/components/sulaQueryTable/utils.tsx +0 -336
- 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
|
|
6
|
-
* @LastEditors:
|
|
7
|
-
*/
|
|
8
|
-
import React, { useMemo
|
|
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
|
|
16
|
-
const businessType = props?.selectBusinessType || 'supplier';
|
|
17
|
-
const prefixUrl = props?.prefixUrl || { selectPrefix: handleDefaultPrefixUrl(businessType), formSelectFix: handleDefaultPrefixUrl(businessType) };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
});
|