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

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 (34) hide show
  1. package/README.md +4 -0
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -0
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.d.ts +2 -0
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  5. package/dist/Invoice/ui/default/GoodsList/index.d.ts +1 -0
  6. package/dist/Invoice/ui/default/GoodsList/ui/AddRowButton/index.d.ts +1 -1
  7. package/dist/Invoice/ui/digtal/GoodsList/index.d.ts +1 -0
  8. package/dist/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.d.ts +4 -1
  9. package/dist/index.esm.js +707 -251
  10. package/dist/index.js +706 -250
  11. package/package.json +1 -1
  12. package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +1 -1
  13. package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +69 -7
  14. package/src/Invoice/Invoice-digtal/index.md +2 -9
  15. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +2 -0
  16. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.ts +3 -0
  17. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
  18. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +2 -2
  19. package/src/Invoice/_test/deduction/index.tsx +28 -6
  20. package/src/Invoice/index.md +4 -4
  21. package/src/Invoice/ui/default/GoodsList/index.tsx +3 -1
  22. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +8 -1
  23. package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +4 -1
  24. package/src/Invoice/ui/digtal/Architecture/index.tsx +1 -1
  25. package/src/Invoice/ui/digtal/FreightList/index.tsx +1 -1
  26. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +37 -23
  27. package/src/Invoice/ui/digtal/GoodsList/index.tsx +3 -1
  28. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +20 -10
  29. package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +11 -6
  30. package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +5 -2
  31. package/src/Invoice/ui/digtal/RealEstateInfo/index.less +7 -0
  32. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +363 -104
  33. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +7 -6
  34. package/src/Invoice/ui/digtal/Stakeholder/index.tsx +22 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.228-fuling",
3
+ "version": "3.2.229",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -164,7 +164,7 @@ export default () => {
164
164
  <Invoice
165
165
  invoiceType='digtal'
166
166
  controller={controller}
167
- goodsList={<Invoice.GoodsListDigtal />}
167
+ goodsList={<Invoice.GoodsListDigtal onTaxSwitchChange={onTaxSwitchChange} />}
168
168
  // stakeholder={<Invoice.Stakeholder leqi={true} invoiceMarkCallback={callback} />}
169
169
  invoiceHeader={
170
170
  <Invoice.InvoiceHeader
@@ -2,21 +2,83 @@ import React from 'react';
2
2
  import Invoice from '../../..';
3
3
  import moment from 'moment';
4
4
  import 'antd/dist/antd.css';
5
-
5
+ import { Button } from 'kts-components-antd-x3';
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)
12
59
  })
13
60
  }, [])
14
-
61
+ const onSave = async () => {
62
+ const formValues = await controller.validateFields();
63
+ console.log(formValues)
64
+ }
15
65
  return (
16
- <Invoice
17
- invoiceType='digtal'
18
- controller={controller}
19
- specialInfor={<Invoice.RealEstateInfo />}
20
- />
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
+ </>
21
83
  )
22
84
  };
@@ -37,16 +37,9 @@
37
37
  ## 查看当前可用授信额度
38
38
  <code src="./_test/lineCredit/index.tsx"></code>
39
39
 
40
- ## 不动产经营租赁服务
41
- <code src="./_test/realEstateInfo/index.tsx"></code>
42
40
 
43
- -->
44
- <<<<<<< HEAD
45
41
 
46
- ## 货物运输服务
47
- <code src="./_test/freight/index.tsx"></code>
48
- =======
42
+ -->
49
43
  <!--
50
44
  ## 货物运输服务
51
- <code src="./_test/freight/index.tsx"></code> -->
52
- >>>>>>> 3e4750d (农产品发票升级)
45
+ <code src="./_test/freight/index.tsx"></code> -->
@@ -84,4 +84,6 @@ export default interface IGood {
84
84
 
85
85
  /** 孩子 */
86
86
  children?: IGood[];
87
+
88
+ cd?:number
87
89
  }
@@ -63,6 +63,9 @@ export default class ImportGoods<ColumnType = any> {
63
63
  /** 是否显示导入 */
64
64
  isVisibleDrawer = false;
65
65
 
66
+ /** 搜索条件 */
67
+ filter: any = {};
68
+
66
69
  /** 顶部扩展 */
67
70
  topExpand?: React.ReactNode;
68
71
 
@@ -128,4 +128,7 @@ export default class GoodsListState {
128
128
  /** 商品拖拽数据 */
129
129
  drag = new Drag();
130
130
 
131
+ /** 商品校验是否关闭,默认开启 */
132
+ isValidateGood = true;
133
+
131
134
  }
@@ -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
-
10
+ // const isValidateGood = state.goodsListState.isValidateGood
11
11
  if (!editGood || !form || state.goodsListState.importGoods.isVisibleDrawer || state.calculatingField) return;
12
12
  if ((await validateFields(form)).err) return;
13
13
 
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
- import { Input } from 'kts-components-antd-x3';
2
+ import { Input, message } 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
+
9
13
 
14
+ })
15
+ }, [])
10
16
  const [deduction, setDeduction] = React.useState<number | undefined>(0);
11
17
 
12
18
  const [goodMax, setgoodMax] = React.useState(0);
@@ -29,17 +35,33 @@ export default () => {
29
35
  </span>
30
36
  )
31
37
  }, [])
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
+ }
32
49
 
50
+ }, 1000)
51
+ })
52
+ }
33
53
  return (
34
54
  <Invoice
35
55
  controller={controller}
36
56
  goodsList={
37
57
  <Invoice.GoodsList
38
- isSwitchTax={false} // 是否可以切换(含税/不含税)状态
39
- isAddDiscount={false} // 不能添加折扣行
40
- goodMax={goodMax} // 控制能可以添加的货物函数
41
- deduction={deduction} // 扣除额
42
- menuExpansion={menuExpansion} // 扩展
58
+
59
+ // addGoodsCheck={checkGood}
60
+ // isSwitchTax={false} // 是否可以切换(含税/不含税)状态
61
+ // isAddDiscount={false} // 不能添加折扣行
62
+ // goodMax={goodMax} // 控制能可以添加的货物函数
63
+ // deduction={deduction} // 扣除额
64
+ // menuExpansion={menuExpansion} // 扩展
43
65
  />
44
66
  }
45
67
  />
@@ -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> -->
@@ -47,6 +47,8 @@ export interface IGoodsListProps {
47
47
 
48
48
  /** 是否可以切换(含税/不含税)状态 */
49
49
  isSwitchTax?: boolean;
50
+
51
+ addGoodsCheck?:()=>void;
50
52
  }
51
53
 
52
54
  export default class GoodsList extends React.Component<IGoodsListProps>{
@@ -137,7 +139,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
137
139
  <div className="kts-invoice-operate-goods-list-able">
138
140
  <div className="kts-invoice-operate-goods-list-able-list">
139
141
  {/* 添加行 */}
140
- <AddRowButton />
142
+ <AddRowButton addGoodsCheck={props.addGoodsCheck}/>
141
143
 
142
144
  {/* 批量菜单 */}
143
145
  {/* <BulkMenu /> */}
@@ -3,7 +3,7 @@ import Invoice from '../../../../..';
3
3
  import { Button, message } from 'kts-components-antd-x3';
4
4
  import InvoiceController, { LineAttributeType } from '../../../../../InvoiceController';
5
5
 
6
- export default () => {
6
+ export default (props: any) => {
7
7
  const controller = Invoice.useInvoiceController();
8
8
 
9
9
  const model = controller.useMemo(s => s.model, []);
@@ -26,6 +26,12 @@ export default () => {
26
26
  const disabled = React.useMemo(() => typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue, [goodMax, goodsNum, searchValue])
27
27
 
28
28
  const onClick = React.useCallback(async () => {
29
+ await controller.run(async (s) => {
30
+ if (s.addGoodsCheck) {
31
+ await s.addGoodsCheck();
32
+ }
33
+ });
34
+ console.log('continue')
29
35
  await addGood(controller);
30
36
  await rollBottom(controller, rootElement);
31
37
  }, [controller, rootElement]);
@@ -43,6 +49,7 @@ export default () => {
43
49
 
44
50
  /** 添加一个空货物 */
45
51
  async function addGood(controller: InvoiceController) {
52
+
46
53
  await controller.saveEditGood();
47
54
  await controller.wait();
48
55
  await controller.run(async (s) => {
@@ -14,7 +14,10 @@ export default () => {
14
14
  const topExpand = controller.useMemo(s => s.goodsListState.importGoods.topExpand, []);
15
15
 
16
16
  const onClose = React.useCallback(() => {
17
- controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = false })();
17
+ controller.pipeline(async s => {
18
+ s.goodsListState.importGoods.filter = {};
19
+ s.goodsListState.importGoods.isVisibleDrawer = false;
20
+ })();
18
21
  }, [controller]);
19
22
 
20
23
  return (
@@ -40,7 +40,7 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
40
40
 
41
41
  return (
42
42
  <div className="kts-invoice-operate-real-estate-info-digtal">
43
- <div className='real-estate-info-digtal-label' >特殊信息-建筑服务</div>
43
+ <div className='real-estate-info-digtal-label' >特定信息-建筑服务</div>
44
44
  <Row gutter={[17, 0]}>
45
45
  <Col span={6} >
46
46
  <Form.Item label='土地增值税项目编号' >
@@ -94,7 +94,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
94
94
  // controller.useForm('freightInfo', form);
95
95
  return (
96
96
  <div className="kts-invoice-operate-freight">
97
- <div className='real-estate-info-digtal-label' >特殊信息-货物运输</div>
97
+ <div className='real-estate-info-digtal-label' >特定信息-货物运输</div>
98
98
  <div className="kts-invoice-operate-goods-list-digtal" onClick={(e) => { e.stopPropagation() }} >
99
99
  <div className="kts-invoice-operate-freight-list-able">
100
100
  {/* 添加行 */}
@@ -73,6 +73,7 @@ export default (form: WrappedFormUtils) => {
73
73
  /** 计算中启动字段 */
74
74
  const changeField = controller.useMemo((e) => e.calculatingField, []);
75
75
 
76
+ const isValidateGood = controller.useMemo(s => s.goodsListState.isValidateGood, [])
76
77
  /** 计算中启动字段 */
77
78
  const setChangeField = React.useCallback((value: string) => controller.run(async s => { s.calculatingField = value }), []);
78
79
 
@@ -124,12 +125,16 @@ export default (form: WrappedFormUtils) => {
124
125
  ...getReplenishRules('itemName'),
125
126
  {
126
127
  validator: async (_, __, callback) => {
127
- await controller.wait();
128
- const value = controller.state.goodsListState.editGood;
129
- if (!value?.itemName && !value?.itemNameSelf) {
130
- callback('项目名称不能为空');
128
+ if (isValidateGood) {
129
+ await controller.wait();
130
+ const value = controller.state.goodsListState.editGood;
131
+ if (!value?.itemName && !value?.itemNameSelf) {
132
+ callback('项目名称不能为空');
133
+ } else {
134
+ return;
135
+ }
131
136
  } else {
132
- return;
137
+ callback();
133
138
  }
134
139
  }
135
140
  }
@@ -252,11 +257,16 @@ export default (form: WrappedFormUtils) => {
252
257
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
253
258
  {
254
259
  validator: async (_, value, callback) => {
255
- await controller.wait();
256
- const isvalue = !!value || value === 0;
257
- const isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
258
- if (isvalue || isPrice === isvalue) return;
259
- callback('请输入数量');
260
+
261
+ if (isValidateGood) {
262
+ await controller.wait();
263
+ const isvalue = !!value || value === 0;
264
+ const isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
265
+ if (isvalue || isPrice === isvalue) return;
266
+ callback('请输入数量');
267
+ } else {
268
+ callback();
269
+ }
260
270
  }
261
271
  }
262
272
  ],
@@ -381,7 +391,7 @@ export default (form: WrappedFormUtils) => {
381
391
  getValueFromEvent: onNumberValueChange,
382
392
  rules: [
383
393
  ...getReplenishRules('lineAmountIncludeTax'),
384
- { required: true, message: '金额不能为空' },
394
+ { required: isValidateGood, message: '金额不能为空' },
385
395
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
386
396
  {
387
397
  validator: async (_, value, callback) => {
@@ -411,7 +421,7 @@ export default (form: WrappedFormUtils) => {
411
421
  </Form.Item>
412
422
  );
413
423
  } else {
414
- return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
424
+ return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
415
425
  }
416
426
  },
417
427
  },
@@ -430,7 +440,7 @@ export default (form: WrappedFormUtils) => {
430
440
  getValueFromEvent: onNumberValueChange,
431
441
  rules: [
432
442
  ...getReplenishRules('lineAmountExcludeTax'),
433
- { required: true, message: '金额不能为空' },
443
+ { required: isValidateGood, message: '金额不能为空' },
434
444
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
435
445
  {
436
446
  validator: async (_, value: string, callback) => {
@@ -453,7 +463,7 @@ export default (form: WrappedFormUtils) => {
453
463
  </Form.Item>
454
464
  );
455
465
  } else {
456
- return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
466
+ return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
457
467
  }
458
468
  },
459
469
  },
@@ -463,7 +473,7 @@ export default (form: WrappedFormUtils) => {
463
473
  key: 'taxRate',
464
474
  align: 'right',
465
475
  width: 70,
466
- render: (value: string, record: IGood) => {
476
+ render: (value: string|number, record: IGood) => {
467
477
  if (editGood?.$index === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
468
478
  return (
469
479
  <Form.Item>
@@ -471,7 +481,7 @@ export default (form: WrappedFormUtils) => {
471
481
  initialValue: editGood.taxRate,
472
482
  rules: [
473
483
  ...getReplenishRules('taxRate'),
474
- { required: true, message: '请选择税率' },
484
+ { required: isValidateGood, message: '请选择税率' },
475
485
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请选择正确税率' },
476
486
  ],
477
487
  })(
@@ -498,7 +508,11 @@ export default (form: WrappedFormUtils) => {
498
508
  </Form.Item>
499
509
  );
500
510
  } else {
501
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : `${value}%`}</span>;
511
+ if (value || value === '0' || value === 0) {
512
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : `${value}%`}</span>;
513
+ } else {
514
+ return ''
515
+ }
502
516
  }
503
517
  },
504
518
  },
@@ -509,27 +523,27 @@ export default (form: WrappedFormUtils) => {
509
523
  align: 'right',
510
524
  width: 119,
511
525
  render: (value: string, record: IGood) => {
512
- if (editGood?.$index === record.$index && !disableds.includes('taxAmount')&& model !== 'prefab') {
526
+ if (editGood?.$index === record.$index && !disableds.includes('taxAmount') && model !== 'prefab') {
513
527
  return (
514
528
  <Form.Item>
515
529
  {getFieldDecorator('taxAmount', {
516
530
  initialValue: editGood.taxAmount,
517
531
  rules: [
518
532
  ...getReplenishRules('taxAmount'),
519
- { required: true, message: '税额不能为空' },
533
+ { required: isValidateGood, message: '税额不能为空' },
520
534
  {
521
535
  validator: (rule, value, callback) => {
522
536
  //含税金额
523
537
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
524
538
  //不含税金额
525
539
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
526
- const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax||0)).subtract(bignumber(value||0));
540
+ const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
527
541
  const taxRate = editGood?.taxRate;
528
542
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
529
543
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
530
- const total = lineAmountExcludeTax.multiply(bignumber(taxRate||0)).divide(bignumber(100));
544
+ const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
531
545
  // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
532
- if (Math.abs(total.subtract(bignumber(value||0)).done().toNumber()) <= 0.01) {
546
+ if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
533
547
  callback();
534
548
  } else {
535
549
  callback('税额填写错误,请重新输入')
@@ -559,7 +573,7 @@ export default (form: WrappedFormUtils) => {
559
573
  </Form.Item>
560
574
  )
561
575
  } else {
562
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : parseFloat(value).toFixed(2)}</span>;
576
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value && parseFloat(value).toFixed(2)}</span>;
563
577
  }
564
578
  },
565
579
  },
@@ -42,6 +42,8 @@ export interface IGoodsListProps {
42
42
 
43
43
  /** 是否可以切换(含税/不含税)状态 */
44
44
  isSwitchTax?: boolean;
45
+
46
+ onTaxSwitchChange?:(e:any)=>void;
45
47
  }
46
48
 
47
49
  export default class GoodsList extends React.Component<IGoodsListProps>{
@@ -137,7 +139,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
137
139
  {endowCodeButton.button}
138
140
 
139
141
  {/* 是否含税开关 */}
140
- <TaxIncludedSwitch />
142
+ <TaxIncludedSwitch onChange={props.onTaxSwitchChange}/>
141
143
 
142
144
  {/* 搜索 */}
143
145
  <Search />
@@ -45,6 +45,13 @@ export default () => {
45
45
 
46
46
  /** 添加一个空货物 */
47
47
  async function addGood(controller: InvoiceController) {
48
+ await controller.formList.get('realEstateInfo')?.validateFields(async (err: any, values: any) => {
49
+
50
+ if (err) {
51
+ message.error('请先填写发票行信息,再添加新的行');
52
+ return;
53
+ }
54
+ });
48
55
  await controller.saveEditGood();
49
56
  await controller.wait();
50
57
  await controller.run(async (s) => {
@@ -54,16 +61,19 @@ async function addGood(controller: InvoiceController) {
54
61
  // key: '你正在编辑一个货物',
55
62
  // });
56
63
  // return;
57
- await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
58
- if (err) {
59
- const firstError: any = Object.values(err)[0];
60
- message.error({
61
- content: firstError.errors[0].message,
62
- key: '你正在编辑一个货物',
63
- });
64
- return;
65
- }
66
- });
64
+ const isValidateGood = controller.state.goodsListState.isValidateGood;
65
+ if (isValidateGood) {
66
+ await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
67
+ if (err) {
68
+ const firstError: any = Object.values(err)[0];
69
+ message.error({
70
+ content: firstError.errors[0].message,
71
+ key: '你正在编辑一个货物',
72
+ });
73
+ return;
74
+ }
75
+ });
76
+ }
67
77
  }
68
78
  s.goodsListState.editGood = await controller.addGood({ taxRate: s.goodsListState.defaultRate, lineAttribute: LineAttributeType.正常 });
69
79
  });
@@ -40,8 +40,9 @@ export default function <T extends object = any>(props: TableProps<T>) {
40
40
 
41
41
  // 设置占位dom的搞
42
42
  const placeholderHeight = React.useMemo(() => {
43
- if (!self || !rowHeight || !props.dataSource || !placeholder) return;
44
- const placeholderHeight = rowHeight * props.dataSource.length;
43
+ const { dataSource = [] } = props
44
+ if (!self || !rowHeight || !dataSource || !placeholder) return;
45
+ const placeholderHeight = rowHeight * dataSource.length;
45
46
  placeholder.style.height = `${placeholderHeight}px`;
46
47
  return placeholderHeight;
47
48
  }, [self, rowHeight, props.dataSource, placeholder]);
@@ -80,19 +81,23 @@ export default function <T extends object = any>(props: TableProps<T>) {
80
81
 
81
82
  // 移动列表
82
83
  React.useEffect(() => {
83
- if (!self) return;
84
+ if (!self) return
84
85
 
85
86
  const table = self.querySelector('.ktsAntX-table .ktsAntX-table-body>table') as HTMLDivElement;
87
+
86
88
  if (!table) return;
89
+ if ((props.dataSource?.length || 0) < 10) {
90
+ table.style.top = '0px';
91
+ } else {
92
+ table.style.top = `${pointer * rowHeight}px`;
93
+ }
87
94
 
88
- table.style.top = `${pointer * rowHeight}px`;
89
- }, [pointer, self, rowHeight]);
95
+ }, [pointer, self, rowHeight, props.dataSource?.length]);
90
96
 
91
97
  React.useEffect(() => {
92
98
  if (!self) return;
93
99
  const cont = self.querySelector('.kts-invoice-operate-goods-table-virtual .ktsAntX-table-body');
94
100
  if (!cont) return;
95
-
96
101
  cont.scrollTop = 0;
97
102
  }, [props.dataSource?.length])
98
103
 
@@ -3,8 +3,10 @@ import React from 'react';
3
3
  import { Switch } from 'kts-xui';
4
4
  import Invoice from '../../../../..';
5
5
  import { onChangeSwitchTax } from '../../hook/useColumns/autoFillFn';
6
-
7
- export default () => {
6
+ interface IProps {
7
+ onChange?:(e:any)=>void;
8
+ }
9
+ export default (props:IProps) => {
8
10
 
9
11
  const controller = Invoice.useInvoiceController();
10
12
 
@@ -16,6 +18,7 @@ export default () => {
16
18
 
17
19
  const onChange = React.useCallback(async e => {
18
20
  onChangeSwitchTax(controller, e);
21
+ props.onChange && props.onChange(e);
19
22
  }, [])
20
23
 
21
24
  return (
@@ -12,4 +12,11 @@
12
12
  .ktsAnt3x-row.ktsAnt3x-form-item {
13
13
  margin-bottom: 0;
14
14
  }
15
+ .ktsAntX-row{
16
+ border-bottom: 1px dashed #9F613E;
17
+ &:last-child {
18
+ border-bottom: none;
19
+ }
20
+ }
21
+
15
22
  }