kts-component-invoice-operate 3.2.219 → 3.2.220-chinaship
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.
- package/README.md +0 -4
- package/dist/Invoice/ui/default/GoodsList/index.d.ts +0 -1
- package/dist/Invoice/ui/default/GoodsList/ui/AddRowButton/index.d.ts +1 -1
- package/dist/index.esm.js +286 -325
- package/dist/index.js +285 -324
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +7 -22
- package/src/Invoice/Invoice-digtal/index.md +4 -6
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +0 -1
- package/src/Invoice/InvoiceController/fns/saveEditGood.ts +2 -2
- package/src/Invoice/_test/deduction/index.tsx +6 -22
- package/src/Invoice/index.md +2 -2
- package/src/Invoice/ui/default/GoodsList/index.tsx +1 -3
- package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +1 -4
- package/src/Invoice/ui/digtal/Architecture/index.tsx +1 -1
- package/src/Invoice/ui/digtal/FreightList/index.tsx +1 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +17 -12
- package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +13 -18
- package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +11 -6
- package/src/Invoice/ui/digtal/RealEstateInfo/index.less +0 -7
- package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +102 -152
- package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +29 -15
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +22 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Invoice from '../../..';
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import 'antd/dist/antd.css';
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
export default () => {
|
|
7
7
|
|
|
8
8
|
const controller = React.useMemo(() => new Invoice.InvoiceController(), []);
|
|
@@ -11,27 +11,12 @@ export default () => {
|
|
|
11
11
|
controller.run(async s => {
|
|
12
12
|
})
|
|
13
13
|
}, [])
|
|
14
|
-
|
|
15
|
-
const formValues = await controller.validateFields();
|
|
16
|
-
console.log(formValues)
|
|
17
|
-
}
|
|
14
|
+
|
|
18
15
|
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
specialInfor={<Invoice.RealEstateInfo realEstateAddressOptions={[
|
|
25
|
-
{
|
|
26
|
-
"code": "11",
|
|
27
|
-
"name": "北京市"
|
|
28
|
-
}] || []}
|
|
29
|
-
realEstateAddressFieldNames={{
|
|
30
|
-
label: 'name',
|
|
31
|
-
value: 'name',
|
|
32
|
-
children: 'children'
|
|
33
|
-
}} />}
|
|
34
|
-
/>
|
|
35
|
-
</>
|
|
16
|
+
<Invoice
|
|
17
|
+
invoiceType='digtal'
|
|
18
|
+
controller={controller}
|
|
19
|
+
specialInfor={<Invoice.RealEstateInfo />}
|
|
20
|
+
/>
|
|
36
21
|
)
|
|
37
22
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# 数电
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<code src="./_test/easiest/index.tsx"></code>
|
|
5
|
-
|
|
6
|
-
## 不动产经营租赁服务
|
|
7
|
-
<code src="./_test/realEstateInfo/index.tsx"></code>
|
|
3
|
+
## 简单用法
|
|
4
|
+
<code src="./_test/easiest/index.tsx"></code>
|
|
8
5
|
|
|
9
6
|
<!-- ## 建筑服务
|
|
10
7
|
<code src="./_test/architecture/index.tsx"></code> -->
|
|
@@ -36,7 +33,8 @@
|
|
|
36
33
|
## 查看当前可用授信额度
|
|
37
34
|
<code src="./_test/lineCredit/index.tsx"></code>
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
## 不动产经营租赁服务
|
|
37
|
+
<code src="./_test/realEstateInfo/index.tsx"></code>
|
|
40
38
|
|
|
41
39
|
-->
|
|
42
40
|
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Input
|
|
2
|
+
import { Input } from 'kts-components-antd-x3';
|
|
3
3
|
import Invoice from '../../';
|
|
4
4
|
import 'antd/dist/antd.css';
|
|
5
5
|
|
|
@@ -29,33 +29,17 @@ export default () => {
|
|
|
29
29
|
</span>
|
|
30
30
|
)
|
|
31
31
|
}, [])
|
|
32
|
-
const checkGood = async () => {
|
|
33
|
-
await new Promise((resolve,) => {
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
const a = Math.random();
|
|
36
|
-
if (a > 0.5) {
|
|
37
|
-
message.error('请先填写发票行信息,再添加新的行');
|
|
38
|
-
return false;
|
|
39
|
-
} else {
|
|
40
|
-
resolve(true)
|
|
41
|
-
console.log(11112)
|
|
42
|
-
}
|
|
43
32
|
|
|
44
|
-
}, 1000)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
33
|
return (
|
|
48
34
|
<Invoice
|
|
49
35
|
controller={controller}
|
|
50
36
|
goodsList={
|
|
51
37
|
<Invoice.GoodsList
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// deduction={deduction} // 扣除额
|
|
58
|
-
// menuExpansion={menuExpansion} // 扩展
|
|
38
|
+
isSwitchTax={false} // 是否可以切换(含税/不含税)状态
|
|
39
|
+
isAddDiscount={false} // 不能添加折扣行
|
|
40
|
+
goodMax={goodMax} // 控制能可以添加的货物函数
|
|
41
|
+
deduction={deduction} // 扣除额
|
|
42
|
+
menuExpansion={menuExpansion} // 扩展
|
|
59
43
|
/>
|
|
60
44
|
}
|
|
61
45
|
/>
|
package/src/Invoice/index.md
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
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
|
## 发票头类型设置和购买方信息配置
|
|
@@ -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
|
|
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 (
|
|
6
|
+
export default () => {
|
|
7
7
|
const controller = Invoice.useInvoiceController();
|
|
8
8
|
|
|
9
9
|
const model = controller.useMemo(s => s.model, []);
|
|
@@ -26,8 +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
|
-
props.addGoodsCheck &&await props.addGoodsCheck();
|
|
30
|
-
console.log('continue')
|
|
31
29
|
await addGood(controller);
|
|
32
30
|
await rollBottom(controller, rootElement);
|
|
33
31
|
}, [controller, rootElement]);
|
|
@@ -45,7 +43,6 @@ export default (props: any) => {
|
|
|
45
43
|
|
|
46
44
|
/** 添加一个空货物 */
|
|
47
45
|
async function addGood(controller: InvoiceController) {
|
|
48
|
-
|
|
49
46
|
await controller.saveEditGood();
|
|
50
47
|
await controller.wait();
|
|
51
48
|
await controller.run(async (s) => {
|
|
@@ -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'
|
|
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'
|
|
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
|
{/* 添加行 */}
|
|
@@ -257,11 +257,16 @@ export default (form: WrappedFormUtils) => {
|
|
|
257
257
|
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
|
|
258
258
|
{
|
|
259
259
|
validator: async (_, value, callback) => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
+
}
|
|
265
270
|
}
|
|
266
271
|
}
|
|
267
272
|
],
|
|
@@ -416,7 +421,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
416
421
|
</Form.Item>
|
|
417
422
|
);
|
|
418
423
|
} else {
|
|
419
|
-
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>;
|
|
420
425
|
}
|
|
421
426
|
},
|
|
422
427
|
},
|
|
@@ -458,7 +463,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
458
463
|
</Form.Item>
|
|
459
464
|
);
|
|
460
465
|
} else {
|
|
461
|
-
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>;
|
|
462
467
|
}
|
|
463
468
|
},
|
|
464
469
|
},
|
|
@@ -518,7 +523,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
518
523
|
align: 'right',
|
|
519
524
|
width: 119,
|
|
520
525
|
render: (value: string, record: IGood) => {
|
|
521
|
-
if (editGood?.$index === record.$index && !disableds.includes('taxAmount')&& model !== 'prefab') {
|
|
526
|
+
if (editGood?.$index === record.$index && !disableds.includes('taxAmount') && model !== 'prefab') {
|
|
522
527
|
return (
|
|
523
528
|
<Form.Item>
|
|
524
529
|
{getFieldDecorator('taxAmount', {
|
|
@@ -532,13 +537,13 @@ export default (form: WrappedFormUtils) => {
|
|
|
532
537
|
const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
|
|
533
538
|
//不含税金额
|
|
534
539
|
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
535
|
-
const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax||0)).subtract(bignumber(value||0));
|
|
540
|
+
const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
536
541
|
const taxRate = editGood?.taxRate;
|
|
537
542
|
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
538
543
|
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
539
|
-
const total = lineAmountExcludeTax.multiply(bignumber(taxRate||0)).divide(bignumber(100));
|
|
544
|
+
const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
|
|
540
545
|
// if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
541
|
-
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) {
|
|
542
547
|
callback();
|
|
543
548
|
} else {
|
|
544
549
|
callback('税额填写错误,请重新输入')
|
|
@@ -568,7 +573,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
568
573
|
</Form.Item>
|
|
569
574
|
)
|
|
570
575
|
} else {
|
|
571
|
-
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>;
|
|
572
577
|
}
|
|
573
578
|
},
|
|
574
579
|
},
|
|
@@ -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,17 +54,19 @@ async function addGood(controller: InvoiceController) {
|
|
|
61
54
|
// key: '你正在编辑一个货物',
|
|
62
55
|
// });
|
|
63
56
|
// return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
const isValidateGood = controller.state.goodsListState.isValidateGood;
|
|
58
|
+
if (isValidateGood) {
|
|
59
|
+
await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
|
|
60
|
+
if (err) {
|
|
61
|
+
const firstError: any = Object.values(err)[0];
|
|
62
|
+
message.error({
|
|
63
|
+
content: firstError.errors[0].message,
|
|
64
|
+
key: '你正在编辑一个货物',
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
75
70
|
}
|
|
76
71
|
s.goodsListState.editGood = await controller.addGood({ taxRate: s.goodsListState.defaultRate, lineAttribute: LineAttributeType.正常 });
|
|
77
72
|
});
|
|
@@ -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
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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
|
|