kts-component-invoice-operate 3.2.153 → 3.2.155
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 +6 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +4 -0
- package/dist/Invoice/InvoiceController/index.d.ts +2 -0
- package/dist/Invoice/_test/children/index.d.ts +4 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/index.d.ts +6 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useRowSelection/index.d.ts +6 -0
- package/dist/index.esm.js +498 -185
- package/dist/index.js +497 -184
- package/docs-dist/static/I001.4ff48f20.svg +1 -0
- package/docs-dist/static/I002.38b94da1.svg +1 -0
- package/docs-dist/umi.css +1 -1
- package/docs-dist/umi.js +1 -1
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +9 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +6 -0
- package/src/Invoice/InvoiceController/fns/saveEditGood.ts +1 -1
- package/src/Invoice/InvoiceController/index.ts +4 -0
- package/src/Invoice/_test/children/index.tsx +203 -0
- package/src/Invoice/index.md +3 -0
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +39 -3
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +15 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/index.tsx +53 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/svg/I001.svg +1 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/svg/I002.svg +1 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +1 -0
- package/src/Invoice/ui/default/GoodsList/hook/useOnRow/index.tsx +13 -0
- package/src/Invoice/ui/default/GoodsList/hook/useRowSelection/index.tsx +8 -2
- package/src/Invoice/ui/default/GoodsList/index.less +8 -1
- package/src/Invoice/ui/default/GoodsList/ui/TableVirtual/index.tsx +35 -12
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +14 -11
- package/src/Invoice/ui/digtal/GoodsList/hook/useOnRow/index.tsx +13 -1
package/package.json
CHANGED
|
@@ -4,6 +4,9 @@ export default interface IGood {
|
|
|
4
4
|
/** 数据索引 */
|
|
5
5
|
$index: string;
|
|
6
6
|
|
|
7
|
+
/** 级别 */
|
|
8
|
+
level?: number;
|
|
9
|
+
|
|
7
10
|
/** 序号 */
|
|
8
11
|
serialNo?: number;
|
|
9
12
|
|
|
@@ -52,6 +55,9 @@ export default interface IGood {
|
|
|
52
55
|
/** 金额(不含税) */
|
|
53
56
|
lineAmountExcludeTax?: number;
|
|
54
57
|
|
|
58
|
+
/** 税率列表 */
|
|
59
|
+
goodsTaxRateList?: number[] | null;
|
|
60
|
+
|
|
55
61
|
/** 税率 */
|
|
56
62
|
taxRate?: number;
|
|
57
63
|
|
|
@@ -75,4 +81,7 @@ export default interface IGood {
|
|
|
75
81
|
|
|
76
82
|
/** 税收分类名称 */
|
|
77
83
|
productName?: string;
|
|
84
|
+
|
|
85
|
+
/** 孩子 */
|
|
86
|
+
children?: IGood[];
|
|
78
87
|
}
|
|
@@ -21,6 +21,9 @@ export default class GoodsListState {
|
|
|
21
21
|
/** 切换含税时是否重新计算 */
|
|
22
22
|
isRecalculateWhenSwitchTax = false;
|
|
23
23
|
|
|
24
|
+
/** 是否根据税收分类编码改变商品的可选税率 */
|
|
25
|
+
isUpdateGoodsTaxRateList = false;
|
|
26
|
+
|
|
24
27
|
/** 是否能添加折扣行 */
|
|
25
28
|
isAddDiscount?: boolean;
|
|
26
29
|
|
|
@@ -74,6 +77,9 @@ export default class GoodsListState {
|
|
|
74
77
|
/** 货物字典 */
|
|
75
78
|
goodsMap = new Map<string, IGood>();
|
|
76
79
|
|
|
80
|
+
/** 子级展开的货物 */
|
|
81
|
+
expandedRowKeys: string[] = [];
|
|
82
|
+
|
|
77
83
|
/** 货物菜单扩展 */
|
|
78
84
|
goodsMenuExpand: ((index: string, controller: InvoiceController) => React.ReactNode)[] = [];
|
|
79
85
|
|
|
@@ -78,4 +78,8 @@ export default class InvoiceController extends InvoiceControllerForm {
|
|
|
78
78
|
|
|
79
79
|
/** 获取筛选后的列表 */
|
|
80
80
|
getGoodsSearch = getGoodsSearch;
|
|
81
|
+
|
|
82
|
+
/** 获取货物的税率可选列表, 如果没传taxClassificationCode,返回undefined */
|
|
83
|
+
getGoodsTaxRateList?: (taxClassificationCode: string) => Promise<number[] | undefined | null>;
|
|
84
|
+
|
|
81
85
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Invoice } from '../../..';
|
|
3
|
+
import 'antd/dist/antd.css';
|
|
4
|
+
import { LineAttributeType } from '@/Invoice/InvoiceController';
|
|
5
|
+
import idGenerator from '@/Invoice/tools/idGenerator';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
|
|
9
|
+
const invoiceController = React.useMemo(() => new Invoice.InvoiceController(), [])
|
|
10
|
+
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
invoiceController.run(async s => {
|
|
14
|
+
s.goodsListState.goodsList = lines.map(e => ({ $index: idGenerator(), ...e }));
|
|
15
|
+
})
|
|
16
|
+
}, 1000)
|
|
17
|
+
}, [])
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Invoice controller={invoiceController} />
|
|
21
|
+
)
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const children = []
|
|
25
|
+
for (let i = 0; i <= 10; i++) {
|
|
26
|
+
children.push({
|
|
27
|
+
itemName: `项目名称${i}`,
|
|
28
|
+
lineAttribute: LineAttributeType.正常,
|
|
29
|
+
lineAmountExcludeTax: 9.99,
|
|
30
|
+
lineAmountIncludeTax: 10.29,
|
|
31
|
+
taxRate: 3,
|
|
32
|
+
taxAmount: 0.3,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const lines: any[] = [
|
|
38
|
+
{
|
|
39
|
+
"serialNumber": "1714491422279110656",
|
|
40
|
+
"lineNumber": 1,
|
|
41
|
+
"taxCode": "3070401000000000000",
|
|
42
|
+
"taxName": "信息技术服务",
|
|
43
|
+
"specification": null,
|
|
44
|
+
"itemName": "技术服务费",
|
|
45
|
+
"itemCode": "z",
|
|
46
|
+
"unit": "套",
|
|
47
|
+
"quantity": 1.0000000000001,
|
|
48
|
+
"taxRate": 0.06,
|
|
49
|
+
"priceExcludeTax": 0.0000000000001,
|
|
50
|
+
"priceIncludeTax": 2.12,
|
|
51
|
+
"amountTax": 0.3,
|
|
52
|
+
"lineAmountExcludeTax": 5,
|
|
53
|
+
"lineAmountIncludeTax": 5.3,
|
|
54
|
+
"lineAttribute": LineAttributeType.正常,
|
|
55
|
+
"discountGroup": "1714491422291693568",
|
|
56
|
+
"favouredPolicyMark": false,
|
|
57
|
+
"favouredPolicyName": null,
|
|
58
|
+
"zeroTaxRateFlag": null,
|
|
59
|
+
"referenceLines": null,
|
|
60
|
+
"version": 0,
|
|
61
|
+
"taxAmount": 1
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"serialNumber": "1714491422279110656",
|
|
65
|
+
"lineNumber": 2,
|
|
66
|
+
"taxCode": "3070401000000000000",
|
|
67
|
+
"taxName": "信息技术服务",
|
|
68
|
+
"specification": "",
|
|
69
|
+
"itemName": "技术服务费",
|
|
70
|
+
"itemCode": "z",
|
|
71
|
+
"unit": "",
|
|
72
|
+
"quantity": -1,
|
|
73
|
+
"taxRate": 0.06,
|
|
74
|
+
"priceExcludeTax": null,
|
|
75
|
+
"priceIncludeTax": null,
|
|
76
|
+
"amountTax": -0.06,
|
|
77
|
+
"lineAmountExcludeTax": 2,
|
|
78
|
+
"lineAmountIncludeTax": 2.3,
|
|
79
|
+
"lineAttribute": LineAttributeType.正常,
|
|
80
|
+
"discountGroup": "1714491422291693568",
|
|
81
|
+
"favouredPolicyMark": false,
|
|
82
|
+
"favouredPolicyName": null,
|
|
83
|
+
"zeroTaxRateFlag": null,
|
|
84
|
+
"referenceLines": null,
|
|
85
|
+
"version": 0,
|
|
86
|
+
"taxAmount": 1,
|
|
87
|
+
"children": children.map(e => ({ ...e, $index: idGenerator(), }))
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"serialNumber": "1714491422279110656",
|
|
91
|
+
"lineNumber": 3,
|
|
92
|
+
"taxCode": "3070401000000000000",
|
|
93
|
+
"taxName": "信息技术服务",
|
|
94
|
+
"specification": null,
|
|
95
|
+
"itemName": "技术服务费",
|
|
96
|
+
"itemCode": "z",
|
|
97
|
+
"unit": "套",
|
|
98
|
+
"quantity": 1,
|
|
99
|
+
"taxRate": 0.06,
|
|
100
|
+
"priceExcludeTax": 2,
|
|
101
|
+
"priceIncludeTax": 2.12,
|
|
102
|
+
"amountTax": 0.12,
|
|
103
|
+
"lineAmountExcludeTax": 5,
|
|
104
|
+
"lineAmountIncludeTax": 5.3,
|
|
105
|
+
"lineAttribute": LineAttributeType.正常,
|
|
106
|
+
"discountGroup": null,
|
|
107
|
+
"favouredPolicyMark": false,
|
|
108
|
+
"favouredPolicyName": null,
|
|
109
|
+
"zeroTaxRateFlag": null,
|
|
110
|
+
"referenceLines": null,
|
|
111
|
+
"version": 0,
|
|
112
|
+
"taxAmount": 1
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"serialNumber": "1714491422279110656",
|
|
116
|
+
"lineNumber": 3,
|
|
117
|
+
"taxCode": "3070401000000000000",
|
|
118
|
+
"taxName": "信息技术服务",
|
|
119
|
+
"specification": null,
|
|
120
|
+
"itemName": "技术服务费",
|
|
121
|
+
"itemCode": "z",
|
|
122
|
+
"unit": "套",
|
|
123
|
+
"quantity": 1,
|
|
124
|
+
"taxRate": 0.06,
|
|
125
|
+
"priceExcludeTax": 2,
|
|
126
|
+
"priceIncludeTax": 2.12,
|
|
127
|
+
"amountTax": 0.12,
|
|
128
|
+
"lineAmountExcludeTax": 5,
|
|
129
|
+
"lineAmountIncludeTax": 5.3,
|
|
130
|
+
"lineAttribute": LineAttributeType.正常,
|
|
131
|
+
"discountGroup": null,
|
|
132
|
+
"favouredPolicyMark": false,
|
|
133
|
+
"favouredPolicyName": null,
|
|
134
|
+
"zeroTaxRateFlag": null,
|
|
135
|
+
"referenceLines": null,
|
|
136
|
+
"version": 0,
|
|
137
|
+
"taxAmount": 1,
|
|
138
|
+
"children": children.map(e => ({ ...e, $index: idGenerator(), }))
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"serialNumber": "1714491422279110656",
|
|
142
|
+
"lineNumber": 3,
|
|
143
|
+
"taxCode": "3070401000000000000",
|
|
144
|
+
"taxName": "信息技术服务",
|
|
145
|
+
"specification": null,
|
|
146
|
+
"itemName": "技术服务费",
|
|
147
|
+
"itemCode": "z",
|
|
148
|
+
"unit": "套",
|
|
149
|
+
"quantity": 1,
|
|
150
|
+
"taxRate": 0.06,
|
|
151
|
+
"priceExcludeTax": 2,
|
|
152
|
+
"priceIncludeTax": 2.12,
|
|
153
|
+
"amountTax": 0.12,
|
|
154
|
+
"lineAmountExcludeTax": 5,
|
|
155
|
+
"lineAmountIncludeTax": 5.3,
|
|
156
|
+
"lineAttribute": LineAttributeType.正常,
|
|
157
|
+
"discountGroup": null,
|
|
158
|
+
"favouredPolicyMark": false,
|
|
159
|
+
"favouredPolicyName": null,
|
|
160
|
+
"zeroTaxRateFlag": null,
|
|
161
|
+
"referenceLines": null,
|
|
162
|
+
"version": 0,
|
|
163
|
+
"taxAmount": 1
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"serialNumber": "1714491422279110656",
|
|
167
|
+
"lineNumber": 3,
|
|
168
|
+
"taxCode": "3070401000000000000",
|
|
169
|
+
"taxName": "信息技术服务",
|
|
170
|
+
"specification": null,
|
|
171
|
+
"itemName": "技术服务费",
|
|
172
|
+
"itemCode": "z",
|
|
173
|
+
"unit": "套",
|
|
174
|
+
"quantity": 1,
|
|
175
|
+
"taxRate": 0.06,
|
|
176
|
+
"priceExcludeTax": 2,
|
|
177
|
+
"priceIncludeTax": 2.12,
|
|
178
|
+
"amountTax": 0.12,
|
|
179
|
+
"lineAmountExcludeTax": 5,
|
|
180
|
+
"lineAmountIncludeTax": 5.3,
|
|
181
|
+
"lineAttribute": LineAttributeType.正常,
|
|
182
|
+
"discountGroup": null,
|
|
183
|
+
"favouredPolicyMark": false,
|
|
184
|
+
"favouredPolicyName": null,
|
|
185
|
+
"zeroTaxRateFlag": null,
|
|
186
|
+
"referenceLines": null,
|
|
187
|
+
"version": 0,
|
|
188
|
+
"shorthand": "布料",
|
|
189
|
+
"taxAmount": 1
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
for (let i = 0; i <= 100; i++) {
|
|
194
|
+
lines.push({
|
|
195
|
+
$index: idGenerator(),
|
|
196
|
+
itemName: `项目名称${100 + i}`,
|
|
197
|
+
lineAttribute: LineAttributeType.正常,
|
|
198
|
+
lineAmountExcludeTax: 9.99,
|
|
199
|
+
lineAmountIncludeTax: 10.29,
|
|
200
|
+
taxRate: 3,
|
|
201
|
+
taxAmount: 0.3,
|
|
202
|
+
});
|
|
203
|
+
}
|
package/src/Invoice/index.md
CHANGED
|
@@ -53,6 +53,13 @@ export default () => {
|
|
|
53
53
|
setDefaultValue(await getDefaultValue({ ...good }, endowcodeGoodIndex.length));
|
|
54
54
|
} else {
|
|
55
55
|
if (endowcodeGoodIndex.length === 1) {
|
|
56
|
+
if (controller.state.goodsListState.isUpdateGoodsTaxRateList && controller.getGoodsTaxRateList && good.taxClassificationCode) {
|
|
57
|
+
const goodsTaxRateList = await controller.getGoodsTaxRateList(good.taxClassificationCode);
|
|
58
|
+
good.goodsTaxRateList = goodsTaxRateList;
|
|
59
|
+
// if (good.taxRate !== undefined && good.taxRate !== null && !goodsTaxRateList.includes(good.taxRate)) {
|
|
60
|
+
// good.taxRate = undefined;
|
|
61
|
+
// }
|
|
62
|
+
}
|
|
56
63
|
setDefaultValue(good);
|
|
57
64
|
} else {
|
|
58
65
|
setDefaultValue({ taxRate: good.taxRate } as any);
|
|
@@ -111,7 +118,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
111
118
|
}, [])
|
|
112
119
|
|
|
113
120
|
/** 税率列表 */
|
|
114
|
-
const taxRateList = controller.useMemo(s => s.goodsListState.taxRateList
|
|
121
|
+
const taxRateList = controller.useMemo(s => s.goodsListState.taxRateList, []);
|
|
115
122
|
|
|
116
123
|
/** 免税类型 列表 */
|
|
117
124
|
const taxFreeTypeList = controller.useMemo(s => s.goodsListState.endowCode.taxFreeTypeList, []);
|
|
@@ -125,6 +132,13 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
125
132
|
/** 税率 */
|
|
126
133
|
const [taxRate, setTaxRate] = React.useState<number>(0);
|
|
127
134
|
|
|
135
|
+
/** 商品可用税率 */
|
|
136
|
+
const [goodsTaxRateList, setGoodsTaxRateList] = React.useState<number[] | null | undefined>(defaultValue.goodsTaxRateList);
|
|
137
|
+
|
|
138
|
+
const formattedTaxRateList = React.useMemo(() => {
|
|
139
|
+
return (goodsTaxRateList || taxRateList).map((e) => ({ label: `${e}%`, value: e }))
|
|
140
|
+
}, [goodsTaxRateList, taxRateList])
|
|
141
|
+
|
|
128
142
|
/** 税收分类编码 选择组件 */
|
|
129
143
|
const ShowSearch = React.useCallback(props => {
|
|
130
144
|
|
|
@@ -342,6 +356,25 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
342
356
|
}, []);
|
|
343
357
|
|
|
344
358
|
const onSelect = React.useCallback((key: any, info: any) => {
|
|
359
|
+
|
|
360
|
+
// 根据税编改变税率列表
|
|
361
|
+
// 如果只有一个,默认选中,有多个时,置空,用户手选
|
|
362
|
+
if (controller.state.goodsListState.isUpdateGoodsTaxRateList) {
|
|
363
|
+
if (info.node.taxRateList?.length) {
|
|
364
|
+
setGoodsTaxRateList(info.node.taxRateList);
|
|
365
|
+
}
|
|
366
|
+
if (!readOnlyTaxRate) {
|
|
367
|
+
actions.setFieldState('taxRate', async s => {
|
|
368
|
+
if (info.node.taxRateList && info.node.taxRateList?.length === 1) {
|
|
369
|
+
s.value = info.node.taxRateList[0]
|
|
370
|
+
} else {
|
|
371
|
+
s.value = undefined
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
345
378
|
// !readOnlyTaxRate && actions.setFieldState('taxRate', async s => {
|
|
346
379
|
// if (info.node.taxRate || info.taxRate === 0) {
|
|
347
380
|
// s.value = info.node.taxRate
|
|
@@ -437,12 +470,15 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
437
470
|
good.priceExcludeTax = countPrice(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits) as any;
|
|
438
471
|
}
|
|
439
472
|
|
|
473
|
+
//赋值商品的可用税率
|
|
474
|
+
good.goodsTaxRateList = goodsTaxRateList;
|
|
475
|
+
|
|
440
476
|
});
|
|
441
477
|
|
|
442
478
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|
|
443
479
|
s.goodsListState.endowCode.endowcodeGoodIndex = [];
|
|
444
480
|
})();
|
|
445
|
-
}, [controller]);
|
|
481
|
+
}, [controller, goodsTaxRateList]);
|
|
446
482
|
|
|
447
483
|
const effects = React.useCallback(() => {
|
|
448
484
|
// 税率变化
|
|
@@ -493,7 +529,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
493
529
|
title="税率"
|
|
494
530
|
x-component-props={{ disabled: readOnlyTaxRate }}
|
|
495
531
|
default={defaultValue?.taxRate ?? 0}
|
|
496
|
-
enum={
|
|
532
|
+
enum={formattedTaxRateList}
|
|
497
533
|
x-rules={[{ message: '请选择税率', required: true }]}
|
|
498
534
|
/>
|
|
499
535
|
{taxRate === 0 && isTaxFreeTypeNeeded &&
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
import { getItemNameWithShorthand } from '../../../../../tools/itemName';
|
|
22
22
|
import Drag from './ui/Drag';
|
|
23
23
|
import { nonScientificNotation } from '../../../../../tools/calculate';
|
|
24
|
+
import Expand from './ui/Expand';
|
|
24
25
|
|
|
25
26
|
export default (form: WrappedFormUtils) => {
|
|
26
27
|
const { getFieldDecorator, getFieldValue } = form;
|
|
@@ -47,6 +48,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
47
48
|
/** 正在编辑的货物 */
|
|
48
49
|
const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
|
|
49
50
|
|
|
51
|
+
/** 正在编辑的货物 */
|
|
52
|
+
const goodsList = controller.useMemo((e) => e.goodsListState.goodsList, []);
|
|
53
|
+
|
|
50
54
|
/** 商品表格隐藏列 */
|
|
51
55
|
const columnshide = controller.useMemo((e) => e.goodsListState.columnshide, []);
|
|
52
56
|
|
|
@@ -96,6 +100,13 @@ export default (form: WrappedFormUtils) => {
|
|
|
96
100
|
align: 'center',
|
|
97
101
|
render: (_: any, record: IGood) => <Drag record={record} />
|
|
98
102
|
},
|
|
103
|
+
{
|
|
104
|
+
title: ' ',
|
|
105
|
+
key: 'expand',
|
|
106
|
+
width: 40,
|
|
107
|
+
align: 'center',
|
|
108
|
+
render: (_: any, record: IGood) => <Expand record={record} />
|
|
109
|
+
},
|
|
99
110
|
{
|
|
100
111
|
title: '序号',
|
|
101
112
|
key: 'serialNo',
|
|
@@ -506,7 +517,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
506
517
|
onChangeTaxRate(controller, form, record);
|
|
507
518
|
}}
|
|
508
519
|
>
|
|
509
|
-
{taxRateList.map((e, i) => {
|
|
520
|
+
{(record.goodsTaxRateList || taxRateList).map((e, i) => {
|
|
510
521
|
return (
|
|
511
522
|
<Select.Option key={i} value={e}>
|
|
512
523
|
{e}%
|
|
@@ -584,6 +595,8 @@ export default (form: WrappedFormUtils) => {
|
|
|
584
595
|
})
|
|
585
596
|
// 是否启动拖拽
|
|
586
597
|
.filter(e => e.key !== 'drag' || isStart)
|
|
598
|
+
// 是否启动展开
|
|
599
|
+
.filter(e => e.key === 'expand' ? goodsList.some(e => !!e.children) : true)
|
|
587
600
|
// 只读
|
|
588
601
|
.filter(e => {
|
|
589
602
|
if (model === 'readOnly') {
|
|
@@ -598,7 +611,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
598
611
|
ellipsis: true,
|
|
599
612
|
};
|
|
600
613
|
}) as any[];
|
|
601
|
-
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
|
|
614
|
+
}, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
|
|
602
615
|
return columns;
|
|
603
616
|
};
|
|
604
617
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button } from 'kts-xui';
|
|
5
|
+
import Icon from '@ant-design/icons';
|
|
6
|
+
import { ReactComponent as I001Svg } from './svg/I001.svg';
|
|
7
|
+
import { ReactComponent as I002Svg } from './svg/I002.svg';
|
|
8
|
+
import { IGood, Invoice } from '../../../../../../../..';
|
|
9
|
+
|
|
10
|
+
export interface IExpandProps {
|
|
11
|
+
record: IGood
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function Expand(props: IExpandProps) {
|
|
15
|
+
|
|
16
|
+
const { record } = props;
|
|
17
|
+
|
|
18
|
+
const controller = Invoice.useInvoiceController();
|
|
19
|
+
|
|
20
|
+
const goodsMap = controller.useMemo(s => s.goodsListState.goodsMap, []);
|
|
21
|
+
|
|
22
|
+
const expandedRowKeys = controller.useMemo(s => s.goodsListState.expandedRowKeys, []);
|
|
23
|
+
|
|
24
|
+
if (goodsMap.get(record.$index)?.children) {
|
|
25
|
+
if (expandedRowKeys.includes(record.$index)) {
|
|
26
|
+
return (
|
|
27
|
+
<Button
|
|
28
|
+
type='text'
|
|
29
|
+
style={{ width: 'auto', color: "#0074ff" }}
|
|
30
|
+
icon={<Icon component={I002Svg} />}
|
|
31
|
+
onClick={controller.pipeline(async (s, e) => {
|
|
32
|
+
e?.stopPropagation()
|
|
33
|
+
s.goodsListState.expandedRowKeys = s.goodsListState.expandedRowKeys.filter(e => e !== record.$index)
|
|
34
|
+
})}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
} else {
|
|
38
|
+
return (
|
|
39
|
+
<Button
|
|
40
|
+
type='text'
|
|
41
|
+
style={{ width: 'auto', color: "#0074ff" }}
|
|
42
|
+
icon={<Icon component={I001Svg} />}
|
|
43
|
+
onClick={controller.pipeline(async (s, e) => {
|
|
44
|
+
e?.stopPropagation()
|
|
45
|
+
s.goodsListState.expandedRowKeys = [...s.goodsListState.expandedRowKeys, record.$index]
|
|
46
|
+
})}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
return <></>
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg t="1719031046892" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5456" width="200" height="200"><path d="M879.9725037 997.08776297H146.45475555c-67.23508148 0-122.2125037-54.97742222-122.2125037-122.21250372V141.23614815c0-67.23508148 54.97742222-122.2125037 122.2125037-122.2125037h733.63911112c67.23508148 0 122.2125037 54.97742222 122.2125037 122.2125037V874.87525925c0 67.11371852-54.97742222 122.2125037-122.33386667 122.21250372zM146.45475555 80.06921482c-36.65161482 0-61.16693333 24.39395555-61.16693333 61.16693333V874.87525925c0 36.65161482 24.39395555 61.16693333 61.16693333 61.16693334h733.63911112c36.65161482 0 61.16693333-24.39395555 61.16693333-61.16693334V141.23614815c0-36.65161482-24.39395555-61.16693333-61.16693333-61.16693333H146.45475555z m0 0" p-id="5457"></path><path d="M757.76 538.57848889h-489.09274075c-18.32580741 0-30.58346667-12.25765925-30.58346666-30.58346667s12.25765925-30.58346667 30.58346666-30.58346667h489.09274075c18.32580741 0 30.58346667 12.25765925 30.58346667 30.58346667s-12.25765925 30.58346667-30.58346667 30.58346667z m0 0" p-id="5458"></path><path d="M513.21362963 783.12485925c-18.32580741 0-30.58346667-12.25765925-30.58346666-30.58346666v-489.09274074c0-18.32580741 12.25765925-30.58346667 30.58346666-30.58346667s30.58346667 12.25765925 30.58346667 30.58346667v489.09274074c0 18.32580741-12.25765925 30.58346667-30.58346667 30.58346666z m0 0" p-id="5459"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg t="1719031078613" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5605" width="200" height="200"><path d="M879.9725037 997.08776297H146.45475555c-67.23508148 0-122.2125037-54.97742222-122.2125037-122.21250372V141.23614815c0-67.23508148 54.97742222-122.2125037 122.2125037-122.2125037h733.63911112c67.23508148 0 122.2125037 54.97742222 122.2125037 122.2125037V874.87525925c0 67.11371852-54.97742222 122.2125037-122.33386667 122.21250372zM146.45475555 80.06921482c-36.65161482 0-61.16693333 24.39395555-61.16693333 61.16693333V874.87525925c0 36.65161482 24.39395555 61.16693333 61.16693333 61.16693334h733.63911112c36.65161482 0 61.16693333-24.39395555 61.16693333-61.16693334V141.23614815c0-36.65161482-24.39395555-61.16693333-61.16693333-61.16693333H146.45475555z m0 0" p-id="5606"></path><path d="M757.76 538.57848889h-489.09274075c-18.32580741 0-30.58346667-12.25765925-30.58346666-30.58346667s12.25765925-30.58346667 30.58346666-30.58346667h489.09274075c18.32580741 0 30.58346667 12.25765925 30.58346667 30.58346667s-12.25765925 30.58346667-30.58346667 30.58346667z m0 0" p-id="5607"></path></svg>
|
|
@@ -16,6 +16,7 @@ export default () => {
|
|
|
16
16
|
const onClick = React.useCallback(
|
|
17
17
|
async (record: IGood) => {
|
|
18
18
|
// if (model === 'prefab') return;
|
|
19
|
+
if (record.level && record.level > 0) return;
|
|
19
20
|
if (model === 'readOnly') return;
|
|
20
21
|
|
|
21
22
|
const editGood = controller.state.goodsListState.editGood;
|
|
@@ -25,8 +26,20 @@ export default () => {
|
|
|
25
26
|
if (editGood.$index === record.$index) return;
|
|
26
27
|
await controller.saveEditGood();
|
|
27
28
|
await controller.wait();
|
|
29
|
+
if (controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList ) {
|
|
30
|
+
record.goodsTaxRateList = await controller.getGoodsTaxRateList(record.taxClassificationCode);
|
|
31
|
+
// if (record.taxRate !== undefined && record.taxRate !== null && !record.goodsTaxRateList.includes(record.taxRate)) {
|
|
32
|
+
// record.taxRate = undefined;
|
|
33
|
+
// }
|
|
34
|
+
}
|
|
28
35
|
await controller.pipeline(async s => { s.goodsListState.editGood || (await controller.setEditGood(record)) })();
|
|
29
36
|
} else {
|
|
37
|
+
if (controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList ) {
|
|
38
|
+
record.goodsTaxRateList = await controller.getGoodsTaxRateList(record.taxClassificationCode);
|
|
39
|
+
// if (record.taxRate !== undefined && record.taxRate !== null && !record.goodsTaxRateList.includes(record.taxRate)) {
|
|
40
|
+
// record.taxRate = undefined;
|
|
41
|
+
// }
|
|
42
|
+
}
|
|
30
43
|
await controller.setEditGood(record);
|
|
31
44
|
}
|
|
32
45
|
},
|
|
@@ -74,7 +74,7 @@ export default () => {
|
|
|
74
74
|
onChange={onClickSelectAll}
|
|
75
75
|
indeterminate={indeterminate}
|
|
76
76
|
checked={isAll}
|
|
77
|
-
|
|
77
|
+
/>
|
|
78
78
|
)
|
|
79
79
|
}, [goodsList, selectedRowKeys, onClickSelectAll, isAll, indeterminate])
|
|
80
80
|
|
|
@@ -85,7 +85,6 @@ export default () => {
|
|
|
85
85
|
s.goodsListState.selectedGoodIndex.forEach($index => {
|
|
86
86
|
const goods = s.goodsListState.goodsMap.get($index);
|
|
87
87
|
|
|
88
|
-
|
|
89
88
|
if (!goods || (goods.lineAttribute !== LineAttributeType.折扣行 && goods.lineAttribute !== LineAttributeType.被折扣行)) return;
|
|
90
89
|
|
|
91
90
|
// 数组位置
|
|
@@ -111,5 +110,12 @@ export default () => {
|
|
|
111
110
|
columnTitle,
|
|
112
111
|
onSelect,
|
|
113
112
|
selectedRowKeys,
|
|
113
|
+
getCheckboxProps: (record: any) => {
|
|
114
|
+
// console.log('===> getCheckboxProps', record, record.level)
|
|
115
|
+
return {
|
|
116
|
+
disabled: record.level > 0,
|
|
117
|
+
style: record.level > 0 ? { display: 'none' } : undefined
|
|
118
|
+
}
|
|
119
|
+
},
|
|
114
120
|
}
|
|
115
121
|
}
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.ktsAntX-table {
|
|
46
|
+
|
|
46
47
|
.ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell,
|
|
47
48
|
.ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {
|
|
48
49
|
background: #f5f5f5;
|
|
@@ -172,8 +173,14 @@
|
|
|
172
173
|
height: 10px;
|
|
173
174
|
}
|
|
174
175
|
}
|
|
176
|
+
|
|
175
177
|
.kts-invoice-operate-goods-list-table {
|
|
178
|
+
.ktsAntX-table-row-indent+.ktsAntX-table-row-expand-icon {
|
|
179
|
+
display: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
176
182
|
.ktsAnt3x-form-item-control.has-error {
|
|
177
183
|
border: 1px solid #f00;
|
|
178
184
|
}
|
|
179
|
-
|
|
185
|
+
|
|
186
|
+
}
|