kts-component-invoice-operate 3.2.174 → 3.2.176
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/dist/Invoice/Invoice-digtal/_test/architecture/index.d.ts +4 -0
- package/dist/Invoice/Invoice-digtal/_test/freight/index.d.ts +4 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.d.ts +6 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.d.ts +23 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.d.ts +21 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.d.ts +31 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +5 -0
- package/dist/Invoice/InvoiceController/fns/addFreight.d.ts +6 -0
- package/dist/Invoice/InvoiceController/fns/delFreight.d.ts +6 -0
- package/dist/Invoice/InvoiceController/fns/saveEditFreight.d.ts +6 -0
- package/dist/Invoice/InvoiceController/fns/setEditFreight.d.ts +6 -0
- package/dist/Invoice/InvoiceController/fns/setFreight.d.ts +6 -0
- package/dist/Invoice/InvoiceController/index.d.ts +10 -0
- package/dist/Invoice/index.d.ts +4 -0
- package/dist/Invoice/ui/digtal/Architecture/index.d.ts +15 -0
- package/dist/Invoice/ui/digtal/FreightList/hook/useColumns/index.d.ts +3 -0
- package/dist/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.d.ts +8 -0
- package/dist/Invoice/ui/digtal/FreightList/hook/useOnRow/index.d.ts +8 -0
- package/dist/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.d.ts +8 -0
- package/dist/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.d.ts +8 -0
- package/dist/Invoice/ui/digtal/FreightList/index.d.ts +9 -0
- package/dist/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.d.ts +3 -0
- package/dist/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +6 -0
- package/dist/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +6 -0
- package/dist/Invoice/ui/digtal/FreightList/ui/TableRow/index.d.ts +3 -0
- package/dist/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.d.ts +4 -0
- package/dist/index.esm.js +1896 -52
- package/dist/index.js +1896 -52
- package/package.json +3 -3
- package/src/Invoice/Invoice-digtal/_test/architecture/index.tsx +22 -0
- package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +14564 -0
- package/src/Invoice/Invoice-digtal/index.md +7 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.ts +10 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.ts +33 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.ts +81 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.ts +40 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +6 -0
- package/src/Invoice/InvoiceController/fns/addFreight.ts +11 -0
- package/src/Invoice/InvoiceController/fns/delFreight.ts +38 -0
- package/src/Invoice/InvoiceController/fns/saveEditFreight.ts +24 -0
- package/src/Invoice/InvoiceController/fns/setEditFreight.ts +16 -0
- package/src/Invoice/InvoiceController/fns/setFreight.ts +11 -0
- package/src/Invoice/InvoiceController/index.ts +20 -1
- package/src/Invoice/index.tsx +8 -1
- package/src/Invoice/tools/useToGenerateId/index.ts +2 -0
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +10 -11
- package/src/Invoice/ui/digtal/Architecture/index.less +15 -0
- package/src/Invoice/ui/digtal/Architecture/index.tsx +166 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/dist/index.js +616 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/index.tsx +246 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.tsx +20 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useOnRow/index.tsx +37 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.tsx +120 -0
- package/src/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.tsx +23 -0
- package/src/Invoice/ui/digtal/FreightList/index.less +74 -0
- package/src/Invoice/ui/digtal/FreightList/index.tsx +108 -0
- package/src/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.tsx +65 -0
- package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -0
- package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -0
- package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.less +29 -0
- package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.tsx +21 -0
- package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.less +39 -0
- package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.tsx +109 -0
- package/src/Invoice/ui/digtal/GoodsList/index.tsx +0 -1
- package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.tsx +0 -1
- package/src/TaxClassificationCodeModal/index.less +0 -8
- package/src/TaxClassificationCodeModal/index.tsx +4 -13
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Invoice from '../../../../../../..';
|
|
3
|
+
import { Button, Menu } from 'kts-xui';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
|
|
7
|
+
const controller = Invoice.useInvoiceController();
|
|
8
|
+
|
|
9
|
+
const model = controller.useMemo(s => s.model, []);
|
|
10
|
+
|
|
11
|
+
const isRemRow = controller.useMemo(s => s.freightListState.isRemRow, []);
|
|
12
|
+
|
|
13
|
+
/** 是否禁用 */
|
|
14
|
+
const disabled = controller.useMemo((s) => {
|
|
15
|
+
if (s.freightListState.selectedGoodIndex.length <= 0) return true;
|
|
16
|
+
return false;
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
/** 点击了删除 */
|
|
20
|
+
const onClick = React.useCallback(async () => {
|
|
21
|
+
const selectedGoodIndex = controller.state.freightListState.selectedGoodIndex.slice();
|
|
22
|
+
for (let i = 0; i < selectedGoodIndex.length; i++) {
|
|
23
|
+
await controller.delFreight(selectedGoodIndex[i]);
|
|
24
|
+
}
|
|
25
|
+
await controller.run(async s => { s.freightListState.selectedGoodIndex = [] });
|
|
26
|
+
}, [])
|
|
27
|
+
|
|
28
|
+
const menuItem = React.useMemo(() => {
|
|
29
|
+
|
|
30
|
+
if (model === 'prefab') return <></>;
|
|
31
|
+
if (model === 'readOnly') return <></>;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Menu.Item key="1" onClick={onClick} disabled={disabled}> 删除行 </Menu.Item>
|
|
35
|
+
)
|
|
36
|
+
}, [model, onClick, disabled])
|
|
37
|
+
|
|
38
|
+
const button = React.useMemo(() => {
|
|
39
|
+
|
|
40
|
+
if (isRemRow === false) return <></>;
|
|
41
|
+
if (model === 'prefab') return <></>;
|
|
42
|
+
if (model === 'readOnly') return <></>;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Button size='small' onClick={onClick} disabled={disabled} >删除</Button>
|
|
46
|
+
)
|
|
47
|
+
}, [model, onClick, disabled, isRemRow])
|
|
48
|
+
|
|
49
|
+
return { button, menuItem };
|
|
50
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import Invoice from '../../../../../../..';
|
|
3
|
+
import { Button, Popconfirm } from "kts-xui"
|
|
4
|
+
import React from "react"
|
|
5
|
+
|
|
6
|
+
/** 清空重填 */
|
|
7
|
+
export default () => {
|
|
8
|
+
|
|
9
|
+
const controller = Invoice.useInvoiceController();
|
|
10
|
+
|
|
11
|
+
const model = controller.useMemo(s => s.model, []);
|
|
12
|
+
|
|
13
|
+
const confirm = React.useCallback(() => {
|
|
14
|
+
controller.run(async s => {
|
|
15
|
+
s.freightListState.goodsList = [];
|
|
16
|
+
s.freightListState.goodsMap = new Map();
|
|
17
|
+
s.freightListState.selectedGoodIndex = [];
|
|
18
|
+
})
|
|
19
|
+
}, [controller])
|
|
20
|
+
|
|
21
|
+
const button = React.useMemo(() => {
|
|
22
|
+
if (model === 'readOnly') return <></>;
|
|
23
|
+
if (model === 'prefab') return <></>;
|
|
24
|
+
return (
|
|
25
|
+
<Popconfirm
|
|
26
|
+
title="将要清空所有项目信息,是否继续"
|
|
27
|
+
onConfirm={confirm}
|
|
28
|
+
okText="确定"
|
|
29
|
+
cancelText="取消"
|
|
30
|
+
>
|
|
31
|
+
<Button size='small' >清空重填</Button>
|
|
32
|
+
</Popconfirm>
|
|
33
|
+
)
|
|
34
|
+
}, [model, confirm])
|
|
35
|
+
|
|
36
|
+
return { button }
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.kts-invoice-operate-goods-list-itemName-drag-container-u {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
&::after {
|
|
5
|
+
content : " ";
|
|
6
|
+
width : 100%;
|
|
7
|
+
height : 2px;
|
|
8
|
+
background: #0074ff;
|
|
9
|
+
position : absolute;
|
|
10
|
+
left : 0;
|
|
11
|
+
top : 0;
|
|
12
|
+
z-index : 9999;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.kts-invoice-operate-goods-list-itemName-drag-container-d {
|
|
17
|
+
position: relative;
|
|
18
|
+
|
|
19
|
+
&::after {
|
|
20
|
+
content : " ";
|
|
21
|
+
width : 100%;
|
|
22
|
+
height : 2px;
|
|
23
|
+
background: #0074ff;
|
|
24
|
+
position : absolute;
|
|
25
|
+
left : 0;
|
|
26
|
+
bottom : 0;
|
|
27
|
+
z-index : 9999;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Invoice from '../../../../..';
|
|
3
|
+
import { LineAttributeType } from '../../../../../InvoiceController'
|
|
4
|
+
import classnames from 'classnames'
|
|
5
|
+
import './index.less'
|
|
6
|
+
|
|
7
|
+
export default function TableRow(props: any) {
|
|
8
|
+
|
|
9
|
+
const rowKey = props['data-row-key']
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
return <tr
|
|
15
|
+
{...props}
|
|
16
|
+
className={classnames(
|
|
17
|
+
props.className,
|
|
18
|
+
)}
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.kts-invoice-operate-goods-table-virtual {
|
|
2
|
+
|
|
3
|
+
.ktsAntX-table-body {
|
|
4
|
+
height: 280px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ktsAntX-table.ktsAntX-table-bordered>.ktsAntX-table-container>.ktsAntX-table-header>table>thead>tr>th {
|
|
8
|
+
padding : 0 10px;
|
|
9
|
+
height : 32px;
|
|
10
|
+
background: #f4f4f4;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ktsAntX-table.ktsAntX-table-bordered>.ktsAntX-table-container>.ktsAntX-table-body>table>tbody>tr>td {
|
|
14
|
+
padding: 0;
|
|
15
|
+
height : 32px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ktsAntX-table .ktsAntX-table-body {
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ktsAntX-table .ktsAntX-table-body>table {
|
|
23
|
+
position: absolute;
|
|
24
|
+
left : 0;
|
|
25
|
+
top : 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ktsAntX-table .ktsAntX-table-tbody {
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ktsAntX-checkbox-wrapper .ktsAntX-checkbox-inner {
|
|
33
|
+
width : 16px;
|
|
34
|
+
height : 16px;
|
|
35
|
+
border : 1px solid #d9d9d9;
|
|
36
|
+
border-radius: 2px;
|
|
37
|
+
top : 1px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TableManual, TableProps } from "kts-xui";
|
|
4
|
+
import { Table } from 'kts-components-antd-x4-v4';
|
|
5
|
+
import './index.less';
|
|
6
|
+
|
|
7
|
+
export default function <T extends object = any>(props: TableProps<T>) {
|
|
8
|
+
|
|
9
|
+
const [self, setSelf] = React.useState<HTMLSpanElement | null>(null);
|
|
10
|
+
|
|
11
|
+
const tableBody = React.useMemo(() => {
|
|
12
|
+
if (!self) return;
|
|
13
|
+
return self.querySelector('.ktsAntX-table-body') as HTMLDivElement;
|
|
14
|
+
}, [self]);
|
|
15
|
+
|
|
16
|
+
/** 显示指针 */
|
|
17
|
+
const [pointer, setPointer] = React.useState(0);
|
|
18
|
+
|
|
19
|
+
/** 行高 */
|
|
20
|
+
const rowHeight = React.useMemo(() => {
|
|
21
|
+
if (!self) return 50;
|
|
22
|
+
|
|
23
|
+
const td = self.querySelector('.ktsAntX-table-tbody .ktsAntX-table-row');
|
|
24
|
+
if (!td) return 50;
|
|
25
|
+
|
|
26
|
+
return td.clientHeight;
|
|
27
|
+
}, [self, props.dataSource]);
|
|
28
|
+
|
|
29
|
+
/** 间隔容器 */
|
|
30
|
+
const placeholder = React.useMemo(() => {
|
|
31
|
+
if (!self || !tableBody) return;
|
|
32
|
+
let placeholder = tableBody.querySelector('.table-virtual-placeholder') as HTMLDivElement;
|
|
33
|
+
if (!placeholder) {
|
|
34
|
+
placeholder = document.createElement('div');
|
|
35
|
+
placeholder.className = 'table-virtual-placeholder';
|
|
36
|
+
tableBody.appendChild(placeholder);
|
|
37
|
+
}
|
|
38
|
+
return placeholder;
|
|
39
|
+
}, [self, tableBody]);
|
|
40
|
+
|
|
41
|
+
// 设置占位dom的搞
|
|
42
|
+
const placeholderHeight = React.useMemo(() => {
|
|
43
|
+
if (!self || !rowHeight || !props.dataSource || !placeholder) return;
|
|
44
|
+
const placeholderHeight = rowHeight * props.dataSource.length;
|
|
45
|
+
placeholder.style.height = `${placeholderHeight}px`;
|
|
46
|
+
return placeholderHeight;
|
|
47
|
+
}, [self, rowHeight, props.dataSource, placeholder]);
|
|
48
|
+
|
|
49
|
+
/** 可以容纳的行数 */
|
|
50
|
+
const rowSize = React.useMemo(() => {
|
|
51
|
+
if (!tableBody! || !rowHeight) return 0;
|
|
52
|
+
return Math.ceil(tableBody.clientHeight / rowHeight);
|
|
53
|
+
}, [tableBody, rowHeight, placeholderHeight]);
|
|
54
|
+
|
|
55
|
+
// 计算渲染的行
|
|
56
|
+
const dataSource = React.useMemo(() => {
|
|
57
|
+
if (!props.dataSource) return [];
|
|
58
|
+
if (props.dataSource.length < 10) return props.dataSource;
|
|
59
|
+
|
|
60
|
+
if (!rowSize) return [props.dataSource[0]];
|
|
61
|
+
return props.dataSource?.slice(pointer, pointer + 2 * rowSize);
|
|
62
|
+
}, [props.dataSource, pointer, rowSize]);
|
|
63
|
+
|
|
64
|
+
// 监听滚动
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
if (!self || !placeholder || !props.dataSource || !rowHeight || !tableBody || props.dataSource.length < 10)
|
|
67
|
+
return;
|
|
68
|
+
|
|
69
|
+
const onScroll = () => {
|
|
70
|
+
if (!props.dataSource || !tableBody) return;
|
|
71
|
+
setPointer(Math.floor((props.dataSource.length - rowSize) * (tableBody.scrollTop / (placeholder.clientHeight - tableBody.clientHeight))));
|
|
72
|
+
};
|
|
73
|
+
onScroll();
|
|
74
|
+
|
|
75
|
+
tableBody.addEventListener('scroll', onScroll);
|
|
76
|
+
return () => {
|
|
77
|
+
tableBody.removeEventListener('scroll', onScroll);
|
|
78
|
+
};
|
|
79
|
+
}, [self, placeholder, props.dataSource, rowHeight, rowSize]);
|
|
80
|
+
|
|
81
|
+
// 移动列表
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (!self) return;
|
|
84
|
+
|
|
85
|
+
const table = self.querySelector('.ktsAntX-table .ktsAntX-table-body>table') as HTMLDivElement;
|
|
86
|
+
if (!table) return;
|
|
87
|
+
|
|
88
|
+
table.style.top = `${pointer * rowHeight}px`;
|
|
89
|
+
}, [pointer, self, rowHeight]);
|
|
90
|
+
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
if (!self) return;
|
|
93
|
+
const cont = self.querySelector('.kts-invoice-operate-goods-table-virtual .ktsAntX-table-body');
|
|
94
|
+
if (!cont) return;
|
|
95
|
+
|
|
96
|
+
cont.scrollTop = 0;
|
|
97
|
+
}, [props.dataSource?.length])
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<span className="kts-invoice-operate-goods-table-virtual" ref={(e) => { setSelf(e) }} >
|
|
101
|
+
<TableManual
|
|
102
|
+
{...props}
|
|
103
|
+
dataSource={dataSource}
|
|
104
|
+
// 新版本Table会有输入框无法连续输入的问题,先兼容老版本
|
|
105
|
+
tableComponent={Table as any}
|
|
106
|
+
/>
|
|
107
|
+
</span>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -121,7 +121,6 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
121
121
|
React.useEffect(() => {
|
|
122
122
|
controller.pipeline(async s => { s.goodsListState.isSwitchTax = props.isSwitchTax })()
|
|
123
123
|
}, [controller, props.isSwitchTax])
|
|
124
|
-
|
|
125
124
|
return (
|
|
126
125
|
<div className="kts-invoice-operate-goods-list-digtal" onClick={(e) => { e.stopPropagation() }} >
|
|
127
126
|
<div className="kts-invoice-operate-goods-list-able">
|
|
@@ -79,16 +79,7 @@ export default function TaxClassificationModal(props: TaxClassificationProps) {
|
|
|
79
79
|
}).catch(errorInfo => {
|
|
80
80
|
console.log('errorInfo', errorInfo);
|
|
81
81
|
});
|
|
82
|
-
}
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
form.setFieldsValue({
|
|
85
|
-
...form.getFieldsValue(),
|
|
86
|
-
taxCategoryCode: props?.info?.taxCategoryCode,
|
|
87
|
-
productName: props?.info?.productName,
|
|
88
|
-
shorthand: props?.info?.shorthand,
|
|
89
|
-
taxDesc: props?.info?.taxDesc,
|
|
90
|
-
})
|
|
91
|
-
},[props?.info?.key])
|
|
82
|
+
}
|
|
92
83
|
return (
|
|
93
84
|
<Drawer
|
|
94
85
|
title="商品和服务税收分类编码"
|
|
@@ -132,8 +123,8 @@ export default function TaxClassificationModal(props: TaxClassificationProps) {
|
|
|
132
123
|
</Form.Item>
|
|
133
124
|
</Form>
|
|
134
125
|
<Card className="taxrightbox">
|
|
135
|
-
<Form form={form} {...layout} initialValues={props.info} >
|
|
136
|
-
<Form.Item name={"taxCategoryCode"} label="编码">
|
|
126
|
+
<Form form={form} key={props?.info?.key} {...layout} initialValues={props.info} >
|
|
127
|
+
<Form.Item rules={[{ required: true, message: '请勾选税收分类编码' }, ]} initialValue={props.info?.taxCategoryCode} name={"taxCategoryCode"} label="编码">
|
|
137
128
|
<FormReadOnly />
|
|
138
129
|
</Form.Item>
|
|
139
130
|
<Form.Item name={"productName"} label="货物和劳务名称">
|
|
@@ -142,7 +133,7 @@ export default function TaxClassificationModal(props: TaxClassificationProps) {
|
|
|
142
133
|
<Form.Item name={"shorthand"} label="简称">
|
|
143
134
|
<FormReadOnly />
|
|
144
135
|
</Form.Item>
|
|
145
|
-
<Form.Item name={"
|
|
136
|
+
<Form.Item name={"desc"} label="说明">
|
|
146
137
|
<FormReadOnly />
|
|
147
138
|
</Form.Item>
|
|
148
139
|
</Form>
|