kts-component-invoice-operate 2.0.21 → 3.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 (29) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +2 -0
  2. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.d.ts +1 -1
  3. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +5 -2
  4. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +5 -2
  5. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +5 -2
  6. package/dist/Invoice/ui/GoodsList/hook/useToGenerateId/index.d.ts +3 -0
  7. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
  8. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -1
  9. package/dist/index.esm.js +901 -1027
  10. package/dist/index.js +900 -1026
  11. package/docs-dist/umi.js +1 -1
  12. package/package.json +1 -1
  13. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +3 -0
  14. package/src/Invoice/index.tsx +15 -18
  15. package/src/Invoice/tools/idGenerator/index.ts +1 -1
  16. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +1 -1
  17. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +22 -29
  18. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.tsx +5 -1
  19. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +33 -10
  20. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +19 -7
  21. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +11 -5
  22. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +52 -18
  23. package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +13 -0
  24. package/src/Invoice/ui/GoodsList/index.tsx +17 -3
  25. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +1 -1
  26. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +10 -39
  27. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +11 -2
  28. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +2 -2
  29. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +58 -63
@@ -49,10 +49,7 @@ const DrawerBody = () => {
49
49
 
50
50
  // const [editGood] = React.useState(controller.state.goodsListState.editGood);
51
51
 
52
- React.useEffect(() => {
53
- controller.getGoodsList &&
54
- controller.getGoodsList({ pagination: { current: 1 } });
55
- }, [controller]);
52
+ React.useEffect(() => { controller.getGoodsList && controller.getGoodsList({ pagination: { current: 1 } }) }, [controller]);
56
53
 
57
54
  return (
58
55
  <Table
@@ -65,66 +62,64 @@ const DrawerBody = () => {
65
62
  onRow={record => {
66
63
  return {
67
64
  onClick: () => {
68
- controller.run(
69
- async s => {
70
- Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
71
-
72
- // 导入时校验函数
73
- if (await s.goodsListState.importGoods.verifyFn(record) === false) return;
74
-
75
- // 没用 被编辑的货物 form 就退出
76
- if (!s.goodsListState.editGood || !s.goodsListState.form) return;
77
-
78
- if (s.goodsListState.editGood.lineAmountExcludeTax || s.goodsListState.editGood.lineAmountIncludeTax) {
79
- record.priceExcludeTax = s.goodsListState.editGood.priceExcludeTax;
80
- record.priceIncludeTax = s.goodsListState.editGood.priceIncludeTax;
81
- record.lineAmountExcludeTax = s.goodsListState.editGood.lineAmountExcludeTax;
82
- record.lineAmountIncludeTax = s.goodsListState.editGood.lineAmountIncludeTax;
83
- }
84
-
85
- // 中间数据
86
- const between = { ...record };
87
- between.itemName = getItemName(record, s.goodsListState.editGood);
88
- between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
89
-
90
- // 设置编辑货物
91
- const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
92
-
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;
100
- } else {
101
- editGood.priceExcludeTax = getPriceExcludeTax(editGood, record) as number;
102
- }
103
-
104
- if (editGood.quantity && editGood.priceIncludeTax) {
105
- editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
106
- }
107
-
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
- }
120
-
121
- s.goodsListState.importGoods.isVisibleDrawer = false;
122
-
123
- s.goodsListState.isTaxIncluded
124
- ? updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
125
- : updateUnitPriceTax(controller, s.goodsListState.form, record)
65
+ controller.run(async s => {
66
+ Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
67
+
68
+ // 导入时校验函数
69
+ if (await s.goodsListState.importGoods.verifyFn(record) === false) return;
70
+
71
+ // 没用 被编辑的货物 和 form 就退出
72
+ if (!s.goodsListState.editGood || !s.goodsListState.form) return;
73
+
74
+ if (s.goodsListState.editGood.lineAmountExcludeTax || s.goodsListState.editGood.lineAmountIncludeTax) {
75
+ record.priceExcludeTax = s.goodsListState.editGood.priceExcludeTax;
76
+ record.priceIncludeTax = s.goodsListState.editGood.priceIncludeTax;
77
+ record.lineAmountExcludeTax = s.goodsListState.editGood.lineAmountExcludeTax;
78
+ record.lineAmountIncludeTax = s.goodsListState.editGood.lineAmountIncludeTax;
79
+ }
80
+
81
+ // 中间数据
82
+ const between = { ...record };
83
+ between.itemName = getItemName(record, s.goodsListState.editGood);
84
+ between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
85
+
86
+ // 设置编辑货物
87
+ const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
88
+
89
+ if (editGood.taxRate) {
90
+ editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
126
91
  }
127
- )
92
+
93
+ if (`${editGood.priceIncludeTax}` === '0') {
94
+ editGood.priceIncludeTax = undefined;
95
+ editGood.priceExcludeTax = undefined;
96
+ } else {
97
+ editGood.priceExcludeTax = getPriceExcludeTax(editGood, record) as number;
98
+ }
99
+
100
+ if (editGood.quantity && editGood.priceIncludeTax) {
101
+ editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
102
+ }
103
+
104
+ // 导入FORM里
105
+ if (s.goodsListState.isMyShow) {
106
+ s.goodsListState.form.setFieldsValue({
107
+ ...editGood,
108
+ itemName: editGood.itemNameSelf,
109
+ itemModelName: editGood.itemModelNameSelf,
110
+ });
111
+ } else {
112
+ s.goodsListState.form.setFieldsValue({
113
+ ...editGood,
114
+ });
115
+ }
116
+
117
+ s.goodsListState.importGoods.isVisibleDrawer = false;
118
+
119
+ s.goodsListState.isTaxIncluded
120
+ ? updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
121
+ : updateUnitPriceTax(controller, s.goodsListState.form, record)
122
+ })
128
123
  }
129
124
  };
130
125
  }}