kts-component-invoice-operate 3.2.227 → 3.2.228-fuling

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 (90) hide show
  1. package/README.md +0 -4
  2. package/dist/Invoice/Invoice-digtal/_test/pay/index.d.ts +4 -0
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +0 -1
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.d.ts +0 -2
  5. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +0 -2
  6. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.d.ts +6 -0
  7. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.d.ts +12 -0
  8. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.d.ts +21 -0
  9. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.d.ts +31 -0
  10. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +2 -0
  11. package/dist/Invoice/InvoiceController/fns/addPay.d.ts +6 -0
  12. package/dist/Invoice/InvoiceController/fns/delPay.d.ts +6 -0
  13. package/dist/Invoice/InvoiceController/fns/saveEditPay.d.ts +6 -0
  14. package/dist/Invoice/InvoiceController/fns/setEditPay.d.ts +6 -0
  15. package/dist/Invoice/InvoiceController/fns/setPay.d.ts +6 -0
  16. package/dist/Invoice/InvoiceController/index.d.ts +6 -0
  17. package/dist/Invoice/index.d.ts +2 -0
  18. package/dist/Invoice/ui/default/GoodsList/index.d.ts +0 -1
  19. package/dist/Invoice/ui/default/GoodsList/ui/AddRowButton/index.d.ts +1 -1
  20. package/dist/Invoice/ui/digtal/GoodsList/index.d.ts +0 -1
  21. package/dist/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -4
  22. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/index.d.ts +3 -0
  23. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.d.ts +8 -0
  24. package/dist/Invoice/ui/digtal/PayList/hook/useOnRow/index.d.ts +8 -0
  25. package/dist/Invoice/ui/digtal/PayList/hook/useRowSelection/index.d.ts +8 -0
  26. package/dist/Invoice/ui/digtal/PayList/hook/useWindowClick/index.d.ts +5 -0
  27. package/dist/Invoice/ui/digtal/PayList/index.d.ts +18 -0
  28. package/dist/Invoice/ui/digtal/PayList/ui/AddRowButton/index.d.ts +3 -0
  29. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +6 -0
  30. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +6 -0
  31. package/dist/Invoice/ui/digtal/PayList/ui/TableRow/index.d.ts +3 -0
  32. package/dist/Invoice/ui/digtal/PayList/ui/TableVirtual/index.d.ts +4 -0
  33. package/dist/index.esm.js +8097 -6065
  34. package/dist/index.js +8096 -6064
  35. package/package.json +1 -1
  36. package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +41 -9
  37. package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +23 -17
  38. package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +14637 -0
  39. package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +7 -69
  40. package/src/Invoice/Invoice-digtal/index.md +16 -8
  41. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +11 -0
  42. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +0 -2
  43. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.ts +0 -3
  44. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +0 -3
  45. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.ts +10 -0
  46. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.ts +35 -0
  47. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.ts +81 -0
  48. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.ts +40 -0
  49. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +3 -0
  50. package/src/Invoice/InvoiceController/fns/addPay.ts +11 -0
  51. package/src/Invoice/InvoiceController/fns/delPay.ts +38 -0
  52. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +2 -2
  53. package/src/Invoice/InvoiceController/fns/saveEditPay.ts +23 -0
  54. package/src/Invoice/InvoiceController/fns/setEditPay.ts +16 -0
  55. package/src/Invoice/InvoiceController/fns/setPay.ts +11 -0
  56. package/src/Invoice/InvoiceController/index.ts +21 -0
  57. package/src/Invoice/_test/deduction/index.tsx +6 -28
  58. package/src/Invoice/index.md +4 -4
  59. package/src/Invoice/index.tsx +3 -0
  60. package/src/Invoice/tools/useToGenerateId/index.ts +2 -0
  61. package/src/Invoice/ui/default/GoodsList/index.tsx +1 -3
  62. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +1 -8
  63. package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +1 -4
  64. package/src/Invoice/ui/digtal/Architecture/index.tsx +1 -1
  65. package/src/Invoice/ui/digtal/FreightList/index.tsx +1 -1
  66. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +23 -37
  67. package/src/Invoice/ui/digtal/GoodsList/index.tsx +1 -3
  68. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +10 -20
  69. package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +6 -11
  70. package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -5
  71. package/src/Invoice/ui/digtal/PayList/hook/useColumns/dist/index.js +616 -0
  72. package/src/Invoice/ui/digtal/PayList/hook/useColumns/index.tsx +168 -0
  73. package/src/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.tsx +20 -0
  74. package/src/Invoice/ui/digtal/PayList/hook/useOnRow/index.tsx +37 -0
  75. package/src/Invoice/ui/digtal/PayList/hook/useRowSelection/index.tsx +120 -0
  76. package/src/Invoice/ui/digtal/PayList/hook/useWindowClick/index.tsx +19 -0
  77. package/src/Invoice/ui/digtal/PayList/index.less +73 -0
  78. package/src/Invoice/ui/digtal/PayList/index.tsx +132 -0
  79. package/src/Invoice/ui/digtal/PayList/ui/AddRowButton/index.tsx +75 -0
  80. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -0
  81. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -0
  82. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.less +29 -0
  83. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.tsx +21 -0
  84. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.less +39 -0
  85. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.tsx +109 -0
  86. package/src/Invoice/ui/digtal/RealEstateInfo/index.less +0 -7
  87. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +104 -363
  88. package/src/Invoice/ui/digtal/StakeFarmerholder/index.less +1 -1
  89. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +528 -207
  90. package/src/Invoice/ui/digtal/Stakeholder/index.tsx +4 -22
@@ -2,83 +2,21 @@ import React from 'react';
2
2
  import Invoice from '../../..';
3
3
  import moment from 'moment';
4
4
  import 'antd/dist/antd.css';
5
- import { Button } from 'kts-components-antd-x3';
5
+
6
6
  export default () => {
7
7
 
8
8
  const controller = React.useMemo(() => new Invoice.InvoiceController(), []);
9
9
 
10
10
  React.useEffect(() => {
11
11
  controller.run(async s => {
12
- controller.state.goodsListState.goodsList = [{
13
- "taxRate": 3,
14
- "lineAttribute": 0,
15
- "$index": "88a5549b-ede2-488a-962b-26dc1d5e4e3a",
16
- "serialNo": 1,
17
- "itemName": "车辆停放服务",
18
- "lineAmountIncludeTax": 6,
19
- "taxAmount": 0.17,
20
- "lineAmountExcludeTax": 5.83,
21
- cd:3,
22
- },{
23
- "taxRate": 3,
24
- "lineAttribute": 0,
25
- "$index": "88a5549b-ede2-488a-962b-26dc1d5e4e31",
26
- "serialNo": 1,
27
- "itemName": "车辆停放服务",
28
- "lineAmountIncludeTax": 6,
29
- "taxAmount": 0.17,
30
- "lineAmountExcludeTax": 5.83,
31
- cd:2
32
- }]
33
- window.setTimeout(() => {
34
- controller.formList.get('realEstateInfo')?.setFieldsValue({
35
- realEstateDataDto: [
36
- {
37
- "$index": "88a5549b-ede2-488a-962b-26dc1d5e4e3a",
38
- realEstateAddress: ['北京市', '北京市', '东城区'],
39
- realEstateDetailedAddress: '东城区东华门大街',
40
- leaseTerm: [moment('2023-07-06 10:43'), moment('2023-07-06 10:59')],
41
- crossCitiesSign: 'Y',
42
- realEstateNumber: '123456789',
43
- realEstateUnit: '平方米',
44
- cphList:['京b22132','渝a12345','渝a1x212'],
45
- },
46
- {
47
- "$index": "88a5549b-ede2-488a-962b-26dc1d5e4e31",
48
- realEstateAddress: ['北京市', '北京市', '东城区'],
49
- realEstateDetailedAddress: '东城区东华门大街',
50
- leaseTerm: [moment('2023-07-06 10:43'), moment('2023-07-06 10:59')],
51
- crossCitiesSign: 'Y',
52
- realEstateNumber: '123456789',
53
- realEstateUnit: '平方米',
54
- cphList:['渝b22132','陕a12345',],
55
- }
56
- ]
57
- })
58
- }, 1000)
59
12
  })
60
13
  }, [])
61
- const onSave = async () => {
62
- const formValues = await controller.validateFields();
63
- console.log(formValues)
64
- }
14
+
65
15
  return (
66
- <>
67
- <Button onClick={onSave}>输出表单内容</Button>
68
- <Invoice
69
- invoiceType='digtal'
70
- controller={controller}
71
- specialInfor={<Invoice.RealEstateInfo realEstateAddressOptions={[
72
- {
73
- "code": "11",
74
- "name": "北京市"
75
- }] || []}
76
- realEstateAddressFieldNames={{
77
- label: 'name',
78
- value: 'name',
79
- children: 'children'
80
- }} />}
81
- />
82
- </>
16
+ <Invoice
17
+ invoiceType='digtal'
18
+ controller={controller}
19
+ specialInfor={<Invoice.RealEstateInfo />}
20
+ />
83
21
  )
84
22
  };
@@ -1,10 +1,11 @@
1
1
  # 数电
2
2
 
3
- <!-- ## 简单用法
4
- <code src="./_test/easiest/index.tsx"></code> -->
3
+ ## 简单用法
4
+ <code src="./_test/pay/index.tsx"></code>
5
+ <!-- <code src="./_test/easiest/index.tsx"></code> -->
5
6
 
6
- ## 不动产经营租赁服务
7
- <code src="./_test/realEstateInfo/index.tsx"></code>
7
+ <!-- ## 不动产经营租赁服务
8
+ <code src="./_test/realEstateInfo/index.tsx"></code> -->
8
9
 
9
10
  <!-- ## 建筑服务
10
11
  <code src="./_test/architecture/index.tsx"></code> -->
@@ -36,9 +37,16 @@
36
37
  ## 查看当前可用授信额度
37
38
  <code src="./_test/lineCredit/index.tsx"></code>
38
39
 
39
-
40
+ ## 不动产经营租赁服务
41
+ <code src="./_test/realEstateInfo/index.tsx"></code>
40
42
 
41
43
  -->
42
-
43
- <!-- ## 货物运输服务
44
- <code src="./_test/freight/index.tsx"></code> -->
44
+ <<<<<<< HEAD
45
+
46
+ ## 货物运输服务
47
+ <code src="./_test/freight/index.tsx"></code>
48
+ =======
49
+ <!--
50
+ ## 货物运输服务
51
+ <code src="./_test/freight/index.tsx"></code> -->
52
+ >>>>>>> 3e4750d (农产品发票升级)
@@ -58,6 +58,17 @@ export default class InvoiceControllerForm extends GreyReactBox<InvoiceControlle
58
58
 
59
59
  _values.set('freightList', this.state.freightListState.goodsList.slice());
60
60
 
61
+ //支付
62
+ if (this.state.payListState.form) {
63
+ try {
64
+ await this.state.payListState.form?.validateFields()
65
+ } catch (error: any) {
66
+ _errors.set('payList', error.errors);
67
+ }
68
+ }
69
+
70
+ _values.set('payList', this.state.payListState.goodsList.slice());
71
+
61
72
  // 金额(含税)
62
73
  _values.set('lineAmountIncludeTax', (() => {
63
74
  let sum = chain(bignumber(0));
@@ -84,6 +84,4 @@ export default interface IGood {
84
84
 
85
85
  /** 孩子 */
86
86
  children?: IGood[];
87
-
88
- cd?:number
89
87
  }
@@ -63,9 +63,6 @@ export default class ImportGoods<ColumnType = any> {
63
63
  /** 是否显示导入 */
64
64
  isVisibleDrawer = false;
65
65
 
66
- /** 搜索条件 */
67
- filter: any = {};
68
-
69
66
  /** 顶部扩展 */
70
67
  topExpand?: React.ReactNode;
71
68
 
@@ -128,7 +128,4 @@ export default class GoodsListState {
128
128
  /** 商品拖拽数据 */
129
129
  drag = new Drag();
130
130
 
131
- /** 商品校验是否关闭,默认开启 */
132
- isValidateGood = true;
133
-
134
131
  }
@@ -0,0 +1,10 @@
1
+
2
+ /** 商品表格补充配置 */
3
+
4
+ import { ValidationRule } from "kts-components-antd-x3/lib/form";
5
+
6
+ export default interface IColumnsReplenish {
7
+
8
+ /** 补充的规则 */
9
+ rules: ValidationRule[];
10
+ }
@@ -0,0 +1,35 @@
1
+ export default interface IGood {
2
+ /** 数据索引 */
3
+ $index: string;
4
+ /** 序号 */
5
+ sortNumber?: number;
6
+ /** 运输工具种类列表 */
7
+ vehicleList?: any[] | null;
8
+
9
+ /** 运输工具种类 */
10
+ vehicle?: string;
11
+
12
+ channel:string;
13
+
14
+ number:string;
15
+
16
+
17
+
18
+ // itemName?:string;
19
+
20
+ /** 运输工具牌号 */
21
+ // vehicleNo?: string;
22
+
23
+ /** 起运地 */
24
+ // origin?: string[];
25
+
26
+ /** 到达地 */
27
+ // destination?: string[];
28
+
29
+ /** 运输货物名称 */
30
+ // goodName?: string;
31
+
32
+ /** 地区 */
33
+ // area?: string[];
34
+
35
+ }
@@ -0,0 +1,81 @@
1
+ import { ColumnProps } from 'kts-components-antd-x3/lib/Table/interface';
2
+ import { PaginationConfig } from 'kts-components-antd-x3/lib/Table';
3
+ import { message } from 'kts-components-antd-x3';
4
+ import React from 'react';
5
+
6
+ export interface IGetGoodsListOption {
7
+ /** 分页数据 */
8
+ pagination: PaginationConfig;
9
+ }
10
+
11
+ export default class ImportGoods<ColumnType = any> {
12
+ /** 表头 */
13
+ columns: ColumnProps<ColumnType>[] = [
14
+ {
15
+ title: '商品分类',
16
+ dataIndex: 'itemType',
17
+ key: 'itemType',
18
+ },
19
+ {
20
+ title: '商品编码',
21
+ dataIndex: 'itemNo',
22
+ key: 'itemNo',
23
+ },
24
+ {
25
+ title: '商品名称',
26
+ dataIndex: 'itemName',
27
+ key: 'itemName',
28
+ },
29
+ {
30
+ title: '规格型号',
31
+ dataIndex: 'itemModelName',
32
+ key: 'itemModelName',
33
+ },
34
+ {
35
+ title: '计量单位',
36
+ dataIndex: 'unit',
37
+ key: 'unit',
38
+ },
39
+ {
40
+ title: '税率',
41
+ dataIndex: 'taxRate',
42
+ key: 'taxRate',
43
+ render: text => text || text === 0 ? `${text}%` : ''
44
+ },
45
+ {
46
+ title: '单价(含税)',
47
+ dataIndex: 'priceIncludeTax',
48
+ key: 'priceIncludeTax',
49
+ },
50
+ {
51
+ title: '税收分类编码',
52
+ dataIndex: 'taxClassificationCode',
53
+ key: 'taxClassificationCode',
54
+ },
55
+ ];
56
+
57
+ /** 货物列表 */
58
+ dataSource: ColumnType[] = [];
59
+
60
+ /** 分页数据 */
61
+ pagination: PaginationConfig = {};
62
+
63
+ /** 是否显示导入 */
64
+ isVisibleDrawer = false;
65
+
66
+ /** 顶部扩展 */
67
+ topExpand?: React.ReactNode;
68
+
69
+ /** 导入时校验函数 */
70
+ verifyFn: (record: any) => Promise<boolean> = async record => {
71
+ if (!record.taxClassificationCode) {
72
+ message.error({ content: '请维护该商品的税收分类编码!', key: '请维护该商品的税收分类编码!' })
73
+ return false;
74
+ }
75
+ if (record.productStatus === 0) {
76
+ message.error({ content: '当前货物为禁用', key: '当前货物为禁用' })
77
+ return false;
78
+ }
79
+ return true;
80
+ };
81
+ }
@@ -0,0 +1,40 @@
1
+ import IGood from './IGood';
2
+ import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
3
+
4
+ export default class PayListState {
5
+
6
+ /** 产品最大数 */
7
+ goodMax?: number;
8
+
9
+ /** 正在编辑的货物 */
10
+ editGood?: IGood;
11
+
12
+ /** 是否可以添加行 */
13
+ isAddRow = true;
14
+
15
+ /** 是否可以删除行 */
16
+ isRemRow = true;
17
+
18
+ /** 货物字典 */
19
+ goodsMap = new Map<string, IGood>();
20
+
21
+ /** 被编辑行的form对象 */
22
+ form?: WrappedFormUtils;
23
+
24
+ /** 运输工具种类列表 */
25
+ vehicleTypeList: any[] = [];
26
+
27
+ /** 货物列表 */
28
+ goodsList: IGood[] = [];
29
+
30
+ /** 列表选中的货物索引列表 */
31
+ selectedGoodIndex: string[] = [];
32
+
33
+ /** 地区 */
34
+ area: any[] = [];
35
+
36
+ addressFieldNames: IFieldNames = { label: 'label', value: 'value', children: 'children' }
37
+ }
38
+ interface IFieldNames {
39
+ label: string; value: string; children: string
40
+ }
@@ -1,5 +1,6 @@
1
1
  import GoodsListState from './GoodsListState';
2
2
  import FreightListState from './FreightListState';
3
+ import PayListState from './PayListState';
3
4
  import BuyerState from './BuyerState';
4
5
  import Stakeholder from './Stakeholder';
5
6
  import { IInvoiceTypeModalProps } from '../../../InvoiceTypeModal';
@@ -68,6 +69,8 @@ export default class InvoiceControllerState {
68
69
  * 货物运输列表
69
70
  */
70
71
  freightListState = new FreightListState();
72
+
73
+ payListState=new PayListState();
71
74
 
72
75
  addGoodsCheck?: any;
73
76
  }
@@ -0,0 +1,11 @@
1
+ import { InvoiceControllerState } from '..';
2
+ import idGenerator from '../../tools/idGenerator';
3
+
4
+ /**
5
+ * 添加的付款
6
+ */
7
+ export default async (state: InvoiceControllerState, options?: any) => {
8
+ options.$index = idGenerator();
9
+ state.payListState.goodsList = [...state.payListState.goodsList, options];
10
+ return options;
11
+ };
@@ -0,0 +1,38 @@
1
+ import { InvoiceControllerState } from '..';
2
+
3
+ /**
4
+ * 删除一个付款行
5
+ */
6
+ export default async (state: InvoiceControllerState, $index?: string) => {
7
+ if (!$index) return;
8
+ // 查下要删除的货物
9
+ const goods = state.payListState.goodsList.filter((e) => e.$index === $index)[0];
10
+ if (!goods) return;
11
+
12
+ // 如果正在编辑 就取消编辑
13
+ if (state.payListState.editGood && state.payListState.editGood.$index === $index) {
14
+ state.payListState.editGood = undefined;
15
+ }
16
+ const goodsList = state.payListState.goodsList;
17
+ const goodsMap = state.payListState.goodsMap;
18
+
19
+ goodsMap.delete($index);
20
+
21
+ for (let i = 0; i < goodsList.length; i++) {
22
+
23
+ if (goodsList[i].$index === $index) {
24
+ // const good = goodsList[i];
25
+
26
+ // if (good.lineAttribute === LineAttributeType.折扣行 && goodsList[i - 1] && goodsList[i - 1].lineAttribute === LineAttributeType.被折扣行) {
27
+ // goodsList[i - 1].lineAttribute = LineAttributeType.正常;
28
+ // }
29
+
30
+ goodsList.splice(i, 1);
31
+
32
+ break;
33
+ }
34
+ }
35
+
36
+ state.payListState.goodsList = [...goodsList];
37
+ state.payListState.goodsMap = new Map(goodsMap);
38
+ };
@@ -4,10 +4,10 @@ import { InvoiceControllerState } from '../';
4
4
  * 保存正在编辑的货物
5
5
  */
6
6
  export default async (state: InvoiceControllerState) => {
7
-
7
+
8
8
  const editGood = state.goodsListState.editGood;
9
9
  const form = state.goodsListState.form;
10
- // const isValidateGood = state.goodsListState.isValidateGood
10
+
11
11
  if (!editGood || !form || state.goodsListState.importGoods.isVisibleDrawer || state.calculatingField) return;
12
12
  if ((await validateFields(form)).err) return;
13
13
 
@@ -0,0 +1,23 @@
1
+ import { InvoiceControllerState } from '..';
2
+
3
+ /**
4
+ * 保存正在编辑的支付信息
5
+ */
6
+ export default async (state: InvoiceControllerState) => {
7
+
8
+ const editGood = state.payListState.editGood;
9
+ const form = state.payListState.form;
10
+ if (!editGood || !form ) return;
11
+ if ((await validateFields(form)).err) return;
12
+
13
+ state.payListState.goodsList = state.payListState.goodsList.map((e) =>
14
+ e.$index === editGood.$index ? { ...e, ...editGood } : e,
15
+ );
16
+ state.payListState.editGood = undefined;
17
+ };
18
+
19
+ const validateFields = (form: any) => new Promise((resolve: (v: { err: any; values: any }) => void) => {
20
+ form.validateFields(async (err: any, values: any) => {
21
+ resolve({ err, values });
22
+ });
23
+ });
@@ -0,0 +1,16 @@
1
+ import { InvoiceControllerState, IGood3 } from '..';
2
+
3
+ /**
4
+ * 设置当前的编辑的付款信息
5
+ */
6
+ export default async (state: InvoiceControllerState, newEditGood?: any) => {
7
+ if (newEditGood) {
8
+ const editGood = state.payListState.editGood as IGood3;
9
+ state.payListState = {
10
+ ...state.payListState,
11
+ editGood: { ...editGood, ...newEditGood },
12
+ };
13
+ } else {
14
+ state.payListState = { ...state.payListState, editGood: undefined };
15
+ }
16
+ };
@@ -0,0 +1,11 @@
1
+
2
+ import { InvoiceControllerState, IGood } from '..';
3
+
4
+ /**
5
+ * 设置单个商品的付款信息
6
+ */
7
+ export default async (state: InvoiceControllerState, options?: IGood) => {
8
+ if (!options || !options.$index) return;
9
+ const goodsList = state.payListState.goodsList.map(e => e.$index === options.$index ? { ...e, ...options } : e);
10
+ state.payListState = { ...state.payListState, goodsList };
11
+ };
@@ -5,16 +5,27 @@ import { IGetGoodsListOption } from './InvoiceControllerState/GoodsListState/Imp
5
5
  // import updateInvoiceNo from './fns/updateInvoiceNo';
6
6
  import setEditGood from './fns/setEditGood';
7
7
  import setEditFreight from './fns/setEditFreight';
8
+ import setEditPay from './fns/setEditPay';
9
+
8
10
  import setGoods from './fns/setGoods';
9
11
  import setFreight from './fns/setFreight';
12
+ import setPay from './fns/setPay';
13
+
10
14
  import delGood from './fns/delGood';
11
15
  import delFreight from './fns/delFreight';
16
+ import delPay from './fns/delPay';
17
+
12
18
  import addGoodDiscount from './fns/addGoodDiscount';
13
19
  import addGoodDiscountV2 from './fns/addGoodDiscountV2';
20
+
14
21
  import addGood from './fns/addGood';
15
22
  import addFreight from './fns/addFreight';
23
+ import addPay from './fns/addPay';
24
+
16
25
  import saveEditGood from './fns/saveEditGood';
17
26
  import saveEditFreight from './fns/saveEditFreight';
27
+ import saveEditPay from './fns/saveEditPay';
28
+
18
29
  import getGoodsSearch from './fns/getGoodsSearch';
19
30
  import mergeDetails from './fns/mergeDetails';
20
31
  import mergeDiscount from './fns/mergeDiscount';
@@ -25,6 +36,7 @@ export { default as InvoiceControllerState } from './InvoiceControllerState';
25
36
  export { default as IGood } from './InvoiceControllerState/GoodsListState/IGood';
26
37
  export { default as LineAttributeType } from './InvoiceControllerState/GoodsListState/LineAttributeType';
27
38
  export { default as IGood2 } from './InvoiceControllerState/FreightListState/IGood';
39
+ export { default as IGood3 } from './InvoiceControllerState/PayListState/IGood';
28
40
  export default class InvoiceController extends InvoiceControllerForm {
29
41
  constructor(state = new InvoiceControllerState()) {
30
42
  super(state);
@@ -48,8 +60,12 @@ export default class InvoiceController extends InvoiceControllerForm {
48
60
  /** 设置货物运输属性 */
49
61
  setFreight = this.pipeline(setFreight);
50
62
 
63
+ setPay = this.pipeline(setPay);
64
+
51
65
  setEditFreight = this.pipeline(setEditFreight);
52
66
 
67
+ setEditPay = this.pipeline(setEditPay);
68
+
53
69
  /** 设置当前的编辑货物 */
54
70
  setEditGood = this.pipeline(setEditGood);
55
71
 
@@ -59,18 +75,23 @@ export default class InvoiceController extends InvoiceControllerForm {
59
75
  /** 保存正在编辑的货物运输 */
60
76
  saveEditFreight = this.pipeline<any>(saveEditFreight);
61
77
 
78
+ saveEditPay=this.pipeline<any>(saveEditPay);
62
79
  /** 删除一个货物 */
63
80
  delGood = this.pipeline(delGood);
64
81
 
65
82
  /** 删除一个货物运输 */
66
83
  delFreight = this.pipeline(delFreight);
67
84
 
85
+ delPay = this.pipeline(delPay);
86
+
68
87
  /** 添加一个货物 */
69
88
  addGood = this.pipeline(addGood);
70
89
 
71
90
  /** 添加一个货物运输 */
72
91
  addFreight = this.pipeline(addFreight);
73
92
 
93
+ addPay = this.pipeline(addPay);
94
+
74
95
  /** 全单合并明细 */
75
96
  mergeDetails = this.pipeline(mergeDetails);
76
97
 
@@ -1,18 +1,12 @@
1
1
  import React from 'react';
2
- import { Input, message } from 'kts-components-antd-x3';
2
+ import { Input } from 'kts-components-antd-x3';
3
3
  import Invoice from '../../';
4
4
  import 'antd/dist/antd.css';
5
5
 
6
6
  export default () => {
7
7
 
8
8
  const controller = React.useMemo(() => new MyController1(), [])
9
- React.useEffect(() => {
10
- controller.run(async s => {
11
- s.addGoodsCheck=checkGood;
12
-
13
9
 
14
- })
15
- }, [])
16
10
  const [deduction, setDeduction] = React.useState<number | undefined>(0);
17
11
 
18
12
  const [goodMax, setgoodMax] = React.useState(0);
@@ -35,33 +29,17 @@ export default () => {
35
29
  </span>
36
30
  )
37
31
  }, [])
38
- const checkGood = async () => {
39
- await new Promise((resolve,) => {
40
- setTimeout(() => {
41
- const a = Math.random();
42
- if (a > 0.5) {
43
- message.error('请先填写发票行信息,再添加新的行');
44
- return false;
45
- } else {
46
- resolve(true)
47
- console.log(11112)
48
- }
49
32
 
50
- }, 1000)
51
- })
52
- }
53
33
  return (
54
34
  <Invoice
55
35
  controller={controller}
56
36
  goodsList={
57
37
  <Invoice.GoodsList
58
-
59
- // addGoodsCheck={checkGood}
60
- // isSwitchTax={false} // 是否可以切换(含税/不含税)状态
61
- // isAddDiscount={false} // 不能添加折扣行
62
- // goodMax={goodMax} // 控制能可以添加的货物函数
63
- // deduction={deduction} // 扣除额
64
- // menuExpansion={menuExpansion} // 扩展
38
+ isSwitchTax={false} // 是否可以切换(含税/不含税)状态
39
+ isAddDiscount={false} // 不能添加折扣行
40
+ goodMax={goodMax} // 控制能可以添加的货物函数
41
+ deduction={deduction} // 扣除额
42
+ menuExpansion={menuExpansion} // 扩展
65
43
  />
66
44
  }
67
45
  />
@@ -1,18 +1,18 @@
1
1
  # 默认
2
2
 
3
- <!-- ## 简单用法
3
+ ## 简单用法
4
4
  <code src="./_test/easiest/index.tsx"></code>
5
5
 
6
6
  ## 设置为草稿,设置默认参数 扩展按钮
7
7
  <code src="./_test/draft/index.tsx" title="类似的操作,请查看API" ></code>
8
8
 
9
9
  ## 设置购买方名称搜索
10
- <code src="./_test/buyerNameSearch/index.tsx"></code> -->
10
+ <code src="./_test/buyerNameSearch/index.tsx"></code>
11
11
 
12
12
  ## 设置扣除额(差额征税)
13
13
  <code src="./_test/deduction/index.tsx"></code>
14
14
 
15
- <!-- ## 设置单位列表、税率列表
15
+ ## 设置单位列表、税率列表
16
16
  <code src="./_test/unit/index.tsx" ></code>
17
17
 
18
18
  ## 发票头类型设置和购买方信息配置
@@ -53,4 +53,4 @@
53
53
  <API name="GoodsList 商品列表 API" exports='["default"]' src="./ui/default/GoodsList/index.tsx"></API>
54
54
  <API name="Buyer 购买方 API" exports='["default"]' src="./ui/default/Buyer/index.tsx"></API>
55
55
  <API name="Seller 销售方 API" exports='["default"]' src="./ui/default/Seller/index.tsx"></API>
56
- <API name="Sign 落款 API" exports='["default"]' src="./ui/default/Sign/index.tsx"></API> -->
56
+ <API name="Sign 落款 API" exports='["default"]' src="./ui/default/Sign/index.tsx"></API>
@@ -21,6 +21,7 @@ import GoodsListDigtal from './ui/digtal/GoodsList';
21
21
  import RealEstateInfo from './ui/digtal/RealEstateInfo';
22
22
  import Architecture from './ui/digtal/Architecture';
23
23
  import FreightList from './ui/digtal/FreightList';
24
+ import PayList from './ui/digtal/PayList';
24
25
 
25
26
  import ImportBuyerDrawer from './ui/default/ImportBuyerDrawer';
26
27
  import ImportGoodsDrawer from './ui/default/ImportGoodsDrawer';
@@ -110,6 +111,8 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
110
111
 
111
112
  static readonly FreightList = FreightList;
112
113
 
114
+ static readonly PayList = PayList;
115
+
113
116
  /** 货物列表(数电) */
114
117
  static readonly GoodsListDigtal = GoodsListDigtal;
115
118
 
@@ -8,4 +8,6 @@ export default function useToGenerateId(controller: InvoiceController) {
8
8
  React.useEffect(() => { goodsList.forEach((e, i) => { e.serialNo = i + 1 }) }, [goodsList])
9
9
  const freightList = controller.useMemo(s => s.freightListState.goodsList, []);
10
10
  React.useEffect(() => { freightList.forEach((e, i) => { e.sortNumber = i + 1 }) }, [freightList])
11
+ const payList = controller.useMemo(s => s.payListState.goodsList, []);
12
+ React.useEffect(() => { payList.forEach((e, i) => { e.sortNumber = i + 1 }) }, [payList])
11
13
  }