kts-component-invoice-operate 2.0.21 → 3.0.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/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +2 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.d.ts +1 -1
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +5 -2
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +5 -2
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +5 -2
- package/dist/Invoice/ui/GoodsList/hook/useToGenerateId/index.d.ts +3 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -1
- package/dist/index.esm.js +901 -1027
- package/dist/index.js +900 -1026
- package/docs-dist/umi.js +1 -1
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +3 -0
- package/src/Invoice/index.tsx +15 -18
- package/src/Invoice/tools/idGenerator/index.ts +1 -1
- package/src/Invoice/ui/AddComparisonDrawer/index.tsx +1 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +22 -29
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.tsx +5 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +33 -10
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +19 -7
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +11 -5
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +52 -18
- package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +13 -0
- package/src/Invoice/ui/GoodsList/index.tsx +17 -3
- package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +1 -1
- package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +10 -39
- package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +11 -2
- package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +2 -2
- package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +58 -63
package/package.json
CHANGED
package/src/Invoice/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import InvoiceController from './InvoiceController';
|
|
4
4
|
import InvoiceHeader from './ui/InvoiceHeader';
|
|
5
5
|
import GoodsList from './ui/GoodsList';
|
|
6
|
+
import useToGenerateId from './ui/GoodsList/hook/useToGenerateId';
|
|
6
7
|
import Seller from './ui/Seller';
|
|
7
8
|
import Sign from './ui/Sign';
|
|
8
9
|
import Buyer from './ui/Buyer';
|
|
@@ -63,9 +64,7 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
|
|
|
63
64
|
static idGenerator = idGenerator;
|
|
64
65
|
|
|
65
66
|
/** 获取控制器钩子 */
|
|
66
|
-
static useInvoiceController = () => {
|
|
67
|
-
return React.useContext(InvoiceContext);
|
|
68
|
-
};
|
|
67
|
+
static useInvoiceController = () => { return React.useContext(InvoiceContext) };
|
|
69
68
|
|
|
70
69
|
render() {
|
|
71
70
|
return <Main {...this.props}></Main>;
|
|
@@ -78,12 +77,15 @@ const Main = (props: IInvoiceProps) => {
|
|
|
78
77
|
|
|
79
78
|
const [key, setKey] = React.useState(0);
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, [controller])
|
|
80
|
+
useToGenerateId(controller);
|
|
81
|
+
|
|
82
|
+
React.useEffect(() => { setKey(key + 1) }, [controller]);
|
|
83
|
+
|
|
84
|
+
React.useEffect(() => { }, [])
|
|
84
85
|
|
|
85
86
|
return (
|
|
86
87
|
<InvoiceContext.Provider key={key} value={controller}>
|
|
88
|
+
|
|
87
89
|
<div className="kts-invoice-operate">
|
|
88
90
|
{props.invoiceHeader || <InvoiceHeader /> /** 发票头 */}
|
|
89
91
|
{props.buyer || <Buyer /> /** 购买方 */}
|
|
@@ -93,17 +95,12 @@ const Main = (props: IInvoiceProps) => {
|
|
|
93
95
|
{props.footExpand}
|
|
94
96
|
</div>
|
|
95
97
|
|
|
96
|
-
{/*
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
{/*
|
|
100
|
-
<ImportGoodsDrawer />
|
|
101
|
-
|
|
102
|
-
{/* 给货品赋码的抽屉 */}
|
|
103
|
-
<EndowCodeDrawer />
|
|
104
|
-
|
|
105
|
-
{/* 添加商品对照的抽屉 */}
|
|
106
|
-
<AddComparisonDrawer />
|
|
98
|
+
<ImportBuyerDrawer />{/* 导入购买方的抽屉 */}
|
|
99
|
+
<ImportGoodsDrawer />{/* 导入货品的抽屉 */}
|
|
100
|
+
<EndowCodeDrawer />{/* 给货品赋码的抽屉 */}
|
|
101
|
+
<AddComparisonDrawer />{/* 添加商品对照的抽屉 */}
|
|
107
102
|
</InvoiceContext.Provider>
|
|
108
103
|
);
|
|
109
|
-
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let id =
|
|
1
|
+
let id = new Date().getTime();
|
|
2
2
|
export default () => ++id;
|
|
@@ -39,7 +39,7 @@ export default function AddComparisonDrawer() {
|
|
|
39
39
|
good.itemName = shorthand ? `*${shorthand}*${values.itemName}` : values.itemName;
|
|
40
40
|
good.itemNameSelf = shorthand ? `*${shorthand}*${values.itemNameSelf}` : values.itemNameSelf;
|
|
41
41
|
|
|
42
|
-
if (good.lineAttribute
|
|
42
|
+
if (good.lineAttribute !== LineAttributeType.折扣行) {
|
|
43
43
|
good.itemModelName = values.itemModelName;
|
|
44
44
|
good.itemModelNameSelf = values.itemModelNameSelf;
|
|
45
45
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
onChangeLineAmountExcludeTax,
|
|
14
14
|
onChangeTaxRate,
|
|
15
15
|
// onSaveEditGood,
|
|
16
|
-
endowCode,
|
|
16
|
+
// endowCode,
|
|
17
17
|
onChangeItemName,
|
|
18
18
|
} from './autoFillFn';
|
|
19
19
|
|
|
@@ -51,10 +51,17 @@ export default (form: WrappedFormUtils) => {
|
|
|
51
51
|
/** 表头 */
|
|
52
52
|
const columns = React.useMemo(() => {
|
|
53
53
|
return [
|
|
54
|
+
{
|
|
55
|
+
title: '序号',
|
|
56
|
+
key: 'serialNo',
|
|
57
|
+
dataIndex: 'serialNo',
|
|
58
|
+
width: 50,
|
|
59
|
+
render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
|
|
60
|
+
},
|
|
54
61
|
{
|
|
55
62
|
title: (
|
|
56
63
|
<>
|
|
57
|
-
<Text type="danger">*</Text
|
|
64
|
+
<Text type="danger">*</Text>项目名称
|
|
58
65
|
</>
|
|
59
66
|
),
|
|
60
67
|
key: 'itemName',
|
|
@@ -85,23 +92,14 @@ export default (form: WrappedFormUtils) => {
|
|
|
85
92
|
/>,
|
|
86
93
|
)}
|
|
87
94
|
<div className="kts-invoice-operate-goods-list-able-list-itemName-import">
|
|
88
|
-
{!editGood.itemName?.match(/\*[^*]+\*/) && (
|
|
89
|
-
<Button
|
|
90
|
-
onClick={() => {
|
|
91
|
-
endowCode(controller, record);
|
|
92
|
-
}}
|
|
93
|
-
type="link"
|
|
94
|
-
icon="file-add"
|
|
95
|
-
/>
|
|
96
|
-
)}
|
|
97
95
|
{controller.getGoodsList && (
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
s.goodsListState.importGoods.isVisibleDrawer = true
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
<Tooltip title="点击从商品管理中添加商品信息">
|
|
97
|
+
<Button
|
|
98
|
+
onClick={controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = true })}
|
|
99
|
+
type="link"
|
|
100
|
+
icon="plus-circle"
|
|
101
|
+
/>
|
|
102
|
+
</Tooltip>
|
|
105
103
|
)}
|
|
106
104
|
</div>
|
|
107
105
|
</div>
|
|
@@ -181,7 +179,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
181
179
|
</Form.Item>
|
|
182
180
|
);
|
|
183
181
|
} else {
|
|
184
|
-
return record.unit
|
|
182
|
+
return <span style={{ padding: '0 10px' }}>{record.unit}</span>;
|
|
185
183
|
}
|
|
186
184
|
},
|
|
187
185
|
},
|
|
@@ -409,7 +407,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
409
407
|
{
|
|
410
408
|
title: (
|
|
411
409
|
<>
|
|
412
|
-
<Text type="danger">*</Text
|
|
410
|
+
<Text type="danger">*</Text>税率%
|
|
413
411
|
</>
|
|
414
412
|
),
|
|
415
413
|
dataIndex: 'taxRate',
|
|
@@ -471,10 +469,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
471
469
|
},
|
|
472
470
|
{
|
|
473
471
|
title: '操作',
|
|
474
|
-
dataIndex: 'operating',
|
|
475
472
|
key: 'operating',
|
|
476
|
-
|
|
477
|
-
|
|
473
|
+
align: 'right',
|
|
474
|
+
width: 110,
|
|
478
475
|
render: (_value: string, record: IGood) => <RowMenu key={record.lineAttribute} goods={record} />,
|
|
479
476
|
},
|
|
480
477
|
]
|
|
@@ -495,12 +492,8 @@ export default (form: WrappedFormUtils) => {
|
|
|
495
492
|
|
|
496
493
|
React.useEffect(() => {
|
|
497
494
|
if (!changeField) return;
|
|
498
|
-
const t = setTimeout(() => {
|
|
499
|
-
|
|
500
|
-
}, 1000);
|
|
501
|
-
return () => {
|
|
502
|
-
clearTimeout(t)
|
|
503
|
-
}
|
|
495
|
+
const t = setTimeout(() => { setChangeField('') }, 1000);
|
|
496
|
+
return () => { clearTimeout(t) }
|
|
504
497
|
}, [changeField]);
|
|
505
498
|
|
|
506
499
|
return columns;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Menu, message, Typography } from 'kts-components-antd-x3';
|
|
5
|
-
import { IGood } from '../../../../../../../../InvoiceController';
|
|
5
|
+
import { IGood, LineAttributeType } from '../../../../../../../../InvoiceController';
|
|
6
6
|
import Invoice from '../../../../../../../../';
|
|
7
7
|
|
|
8
8
|
const { Text } = Typography;
|
|
@@ -29,6 +29,10 @@ export default (goods: IGood) => {
|
|
|
29
29
|
})
|
|
30
30
|
}, [controller, goods.$index]);
|
|
31
31
|
|
|
32
|
+
if (!(goods.lineAttribute !== LineAttributeType.折扣行)) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
return React.useMemo(() => {
|
|
33
37
|
if (productComparison.onComply) {
|
|
34
38
|
return <Menu.Item key="delItem" onClick={onClick}><Text strong>添加商品对照</Text></Menu.Item>
|
|
@@ -10,11 +10,16 @@ export default (goods: IGood) => {
|
|
|
10
10
|
|
|
11
11
|
const controller = Invoice.useInvoiceController();
|
|
12
12
|
|
|
13
|
+
const model = controller.useMemo(s => s.model, [])
|
|
14
|
+
|
|
15
|
+
/** 是否能添加折扣行 */
|
|
16
|
+
const isAddDiscount = controller.useMemo(s => s.goodsListState.isAddDiscount, [])
|
|
17
|
+
|
|
13
18
|
/** 点击了 添加折扣行 按钮 */
|
|
14
19
|
const onClick = React.useCallback(async () => {
|
|
15
20
|
await controller.saveEditGood();
|
|
16
21
|
await controller.wait();
|
|
17
|
-
await controller.
|
|
22
|
+
await controller.run(async s => {
|
|
18
23
|
if (s.goodsListState.form) {
|
|
19
24
|
const err: any = s.goodsListState.form.getFieldsError();
|
|
20
25
|
for (let key in err) {
|
|
@@ -33,20 +38,38 @@ export default (goods: IGood) => {
|
|
|
33
38
|
return;
|
|
34
39
|
}
|
|
35
40
|
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
36
|
-
})
|
|
41
|
+
})
|
|
37
42
|
}, [controller, goods.$index]);
|
|
38
43
|
|
|
39
44
|
if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
40
45
|
return undefined
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
if (!(model !== 'prefab')) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!(isAddDiscount !== false)) {
|
|
53
|
+
return undefined
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
key:'addDiscount',
|
|
62
|
+
title:'折扣',
|
|
63
|
+
onClick,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// return React.useMemo(() => {
|
|
67
|
+
// if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
68
|
+
// return undefined
|
|
69
|
+
// }
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [onClick, goods.lineAttribute]);
|
|
71
|
+
// return (
|
|
72
|
+
// <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
|
|
73
|
+
// );
|
|
74
|
+
// }, [onClick, goods.lineAttribute]);
|
|
52
75
|
};
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Menu, Typography } from 'kts-components-antd-x3';
|
|
2
|
+
// import { Menu, Typography } from 'kts-components-antd-x3';
|
|
3
3
|
import { IGood, LineAttributeType } from '../../../../../../../../InvoiceController';
|
|
4
4
|
import Invoice from '../../../../../../../../';
|
|
5
5
|
|
|
6
|
-
const { Text } = Typography;
|
|
6
|
+
// const { Text } = Typography;
|
|
7
7
|
|
|
8
8
|
export default (goods: IGood) => {
|
|
9
9
|
|
|
10
10
|
const controller = Invoice.useInvoiceController();
|
|
11
11
|
|
|
12
|
+
const model = controller.useMemo(s => s.model, [])
|
|
13
|
+
|
|
12
14
|
const onClick = React.useCallback(() => {
|
|
13
15
|
controller.delGood(goods.$index);
|
|
14
|
-
}, [controller, goods.$index]);
|
|
16
|
+
}, [controller, goods.$index]);
|
|
15
17
|
|
|
16
18
|
if (goods.lineAttribute === LineAttributeType.被折扣行) {
|
|
17
|
-
return undefined
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!(model !== 'prefab')) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
key:'delItem',
|
|
28
|
+
title:'删除',
|
|
29
|
+
onClick,
|
|
18
30
|
}
|
|
19
31
|
|
|
20
|
-
return React.useMemo(() => {
|
|
21
|
-
|
|
22
|
-
}, [onClick])
|
|
32
|
+
// return React.useMemo(() => {
|
|
33
|
+
// return <Menu.Item key="delItem" onClick={onClick}><Text strong type="danger">删除</Text></Menu.Item>
|
|
34
|
+
// }, [onClick])
|
|
23
35
|
};
|
|
@@ -14,15 +14,21 @@ export default (goods: IGood) => {
|
|
|
14
14
|
endowCode(controller, goods);
|
|
15
15
|
}, [controller, goods]);
|
|
16
16
|
|
|
17
|
+
return {
|
|
18
|
+
key: 'endowCode',
|
|
19
|
+
title: '赋码',
|
|
20
|
+
onClick,
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
// return React.useMemo(() => {
|
|
18
24
|
// return (
|
|
19
25
|
// <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
|
|
20
26
|
// );
|
|
21
27
|
// }, [goods.lineAttribute, onClick])
|
|
22
28
|
|
|
23
|
-
return React.useMemo(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [goods.lineAttribute, onClick])
|
|
29
|
+
// return React.useMemo(() => {
|
|
30
|
+
// return (
|
|
31
|
+
// <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
|
|
32
|
+
// );
|
|
33
|
+
// }, [goods.lineAttribute, onClick])
|
|
28
34
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button, Menu, Dropdown, Icon } from 'kts-components-antd-x3';
|
|
2
|
+
import { Button, Menu, Dropdown, Icon, Typography } from 'kts-components-antd-x3';
|
|
3
|
+
import Invoice from '../../../../../../';
|
|
3
4
|
import { IGood } from '../../../../../../InvoiceController';
|
|
4
5
|
import { ReactComponent as SpotSvg } from './spot.svg';
|
|
6
|
+
|
|
5
7
|
import useDelItem from './hook/useDelItem';
|
|
6
8
|
import useAddDiscount from './hook/useAddDiscount';
|
|
7
9
|
import useEndowCode from './hook/useEndowCode';
|
|
8
|
-
import useAddComparison from './hook/useAddComparison';
|
|
10
|
+
// import useAddComparison from './hook/useAddComparison';
|
|
11
|
+
|
|
9
12
|
import './index.less';
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
const { Text } = Typography;
|
|
11
15
|
|
|
12
16
|
export default (props: { goods: IGood }) => {
|
|
13
17
|
|
|
@@ -23,15 +27,16 @@ export default (props: { goods: IGood }) => {
|
|
|
23
27
|
const delItem = useDelItem(props.goods);
|
|
24
28
|
const addDiscount = useAddDiscount(props.goods);
|
|
25
29
|
const endowCode = useEndowCode(props.goods);
|
|
26
|
-
const addComparison = useAddComparison(props.goods);
|
|
30
|
+
// const addComparison = useAddComparison(props.goods);
|
|
27
31
|
|
|
28
32
|
const itemList = React.useMemo(() => {
|
|
29
33
|
const arr: any[] = [];
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
arr.push(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
endowCode && arr.push(endowCode); // 赋码
|
|
36
|
+
addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
37
|
+
delItem && arr.push(delItem); // 删除
|
|
38
|
+
|
|
39
|
+
// addComparison && arr.push(addComparison); // 添加商品对照
|
|
35
40
|
|
|
36
41
|
if (!goodsMenuExpand || goodsMenuExpand.length === 0) return arr;
|
|
37
42
|
|
|
@@ -45,20 +50,49 @@ export default (props: { goods: IGood }) => {
|
|
|
45
50
|
return arr;
|
|
46
51
|
}, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model, isAddDiscount])
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
const overlay = React.useMemo(() => {
|
|
54
|
+
if (itemList.length <= 2) {
|
|
55
|
+
return undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Menu>
|
|
60
|
+
{itemList.slice(2).map(e => {
|
|
61
|
+
return <Menu.Item key={e.key} onClick={e.onClick} ><Text strong>{e.title}</Text></Menu.Item>
|
|
62
|
+
})}
|
|
63
|
+
</Menu>
|
|
64
|
+
)
|
|
65
|
+
}, [itemList])
|
|
66
|
+
|
|
67
|
+
const buttonList = React.useMemo(() => {
|
|
49
68
|
return (
|
|
50
|
-
|
|
69
|
+
<div style={{ flex: 1, textAlign: 'left', display: 'flex', gap: 10 }} >
|
|
70
|
+
{
|
|
71
|
+
itemList.slice(0, 2).map(e => {
|
|
72
|
+
return (
|
|
73
|
+
<Button key={e.key} type='link' onClick={e.onClick} style={{ padding: 0 }} >
|
|
74
|
+
{e.title}
|
|
75
|
+
</Button>
|
|
76
|
+
)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
</div>
|
|
51
80
|
)
|
|
52
|
-
}
|
|
81
|
+
}, [itemList])
|
|
82
|
+
|
|
83
|
+
if (itemList.length === 0) { return (<></>) }
|
|
53
84
|
|
|
54
85
|
return (
|
|
55
|
-
<span>
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
86
|
+
<span style={{ padding: '0 0 0 10px', display: 'flex' }}>
|
|
87
|
+
{buttonList}
|
|
88
|
+
{
|
|
89
|
+
overlay &&
|
|
90
|
+
<Dropdown overlay={overlay} trigger={['click']}>
|
|
91
|
+
<Button className="kts-invoice-operate-goods-list-columns-row-menu ant-btn-icon-only" type="link">
|
|
92
|
+
<Icon component={SpotSvg} />
|
|
93
|
+
</Button>
|
|
94
|
+
</Dropdown>
|
|
95
|
+
}
|
|
62
96
|
</span>
|
|
63
97
|
);
|
|
64
98
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import InvoiceController from '../../../../InvoiceController'
|
|
4
|
+
|
|
5
|
+
/** 更新 商品序号 */
|
|
6
|
+
export default function useToGenerateId(controller: InvoiceController) {
|
|
7
|
+
|
|
8
|
+
const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
|
|
9
|
+
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
goodsList.forEach((e, i) => { e.serialNo = i + 1 });
|
|
12
|
+
}, [goodsList])
|
|
13
|
+
}
|
|
@@ -13,7 +13,7 @@ import TaxIncludedSwitch from './ui/TaxIncludedSwitch';
|
|
|
13
13
|
import DescribeSwitch from './ui/DescribeSwitch';
|
|
14
14
|
import Search from './ui/Search';
|
|
15
15
|
import TableRow from './ui/TableRow';
|
|
16
|
-
import BulkMenu from './ui/BulkMenu';
|
|
16
|
+
// import BulkMenu from './ui/BulkMenu';
|
|
17
17
|
|
|
18
18
|
import useColumns from './hook/useColumns';
|
|
19
19
|
import useOnRow from './hook/useOnRow';
|
|
@@ -25,6 +25,8 @@ import Invoice from '../../';
|
|
|
25
25
|
import './index.less';
|
|
26
26
|
|
|
27
27
|
import useEndowCodeButton from './ui/BulkMenu/hooks/useEndowCodeButton';
|
|
28
|
+
import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
|
|
29
|
+
import useAddDiscountRowButton from './ui/BulkMenu/hooks/useAddDiscountRowButton';
|
|
28
30
|
|
|
29
31
|
export interface IGoodsListProps {
|
|
30
32
|
/** 扩展部分 */
|
|
@@ -75,6 +77,12 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
75
77
|
/** 批量赋码 */
|
|
76
78
|
const endowCodeButton = useEndowCodeButton();
|
|
77
79
|
|
|
80
|
+
/** 批量删除 */
|
|
81
|
+
const delRowButton = useDelRowButton();
|
|
82
|
+
|
|
83
|
+
/** 添加折扣行 */
|
|
84
|
+
const addDiscountRowButton = useAddDiscountRowButton();
|
|
85
|
+
|
|
78
86
|
/** 清空自动赋码缓存 */
|
|
79
87
|
React.useEffect(() => {
|
|
80
88
|
controller.run(async s => { s.goodsListState.endowCode.cache = {} });
|
|
@@ -116,10 +124,16 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
116
124
|
<AddRowButton />
|
|
117
125
|
|
|
118
126
|
{/* 批量菜单 */}
|
|
119
|
-
<BulkMenu />
|
|
127
|
+
{/* <BulkMenu /> */}
|
|
120
128
|
|
|
121
129
|
{/* 批量赋码 */}
|
|
122
|
-
{endowCodeButton.
|
|
130
|
+
{endowCodeButton.button}
|
|
131
|
+
|
|
132
|
+
{/* 批量删除 */}
|
|
133
|
+
{delRowButton.button}
|
|
134
|
+
|
|
135
|
+
{/* 添加折扣行 */}
|
|
136
|
+
{addDiscountRowButton.drawer}
|
|
123
137
|
|
|
124
138
|
{/* 搜索 */}
|
|
125
139
|
<Search />
|
|
@@ -194,23 +194,12 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
|
|
|
194
194
|
{getFieldDecorator('discount', {
|
|
195
195
|
rules: [
|
|
196
196
|
{ required: true, message: '请输入折扣金额' },
|
|
197
|
-
{
|
|
198
|
-
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
199
|
-
message: '请输入数字',
|
|
200
|
-
},
|
|
197
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
|
|
201
198
|
{
|
|
202
199
|
validator: (_, value: string, callback) => {
|
|
203
|
-
if (!value) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) {
|
|
208
|
-
callback();
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (parseFloat(value) > 100 || parseFloat(value) < 0) {
|
|
212
|
-
callback('请输入大于0小于100的数字');
|
|
213
|
-
}
|
|
200
|
+
if (!value) { callback(); return; }
|
|
201
|
+
if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
|
|
202
|
+
if (parseFloat(value) > 100 || parseFloat(value) < 0) { callback('请输入大于0小于100的数字'); }
|
|
214
203
|
callback();
|
|
215
204
|
},
|
|
216
205
|
},
|
|
@@ -227,26 +216,12 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
|
|
|
227
216
|
{getFieldDecorator('discolineAmountunt', {
|
|
228
217
|
rules: [
|
|
229
218
|
{ required: true, message: '请输入折扣金额' },
|
|
230
|
-
{
|
|
231
|
-
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
232
|
-
message: '请输入数字',
|
|
233
|
-
},
|
|
219
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
|
|
234
220
|
{
|
|
235
221
|
validator: (_, value: string, callback) => {
|
|
236
|
-
if (!value) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) {
|
|
241
|
-
callback();
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
if (
|
|
245
|
-
parseFloat(value) > lineAmountSum ||
|
|
246
|
-
parseFloat(value) < 0
|
|
247
|
-
) {
|
|
248
|
-
callback('请输入大于0小于金额合计的数字');
|
|
249
|
-
}
|
|
222
|
+
if (!value) { callback(); return; }
|
|
223
|
+
if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
|
|
224
|
+
if (parseFloat(value) > lineAmountSum || parseFloat(value) < 0) { callback('请输入大于0小于金额合计的数字'); }
|
|
250
225
|
callback();
|
|
251
226
|
},
|
|
252
227
|
},
|
|
@@ -261,12 +236,8 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
|
|
|
261
236
|
</Form.Item>
|
|
262
237
|
</div>
|
|
263
238
|
<div className="add-discount-row-footer">
|
|
264
|
-
<Button block style={{ marginBottom: 12 }} onClick={onClose}>
|
|
265
|
-
|
|
266
|
-
</Button>
|
|
267
|
-
<Button type="primary" block onClick={onClickSave}>
|
|
268
|
-
保存
|
|
269
|
-
</Button>
|
|
239
|
+
<Button block style={{ marginBottom: 12 }} onClick={onClose}>取消</Button>
|
|
240
|
+
<Button type="primary" block onClick={onClickSave}>保存</Button>
|
|
270
241
|
</div>
|
|
271
242
|
</>
|
|
272
243
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Invoice from '../../../../../../';
|
|
3
3
|
import LineAttributeType from '../../../../../../InvoiceController/InvoiceControllerState/GoodsListState/LineAttributeType';
|
|
4
|
-
import { Menu } from 'kts-components-antd-x3';
|
|
4
|
+
import { Button, Menu } from 'kts-components-antd-x3';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
7
7
|
|
|
@@ -53,5 +53,14 @@ export default () => {
|
|
|
53
53
|
)
|
|
54
54
|
}, [model, onClick, disabled])
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
const button = React.useMemo(() => {
|
|
57
|
+
|
|
58
|
+
if (model === 'prefab') return <></>;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Button onClick={onClick} disabled={disabled} >批量删除</Button>
|
|
62
|
+
)
|
|
63
|
+
}, [model, onClick, disabled])
|
|
64
|
+
|
|
65
|
+
return { button, menuItem };
|
|
57
66
|
};
|
|
@@ -42,7 +42,7 @@ export default () => {
|
|
|
42
42
|
)
|
|
43
43
|
}, [onClick, disabled])
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const button = React.useMemo(() => {
|
|
46
46
|
return (
|
|
47
47
|
<Button onClick={onClick} disabled={disabled}>
|
|
48
48
|
批量赋码
|
|
@@ -50,5 +50,5 @@ export default () => {
|
|
|
50
50
|
)
|
|
51
51
|
}, [onClick, disabled])
|
|
52
52
|
|
|
53
|
-
return { menuItem,
|
|
53
|
+
return { menuItem, button };
|
|
54
54
|
};
|