kts-component-invoice-operate 2.0.22 → 3.0.1

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 (45) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.d.ts +1 -1
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +3 -1
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +5 -5
  4. package/dist/Invoice/InvoiceController/fns/addGoodDiscount.d.ts +1 -1
  5. package/dist/Invoice/InvoiceController/fns/delGood.d.ts +1 -1
  6. package/dist/Invoice/InvoiceController/index.d.ts +1 -1
  7. package/dist/Invoice/index.d.ts +1 -1
  8. package/dist/Invoice/tools/idGenerator/index.d.ts +1 -1
  9. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.d.ts +1 -1
  10. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +5 -2
  11. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +5 -2
  12. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +5 -2
  13. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -1
  14. package/dist/Invoice/ui/GoodsList/hook/useToGenerateId/index.d.ts +3 -0
  15. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
  16. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -1
  17. package/dist/index.esm.js +915 -1038
  18. package/dist/index.js +914 -1037
  19. package/docs-dist/umi.css +2 -3
  20. package/docs-dist/umi.js +1 -1
  21. package/package.json +1 -1
  22. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +1 -1
  23. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +4 -1
  24. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +5 -5
  25. package/src/Invoice/InvoiceController/fns/addGoodDiscount.ts +1 -1
  26. package/src/Invoice/InvoiceController/fns/delGood.ts +2 -4
  27. package/src/Invoice/index.tsx +13 -18
  28. package/src/Invoice/tools/idGenerator/index.ts +3 -2
  29. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +1 -1
  30. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +22 -29
  31. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.tsx +5 -1
  32. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +34 -11
  33. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +19 -7
  34. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +11 -5
  35. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +53 -19
  36. package/src/Invoice/ui/GoodsList/hook/useOnRow/index.tsx +0 -1
  37. package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +9 -0
  38. package/src/Invoice/ui/GoodsList/index.less +5 -1
  39. package/src/Invoice/ui/GoodsList/index.tsx +17 -3
  40. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +1 -1
  41. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +10 -39
  42. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +11 -2
  43. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +2 -2
  44. package/src/Invoice/ui/GoodsList/ui/TableRow/index.tsx +13 -4
  45. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +58 -63
@@ -194,23 +194,12 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
194
194
  {getFieldDecorator('discount', {
195
195
  rules: [
196
196
  { required: true, message: '请输入折扣金额' },
197
- {
198
- pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
199
- message: '请输入数字',
200
- },
197
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
201
198
  {
202
199
  validator: (_, value: string, callback) => {
203
- if (!value) {
204
- callback();
205
- return;
206
- }
207
- if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) {
208
- callback();
209
- return;
210
- }
211
- if (parseFloat(value) > 100 || parseFloat(value) < 0) {
212
- callback('请输入大于0小于100的数字');
213
- }
200
+ if (!value) { callback(); return; }
201
+ if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
202
+ if (parseFloat(value) > 100 || parseFloat(value) < 0) { callback('请输入大于0小于100的数字'); }
214
203
  callback();
215
204
  },
216
205
  },
@@ -227,26 +216,12 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
227
216
  {getFieldDecorator('discolineAmountunt', {
228
217
  rules: [
229
218
  { required: true, message: '请输入折扣金额' },
230
- {
231
- pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
232
- message: '请输入数字',
233
- },
219
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
234
220
  {
235
221
  validator: (_, value: string, callback) => {
236
- if (!value) {
237
- callback();
238
- return;
239
- }
240
- if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) {
241
- callback();
242
- return;
243
- }
244
- if (
245
- parseFloat(value) > lineAmountSum ||
246
- parseFloat(value) < 0
247
- ) {
248
- callback('请输入大于0小于金额合计的数字');
249
- }
222
+ if (!value) { callback(); return; }
223
+ if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
224
+ if (parseFloat(value) > lineAmountSum || parseFloat(value) < 0) { callback('请输入大于0小于金额合计的数字'); }
250
225
  callback();
251
226
  },
252
227
  },
@@ -261,12 +236,8 @@ const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
261
236
  </Form.Item>
262
237
  </div>
263
238
  <div className="add-discount-row-footer">
264
- <Button block style={{ marginBottom: 12 }} onClick={onClose}>
265
- 取消
266
- </Button>
267
- <Button type="primary" block onClick={onClickSave}>
268
- 保存
269
- </Button>
239
+ <Button block style={{ marginBottom: 12 }} onClick={onClose}>取消</Button>
240
+ <Button type="primary" block onClick={onClickSave}>保存</Button>
270
241
  </div>
271
242
  </>
272
243
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Invoice from '../../../../../../';
3
3
  import LineAttributeType from '../../../../../../InvoiceController/InvoiceControllerState/GoodsListState/LineAttributeType';
4
- import { Menu } from 'kts-components-antd-x3';
4
+ import { Button, Menu } from 'kts-components-antd-x3';
5
5
 
6
6
  export default () => {
7
7
 
@@ -53,5 +53,14 @@ export default () => {
53
53
  )
54
54
  }, [model, onClick, disabled])
55
55
 
56
- return { menuItem };
56
+ const button = React.useMemo(() => {
57
+
58
+ if (model === 'prefab') return <></>;
59
+
60
+ return (
61
+ <Button onClick={onClick} disabled={disabled} >批量删除</Button>
62
+ )
63
+ }, [model, onClick, disabled])
64
+
65
+ return { button, menuItem };
57
66
  };
@@ -42,7 +42,7 @@ export default () => {
42
42
  )
43
43
  }, [onClick, disabled])
44
44
 
45
- const buuton = React.useMemo(() => {
45
+ const button = React.useMemo(() => {
46
46
  return (
47
47
  <Button onClick={onClick} disabled={disabled}>
48
48
  批量赋码
@@ -50,5 +50,5 @@ export default () => {
50
50
  )
51
51
  }, [onClick, disabled])
52
52
 
53
- return { menuItem, buuton };
53
+ return { menuItem, button };
54
54
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import Invoice from '../../../../';
3
3
  import { LineAttributeType } from '../../../../InvoiceController'
4
+ import classnames from 'classnames'
4
5
 
5
6
  export default function TableRow(props: any) {
6
7
 
@@ -8,13 +9,21 @@ export default function TableRow(props: any) {
8
9
 
9
10
  const goodsMap = controller.useMemo(s => s.goodsListState.goodsMap, [])
10
11
 
11
- const isR = React.useMemo(() => {
12
+ const discount = React.useMemo(() => {
12
13
  const i = goodsMap.get(props['data-row-key']);
13
- if (!i) return false;
14
- return i.lineAttribute !== LineAttributeType.正常
14
+ if (!i) return undefined;
15
+
16
+ if (i.lineAttribute === LineAttributeType.折扣行) {
17
+ return 'kts-invoice-operate-goods-be-discount'
18
+ } else if (i.lineAttribute === LineAttributeType.被折扣行) {
19
+ return 'kts-invoice-operate-goods-discount'
20
+ } else {
21
+ return undefined;
22
+ }
15
23
  }, [props['data-row-key'], goodsMap])
16
24
 
17
25
  return (
18
- <tr {...props} className={`${isR ? 'kts-invoice-operate-goods-discount ' : ''}${props.className}`} />
26
+ // <tr {...props} className={`${isR ? 'kts-invoice-operate-goods-discount ' : ''}${props.className}`} />
27
+ <tr {...props} className={classnames(props.className, discount)} />
19
28
  )
20
29
  }
@@ -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
  }}