@bit-sun/business-component 1.1.21 → 1.1.24
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/package.json +1 -1
- package/src/components/Business/CommodityEntry/index.md +69 -0
- package/src/components/Business/CommodityEntry/index.tsx +75 -0
- package/src/components/Business/SearchSelect/BusinessUtils.ts +888 -0
- package/src/components/Business/SearchSelect/common.ts +34 -0
- package/src/components/Business/SearchSelect/index.md +906 -0
- package/src/components/{SearchSelect/business/BusinessSearchSelect.tsx → Business/SearchSelect/index.tsx} +3 -2
- package/src/components/Business/SearchSelect/utils.ts +71 -0
- package/src/components/{DataValidation → Functional/DataValidation}/index.less +0 -0
- package/src/components/{DataValidation → Functional/DataValidation}/index.md +3 -3
- package/src/components/{DataValidation → Functional/DataValidation}/index.tsx +1 -1
- package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.less +0 -0
- package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.md +3 -3
- package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.tsx +0 -0
- package/src/components/{SearchSelect → Functional/SearchSelect}/index.less +0 -0
- package/src/components/{SearchSelect → Functional/SearchSelect}/index.md +14 -11
- package/src/components/{SearchSelect → Functional/SearchSelect}/index.tsx +226 -106
- package/src/index.ts +5 -4
- package/dist/components/DataValidation/index.d.ts +0 -144
- package/dist/components/QueryMutipleInput/index.d.ts +0 -5
- package/dist/components/SearchSelect/business/BusinessSearchSelect.d.ts +0 -2
- package/dist/components/SearchSelect/business/BusinessUtils.d.ts +0 -22
- package/dist/components/SearchSelect/index.d.ts +0 -3
- package/dist/index.d.ts +0 -5
- package/dist/index.esm.js +0 -3723
- package/dist/index.js +0 -3738
- package/dist/utils/CheckOneUser/index.d.ts +0 -2
- package/src/components/SearchSelect/business/BusinessUtils.ts +0 -464
- package/src/components/SearchSelect/business/index.md +0 -181
package/package.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 业务组件
|
|
7
|
+
order: 1
|
|
8
|
+
title: 商品录入器
|
|
9
|
+
order: 0
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# CommodityEntry
|
|
13
|
+
|
|
14
|
+
## 商品录入器
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { CommodityEntry } from '../../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
const [choosedSku, setChoosedSku] = useState([]);
|
|
22
|
+
|
|
23
|
+
const callbackHideModal = () => {
|
|
24
|
+
alert('关闭弹窗处理函数回调,可以处理刷新表格等操作(非必传)')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const callbackHandleOk = (resultData, callback) => {
|
|
28
|
+
alert('确定操作,可获取到成功录入的商品,做一系列操作')
|
|
29
|
+
console.log(resultData)
|
|
30
|
+
// 一般拿到导入数据是做请求接口操作
|
|
31
|
+
// import {request} from "bssula";
|
|
32
|
+
// request({
|
|
33
|
+
// url: `/bop/api/sku/import/save`,
|
|
34
|
+
// method: "POST",
|
|
35
|
+
// successMessage: "操作成功",
|
|
36
|
+
// convertParams: () => {
|
|
37
|
+
// const targetData = resultData.successData;
|
|
38
|
+
// return {
|
|
39
|
+
// columns: ['skuCode', 'quantity', 'price'],
|
|
40
|
+
// data: targetData
|
|
41
|
+
// };
|
|
42
|
+
// },
|
|
43
|
+
// converter: () => {
|
|
44
|
+
// props.hideModal()
|
|
45
|
+
// },
|
|
46
|
+
// });
|
|
47
|
+
|
|
48
|
+
// 示例处理
|
|
49
|
+
setChoosedSku(resultData.successData.map((i: any) => i.skuCode))
|
|
50
|
+
|
|
51
|
+
callback()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const props = {
|
|
55
|
+
callbackHideModal,
|
|
56
|
+
callbackHandleOk
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div>
|
|
61
|
+
<CommodityEntry {...props} />
|
|
62
|
+
<br />
|
|
63
|
+
<div>已录入sku有:{choosedSku.join(',')}</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { useRef, useState } from 'react';
|
|
3
|
+
import { Modal, Button, message } from 'antd';
|
|
4
|
+
import DataValidation from '@/components/Functional/DataValidation';
|
|
5
|
+
|
|
6
|
+
const CommodityEntry = (props: any) => {
|
|
7
|
+
let dataValidationRef: DataValidation = useRef();
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
buttonName=' + 录入商品',
|
|
11
|
+
modalTitle = '录入商品',
|
|
12
|
+
callbackHideModal,
|
|
13
|
+
callbackHandleOk,
|
|
14
|
+
columns=["skuCode", "quantity", "price"],
|
|
15
|
+
validDataUrl="/bop/api/recordDetailImport/check"
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
const [modalProps, setModalProps]: any = useState({
|
|
19
|
+
maskClosable: false,
|
|
20
|
+
width: 800,
|
|
21
|
+
visible: false,
|
|
22
|
+
title: modalTitle,
|
|
23
|
+
okText: '确定',
|
|
24
|
+
cancelText: '取消',
|
|
25
|
+
hideModal: () => {
|
|
26
|
+
setModalProps(() => ({ ...modalProps, visible: false }));
|
|
27
|
+
callbackHideModal && callbackHideModal()
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const handleOk = () => {
|
|
32
|
+
// 方法获取当前组件内部的数据,然后进行自身的业务操作
|
|
33
|
+
const resultData = dataValidationRef.getValidateData();
|
|
34
|
+
|
|
35
|
+
if (!resultData.successData.length) {
|
|
36
|
+
message.error("无校验通过数据,请校验数据");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (resultData.failData.length) {
|
|
41
|
+
message.error(`有${resultData.failData.length}条校验失败数据`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
callbackHandleOk(resultData, () => {
|
|
46
|
+
modalProps.hideModal()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const handleShowModal = () => {
|
|
52
|
+
setModalProps({ ...modalProps, visible: true})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const handleCancel = () => {
|
|
56
|
+
modalProps.hideModal()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div>
|
|
61
|
+
<Button onClick={handleShowModal}>{buttonName}</Button>
|
|
62
|
+
{modalProps.visible && (
|
|
63
|
+
<Modal {...modalProps} onOk={handleOk} onCancel={handleCancel} destroyOnClose={true} zIndex={15}>
|
|
64
|
+
<DataValidation
|
|
65
|
+
onRef={(ref) => { dataValidationRef = ref }}
|
|
66
|
+
columns={columns}
|
|
67
|
+
validDataUrl={validDataUrl}
|
|
68
|
+
/>
|
|
69
|
+
</Modal>
|
|
70
|
+
) || ''}
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default CommodityEntry;
|