kts-component-invoice-operate 3.2.234 → 3.2.235-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 (34) hide show
  1. package/README.md +0 -4
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +0 -1
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.d.ts +0 -2
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +0 -2
  5. package/dist/Invoice/ui/default/GoodsList/index.d.ts +0 -1
  6. package/dist/Invoice/ui/default/GoodsList/ui/AddRowButton/index.d.ts +1 -1
  7. package/dist/Invoice/ui/digtal/GoodsList/index.d.ts +0 -1
  8. package/dist/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -4
  9. package/dist/index.esm.js +254 -708
  10. package/dist/index.js +253 -707
  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 +7 -69
  14. package/src/Invoice/Invoice-digtal/index.md +9 -2
  15. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +0 -2
  16. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.ts +0 -3
  17. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +0 -3
  18. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +2 -2
  19. package/src/Invoice/_test/deduction/index.tsx +6 -28
  20. package/src/Invoice/index.md +4 -4
  21. package/src/Invoice/ui/default/GoodsList/index.tsx +1 -3
  22. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +1 -8
  23. package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +1 -4
  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 +23 -37
  27. package/src/Invoice/ui/digtal/GoodsList/index.tsx +1 -3
  28. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +10 -20
  29. package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +6 -11
  30. package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -5
  31. package/src/Invoice/ui/digtal/RealEstateInfo/index.less +0 -7
  32. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +104 -363
  33. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +9 -9
  34. package/src/Invoice/ui/digtal/Stakeholder/index.tsx +4 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.234",
3
+ "version": "3.2.235-fuling",
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 onTaxSwitchChange={onTaxSwitchChange} />}
167
+ goodsList={<Invoice.GoodsListDigtal />}
168
168
  // stakeholder={<Invoice.Stakeholder leqi={true} invoiceMarkCallback={callback} />}
169
169
  invoiceHeader={
170
170
  <Invoice.InvoiceHeader
@@ -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
  };
@@ -37,9 +37,16 @@
37
37
  ## 查看当前可用授信额度
38
38
  <code src="./_test/lineCredit/index.tsx"></code>
39
39
 
40
-
40
+ ## 不动产经营租赁服务
41
+ <code src="./_test/realEstateInfo/index.tsx"></code>
41
42
 
42
43
  -->
44
+ <<<<<<< HEAD
45
+
46
+ ## 货物运输服务
47
+ <code src="./_test/freight/index.tsx"></code>
48
+ =======
43
49
  <!--
44
50
  ## 货物运输服务
45
- <code src="./_test/freight/index.tsx"></code> -->
51
+ <code src="./_test/freight/index.tsx"></code> -->
52
+ >>>>>>> 3e4750d (农产品发票升级)
@@ -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
  }
@@ -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
 
@@ -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>
@@ -47,8 +47,6 @@ export interface IGoodsListProps {
47
47
 
48
48
  /** 是否可以切换(含税/不含税)状态 */
49
49
  isSwitchTax?: boolean;
50
-
51
- addGoodsCheck?:()=>void;
52
50
  }
53
51
 
54
52
  export default class GoodsList extends React.Component<IGoodsListProps>{
@@ -139,7 +137,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
139
137
  <div className="kts-invoice-operate-goods-list-able">
140
138
  <div className="kts-invoice-operate-goods-list-able-list">
141
139
  {/* 添加行 */}
142
- <AddRowButton addGoodsCheck={props.addGoodsCheck}/>
140
+ <AddRowButton />
143
141
 
144
142
  {/* 批量菜单 */}
145
143
  {/* <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 (props: any) => {
6
+ export default () => {
7
7
  const controller = Invoice.useInvoiceController();
8
8
 
9
9
  const model = controller.useMemo(s => s.model, []);
@@ -26,12 +26,6 @@ export default (props: any) => {
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')
35
29
  await addGood(controller);
36
30
  await rollBottom(controller, rootElement);
37
31
  }, [controller, rootElement]);
@@ -49,7 +43,6 @@ export default (props: any) => {
49
43
 
50
44
  /** 添加一个空货物 */
51
45
  async function addGood(controller: InvoiceController) {
52
-
53
46
  await controller.saveEditGood();
54
47
  await controller.wait();
55
48
  await controller.run(async (s) => {
@@ -14,10 +14,7 @@ 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 => {
18
- s.goodsListState.importGoods.filter = {};
19
- s.goodsListState.importGoods.isVisibleDrawer = false;
20
- })();
17
+ controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = false })();
21
18
  }, [controller]);
22
19
 
23
20
  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,7 +73,6 @@ 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, [])
77
76
  /** 计算中启动字段 */
78
77
  const setChangeField = React.useCallback((value: string) => controller.run(async s => { s.calculatingField = value }), []);
79
78
 
@@ -125,16 +124,12 @@ export default (form: WrappedFormUtils) => {
125
124
  ...getReplenishRules('itemName'),
126
125
  {
127
126
  validator: async (_, __, 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
- }
127
+ await controller.wait();
128
+ const value = controller.state.goodsListState.editGood;
129
+ if (!value?.itemName && !value?.itemNameSelf) {
130
+ callback('项目名称不能为空');
136
131
  } else {
137
- callback();
132
+ return;
138
133
  }
139
134
  }
140
135
  }
@@ -257,16 +252,11 @@ export default (form: WrappedFormUtils) => {
257
252
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
258
253
  {
259
254
  validator: async (_, value, 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
- }
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('请输入数量');
270
260
  }
271
261
  }
272
262
  ],
@@ -391,7 +381,7 @@ export default (form: WrappedFormUtils) => {
391
381
  getValueFromEvent: onNumberValueChange,
392
382
  rules: [
393
383
  ...getReplenishRules('lineAmountIncludeTax'),
394
- { required: isValidateGood, message: '金额不能为空' },
384
+ { required: true, message: '金额不能为空' },
395
385
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
396
386
  {
397
387
  validator: async (_, value, callback) => {
@@ -421,7 +411,7 @@ export default (form: WrappedFormUtils) => {
421
411
  </Form.Item>
422
412
  );
423
413
  } else {
424
- return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
414
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
425
415
  }
426
416
  },
427
417
  },
@@ -440,7 +430,7 @@ export default (form: WrappedFormUtils) => {
440
430
  getValueFromEvent: onNumberValueChange,
441
431
  rules: [
442
432
  ...getReplenishRules('lineAmountExcludeTax'),
443
- { required: isValidateGood, message: '金额不能为空' },
433
+ { required: true, message: '金额不能为空' },
444
434
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
445
435
  {
446
436
  validator: async (_, value: string, callback) => {
@@ -463,7 +453,7 @@ export default (form: WrappedFormUtils) => {
463
453
  </Form.Item>
464
454
  );
465
455
  } else {
466
- return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
456
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
467
457
  }
468
458
  },
469
459
  },
@@ -473,7 +463,7 @@ export default (form: WrappedFormUtils) => {
473
463
  key: 'taxRate',
474
464
  align: 'right',
475
465
  width: 70,
476
- render: (value: string|number, record: IGood) => {
466
+ render: (value: string, record: IGood) => {
477
467
  if (editGood?.$index === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
478
468
  return (
479
469
  <Form.Item>
@@ -481,7 +471,7 @@ export default (form: WrappedFormUtils) => {
481
471
  initialValue: editGood.taxRate,
482
472
  rules: [
483
473
  ...getReplenishRules('taxRate'),
484
- { required: isValidateGood, message: '请选择税率' },
474
+ { required: true, message: '请选择税率' },
485
475
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请选择正确税率' },
486
476
  ],
487
477
  })(
@@ -508,11 +498,7 @@ export default (form: WrappedFormUtils) => {
508
498
  </Form.Item>
509
499
  );
510
500
  } else {
511
- if (value || value === '0' || value === 0) {
512
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : `${value}%`}</span>;
513
- } else {
514
- return ''
515
- }
501
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : `${value}%`}</span>;
516
502
  }
517
503
  },
518
504
  },
@@ -523,27 +509,27 @@ export default (form: WrappedFormUtils) => {
523
509
  align: 'right',
524
510
  width: 119,
525
511
  render: (value: string, record: IGood) => {
526
- if (editGood?.$index === record.$index && !disableds.includes('taxAmount') && model !== 'prefab') {
512
+ if (editGood?.$index === record.$index && !disableds.includes('taxAmount')&& model !== 'prefab') {
527
513
  return (
528
514
  <Form.Item>
529
515
  {getFieldDecorator('taxAmount', {
530
516
  initialValue: editGood.taxAmount,
531
517
  rules: [
532
518
  ...getReplenishRules('taxAmount'),
533
- { required: isValidateGood, message: '税额不能为空' },
519
+ { required: true, message: '税额不能为空' },
534
520
  {
535
521
  validator: (rule, value, callback) => {
536
522
  //含税金额
537
523
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
538
524
  //不含税金额
539
525
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
540
- const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
526
+ const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax||0)).subtract(bignumber(value||0));
541
527
  const taxRate = editGood?.taxRate;
542
528
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
543
529
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
544
- const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
530
+ const total = lineAmountExcludeTax.multiply(bignumber(taxRate||0)).divide(bignumber(100));
545
531
  // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
546
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
532
+ if (Math.abs(total.subtract(bignumber(value||0)).done().toNumber()) <= 0.01) {
547
533
  callback();
548
534
  } else {
549
535
  callback('税额填写错误,请重新输入')
@@ -573,7 +559,7 @@ export default (form: WrappedFormUtils) => {
573
559
  </Form.Item>
574
560
  )
575
561
  } else {
576
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value && parseFloat(value).toFixed(2)}</span>;
562
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : parseFloat(value).toFixed(2)}</span>;
577
563
  }
578
564
  },
579
565
  },
@@ -42,8 +42,6 @@ export interface IGoodsListProps {
42
42
 
43
43
  /** 是否可以切换(含税/不含税)状态 */
44
44
  isSwitchTax?: boolean;
45
-
46
- onTaxSwitchChange?:(e:any)=>void;
47
45
  }
48
46
 
49
47
  export default class GoodsList extends React.Component<IGoodsListProps>{
@@ -139,7 +137,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
139
137
  {endowCodeButton.button}
140
138
 
141
139
  {/* 是否含税开关 */}
142
- <TaxIncludedSwitch onChange={props.onTaxSwitchChange}/>
140
+ <TaxIncludedSwitch />
143
141
 
144
142
  {/* 搜索 */}
145
143
  <Search />
@@ -45,13 +45,6 @@ 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
- });
55
48
  await controller.saveEditGood();
56
49
  await controller.wait();
57
50
  await controller.run(async (s) => {
@@ -61,19 +54,16 @@ async function addGood(controller: InvoiceController) {
61
54
  // key: '你正在编辑一个货物',
62
55
  // });
63
56
  // return;
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
- }
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
+ });
77
67
  }
78
68
  s.goodsListState.editGood = await controller.addGood({ taxRate: s.goodsListState.defaultRate, lineAttribute: LineAttributeType.正常 });
79
69
  });
@@ -40,9 +40,8 @@ export default function <T extends object = any>(props: TableProps<T>) {
40
40
 
41
41
  // 设置占位dom的搞
42
42
  const placeholderHeight = React.useMemo(() => {
43
- const { dataSource = [] } = props
44
- if (!self || !rowHeight || !dataSource || !placeholder) return;
45
- const placeholderHeight = rowHeight * dataSource.length;
43
+ if (!self || !rowHeight || !props.dataSource || !placeholder) return;
44
+ const placeholderHeight = rowHeight * props.dataSource.length;
46
45
  placeholder.style.height = `${placeholderHeight}px`;
47
46
  return placeholderHeight;
48
47
  }, [self, rowHeight, props.dataSource, placeholder]);
@@ -81,23 +80,19 @@ export default function <T extends object = any>(props: TableProps<T>) {
81
80
 
82
81
  // 移动列表
83
82
  React.useEffect(() => {
84
- if (!self) return
83
+ if (!self) return;
85
84
 
86
85
  const table = self.querySelector('.ktsAntX-table .ktsAntX-table-body>table') as HTMLDivElement;
87
-
88
86
  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
- }
94
87
 
95
- }, [pointer, self, rowHeight, props.dataSource?.length]);
88
+ table.style.top = `${pointer * rowHeight}px`;
89
+ }, [pointer, self, rowHeight]);
96
90
 
97
91
  React.useEffect(() => {
98
92
  if (!self) return;
99
93
  const cont = self.querySelector('.kts-invoice-operate-goods-table-virtual .ktsAntX-table-body');
100
94
  if (!cont) return;
95
+
101
96
  cont.scrollTop = 0;
102
97
  }, [props.dataSource?.length])
103
98
 
@@ -3,10 +3,8 @@ 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
- interface IProps {
7
- onChange?:(e:any)=>void;
8
- }
9
- export default (props:IProps) => {
6
+
7
+ export default () => {
10
8
 
11
9
  const controller = Invoice.useInvoiceController();
12
10
 
@@ -18,7 +16,6 @@ export default (props:IProps) => {
18
16
 
19
17
  const onChange = React.useCallback(async e => {
20
18
  onChangeSwitchTax(controller, e);
21
- props.onChange && props.onChange(e);
22
19
  }, [])
23
20
 
24
21
  return (
@@ -12,11 +12,4 @@
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
-
22
15
  }