kts-component-invoice-operate 3.2.264 → 3.2.266
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/DifferenceInputModal/demo.d.ts +4 -0
- package/dist/DifferenceInputModal/index.d.ts +73 -0
- package/dist/Invoice/Invoice-digtal/_test/differenceInput/index.d.ts +4 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.d.ts +11 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +3 -0
- package/dist/Invoice/InvoiceController/hooks/index.d.ts +3 -0
- package/dist/Invoice/_test/differenceInput/index.d.ts +4 -0
- package/dist/Invoice/tools/calculate/index.d.ts +1 -1
- package/dist/Invoice/ui/digtal/DifferenceInput/index.d.ts +3 -0
- package/dist/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1481 -319
- package/dist/index.js +1478 -315
- package/package.json +1 -1
- package/src/DifferenceInputModal/demo.tsx +22 -0
- package/src/DifferenceInputModal/index.less +102 -0
- package/src/DifferenceInputModal/index.md +5 -0
- package/src/DifferenceInputModal/index.tsx +520 -0
- package/src/Invoice/Invoice-digtal/_test/differenceInput/index.tsx +31 -0
- package/src/Invoice/Invoice-digtal/index.md +12 -9
- package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +9 -2
- package/src/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.ts +16 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +4 -0
- package/src/Invoice/InvoiceController/fns/saveEditGood.ts +1 -0
- package/src/Invoice/InvoiceController/hooks/index.ts +63 -0
- package/src/Invoice/_test/differenceInput/index.tsx +25 -0
- package/src/Invoice/index.md +3 -0
- package/src/Invoice/index.tsx +21 -6
- package/src/Invoice/tools/calculate/index.ts +2 -3
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +19 -6
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +8 -2
- package/src/Invoice/ui/default/GoodsList/hook/useWindowClick/index.tsx +4 -1
- package/src/Invoice/ui/default/GoodsList/index.tsx +1 -1
- package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +4 -0
- package/src/Invoice/ui/digtal/DifferenceInput/index.tsx +69 -0
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -2
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +34 -21
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +15 -4
- package/src/Invoice/ui/digtal/GoodsList/hook/useWindowClick/index.tsx +4 -1
- package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +7 -7
- package/src/TaxClassificationCodeModal/index.tsx +2 -0
- package/src/index.ts +3 -0
|
@@ -70,6 +70,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
70
70
|
/** 扣除额 */
|
|
71
71
|
const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
|
|
72
72
|
|
|
73
|
+
/** 差额开票是否启用 */
|
|
74
|
+
const differenceInputStateEnabled = controller.useMemo((e) => e.differenceInputState.enabled, []);
|
|
75
|
+
|
|
73
76
|
/** 计算中启动字段 */
|
|
74
77
|
const changeField = controller.useMemo((e) => e.calculatingField, []);
|
|
75
78
|
|
|
@@ -123,21 +126,22 @@ export default (form: WrappedFormUtils) => {
|
|
|
123
126
|
initialValue: isMyShow ? record.itemNameSelf : record.itemName,
|
|
124
127
|
rules: [
|
|
125
128
|
...getReplenishRules('itemName'),
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
129
|
+
{ required: isValidateGood, message: '项目名称不能为空' },
|
|
130
|
+
// {
|
|
131
|
+
// validator: async (_, __, callback) => {
|
|
132
|
+
// if (isValidateGood) {
|
|
133
|
+
// await controller.wait();
|
|
134
|
+
// const value = controller.state.goodsListState.editGood;
|
|
135
|
+
// if (!value?.itemName && !value?.itemNameSelf) {
|
|
136
|
+
// callback('项目名称不能为空');
|
|
137
|
+
// } else {
|
|
138
|
+
// return;
|
|
139
|
+
// }
|
|
140
|
+
// } else {
|
|
141
|
+
// callback();
|
|
142
|
+
// }
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
141
145
|
]
|
|
142
146
|
})(
|
|
143
147
|
<ItemNameInput
|
|
@@ -318,6 +322,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
318
322
|
<MyInput
|
|
319
323
|
style={{ textAlign: 'right' }}
|
|
320
324
|
maxLength={25}
|
|
325
|
+
disabled={differenceInputStateEnabled}
|
|
321
326
|
loading={isCipher(changeField, 'priceIncludeTax')}
|
|
322
327
|
onChange={() => {
|
|
323
328
|
setChangeField('priceIncludeTax');
|
|
@@ -362,6 +367,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
362
367
|
<MyInput
|
|
363
368
|
style={{ textAlign: 'right' }}
|
|
364
369
|
maxLength={25}
|
|
370
|
+
disabled={differenceInputStateEnabled}
|
|
365
371
|
loading={isCipher(changeField, 'priceExcludeTax')}
|
|
366
372
|
onChange={() => {
|
|
367
373
|
setChangeField('priceExcludeTax');
|
|
@@ -412,10 +418,14 @@ export default (form: WrappedFormUtils) => {
|
|
|
412
418
|
<MyInput
|
|
413
419
|
style={{ textAlign: 'right' }}
|
|
414
420
|
loading={isCipher(changeField, 'lineAmountIncludeTax')}
|
|
421
|
+
readOnly={differenceInputStateEnabled}
|
|
415
422
|
onChange={() => {
|
|
416
423
|
setChangeField('lineAmountIncludeTax');
|
|
417
424
|
onChangeLineAmountIncludeTax(controller, form, record);
|
|
418
425
|
}}
|
|
426
|
+
onClick={differenceInputStateEnabled ? (() => {
|
|
427
|
+
controller.run(async (s) => { s.differenceInputState.open = true });
|
|
428
|
+
}) : undefined}
|
|
419
429
|
/>,
|
|
420
430
|
)}
|
|
421
431
|
</Form.Item>
|
|
@@ -454,10 +464,14 @@ export default (form: WrappedFormUtils) => {
|
|
|
454
464
|
<MyInput
|
|
455
465
|
style={{ textAlign: 'right' }}
|
|
456
466
|
loading={isCipher(changeField, 'lineAmountExcludeTax')}
|
|
467
|
+
readOnly={differenceInputStateEnabled}
|
|
457
468
|
onChange={() => {
|
|
458
469
|
setChangeField('lineAmountExcludeTax');
|
|
459
470
|
onChangeLineAmountExcludeTax(controller, form, record);
|
|
460
471
|
}}
|
|
472
|
+
onClick={differenceInputStateEnabled ? (() => {
|
|
473
|
+
controller.run(async (s) => { s.differenceInputState.open = true });
|
|
474
|
+
}) : undefined}
|
|
461
475
|
/>,
|
|
462
476
|
)}
|
|
463
477
|
</Form.Item>
|
|
@@ -537,17 +551,16 @@ export default (form: WrappedFormUtils) => {
|
|
|
537
551
|
const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
|
|
538
552
|
//不含税金额
|
|
539
553
|
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
554
|
+
const deduction = controller.state.goodsListState.deduction || 0;
|
|
540
555
|
const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
|
|
541
556
|
const taxRate = editGood?.taxRate;
|
|
542
|
-
if (lineAmountExcludeTax &&
|
|
543
|
-
|
|
544
|
-
const total = chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
|
|
545
|
-
// if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
557
|
+
if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
|
|
558
|
+
const total = chain(bignumber(lineAmountExcludeTax)).subtract(bignumber(deduction || 0)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
|
|
546
559
|
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
|
|
547
560
|
callback();
|
|
548
561
|
} else {
|
|
549
562
|
callback('第' + (record.serialNo) + '行税额校验不通过!')
|
|
550
|
-
}
|
|
563
|
+
}
|
|
551
564
|
} else {
|
|
552
565
|
callback();
|
|
553
566
|
}
|
|
@@ -605,7 +618,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
605
618
|
ellipsis: true,
|
|
606
619
|
};
|
|
607
620
|
}) as any[];
|
|
608
|
-
}, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType]);
|
|
621
|
+
}, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType, differenceInputStateEnabled]);
|
|
609
622
|
|
|
610
623
|
// React.useEffect(() => {
|
|
611
624
|
// clearTimeout(t)
|
|
@@ -5,6 +5,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
5
5
|
import { IGood, Invoice } from '../../../../../../../..';
|
|
6
6
|
import './index.less';
|
|
7
7
|
|
|
8
|
+
/** 商品名称输入框 */
|
|
8
9
|
export default function ItemNameInput(props: {
|
|
9
10
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void,
|
|
10
11
|
suffix?: React.ReactNode,
|
|
@@ -14,7 +15,7 @@ export default function ItemNameInput(props: {
|
|
|
14
15
|
}) {
|
|
15
16
|
|
|
16
17
|
const controller = Invoice.useInvoiceController();
|
|
17
|
-
|
|
18
|
+
const enabled = controller.useMemo((s) => s.differenceInputState.enabled, []);
|
|
18
19
|
const rootElement = controller.useMemo(s => s.rootElement, []);
|
|
19
20
|
|
|
20
21
|
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
@@ -43,10 +44,15 @@ export default function ItemNameInput(props: {
|
|
|
43
44
|
}
|
|
44
45
|
setSelectLine(null);
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
// 失去焦点时,打开差额开票弹窗
|
|
49
|
+
if (enabled) {
|
|
50
|
+
controller.run(async (s) => { s.differenceInputState.open = true });
|
|
51
|
+
}
|
|
46
52
|
} catch (error) {
|
|
47
53
|
throw error;
|
|
48
54
|
}
|
|
49
|
-
}, [autoComplete.onItemNameBlur, selectLine, props.editGood])
|
|
55
|
+
}, [autoComplete.onItemNameBlur, selectLine, props.editGood, enabled])
|
|
50
56
|
|
|
51
57
|
const onChangeAutoComplete = React.useCallback(async (_, i) => {
|
|
52
58
|
const record = options.filter(e => e.$index === i.value)[0] as any;
|
|
@@ -79,8 +85,13 @@ export default function ItemNameInput(props: {
|
|
|
79
85
|
options={options.map(e => ({ value: e.$index, label: e.itemName }))}
|
|
80
86
|
getPopupContainer={() => rootElement || document.body}
|
|
81
87
|
onSelect={onChangeAutoComplete}
|
|
82
|
-
>
|
|
83
|
-
<Input
|
|
88
|
+
>
|
|
89
|
+
<Input
|
|
90
|
+
style={{ height: '100%' }}
|
|
91
|
+
onChange={onChange}
|
|
92
|
+
suffix={props.suffix}
|
|
93
|
+
onBlur={onBlur}
|
|
94
|
+
/>
|
|
84
95
|
</AutoComplete>
|
|
85
96
|
</div>
|
|
86
97
|
)
|
|
@@ -13,7 +13,10 @@ export default function useWindowClick(controller: InvoiceController) {
|
|
|
13
13
|
|
|
14
14
|
/** 点击组件外部 保存正在编辑的货物 */
|
|
15
15
|
React.useEffect(() => {
|
|
16
|
-
const click = () => {
|
|
16
|
+
const click = () => {
|
|
17
|
+
if (!controller.state.goodsListState?.isSaveRowOutside) return;
|
|
18
|
+
setTimeout(controller.saveEditGood)
|
|
19
|
+
};
|
|
17
20
|
|
|
18
21
|
window.addEventListener('click', click);
|
|
19
22
|
return () => {
|
|
@@ -13,6 +13,9 @@ export default () => {
|
|
|
13
13
|
/** 产品数据量 */
|
|
14
14
|
const goodsNum = controller.useMemo(s => s.goodsListState.goodsList.length, []);
|
|
15
15
|
|
|
16
|
+
/** 是否是差额开票模式 */
|
|
17
|
+
const isDifferenceInput = controller.useMemo(s => s.differenceInputState.enabled, []);
|
|
18
|
+
|
|
16
19
|
/** 搜索条件 */
|
|
17
20
|
const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
|
|
18
21
|
|
|
@@ -35,6 +38,7 @@ export default () => {
|
|
|
35
38
|
if (isAddRow === false) return <></>;
|
|
36
39
|
if (model === 'prefab') return <></>;
|
|
37
40
|
if (model === 'readOnly') return <></>;
|
|
41
|
+
// if (isDifferenceInput && goodsNum >= 1) return <></>;
|
|
38
42
|
|
|
39
43
|
return (
|
|
40
44
|
<Button size='small' type='primary' onClick={onClick} disabled={disabled}>
|
|
@@ -45,22 +49,18 @@ export default () => {
|
|
|
45
49
|
|
|
46
50
|
/** 添加一个空货物 */
|
|
47
51
|
async function addGood(controller: InvoiceController) {
|
|
48
|
-
await controller.formList.get('realEstateInfo')?.validateFields(async (err: any, values: any) => {
|
|
49
52
|
|
|
53
|
+
await controller.formList.get('realEstateInfo')?.validateFields(async (err: any, values: any) => {
|
|
50
54
|
if (err) {
|
|
51
55
|
message.error('请先填写发票行信息,再添加新的行');
|
|
52
56
|
return;
|
|
53
57
|
}
|
|
54
58
|
});
|
|
59
|
+
|
|
55
60
|
await controller.saveEditGood();
|
|
56
|
-
await controller.wait();
|
|
61
|
+
await controller.wait();
|
|
57
62
|
await controller.run(async (s) => {
|
|
58
63
|
if (s.goodsListState.editGood) {
|
|
59
|
-
// message.error({
|
|
60
|
-
// content: '你正在编辑一个货物',
|
|
61
|
-
// key: '你正在编辑一个货物',
|
|
62
|
-
// });
|
|
63
|
-
// return;
|
|
64
64
|
const isValidateGood = controller.state.goodsListState.isValidateGood;
|
|
65
65
|
if (isValidateGood) {
|
|
66
66
|
await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
|
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { Drawer, Input, Tree, Form, Button, Card, FormReadOnly } from "kts-xui";
|
|
4
4
|
import { Icon, message } from "kts-components-antd-x3";
|
|
5
5
|
import './index.less';
|
|
6
|
+
|
|
6
7
|
export interface TaxClassificationProps {
|
|
7
8
|
|
|
8
9
|
/** 是否开启 */
|
|
@@ -29,6 +30,7 @@ export interface TaxClassificationProps {
|
|
|
29
30
|
info?: any;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
|
|
32
34
|
export default function TaxClassificationModal(props: TaxClassificationProps) {
|
|
33
35
|
const [form] = Form.useForm<any>();
|
|
34
36
|
|
package/src/index.ts
CHANGED
|
@@ -11,3 +11,6 @@ export type { IInvoiceTypeModalProps } from './InvoiceTypeModal';
|
|
|
11
11
|
export { default as TaxClassificationModal } from './TaxClassificationCodeModal';
|
|
12
12
|
export type { TaxClassificationProps } from './TaxClassificationCodeModal';
|
|
13
13
|
|
|
14
|
+
/** */
|
|
15
|
+
export { DifferenceInputModal } from './DifferenceInputModal';
|
|
16
|
+
export type { IDifferenceInputModalProps } from './DifferenceInputModal';
|