kts-component-invoice-operate 1.2.22 → 2.0.1
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/d.dio +2 -69
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.d.ts → EndowCode/index.d.ts} +2 -2
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.d.ts → IGood/index.d.ts} +15 -5
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.d.ts → ImportGoods/index.d.ts} +0 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.d.ts → LineAttributeType/index.d.ts} +0 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.d.ts +7 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +9 -0
- package/dist/Invoice/InvoiceController/fns/getGoodsSearch.d.ts +2 -0
- package/dist/Invoice/InvoiceController/index.d.ts +3 -0
- package/dist/Invoice/index.d.ts +1 -1
- package/dist/Invoice/tools/itemName/index.d.ts +14 -0
- package/dist/Invoice/ui/AddComparisonDrawer/index.d.ts +3 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +4 -0
- package/dist/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.d.ts +4 -2
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.d.ts +4 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +4 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +4 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/{DelRowButton → DescribeSwitch}/index.d.ts +0 -0
- package/dist/Invoice/ui/GoodsList/ui/Search/index.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1650 -615
- package/dist/index.js +1649 -614
- package/docs/index.md +1 -1
- package/package.json +6 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.tsx → EndowCode/index.tsx} +3 -3
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.ts → IGood/index.ts} +20 -5
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.ts → ImportGoods/index.ts} +0 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.ts → LineAttributeType/index.ts} +0 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +10 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +14 -1
- package/src/Invoice/InvoiceController/fns/getGoodsSearch.ts +17 -0
- package/src/Invoice/InvoiceController/index.ts +4 -0
- package/src/Invoice/_test/importGoods/index.tsx +21 -3
- package/src/Invoice/index.tsx +5 -1
- package/src/Invoice/tools/itemName/index.ts +48 -0
- package/src/Invoice/ui/AddComparisonDrawer/index.tsx +175 -0
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +6 -17
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +15 -0
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +100 -32
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.tsx +39 -0
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +5 -2
- package/src/Invoice/ui/GoodsList/hook/useRowSelection/index.tsx +34 -8
- package/src/Invoice/ui/GoodsList/index.less +42 -37
- package/src/Invoice/ui/GoodsList/index.tsx +21 -17
- package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +5 -2
- package/src/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.less +0 -0
- package/src/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.tsx +20 -17
- package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +80 -0
- package/src/Invoice/ui/GoodsList/ui/{DelRowButton → BulkMenu/hooks/useDelRowButton}/index.tsx +15 -7
- package/src/Invoice/ui/GoodsList/ui/{EndowCodeButton → BulkMenu/hooks/useEndowCodeButton}/index.tsx +13 -9
- package/src/Invoice/ui/GoodsList/ui/BulkMenu/index.tsx +43 -0
- package/src/Invoice/ui/GoodsList/ui/DescribeSwitch/index.tsx +37 -0
- package/src/Invoice/ui/GoodsList/ui/Search/icon/magnifier.svg +1 -0
- package/src/Invoice/ui/GoodsList/ui/Search/index.less +10 -0
- package/src/Invoice/ui/GoodsList/ui/Search/index.tsx +47 -0
- package/src/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -2
- package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +70 -18
- package/src/index.ts +1 -0
- package/yarn.e.lock +14331 -0
- package/yarn.o.lock +14800 -0
- package/dist/Invoice/ui/GoodsList/ui/EndowCodeButton/index.d.ts +0 -2
- package/docs-dist/404.html +0 -33
- package/docs-dist/index.html +0 -33
- package/docs-dist/static/auto.a6cd905c.svg +0 -1
- package/docs-dist/static/spot.42e620e1.svg +0 -1
- package/docs-dist/umi.css +0 -20
- package/docs-dist/umi.js +0 -1
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Form, AutoComplete, Select, Typography, Button, Input, Spin } from 'kts-components-antd-x3';
|
|
3
3
|
import { InputProps } from 'kts-components-antd-x3/lib/input';
|
|
4
4
|
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
5
|
-
import Invoice from '../../../../';
|
|
6
5
|
import { IGood } from '../../../../InvoiceController';
|
|
6
|
+
import Invoice from '../../../../';
|
|
7
7
|
import RowMenu from './ui/RowMenu';
|
|
8
8
|
import {
|
|
9
9
|
onChangeQuantity,
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
onChangeLineAmountIncludeTax,
|
|
13
13
|
onChangeLineAmountExcludeTax,
|
|
14
14
|
onChangeTaxRate,
|
|
15
|
-
onSaveEditGood,
|
|
15
|
+
// onSaveEditGood,
|
|
16
16
|
endowCode,
|
|
17
|
+
onChangeItemName,
|
|
17
18
|
} from './autoFillFn';
|
|
18
19
|
|
|
19
20
|
const { Text } = Typography;
|
|
@@ -26,9 +27,15 @@ export default (form: WrappedFormUtils) => {
|
|
|
26
27
|
/** 是否含税 */
|
|
27
28
|
const isTaxIncluded = controller.useMemo(e => e.goodsListState.isTaxIncluded, []);
|
|
28
29
|
|
|
30
|
+
/** 是否显示我方 */
|
|
31
|
+
const isMyShow = controller.useMemo(e => e.goodsListState.isMyShow, []);
|
|
32
|
+
|
|
29
33
|
/** 正在编辑的货物 */
|
|
30
34
|
const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
|
|
31
35
|
|
|
36
|
+
/** 搜索条件 */
|
|
37
|
+
const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
|
|
38
|
+
|
|
32
39
|
/** 税率列表 */
|
|
33
40
|
const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
|
|
34
41
|
|
|
@@ -50,21 +57,30 @@ export default (form: WrappedFormUtils) => {
|
|
|
50
57
|
<Text type="danger">*</Text>货物名称
|
|
51
58
|
</>
|
|
52
59
|
),
|
|
53
|
-
dataIndex: 'itemName',
|
|
54
60
|
key: 'itemName',
|
|
55
|
-
render: (
|
|
61
|
+
render: (_: string, record: IGood) => {
|
|
56
62
|
if (editGood?.$index === record.$index) {
|
|
57
63
|
return (
|
|
58
64
|
<Form.Item>
|
|
59
65
|
<div style={{ display: 'flex' }} >
|
|
60
66
|
{getFieldDecorator('itemName', {
|
|
61
|
-
initialValue:
|
|
62
|
-
rules: [{
|
|
67
|
+
initialValue: isMyShow ? record.itemName : record.itemNameOther,
|
|
68
|
+
rules: [{
|
|
69
|
+
validator: async (_, __, callback) => {
|
|
70
|
+
await controller.wait();
|
|
71
|
+
const value = controller.state.goodsListState.editGood;
|
|
72
|
+
if (!value?.itemName && !value?.itemNameOther) {
|
|
73
|
+
callback('货物名称不能为空');
|
|
74
|
+
} else {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}]
|
|
63
79
|
})(
|
|
64
80
|
<MyInput
|
|
65
81
|
style={{ flex: 1 }}
|
|
66
82
|
onChange={() => {
|
|
67
|
-
|
|
83
|
+
onChangeItemName(controller, form, record);
|
|
68
84
|
}}
|
|
69
85
|
/>,
|
|
70
86
|
)}
|
|
@@ -80,11 +96,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
80
96
|
)}
|
|
81
97
|
{controller.getGoodsList && (
|
|
82
98
|
<Button
|
|
83
|
-
onClick={() => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})();
|
|
87
|
-
}}
|
|
99
|
+
onClick={controller.pipeline(async (s) => {
|
|
100
|
+
s.goodsListState.importGoods.isVisibleDrawer = true;
|
|
101
|
+
})}
|
|
88
102
|
type="link"
|
|
89
103
|
icon="plus-circle"
|
|
90
104
|
/>
|
|
@@ -94,41 +108,59 @@ export default (form: WrappedFormUtils) => {
|
|
|
94
108
|
</Form.Item>
|
|
95
109
|
);
|
|
96
110
|
} else {
|
|
97
|
-
return
|
|
111
|
+
return (
|
|
112
|
+
<MyItemNameDiv
|
|
113
|
+
valueT={formatSearch(record.itemName, searchValue)}
|
|
114
|
+
valueF={record.itemNameOther}
|
|
115
|
+
isMyShow={isMyShow}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
// return (
|
|
119
|
+
// <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>
|
|
120
|
+
// );
|
|
98
121
|
}
|
|
99
122
|
},
|
|
100
123
|
},
|
|
101
124
|
{
|
|
102
125
|
title: '货物规格型号',
|
|
103
|
-
dataIndex: 'itemModelName',
|
|
104
126
|
key: 'itemModelName',
|
|
105
127
|
width: 119,
|
|
106
|
-
render: (
|
|
128
|
+
render: (_: string, record: IGood) => {
|
|
107
129
|
if (editGood?.$index === record.$index) {
|
|
108
130
|
return (
|
|
109
131
|
<Form.Item>
|
|
110
132
|
{getFieldDecorator('itemModelName', {
|
|
111
|
-
initialValue: editGood.itemModelName,
|
|
133
|
+
initialValue: isMyShow ? editGood.itemModelName : editGood.itemModelNameOther,
|
|
112
134
|
})(
|
|
113
135
|
<MyInput
|
|
114
|
-
onChange={() => {
|
|
115
|
-
|
|
136
|
+
onChange={async () => {
|
|
137
|
+
await controller.wait()
|
|
138
|
+
const key = isMyShow ? 'itemModelName' : 'itemModelNameOther';
|
|
139
|
+
const value = {} as any;
|
|
140
|
+
value[key] = form.getFieldsValue().itemModelName;
|
|
141
|
+
controller.setEditGood(value);
|
|
116
142
|
}}
|
|
117
143
|
/>,
|
|
118
144
|
)}
|
|
119
145
|
</Form.Item>
|
|
120
146
|
);
|
|
121
147
|
} else {
|
|
122
|
-
return
|
|
148
|
+
return (
|
|
149
|
+
<MyItemNameDiv
|
|
150
|
+
valueT={formatSearch(record.itemModelName, searchValue)}
|
|
151
|
+
valueF={formatSearch(record.itemModelNameOther, searchValue)}
|
|
152
|
+
isMyShow={isMyShow}
|
|
153
|
+
/>
|
|
154
|
+
)
|
|
155
|
+
// return <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>;
|
|
123
156
|
}
|
|
124
157
|
},
|
|
125
158
|
},
|
|
126
159
|
{
|
|
127
160
|
title: '单位',
|
|
128
|
-
dataIndex: 'unit',
|
|
129
161
|
key: 'unit',
|
|
130
162
|
width: 70,
|
|
131
|
-
render: (
|
|
163
|
+
render: (_: string, record: IGood) => {
|
|
132
164
|
if (editGood?.$index === record.$index) {
|
|
133
165
|
return (
|
|
134
166
|
<Form.Item>
|
|
@@ -138,15 +170,19 @@ export default (form: WrappedFormUtils) => {
|
|
|
138
170
|
<AutoComplete
|
|
139
171
|
style={{ width: '100%' }}
|
|
140
172
|
dataSource={unitList}
|
|
141
|
-
onChange={() => {
|
|
142
|
-
|
|
173
|
+
onChange={async () => {
|
|
174
|
+
await controller.wait()
|
|
175
|
+
const key = isMyShow ? 'unit' : 'unitOther';
|
|
176
|
+
const value = {} as any;
|
|
177
|
+
value[key] = form.getFieldsValue().unit;
|
|
178
|
+
controller.setEditGood(value);
|
|
143
179
|
}}
|
|
144
180
|
/>,
|
|
145
181
|
)}
|
|
146
182
|
</Form.Item>
|
|
147
183
|
);
|
|
148
184
|
} else {
|
|
149
|
-
return <
|
|
185
|
+
return <MyItemNameDiv valueT={record.unit} valueF={record.unitOther} isMyShow={isMyShow} />;
|
|
150
186
|
}
|
|
151
187
|
},
|
|
152
188
|
},
|
|
@@ -323,7 +359,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
323
359
|
</Form.Item>
|
|
324
360
|
);
|
|
325
361
|
} else {
|
|
326
|
-
return <span style={{ padding: '0 10px' }}>{parseFloat(value).toFixed(2)}</span>;
|
|
362
|
+
return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
|
|
327
363
|
}
|
|
328
364
|
},
|
|
329
365
|
},
|
|
@@ -444,13 +480,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
444
480
|
]
|
|
445
481
|
.filter((e) => {
|
|
446
482
|
if (isTaxIncluded) {
|
|
447
|
-
return !(
|
|
448
|
-
e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax'
|
|
449
|
-
);
|
|
483
|
+
return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
|
|
450
484
|
} else {
|
|
451
|
-
return !(
|
|
452
|
-
e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax'
|
|
453
|
-
);
|
|
485
|
+
return !(e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax');
|
|
454
486
|
}
|
|
455
487
|
})
|
|
456
488
|
.map((e) => {
|
|
@@ -459,7 +491,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
459
491
|
ellipsis: true,
|
|
460
492
|
};
|
|
461
493
|
}) as any[];
|
|
462
|
-
}, [isTaxIncluded, editGood, controller, changeField, deduction]);
|
|
494
|
+
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue]);
|
|
463
495
|
|
|
464
496
|
React.useEffect(() => {
|
|
465
497
|
if (!changeField) return;
|
|
@@ -499,3 +531,39 @@ class MyDiv extends React.Component<{ value?: any }> {
|
|
|
499
531
|
return <span style={{ padding: '0 10px' }}>{this.props.value}</span>;
|
|
500
532
|
}
|
|
501
533
|
}
|
|
534
|
+
|
|
535
|
+
class MyItemNameDiv extends React.Component<{ valueT?: React.ReactNode, valueF?: React.ReactNode, isMyShow: boolean }> {
|
|
536
|
+
render(): React.ReactNode {
|
|
537
|
+
|
|
538
|
+
const { isMyShow, valueT, valueF } = this.props;
|
|
539
|
+
|
|
540
|
+
if (isMyShow) {
|
|
541
|
+
if (valueT) {
|
|
542
|
+
return (
|
|
543
|
+
<span style={{ padding: '0 10px', color: '#0074ff' }}>{valueT}</span>
|
|
544
|
+
)
|
|
545
|
+
} else {
|
|
546
|
+
return (
|
|
547
|
+
<span style={{ padding: '0 10px' }}>{valueF}</span>
|
|
548
|
+
)
|
|
549
|
+
}
|
|
550
|
+
} else {
|
|
551
|
+
if (valueF) {
|
|
552
|
+
return (
|
|
553
|
+
<span style={{ padding: '0 10px' }}>{valueF}</span>
|
|
554
|
+
)
|
|
555
|
+
} else {
|
|
556
|
+
return (
|
|
557
|
+
<span style={{ padding: '0 10px', color: '#0074ff' }}>{valueT}</span>
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
/** 格式搜索结果 */
|
|
564
|
+
function formatSearch(value?: string, search?: string) {
|
|
565
|
+
if (!value || !search) return value;
|
|
566
|
+
|
|
567
|
+
const __html = value.split(new RegExp(search, 'g')).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
|
|
568
|
+
return <span dangerouslySetInnerHTML={{ __html }} />
|
|
569
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** 添加商品对照 */
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Menu, message, Typography } from 'kts-components-antd-x3';
|
|
5
|
+
import { IGood } from '../../../../../../../../InvoiceController';
|
|
6
|
+
import Invoice from '../../../../../../../../';
|
|
7
|
+
|
|
8
|
+
const { Text } = Typography;
|
|
9
|
+
|
|
10
|
+
export default (goods: IGood) => {
|
|
11
|
+
|
|
12
|
+
const controller = Invoice.useInvoiceController();
|
|
13
|
+
|
|
14
|
+
const productComparison = controller.useMemo(s => s.goodsListState.productComparison, []);
|
|
15
|
+
|
|
16
|
+
const onClick = React.useCallback(async () => {
|
|
17
|
+
await controller.saveEditGood();
|
|
18
|
+
await controller.wait();
|
|
19
|
+
await controller.run(async s => {
|
|
20
|
+
if (s.goodsListState.form) {
|
|
21
|
+
const err: any = s.goodsListState.form.getFieldsError();
|
|
22
|
+
for (let key in err) {
|
|
23
|
+
if (!err[key]) continue;
|
|
24
|
+
message.error(err[key][0]);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
s.goodsListState.addComparisonIndex = goods.$index;
|
|
29
|
+
})
|
|
30
|
+
}, [controller, goods.$index]);
|
|
31
|
+
|
|
32
|
+
return React.useMemo(() => {
|
|
33
|
+
if (productComparison.onComply) {
|
|
34
|
+
return <Menu.Item key="delItem" onClick={onClick}><Text strong>添加商品对照</Text></Menu.Item>
|
|
35
|
+
} else {
|
|
36
|
+
return <></>
|
|
37
|
+
}
|
|
38
|
+
}, [onClick, productComparison])
|
|
39
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ReactComponent as SpotSvg } from './spot.svg';
|
|
|
5
5
|
import useDelItem from './hook/useDelItem';
|
|
6
6
|
import useAddDiscount from './hook/useAddDiscount';
|
|
7
7
|
import useEndowCode from './hook/useEndowCode';
|
|
8
|
+
import useAddComparison from './hook/useAddComparison';
|
|
8
9
|
import './index.less';
|
|
9
10
|
import Invoice from '../../../../../../';
|
|
10
11
|
|
|
@@ -22,13 +23,15 @@ export default (props: { goods: IGood }) => {
|
|
|
22
23
|
const delItem = useDelItem(props.goods);
|
|
23
24
|
const addDiscount = useAddDiscount(props.goods);
|
|
24
25
|
const endowCode = useEndowCode(props.goods);
|
|
26
|
+
const addComparison = useAddComparison(props.goods);
|
|
25
27
|
|
|
26
28
|
const itemList = React.useMemo(() => {
|
|
27
29
|
const arr: any[] = [];
|
|
28
30
|
|
|
29
31
|
model !=='prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
arr.push(addComparison); // 添加商品对照
|
|
33
|
+
endowCode && arr.push(endowCode); // 赋码
|
|
34
|
+
model !=='prefab' && delItem && arr.push(delItem); // 删除
|
|
32
35
|
|
|
33
36
|
if (!goodsMenuExpand || goodsMenuExpand.length === 0) return arr;
|
|
34
37
|
|
|
@@ -15,20 +15,46 @@ export default () => {
|
|
|
15
15
|
/** 货物列表 */
|
|
16
16
|
const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
|
|
17
17
|
|
|
18
|
+
/** 搜索条件 */
|
|
19
|
+
const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
|
|
20
|
+
|
|
18
21
|
/** 是否全选 */
|
|
19
|
-
const isAll = controller.useMemo(s => s.goodsListState.goodsList.length > 0 && s.goodsListState.selectedGoodIndex.length === s.goodsListState.goodsList.length, [])
|
|
22
|
+
// const isAll = controller.useMemo(s => s.goodsListState.goodsList.length > 0 && s.goodsListState.selectedGoodIndex.length === s.goodsListState.goodsList.length, [])
|
|
23
|
+
const isAll = controller.useMemo(s => {
|
|
24
|
+
if (s.goodsListState.selectedGoodIndex.length <= 0) return false;
|
|
25
|
+
const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index);
|
|
26
|
+
const selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
|
|
27
|
+
return selectedGoodIndex.length === seeGoodsIndex.length
|
|
28
|
+
}, [])
|
|
29
|
+
|
|
30
|
+
const indeterminate = controller.useMemo(s => {
|
|
31
|
+
const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index);
|
|
32
|
+
const selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
|
|
33
|
+
if (selectedGoodIndex.length === 0) return false;
|
|
34
|
+
return selectedGoodIndex.length < seeGoodsIndex.length
|
|
35
|
+
}, [])
|
|
20
36
|
|
|
21
37
|
/** 点击了全选 */
|
|
22
|
-
const onClickSelectAll = React.useCallback(() => {
|
|
38
|
+
const onClickSelectAll = React.useCallback(async () => {
|
|
23
39
|
if (isAll) {
|
|
24
|
-
controller.pipeline(async s => {
|
|
25
|
-
s.goodsListState.
|
|
40
|
+
await controller.pipeline(async s => {
|
|
41
|
+
const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index)
|
|
42
|
+
|
|
43
|
+
s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e=>!seeGoodsIndex.some(t => e === t));
|
|
26
44
|
})()
|
|
27
45
|
} else {
|
|
28
|
-
controller.pipeline(async s => {
|
|
29
|
-
|
|
46
|
+
// controller.pipeline(async s => {
|
|
47
|
+
// s.goodsListState.selectedGoodIndex = s.goodsListState.goodsList.map(e => e.$index);
|
|
48
|
+
// })()
|
|
49
|
+
|
|
50
|
+
await controller.pipeline(async s => {
|
|
51
|
+
const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index)
|
|
52
|
+
|
|
53
|
+
s.goodsListState.selectedGoodIndex = [...s.goodsListState.selectedGoodIndex, ...seeGoodsIndex];
|
|
54
|
+
s.goodsListState.selectedGoodIndex = Array.from(new Set(s.goodsListState.selectedGoodIndex));
|
|
30
55
|
})()
|
|
31
56
|
}
|
|
57
|
+
await sortOut(true);
|
|
32
58
|
}, [controller, isAll])
|
|
33
59
|
|
|
34
60
|
const onSelect = React.useCallback(async (record, selected) => {
|
|
@@ -50,11 +76,11 @@ export default () => {
|
|
|
50
76
|
return (
|
|
51
77
|
<Checkbox
|
|
52
78
|
onChange={onClickSelectAll}
|
|
53
|
-
indeterminate={
|
|
79
|
+
indeterminate={indeterminate}
|
|
54
80
|
checked={isAll}
|
|
55
81
|
></Checkbox>
|
|
56
82
|
)
|
|
57
|
-
}, [goodsList, selectedRowKeys, onClickSelectAll, isAll])
|
|
83
|
+
}, [goodsList, selectedRowKeys, onClickSelectAll, isAll, indeterminate])
|
|
58
84
|
|
|
59
85
|
/** 选择了商品后 调整 折扣行 和 被折扣行 */
|
|
60
86
|
const sortOut = React.useCallback(async (selected: boolean) => {
|
|
@@ -7,46 +7,45 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.kts-invoice-operate-goods-list-able {
|
|
10
|
-
display: flex;
|
|
11
|
-
padding: 10px;
|
|
10
|
+
display : flex;
|
|
11
|
+
padding : 10px;
|
|
12
12
|
border-bottom: 1px solid #dcdcdc;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.kts-invoice-operate-goods-list-able-list {
|
|
16
|
-
flex: 1;
|
|
16
|
+
flex : 1;
|
|
17
|
+
display : flex;
|
|
18
|
+
gap : 10px;
|
|
19
|
+
padding-right: 10px;
|
|
17
20
|
|
|
18
21
|
button {
|
|
19
|
-
padding-left: 10px;
|
|
22
|
+
padding-left : 10px;
|
|
20
23
|
padding-right: 10px;
|
|
21
24
|
border-radius: 12px;
|
|
22
|
-
color: #0074ff;
|
|
23
|
-
border: 1px solid #0074ff;
|
|
24
|
-
|
|
25
|
-
height:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
font-size: 12px;
|
|
25
|
+
color : #0074ff;
|
|
26
|
+
border : 1px solid #0074ff;
|
|
27
|
+
height : 24px;
|
|
28
|
+
line-height : 22px;
|
|
29
|
+
cursor : pointer;
|
|
30
|
+
font-size : 12px;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
button[disabled] {
|
|
32
|
-
color: rgba(0, 0, 0, 0.25);
|
|
34
|
+
color : rgba(0, 0, 0, 0.25);
|
|
33
35
|
border: 1px solid;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.kts-invoice-operate-goods-list-able-extend {
|
|
38
|
-
flex: none;
|
|
40
|
+
flex : none;
|
|
39
41
|
display: flex;
|
|
40
|
-
|
|
41
|
-
label {
|
|
42
|
-
margin-right: 5px;
|
|
43
|
-
}
|
|
42
|
+
gap : 5px;
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab{
|
|
48
|
-
.ktsAnt3x-table-row{
|
|
49
|
-
color: rgba(0, 0, 0, 0.25);
|
|
46
|
+
.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab {
|
|
47
|
+
.ktsAnt3x-table-row {
|
|
48
|
+
color : rgba(0, 0, 0, 0.25);
|
|
50
49
|
background: #f5f5f5;
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
border-bottom: 1px solid #dcdcdc;
|
|
56
55
|
|
|
57
56
|
.kts-invoice-operate-goods-discount {
|
|
58
|
-
color: rgba(0, 0, 0, 0.25);
|
|
57
|
+
color : rgba(0, 0, 0, 0.25);
|
|
59
58
|
background: #f5f5f5;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -63,15 +62,15 @@
|
|
|
63
62
|
display: flex;
|
|
64
63
|
|
|
65
64
|
.ktsAnt3x-btn {
|
|
66
|
-
display: block;
|
|
67
|
-
line-height: 0;
|
|
68
|
-
width: auto;
|
|
65
|
+
display : block;
|
|
66
|
+
line-height : 0;
|
|
67
|
+
width : auto;
|
|
69
68
|
padding-right: 5px;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
.ktsAnt3x-form-item-children {
|
|
74
|
-
height: 30px;
|
|
73
|
+
height : 30px;
|
|
75
74
|
display: block;
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -81,8 +80,8 @@
|
|
|
81
80
|
|
|
82
81
|
.ktsAnt3x-form-explain {
|
|
83
82
|
position: absolute;
|
|
84
|
-
right: 6px;
|
|
85
|
-
top: 6px;
|
|
83
|
+
right : 6px;
|
|
84
|
+
top : 6px;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
table {
|
|
@@ -98,7 +97,7 @@
|
|
|
98
97
|
|
|
99
98
|
.ktsAnt3x-form-item {
|
|
100
99
|
padding: 0;
|
|
101
|
-
margin: 0;
|
|
100
|
+
margin : 0;
|
|
102
101
|
|
|
103
102
|
.ktsAnt3x-form-item-control {
|
|
104
103
|
line-height: inherit;
|
|
@@ -108,22 +107,28 @@
|
|
|
108
107
|
.has-error .ktsAnt3x-select-selection,
|
|
109
108
|
.has-error .ktsAnt3x-input,
|
|
110
109
|
.has-error .ktsAnt3x-input:hover {
|
|
111
|
-
border-right-width: 1px !important;
|
|
112
|
-
border-top-width: 1px;
|
|
113
|
-
border-left-width: 1px;
|
|
110
|
+
border-right-width : 1px !important;
|
|
111
|
+
border-top-width : 1px;
|
|
112
|
+
border-left-width : 1px;
|
|
114
113
|
border-bottom-width: 1px;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
.ktsAnt3x-select-selection--single,
|
|
118
117
|
.ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,
|
|
119
118
|
.ktsAnt3x-input {
|
|
120
|
-
height: 30px;
|
|
121
|
-
border-radius: 0;
|
|
122
|
-
border-right-width: 0 !important;
|
|
123
|
-
border-top-width: 0;
|
|
124
|
-
border-left-width: 0;
|
|
119
|
+
height : 30px;
|
|
120
|
+
border-radius : 0;
|
|
121
|
+
border-right-width : 0 !important;
|
|
122
|
+
border-top-width : 0;
|
|
123
|
+
border-left-width : 0;
|
|
125
124
|
border-bottom-width: 0;
|
|
126
|
-
box-shadow: none;
|
|
125
|
+
box-shadow : none;
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
}
|
|
129
|
+
|
|
130
|
+
.kts-invoice-operate-goods-list-table-search-protrude {
|
|
131
|
+
background : #ff0;
|
|
132
|
+
color : #000;
|
|
133
|
+
font-weight: bold;
|
|
134
|
+
}
|
|
@@ -10,10 +10,10 @@ import TableVirtual from './ui/TableVirtual';
|
|
|
10
10
|
import Statistics from './ui/Statistics';
|
|
11
11
|
import AddRowButton from './ui/AddRowButton';
|
|
12
12
|
import TaxIncludedSwitch from './ui/TaxIncludedSwitch';
|
|
13
|
+
import DescribeSwitch from './ui/DescribeSwitch';
|
|
14
|
+
import Search from './ui/Search';
|
|
13
15
|
import TableRow from './ui/TableRow';
|
|
14
|
-
import
|
|
15
|
-
import EndowCodeButton from './ui/EndowCodeButton';
|
|
16
|
-
import DelRowButton from './ui/DelRowButton';
|
|
16
|
+
import BulkMenu from './ui/BulkMenu';
|
|
17
17
|
|
|
18
18
|
import useColumns from './hook/useColumns';
|
|
19
19
|
import useOnRow from './hook/useOnRow';
|
|
@@ -56,6 +56,12 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
56
56
|
|
|
57
57
|
const isprefab = controller.useMemo(s => s.model === 'prefab', []);
|
|
58
58
|
|
|
59
|
+
const dataSource = controller.useMemo(s => s.goodsListState.goodsList, [])
|
|
60
|
+
|
|
61
|
+
const searchValue = controller.useMemo(s => s.goodsListState.searchValue, [])
|
|
62
|
+
|
|
63
|
+
const dataSourceSearch = React.useMemo(() => controller.getGoodsSearch(dataSource, searchValue), [dataSource, searchValue, controller])
|
|
64
|
+
|
|
59
65
|
/** 表格行事件 */
|
|
60
66
|
const onRow = useOnRow();
|
|
61
67
|
|
|
@@ -69,17 +75,15 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
69
75
|
|
|
70
76
|
/** 注册 from 对象 */
|
|
71
77
|
React.useEffect(() => {
|
|
72
|
-
controller.pipeline<WrappedFormUtils>(async (s, form) => {
|
|
73
|
-
s.goodsListState = { ...s.goodsListState, form };
|
|
74
|
-
})(props.form);
|
|
78
|
+
controller.pipeline<WrappedFormUtils>(async (s, form) => { s.goodsListState = { ...s.goodsListState, form } })(props.form);
|
|
75
79
|
}, [controller, props.form]);
|
|
76
80
|
|
|
77
81
|
// 跟新 货物
|
|
78
82
|
React.useEffect(() => {
|
|
79
|
-
controller.
|
|
83
|
+
controller.run(async (s) => {
|
|
80
84
|
s.goodsListState.goodsMap = new Map();
|
|
81
85
|
goodsList.forEach((e) => { s.goodsListState.goodsMap.set(e.$index, e); });
|
|
82
|
-
})
|
|
86
|
+
});
|
|
83
87
|
}, [controller, goodsList]);
|
|
84
88
|
|
|
85
89
|
/** props 产品最大数 更新 */
|
|
@@ -104,20 +108,20 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
104
108
|
{/* 添加行 */}
|
|
105
109
|
<AddRowButton />
|
|
106
110
|
|
|
107
|
-
{/*
|
|
108
|
-
<
|
|
111
|
+
{/* 批量菜单 */}
|
|
112
|
+
<BulkMenu />
|
|
109
113
|
|
|
110
|
-
{/*
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
{/* 批量赋码 */}
|
|
114
|
-
<EndowCodeButton />
|
|
114
|
+
{/* 搜索 */}
|
|
115
|
+
<Search />
|
|
115
116
|
</div>
|
|
116
117
|
<div className="kts-invoice-operate-goods-list-able-extend">
|
|
117
118
|
|
|
118
119
|
{/* 扩展部分 */}
|
|
119
120
|
{props.menuExpansion}
|
|
120
121
|
|
|
122
|
+
{/* 使用哪方商品描述 */}
|
|
123
|
+
<DescribeSwitch />
|
|
124
|
+
|
|
121
125
|
{/* 是否含税开关 */}
|
|
122
126
|
<TaxIncludedSwitch />
|
|
123
127
|
</div>
|
|
@@ -130,10 +134,10 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
130
134
|
pagination={false}
|
|
131
135
|
scroll={{ y: 540 }}
|
|
132
136
|
components={{ body: { row: TableRow } }}
|
|
133
|
-
dataSource={
|
|
137
|
+
dataSource={dataSourceSearch}
|
|
134
138
|
columns={useColumns(props.form)}
|
|
135
139
|
rowSelection={useRowSelection()}
|
|
136
|
-
onRow={
|
|
140
|
+
onRow={record => ({
|
|
137
141
|
onClick: () => {
|
|
138
142
|
onRow.onClick(record);
|
|
139
143
|
},
|
|
@@ -11,13 +11,16 @@ export default () => {
|
|
|
11
11
|
/** 产品数据量 */
|
|
12
12
|
const goodsNum = controller.useMemo(s => s.goodsListState.goodsList.length, []);
|
|
13
13
|
|
|
14
|
+
/** 搜索条件 */
|
|
15
|
+
const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
|
|
16
|
+
|
|
14
17
|
/** 产品最大数 */
|
|
15
18
|
const goodMax = controller.useMemo(s => s.goodsListState.goodMax, []);
|
|
16
19
|
|
|
17
20
|
/** 按钮是否禁用 */
|
|
18
21
|
const disabled = React.useMemo(() => {
|
|
19
|
-
return typeof goodMax === 'number' ? goodsNum >= goodMax :
|
|
20
|
-
}, [goodMax, goodsNum])
|
|
22
|
+
return typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue;
|
|
23
|
+
}, [goodMax, goodsNum, searchValue])
|
|
21
24
|
|
|
22
25
|
const onClick = React.useCallback(async () => {
|
|
23
26
|
await controller.saveEditGood();
|
|
File without changes
|