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.
Files changed (76) hide show
  1. package/d.dio +2 -69
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.d.ts → EndowCode/index.d.ts} +2 -2
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.d.ts → IGood/index.d.ts} +15 -5
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.d.ts → ImportGoods/index.d.ts} +0 -0
  5. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.d.ts → LineAttributeType/index.d.ts} +0 -0
  6. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.d.ts +7 -0
  7. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +7 -0
  8. package/dist/Invoice/_test/buyerNameSearch/index.d.ts +1 -0
  9. package/dist/Invoice/_test/deduction/index.d.ts +1 -0
  10. package/dist/Invoice/_test/draft/index.d.ts +1 -0
  11. package/dist/Invoice/_test/easiest/index.d.ts +1 -0
  12. package/dist/Invoice/_test/endowCode/index.d.ts +1 -0
  13. package/dist/Invoice/_test/goodsMenuExpand/index.d.ts +1 -0
  14. package/dist/Invoice/_test/importBuyer/index.d.ts +1 -0
  15. package/dist/Invoice/_test/importGoods/index.d.ts +1 -0
  16. package/dist/Invoice/_test/invoiceType/index.d.ts +1 -0
  17. package/dist/Invoice/_test/isInvoiceNo/index.d.ts +1 -0
  18. package/dist/Invoice/_test/replaceHead/index.d.ts +1 -0
  19. package/dist/Invoice/_test/retrieveData/index.d.ts +1 -0
  20. package/dist/Invoice/_test/seller/index.d.ts +1 -0
  21. package/dist/Invoice/_test/setDataSource/index.d.ts +1 -0
  22. package/dist/Invoice/_test/unit/index.d.ts +1 -0
  23. package/dist/Invoice/index.d.ts +1 -1
  24. package/dist/Invoice/tools/itemName/index.d.ts +14 -0
  25. package/dist/Invoice/ui/AddComparisonDrawer/index.d.ts +3 -0
  26. package/dist/Invoice/ui/Buyer/ui/BuyerNameInput/index.d.ts +1 -0
  27. package/dist/Invoice/ui/Buyer/ui/ImportBuyerButton/index.d.ts +1 -0
  28. package/dist/Invoice/ui/EndowCodeDrawer/index.d.ts +1 -0
  29. package/dist/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
  30. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowEditButton/index.d.ts +1 -0
  31. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +5 -0
  32. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +1 -0
  33. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +1 -0
  34. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +1 -0
  35. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.d.ts +1 -0
  36. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowSaveButton/index.d.ts +1 -0
  37. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -0
  38. package/dist/Invoice/ui/GoodsList/ui/AddRowButton/index.d.ts +1 -0
  39. package/dist/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.d.ts +3 -0
  40. package/dist/Invoice/ui/GoodsList/ui/DelRowButton/index.d.ts +1 -0
  41. package/dist/Invoice/ui/GoodsList/ui/DescribeSwitch/index.d.ts +3 -0
  42. package/dist/Invoice/ui/GoodsList/ui/EndowCodeButton/index.d.ts +1 -0
  43. package/dist/Invoice/ui/GoodsList/ui/Statistics/index.d.ts +1 -0
  44. package/dist/Invoice/ui/GoodsList/ui/TableRow/index.d.ts +1 -0
  45. package/dist/Invoice/ui/GoodsList/ui/TableVirtual/index.d.ts +1 -0
  46. package/dist/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -0
  47. package/dist/Invoice/ui/ImportBuyerDrawer/index.d.ts +1 -0
  48. package/dist/Invoice/ui/ImportGoodsDrawer/index.d.ts +1 -0
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.esm.js +1044 -267
  51. package/dist/index.js +1043 -266
  52. package/docs/index.md +1 -1
  53. package/package.json +4 -1
  54. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.tsx → EndowCode/index.tsx} +3 -3
  55. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.ts → IGood/index.ts} +20 -5
  56. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.ts → ImportGoods/index.ts} +0 -0
  57. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.ts → LineAttributeType/index.ts} +0 -0
  58. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +10 -0
  59. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +11 -1
  60. package/src/Invoice/_test/importGoods/index.tsx +21 -3
  61. package/src/Invoice/index.tsx +5 -1
  62. package/src/Invoice/tools/itemName/index.ts +48 -0
  63. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +179 -0
  64. package/src/Invoice/ui/EndowCodeDrawer/index.tsx +6 -17
  65. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +15 -0
  66. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +71 -29
  67. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.tsx +39 -0
  68. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +5 -2
  69. package/src/Invoice/ui/GoodsList/index.less +34 -37
  70. package/src/Invoice/ui/GoodsList/index.tsx +8 -0
  71. package/src/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.tsx +74 -0
  72. package/src/Invoice/ui/GoodsList/ui/DescribeSwitch/index.tsx +37 -0
  73. package/src/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -2
  74. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +70 -18
  75. package/src/index.ts +1 -0
  76. package/yarn.o.lock +14800 -0
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import { Drawer, message, Table } from 'kts-components-antd-x3';
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
- s.goodsListState.editGood = { ...s.goodsListState.editGood, ...record };
83
- if (!s.goodsListState.editGood) return;
85
+ // 中间数据
86
+ const between = { ...record };
87
+ between.itemName = getItemName(record, s.goodsListState.editGood);
88
+ between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
84
89
 
85
- if(s.goodsListState.editGood.taxRate)
86
- s.goodsListState.editGood.taxRate = dutyFree(controller, s.goodsListState.editGood.taxRate, s.goodsListState.form, s.goodsListState.editGood)
90
+ // 设置编辑货物
91
+ const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
87
92
 
88
- if (`${s.goodsListState.editGood.priceIncludeTax}` === '0') {
89
- s.goodsListState.editGood.priceIncludeTax = undefined;
90
- s.goodsListState.editGood.priceExcludeTax = undefined;
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
- s.goodsListState.editGood.priceExcludeTax = getPriceExcludeTax(s.goodsListState.editGood, record) as number;
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
- if (s.goodsListState.editGood.quantity && s.goodsListState.editGood.priceIncludeTax)
96
- s.goodsListState.editGood.lineAmountIncludeTax = countAmountIncludeTax(s.goodsListState.editGood.quantity, s.goodsListState.editGood.priceIncludeTax);
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
- return record.shorthand
118
- ? `*${record.shorthand}*${record.itemName}`
119
- : record.itemName;
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';