@bit-sun/business-component 1.1.37 → 1.2.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.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.gitlab-ci.yml +174 -174
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +59 -28
- package/README.md +27 -27
- package/dist/index.esm.js +2525 -3854
- package/dist/index.js +2525 -3854
- package/dist/utils/CheckOneUser/index.d.ts +1 -1
- package/docs/index.md +21 -21
- package/package.json +50 -50
- package/src/components/Business/CommodityEntry/index.md +69 -69
- package/src/components/Business/CommodityEntry/index.tsx +75 -75
- package/src/components/Business/SearchSelect/BusinessUtils.ts +1365 -1148
- package/src/components/Business/SearchSelect/common.ts +34 -34
- package/src/components/Business/SearchSelect/index.md +1107 -1061
- package/src/components/Business/SearchSelect/index.tsx +43 -43
- package/src/components/Business/SearchSelect/utils.ts +74 -74
- 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 +672 -668
- 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 +715 -714
- package/src/index.ts +21 -21
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/tsconfig.json +29 -29
- package/typings.d.ts +2 -2
|
@@ -1,43 +1,43 @@
|
|
|
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 SearchSelect from '@/components/Functional/SearchSelect';
|
|
11
|
-
|
|
12
|
-
const MemoSearchSelect = React.memo(SearchSelect)
|
|
13
|
-
|
|
14
|
-
const BusinessSearchSelect = (props: any) => {
|
|
15
|
-
const businessType = props?.selectBusinessType || 'supplier';
|
|
16
|
-
const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
|
|
17
|
-
|
|
18
|
-
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
|
|
19
|
-
const currentProps = useMemo(() => {
|
|
20
|
-
return {
|
|
21
|
-
...props,
|
|
22
|
-
requestConfig,
|
|
23
|
-
needModalTable,
|
|
24
|
-
modalTableProps
|
|
25
|
-
}
|
|
26
|
-
}, [props?.value])
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div>
|
|
30
|
-
<MemoSearchSelect {...currentProps} />
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
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
|
-
});
|
|
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 SearchSelect from '@/components/Functional/SearchSelect';
|
|
11
|
+
|
|
12
|
+
const MemoSearchSelect = React.memo(SearchSelect)
|
|
13
|
+
|
|
14
|
+
const BusinessSearchSelect = (props: any) => {
|
|
15
|
+
const businessType = props?.selectBusinessType || 'supplier';
|
|
16
|
+
const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
|
|
17
|
+
|
|
18
|
+
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
|
|
19
|
+
const currentProps = useMemo(() => {
|
|
20
|
+
return {
|
|
21
|
+
...props,
|
|
22
|
+
requestConfig,
|
|
23
|
+
needModalTable,
|
|
24
|
+
modalTableProps
|
|
25
|
+
}
|
|
26
|
+
}, [props?.value])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<MemoSearchSelect {...currentProps} />
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
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
|
+
});
|
|
@@ -1,74 +1,74 @@
|
|
|
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 !== '0') {
|
|
63
|
-
message.error(result.msg);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
resolve(result);
|
|
67
|
-
})
|
|
68
|
-
.catch((err) => {
|
|
69
|
-
reject(err);
|
|
70
|
-
});
|
|
71
|
-
})
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export { getDictionarySource, getDictionaryTextByValue, loadSelectSource }
|
|
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
|
+
export { getDictionarySource, getDictionaryTextByValue, loadSelectSource }
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
.luckysheet {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
.luckysheet-work-area.luckysheet-noselected-text {
|
|
4
|
-
display: none;
|
|
5
|
-
|
|
6
|
-
// .luckysheet_info_detail {
|
|
7
|
-
// display: none !important;
|
|
8
|
-
// }
|
|
9
|
-
|
|
10
|
-
// .luckysheet-wa-editor.toolbar {
|
|
11
|
-
// overflow: hidden;
|
|
12
|
-
// }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.sheet_table_top {
|
|
17
|
-
height: 50px;
|
|
18
|
-
background: #f2f2f2;
|
|
19
|
-
width: 100%;
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
align-items: center;
|
|
23
|
-
padding: 0 20px;
|
|
24
|
-
border: 1px solid #d8d8d8;
|
|
25
|
-
|
|
26
|
-
.menu_item_text {
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.sheet_table_footer {
|
|
34
|
-
height: 50px;
|
|
35
|
-
background: #f2f2f2;
|
|
36
|
-
width: 100%;
|
|
37
|
-
display: flex;
|
|
38
|
-
justify-content: space-between;
|
|
39
|
-
align-items: center;
|
|
40
|
-
padding: 0 20px;
|
|
41
|
-
border: 1px solid #d8d8d8;
|
|
42
|
-
|
|
43
|
-
.sheet_table_footer_l {
|
|
44
|
-
}
|
|
45
|
-
.sheet_table_footer_r {
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.sheet_table_text {
|
|
50
|
-
color: #8f8f8f;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.sheet_table_dnd_text {
|
|
54
|
-
background: #f2f2f2;
|
|
55
|
-
border: 1px solid #d8d8d8;
|
|
56
|
-
display: inline-block;
|
|
57
|
-
width: 100px;
|
|
58
|
-
height: 30px;
|
|
59
|
-
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
}
|
|
1
|
+
.luckysheet {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
.luckysheet-work-area.luckysheet-noselected-text {
|
|
4
|
+
display: none;
|
|
5
|
+
|
|
6
|
+
// .luckysheet_info_detail {
|
|
7
|
+
// display: none !important;
|
|
8
|
+
// }
|
|
9
|
+
|
|
10
|
+
// .luckysheet-wa-editor.toolbar {
|
|
11
|
+
// overflow: hidden;
|
|
12
|
+
// }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sheet_table_top {
|
|
17
|
+
height: 50px;
|
|
18
|
+
background: #f2f2f2;
|
|
19
|
+
width: 100%;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 0 20px;
|
|
24
|
+
border: 1px solid #d8d8d8;
|
|
25
|
+
|
|
26
|
+
.menu_item_text {
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sheet_table_footer {
|
|
34
|
+
height: 50px;
|
|
35
|
+
background: #f2f2f2;
|
|
36
|
+
width: 100%;
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
align-items: center;
|
|
40
|
+
padding: 0 20px;
|
|
41
|
+
border: 1px solid #d8d8d8;
|
|
42
|
+
|
|
43
|
+
.sheet_table_footer_l {
|
|
44
|
+
}
|
|
45
|
+
.sheet_table_footer_r {
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sheet_table_text {
|
|
50
|
+
color: #8f8f8f;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sheet_table_dnd_text {
|
|
54
|
+
background: #f2f2f2;
|
|
55
|
+
border: 1px solid #d8d8d8;
|
|
56
|
+
display: inline-block;
|
|
57
|
+
width: 100px;
|
|
58
|
+
height: 30px;
|
|
59
|
+
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
---
|
|
2
|
-
nav:
|
|
3
|
-
title: '组件'
|
|
4
|
-
order: 1
|
|
5
|
-
group:
|
|
6
|
-
title: 功能组件
|
|
7
|
-
order: 0
|
|
8
|
-
title: 数据校验
|
|
9
|
-
order: 1
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## DataValidation
|
|
13
|
-
|
|
14
|
-
Demo:
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import React, { useRef } from 'react';
|
|
18
|
-
import { DataValidation } from '../../../index';
|
|
19
|
-
|
|
20
|
-
export default () => {
|
|
21
|
-
let dataValidationRef: DataValidation = useRef();
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div>
|
|
25
|
-
<DataValidation
|
|
26
|
-
// columns={['skuCode', 'quantity', 'price']}
|
|
27
|
-
columns={["skuCode", "quantity", "price"]} // 需要哪些列展示,以及展示的顺序
|
|
28
|
-
validDataUrl="/wms-ops/recordDetailImport/check" // 校验的接口url
|
|
29
|
-
onRef={(ref) => {
|
|
30
|
-
dataValidationRef = ref;
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
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: 0
|
|
8
|
+
title: 数据校验
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## DataValidation
|
|
13
|
+
|
|
14
|
+
Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useRef } from 'react';
|
|
18
|
+
import { DataValidation } from '../../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
let dataValidationRef: DataValidation = useRef();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<DataValidation
|
|
26
|
+
// columns={['skuCode', 'quantity', 'price']}
|
|
27
|
+
columns={["skuCode", "quantity", "price"]} // 需要哪些列展示,以及展示的顺序
|
|
28
|
+
validDataUrl="/wms-ops/recordDetailImport/check" // 校验的接口url
|
|
29
|
+
onRef={(ref) => {
|
|
30
|
+
dataValidationRef = ref;
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|