kts-component-invoice-operate 3.2.27 → 3.2.29
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/InvoiceController/InvoiceControllerState/AutoComplete/index.d.ts +2 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.d.ts +7 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +3 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.d.ts +7 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.d.ts +7 -0
- package/dist/index.esm.js +365 -105
- package/dist/index.js +365 -105
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +3 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.ts +10 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +4 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +16 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +37 -30
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.less +3 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.tsx +49 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/svg/I001.svg +1 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.less +18 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.tsx +46 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +5 -2
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +4 -4
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import ProductComparison from './ProductComparison';
|
|
|
5
5
|
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
6
6
|
import InvoiceController from '../..';
|
|
7
7
|
import IColumnsReplenish from './IColumnsReplenish';
|
|
8
|
+
import Drag from './Drag';
|
|
8
9
|
|
|
9
10
|
export default class GoodsListState {
|
|
10
11
|
|
|
@@ -100,4 +101,7 @@ export default class GoodsListState {
|
|
|
100
101
|
|
|
101
102
|
/** 正在 添加商品对照 的货物 */
|
|
102
103
|
addComparisonIndex?: string;
|
|
104
|
+
|
|
105
|
+
/** 商品拖拽数据 */
|
|
106
|
+
drag = new Drag()
|
|
103
107
|
}
|
|
@@ -515,4 +515,19 @@ export const onChangeItemName = async (controller: InvoiceController, form: Wrap
|
|
|
515
515
|
record.itemNameSelf && await controller.setEditGood({ itemNameSelf: record.itemNameSelf });
|
|
516
516
|
}
|
|
517
517
|
})
|
|
518
|
-
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** 修改了 商品编码 */
|
|
521
|
+
export const onChangeItemCode = async (controller: InvoiceController, form: WrappedFormUtils<any>, record: IGood) => {
|
|
522
|
+
controller.run(async s => {
|
|
523
|
+
const value = form.getFieldsValue().itemCode;
|
|
524
|
+
|
|
525
|
+
if (s.goodsListState.isMyShow) {
|
|
526
|
+
await controller.setEditGood({ itemCodeSelf: value });
|
|
527
|
+
record.itemCode && await controller.setEditGood({ itemCode: record.itemCode });
|
|
528
|
+
} else {
|
|
529
|
+
await controller.setEditGood({ itemCode: value });
|
|
530
|
+
record.itemCodeSelf && await controller.setEditGood({ itemCodeSelf: record.itemCodeSelf });
|
|
531
|
+
}
|
|
532
|
+
})
|
|
533
|
+
}
|
|
@@ -7,6 +7,7 @@ import Invoice from '../../../../..';
|
|
|
7
7
|
import RowMenu from './ui/RowMenu';
|
|
8
8
|
import TitleText from './ui/TitleText';
|
|
9
9
|
import ItemNameInput from './ui/ItemNameInput';
|
|
10
|
+
import ItemCodeInput from './ui/ItemCodeInput';
|
|
10
11
|
import {
|
|
11
12
|
onChangeQuantity,
|
|
12
13
|
onChangePriceIncludeTax,
|
|
@@ -15,8 +16,10 @@ import {
|
|
|
15
16
|
onChangeLineAmountExcludeTax,
|
|
16
17
|
onChangeTaxRate,
|
|
17
18
|
onChangeItemName,
|
|
19
|
+
onChangeItemCode,
|
|
18
20
|
} from './autoFillFn';
|
|
19
21
|
import { getItemNameWithShorthand } from '../../../../../tools/itemName';
|
|
22
|
+
import Drag from './ui/Drag';
|
|
20
23
|
|
|
21
24
|
export default (form: WrappedFormUtils) => {
|
|
22
25
|
const { getFieldDecorator, getFieldValue } = form;
|
|
@@ -77,6 +80,13 @@ export default (form: WrappedFormUtils) => {
|
|
|
77
80
|
/** 表头 */
|
|
78
81
|
const columns = React.useMemo(() => {
|
|
79
82
|
return [
|
|
83
|
+
// {
|
|
84
|
+
// title: ' ',
|
|
85
|
+
// key: 'drag',
|
|
86
|
+
// width: 40,
|
|
87
|
+
// align: 'center',
|
|
88
|
+
// render: (_: any, record: IGood) => <Drag record={record} />
|
|
89
|
+
// },
|
|
80
90
|
{
|
|
81
91
|
title: '序号',
|
|
82
92
|
key: 'serialNo',
|
|
@@ -84,6 +94,31 @@ export default (form: WrappedFormUtils) => {
|
|
|
84
94
|
width: 50,
|
|
85
95
|
render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
|
|
86
96
|
},
|
|
97
|
+
{
|
|
98
|
+
title: '商品编码',
|
|
99
|
+
key: 'itemCode',
|
|
100
|
+
width: 119,
|
|
101
|
+
render: (_: string, record: IGood) => {
|
|
102
|
+
if (editGood?.$index === record.$index) {
|
|
103
|
+
return (
|
|
104
|
+
<Form.Item>
|
|
105
|
+
{getFieldDecorator('itemCode', {
|
|
106
|
+
initialValue: editGood.itemCode,
|
|
107
|
+
})(
|
|
108
|
+
<ItemCodeInput
|
|
109
|
+
shorthand={editGood.shorthand}
|
|
110
|
+
onChange={() => {
|
|
111
|
+
onChangeItemCode(controller, form, record);
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
</Form.Item>
|
|
116
|
+
)
|
|
117
|
+
} else {
|
|
118
|
+
return record.itemCode
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
87
122
|
{
|
|
88
123
|
title: <TitleText required >项目名称</TitleText>,
|
|
89
124
|
key: 'itemName',
|
|
@@ -141,26 +176,6 @@ export default (form: WrappedFormUtils) => {
|
|
|
141
176
|
}
|
|
142
177
|
},
|
|
143
178
|
},
|
|
144
|
-
{
|
|
145
|
-
title: '商品编码',
|
|
146
|
-
key: 'itemCode',
|
|
147
|
-
width: 119,
|
|
148
|
-
render: (_: string, record: IGood) => {
|
|
149
|
-
if (editGood?.$index === record.$index) {
|
|
150
|
-
return (
|
|
151
|
-
<Form.Item>
|
|
152
|
-
{getFieldDecorator('itemCode', {
|
|
153
|
-
initialValue: editGood.itemCode,
|
|
154
|
-
})(
|
|
155
|
-
<MyInput />,
|
|
156
|
-
)}
|
|
157
|
-
</Form.Item>
|
|
158
|
-
)
|
|
159
|
-
} else {
|
|
160
|
-
return record.itemCode
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
179
|
{
|
|
165
180
|
title: <TitleText rules={columnsReplenish['itemModelName']?.rules} >规格型号</TitleText>,
|
|
166
181
|
key: 'itemModelName',
|
|
@@ -521,7 +536,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
521
536
|
},
|
|
522
537
|
]
|
|
523
538
|
// 筛选隐藏
|
|
524
|
-
.filter(e => {
|
|
539
|
+
.filter(e => {
|
|
525
540
|
return e.key ? columnshide.indexOf(e.key) < 0 : false;
|
|
526
541
|
})
|
|
527
542
|
// 含税不含税
|
|
@@ -547,13 +562,6 @@ export default (form: WrappedFormUtils) => {
|
|
|
547
562
|
};
|
|
548
563
|
}) as any[];
|
|
549
564
|
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide]);
|
|
550
|
-
|
|
551
|
-
// React.useEffect(() => {
|
|
552
|
-
// clearTimeout(t)
|
|
553
|
-
// const t = setTimeout(() => { setChangeField('') }, 1000);
|
|
554
|
-
// return () => { clearTimeout(t) }
|
|
555
|
-
// }, [changeField]);
|
|
556
|
-
|
|
557
565
|
return columns;
|
|
558
566
|
};
|
|
559
567
|
|
|
@@ -578,7 +586,6 @@ class MyInput extends React.Component<InputProps & { loading?: boolean }> {
|
|
|
578
586
|
}
|
|
579
587
|
|
|
580
588
|
class MyDiv extends React.Component<{ value?: any, loading?: boolean }> {
|
|
581
|
-
|
|
582
589
|
render() {
|
|
583
590
|
if (this.props.loading) {
|
|
584
591
|
return (
|
|
@@ -645,4 +652,4 @@ function ucoding(v: string): string {
|
|
|
645
652
|
/** 解码 */
|
|
646
653
|
function dcoding(v: string): string {
|
|
647
654
|
return v.split('U').map(e => e ? String.fromCharCode(parseInt(e.replace('E', ''))) : '').join('');
|
|
648
|
-
}
|
|
655
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Icon from '@ant-design/icons';
|
|
4
|
+
import { ReactComponent as I001Svg } from './svg/I001.svg';
|
|
5
|
+
import { Button } from "kts-components-antd-x3";
|
|
6
|
+
import { IGood, Invoice } from '../../../../../../../..';
|
|
7
|
+
import './index.less';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface IDragProps {
|
|
11
|
+
record: IGood
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function Drag(props: IDragProps) {
|
|
15
|
+
|
|
16
|
+
const { record } = props;
|
|
17
|
+
|
|
18
|
+
const controller = Invoice.useInvoiceController();
|
|
19
|
+
|
|
20
|
+
const editGood = controller.useMemo(s => s.goodsListState.editGood, []);
|
|
21
|
+
|
|
22
|
+
const current = controller.useMemo(s => s.goodsListState.drag.current, []);
|
|
23
|
+
|
|
24
|
+
const disabled = React.useMemo(() => !!editGood, [editGood]);
|
|
25
|
+
|
|
26
|
+
const onMouseDown = React.useCallback(() => {
|
|
27
|
+
if (!controller || !record) return;
|
|
28
|
+
controller.run(async s => s.goodsListState.drag.current = record.$index);
|
|
29
|
+
window.addEventListener('mouseup', onMouseup);
|
|
30
|
+
|
|
31
|
+
function onMouseup() {
|
|
32
|
+
controller.run(async s => s.goodsListState.drag.current = undefined);
|
|
33
|
+
window.removeEventListener('mouseup', onMouseup);
|
|
34
|
+
}
|
|
35
|
+
}, [controller, record])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Button
|
|
39
|
+
type='link'
|
|
40
|
+
style={{ padding: 0 }}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
onMouseDown={onMouseDown}
|
|
43
|
+
onClick={e => { e.stopPropagation() }}
|
|
44
|
+
className={"kts-invoice-operate-goods-list-itemName-drag"}
|
|
45
|
+
>
|
|
46
|
+
<Icon component={I001Svg} />
|
|
47
|
+
</Button>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg t="1694426134787" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4024" width="200" height="200"><path d="M304.87387614-5.81530905h123.75785957v123.75785958H304.87387614V-5.81530905z m281.27727647 0h123.75785836v123.75785958h-123.75785836V-5.81530905zM304.87387614 286.75034075h123.75785957v123.75785835H304.87387614V286.75034075z m281.27727647 0h123.75785836v123.75785835h-123.75785836V286.75034075zM304.87387614 579.21242666h123.75785957v123.75785957H304.87387614v-123.75785957z m281.27727647 0h123.75785836v123.75785957h-123.75785836v-123.75785957zM304.87387614 871.82985838h123.75785957v123.75785837H304.87387614v-123.75785837z m281.27727647 0h123.75785836v123.75785837h-123.75785836v-123.75785837z" p-id="4025"></path></svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.kts-invoice-operate-goods-list-itemCode-input {
|
|
2
|
+
display : flex;
|
|
3
|
+
flex : 1;
|
|
4
|
+
padding-left: 10px;
|
|
5
|
+
height : 31px;
|
|
6
|
+
|
|
7
|
+
.ktsAntX-select {
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
.ktsAntX-select-selector{
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.has-error .kts-invoice-operate-goods-list-itemCode-input {
|
|
17
|
+
border: 1px solid #f5222d;
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import { Input } from 'kts-components-antd-x3';
|
|
3
|
+
import React, { ChangeEvent } from 'react';
|
|
4
|
+
import { AutoComplete } from 'kts-xui';
|
|
5
|
+
import { IGood, Invoice } from '../../../../../../../..';
|
|
6
|
+
import './index.less';
|
|
7
|
+
|
|
8
|
+
export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, shorthand?: string }) {
|
|
9
|
+
|
|
10
|
+
const controller = Invoice.useInvoiceController();
|
|
11
|
+
|
|
12
|
+
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
13
|
+
|
|
14
|
+
const [options, setOptions] = React.useState<IGood[]>([])
|
|
15
|
+
|
|
16
|
+
const onChange = React.useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
const event = { ...e };
|
|
18
|
+
props.onChange && props.onChange(event);
|
|
19
|
+
}, [])
|
|
20
|
+
|
|
21
|
+
const onSearch = React.useCallback(async (searchText: string) => {
|
|
22
|
+
try {
|
|
23
|
+
if (autoComplete.onItemCodeSearch) {
|
|
24
|
+
setOptions(await autoComplete.onItemCodeSearch(searchText))
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
setOptions([])
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}, [autoComplete.onItemCodeSearch])
|
|
31
|
+
|
|
32
|
+
const onChangeAutoComplete = React.useCallback(async itemName => {
|
|
33
|
+
const record = options.filter(e => e.itemCode === itemName)[0] as any;
|
|
34
|
+
if (!record) return;
|
|
35
|
+
await controller.setEditGood({ itemCode: record.itemCode });
|
|
36
|
+
}, [options, controller])
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className='kts-invoice-operate-goods-list-itemCode-input'>
|
|
40
|
+
{props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
|
|
41
|
+
<AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemCode }))} onChange={onChangeAutoComplete} >
|
|
42
|
+
<Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
|
|
43
|
+
</AutoComplete>
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -32,12 +32,15 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
32
32
|
}
|
|
33
33
|
}, [autoComplete.onItemNameSearch])
|
|
34
34
|
|
|
35
|
-
const onChangeAutoComplete = React.useCallback(itemName => {
|
|
35
|
+
const onChangeAutoComplete = React.useCallback(async itemName => {
|
|
36
36
|
// const good = options.filter(e=>e.itemName === itemName)[0];
|
|
37
37
|
// good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
|
|
38
38
|
|
|
39
39
|
const record = options.filter(e => e.itemName === itemName)[0] as any;
|
|
40
40
|
if (!record) return;
|
|
41
|
+
|
|
42
|
+
await controller.setEditGood({ itemName: record.itemName });
|
|
43
|
+
|
|
41
44
|
controller.importGoodsDrawer(record);
|
|
42
45
|
// controller.run(async s => {
|
|
43
46
|
// Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
|
|
@@ -122,4 +125,4 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
122
125
|
|
|
123
126
|
// // 单价(含税)/(1+税率) = 单价(不含税)
|
|
124
127
|
// return format15(evaluate(`${record.priceIncludeTax} / (1+${s.taxRate}/100)`), calculatingDigits);
|
|
125
|
-
// };
|
|
128
|
+
// };
|
|
@@ -8,7 +8,7 @@ export default function useMergeDetails() {
|
|
|
8
8
|
|
|
9
9
|
const controller = Invoice.useInvoiceController();
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const selectedGoodIndex = controller.useMemo(s => s.goodsListState.selectedGoodIndex, []);
|
|
12
12
|
|
|
13
13
|
const isMergeDetails = controller.useMemo(s => s.goodsListState.isMergeDetails, []);
|
|
14
14
|
|
|
@@ -23,15 +23,15 @@ export default function useMergeDetails() {
|
|
|
23
23
|
return (
|
|
24
24
|
<Button
|
|
25
25
|
onClick={onClick}
|
|
26
|
-
disabled={
|
|
26
|
+
disabled={selectedGoodIndex.length <= 1}
|
|
27
27
|
>
|
|
28
28
|
合并明细
|
|
29
29
|
</Button>
|
|
30
30
|
)
|
|
31
|
-
}, [
|
|
31
|
+
}, [selectedGoodIndex.length])
|
|
32
32
|
|
|
33
33
|
return {
|
|
34
34
|
/** 按钮 */
|
|
35
35
|
button,
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|