kts-component-invoice-operate 1.2.25 → 2.0.2
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} +13 -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 +5 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +7 -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 +2 -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 +5 -0
- package/dist/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.d.ts +5 -2
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.d.ts +5 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +5 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +5 -0
- package/dist/Invoice/ui/GoodsList/ui/BulkMenu/index.d.ts +2 -0
- package/dist/Invoice/ui/GoodsList/ui/{DelRowButton → DescribeSwitch}/index.d.ts +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1084 -314
- package/dist/index.js +1083 -313
- package/docs/index.md +1 -1
- package/docs-dist/umi.css +8 -7
- package/docs-dist/umi.js +1 -1
- package/package.json +8 -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} +17 -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 +10 -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 +135 -0
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +6 -17
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +16 -0
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +101 -36
- 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/index.less +1 -4
- package/src/Invoice/ui/GoodsList/index.tsx +11 -17
- 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 +75 -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/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 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Switch, Icon, Tooltip } from 'kts-components-antd-x3';
|
|
4
|
+
import Invoice from '../../../../';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
|
|
8
|
+
const controller = Invoice.useInvoiceController();
|
|
9
|
+
|
|
10
|
+
const productComparison = controller.useMemo(s => s.goodsListState.productComparison, [])
|
|
11
|
+
|
|
12
|
+
const isMyShow = controller.useMemo(s => s.goodsListState.isMyShow, []);
|
|
13
|
+
|
|
14
|
+
const onChange = React.useCallback(e => {
|
|
15
|
+
controller.run(async s => s.goodsListState.isMyShow = !s.goodsListState.isMyShow)
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
if (!productComparison.onComply) return <></>;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<span>
|
|
22
|
+
<label style={{ marginRight: 2 }} >
|
|
23
|
+
<Tooltip title="蓝色代表我方商品描述,黑色代表对方的商品描述。">
|
|
24
|
+
<Icon style={{ marginRight: 3 }} type="info-circle" />
|
|
25
|
+
</Tooltip>
|
|
26
|
+
使用哪方商品描述:
|
|
27
|
+
</label>
|
|
28
|
+
<Switch
|
|
29
|
+
checked={isMyShow}
|
|
30
|
+
checkedChildren="我方"
|
|
31
|
+
unCheckedChildren="对方"
|
|
32
|
+
defaultChecked
|
|
33
|
+
onChange={onChange}
|
|
34
|
+
/>
|
|
35
|
+
</span>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -14,12 +14,12 @@ export default () => {
|
|
|
14
14
|
const isSwitchTax = controller.useMemo(e => e.goodsListState.isSwitchTax, []);
|
|
15
15
|
|
|
16
16
|
const onChange = React.useCallback(e => {
|
|
17
|
-
controller.pipeline(async s => { s.goodsListState = { ...s.goodsListState, isTaxIncluded: e } })()
|
|
17
|
+
controller.pipeline(async s => { s.goodsListState = { ...s.goodsListState, isTaxIncluded: e } })();
|
|
18
18
|
}, [])
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<span>
|
|
22
|
-
<label>含税:</label>
|
|
22
|
+
<label style={{ marginRight: 2 }}>含税:</label>
|
|
23
23
|
<Switch
|
|
24
24
|
disabled={isSwitchTax === false}
|
|
25
25
|
checked={isTaxIncluded}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Drawer,
|
|
2
|
+
import { Drawer, Table } from 'kts-components-antd-x3';
|
|
3
3
|
import Invoice from '../../';
|
|
4
4
|
import { updateUnitPriceExcludingTax, updateUnitPriceTax, dutyFree, format15 } from '../GoodsList/hook/useColumns/autoFillFn';
|
|
5
5
|
import { countAmountIncludeTax } from '../../tools/calculate'
|
|
6
|
+
import { getSN } from '../../tools/itemName'
|
|
6
7
|
import { IGood } from '../../InvoiceController';
|
|
7
8
|
import evaluate from '../../tools/evaluate';
|
|
8
9
|
|
|
@@ -68,8 +69,10 @@ const DrawerBody = () => {
|
|
|
68
69
|
async s => {
|
|
69
70
|
Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
|
|
70
71
|
|
|
72
|
+
// 导入时校验函数
|
|
71
73
|
if (await s.goodsListState.importGoods.verifyFn(record) === false) return;
|
|
72
74
|
|
|
75
|
+
// 没用 被编辑的货物 和 form 就退出
|
|
73
76
|
if (!s.goodsListState.editGood || !s.goodsListState.form) return;
|
|
74
77
|
|
|
75
78
|
if (s.goodsListState.editGood.lineAmountExcludeTax || s.goodsListState.editGood.lineAmountIncludeTax) {
|
|
@@ -79,25 +82,42 @@ const DrawerBody = () => {
|
|
|
79
82
|
record.lineAmountIncludeTax = s.goodsListState.editGood.lineAmountIncludeTax;
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
// 中间数据
|
|
86
|
+
const between = { ...record };
|
|
87
|
+
between.itemName = getItemName(record, s.goodsListState.editGood);
|
|
88
|
+
between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
// 设置编辑货物
|
|
91
|
+
const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
|
|
87
92
|
|
|
88
|
-
if (
|
|
89
|
-
s.goodsListState.editGood
|
|
90
|
-
|
|
93
|
+
if (editGood.taxRate) {
|
|
94
|
+
editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (`${editGood.priceIncludeTax}` === '0') {
|
|
98
|
+
editGood.priceIncludeTax = undefined;
|
|
99
|
+
editGood.priceExcludeTax = undefined;
|
|
91
100
|
} else {
|
|
92
|
-
|
|
101
|
+
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record) as number;
|
|
93
102
|
}
|
|
94
103
|
|
|
95
|
-
if (
|
|
96
|
-
|
|
104
|
+
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
105
|
+
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
|
|
106
|
+
}
|
|
97
107
|
|
|
98
|
-
|
|
108
|
+
// 导入FORM里
|
|
109
|
+
if (s.goodsListState.isMyShow) {
|
|
110
|
+
s.goodsListState.form.setFieldsValue({
|
|
111
|
+
...editGood,
|
|
112
|
+
itemName: editGood.itemNameSelf,
|
|
113
|
+
itemModelName: editGood.itemModelNameSelf,
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
s.goodsListState.form.setFieldsValue({
|
|
117
|
+
...editGood,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
99
120
|
|
|
100
|
-
s.goodsListState.form.setFieldsValue(s.goodsListState.editGood as any);
|
|
101
121
|
s.goodsListState.importGoods.isVisibleDrawer = false;
|
|
102
122
|
|
|
103
123
|
s.goodsListState.isTaxIncluded
|
|
@@ -113,11 +133,11 @@ const DrawerBody = () => {
|
|
|
113
133
|
};
|
|
114
134
|
|
|
115
135
|
/** 货物名称 */
|
|
116
|
-
const getItemName = (record: any) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
136
|
+
// const getItemName = (record: any) => {
|
|
137
|
+
// return record.shorthand
|
|
138
|
+
// ? `*${record.shorthand}*${record.itemName}`
|
|
139
|
+
// : record.itemName;
|
|
140
|
+
// };
|
|
121
141
|
|
|
122
142
|
/** 货物单价,不含税 */
|
|
123
143
|
const getPriceExcludeTax = (s: IGood, record: any) => {
|
|
@@ -126,3 +146,35 @@ const getPriceExcludeTax = (s: IGood, record: any) => {
|
|
|
126
146
|
// 单价(含税)/(1+税率) = 单价(不含税)
|
|
127
147
|
return format15(evaluate(`${record.priceIncludeTax} / (1+${s.taxRate}/100)`));
|
|
128
148
|
};
|
|
149
|
+
|
|
150
|
+
// 获取我方名称
|
|
151
|
+
const getItemName = (record: any, editGood: IGood) => {
|
|
152
|
+
|
|
153
|
+
let shorthand;
|
|
154
|
+
|
|
155
|
+
shorthand = record.shorthand;
|
|
156
|
+
if (shorthand) {
|
|
157
|
+
return `*${shorthand}*${record.itemName}`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
shorthand = getSN(editGood.itemName)?.shorthand;
|
|
161
|
+
if (shorthand) {
|
|
162
|
+
return `*${shorthand}*${record.itemNameSelf}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return record.itemName;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 获取他方名称
|
|
169
|
+
const getItemNameOther = (record: any, editGood: IGood) => {
|
|
170
|
+
if (!editGood.itemName) return editGood.itemName;
|
|
171
|
+
|
|
172
|
+
let shorthand;
|
|
173
|
+
|
|
174
|
+
shorthand = record.shorthand;
|
|
175
|
+
if (shorthand) {
|
|
176
|
+
return `*${shorthand}*${record.itemNameSelf}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return record.itemName;
|
|
180
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,3 +3,4 @@ import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
|
|
|
3
3
|
|
|
4
4
|
export { default as Invoice } from './Invoice';
|
|
5
5
|
export { default as InvoiceController } from './Invoice/InvoiceController';
|
|
6
|
+
export type { default as IGood } from './Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood';
|