kts-component-invoice-operate 1.2.22 → 2.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/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 +7 -0
- package/dist/Invoice/_test/buyerNameSearch/index.d.ts +1 -0
- package/dist/Invoice/_test/deduction/index.d.ts +1 -0
- package/dist/Invoice/_test/draft/index.d.ts +1 -0
- package/dist/Invoice/_test/easiest/index.d.ts +1 -0
- package/dist/Invoice/_test/endowCode/index.d.ts +1 -0
- package/dist/Invoice/_test/goodsMenuExpand/index.d.ts +1 -0
- package/dist/Invoice/_test/importBuyer/index.d.ts +1 -0
- package/dist/Invoice/_test/importGoods/index.d.ts +1 -0
- package/dist/Invoice/_test/invoiceType/index.d.ts +1 -0
- package/dist/Invoice/_test/isInvoiceNo/index.d.ts +1 -0
- package/dist/Invoice/_test/replaceHead/index.d.ts +1 -0
- package/dist/Invoice/_test/retrieveData/index.d.ts +1 -0
- package/dist/Invoice/_test/seller/index.d.ts +1 -0
- package/dist/Invoice/_test/setDataSource/index.d.ts +1 -0
- package/dist/Invoice/_test/unit/index.d.ts +1 -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/Buyer/ui/BuyerNameInput/index.d.ts +1 -0
- package/dist/Invoice/ui/Buyer/ui/ImportBuyerButton/index.d.ts +1 -0
- package/dist/Invoice/ui/EndowCodeDrawer/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowEditButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +5 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowSaveButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/AddRowButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.d.ts +3 -0
- package/dist/Invoice/ui/GoodsList/ui/DelRowButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/DescribeSwitch/index.d.ts +3 -0
- package/dist/Invoice/ui/GoodsList/ui/EndowCodeButton/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/Statistics/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/TableRow/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/TableVirtual/index.d.ts +1 -0
- package/dist/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -0
- package/dist/Invoice/ui/ImportBuyerDrawer/index.d.ts +1 -0
- package/dist/Invoice/ui/ImportGoodsDrawer/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1044 -267
- package/dist/index.js +1043 -266
- package/docs/index.md +1 -1
- package/package.json +4 -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 +11 -1
- 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 +179 -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 +71 -29
- 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 +34 -37
- package/src/Invoice/ui/GoodsList/index.tsx +8 -0
- package/src/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.tsx +74 -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.o.lock +14800 -0
|
@@ -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;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
105
|
+
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
|
|
93
106
|
}
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
// 导入FORM里
|
|
109
|
+
if (s.goodsListState.isMyShow) {
|
|
110
|
+
s.goodsListState.form.setFieldsValue(editGood);
|
|
111
|
+
} else {
|
|
112
|
+
s.goodsListState.form.setFieldsValue({
|
|
113
|
+
...editGood,
|
|
114
|
+
itemName: editGood.itemNameOther,
|
|
115
|
+
unit: editGood.unitOther,
|
|
116
|
+
itemModelName: editGood.itemModelNameOther,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
97
119
|
|
|
98
|
-
s.goodsListState.editGood.itemName = getItemName(record);
|
|
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.itemNameOther)?.shorthand;
|
|
161
|
+
if (shorthand) {
|
|
162
|
+
return `*${shorthand}*${record.itemName}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return record.itemName;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 获取他方名称
|
|
169
|
+
const getItemNameOther = (record: any, editGood: IGood) => {
|
|
170
|
+
if (!editGood.itemNameOther) return editGood.itemNameOther;
|
|
171
|
+
|
|
172
|
+
let shorthand;
|
|
173
|
+
|
|
174
|
+
shorthand = record.shorthand;
|
|
175
|
+
if (shorthand) {
|
|
176
|
+
return `*${shorthand}*${record.itemName}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return record.itemNameOther;
|
|
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';
|