kts-component-invoice-operate 3.2.196 → 3.2.198
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/index.esm.js +233 -113
- package/dist/index.js +233 -113
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +3 -1
- package/src/Invoice/index.tsx +8 -1
- package/src/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.tsx +16 -6
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +32 -22
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +3 -2
- package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +16 -6
- package/src/Invoice/ui/digtal/GoodsList/ui/Search/index.tsx +14 -4
package/package.json
CHANGED
|
@@ -11,7 +11,9 @@ export default () => {
|
|
|
11
11
|
|
|
12
12
|
React.useEffect(() => {
|
|
13
13
|
controller.run(async s=>{
|
|
14
|
-
s.stakeholder.enables = ['taxAmount']
|
|
14
|
+
s.stakeholder.enables = ['taxAmount'];
|
|
15
|
+
s.priceIntegerDigit = 25;
|
|
16
|
+
s.calculatingDigits=25;
|
|
15
17
|
})
|
|
16
18
|
}, [controller])
|
|
17
19
|
return (
|
package/src/Invoice/index.tsx
CHANGED
|
@@ -26,6 +26,13 @@ import ImportBuyerDrawer from './ui/default/ImportBuyerDrawer';
|
|
|
26
26
|
import ImportGoodsDrawer from './ui/default/ImportGoodsDrawer';
|
|
27
27
|
import EndowCodeDrawer from './ui/default/EndowCodeDrawer';
|
|
28
28
|
import AddComparisonDrawer from './ui/default/AddComparisonDrawer';
|
|
29
|
+
import { create, all } from 'mathjs';
|
|
30
|
+
const config = {
|
|
31
|
+
number: 'BigNumber',
|
|
32
|
+
precision: 64,
|
|
33
|
+
}
|
|
34
|
+
create(all, config);
|
|
35
|
+
|
|
29
36
|
|
|
30
37
|
/** 发票组件的上下文 */
|
|
31
38
|
export const InvoiceContext = React.createContext<InvoiceController>(
|
|
@@ -97,7 +104,7 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
|
|
|
97
104
|
|
|
98
105
|
/** 特殊信息-不动产经营租赁服务(数电) */
|
|
99
106
|
static readonly RealEstateInfo = RealEstateInfo;
|
|
100
|
-
|
|
107
|
+
|
|
101
108
|
/** 特殊信息-建筑服务(数电) */
|
|
102
109
|
static readonly Architecture = Architecture;
|
|
103
110
|
|
|
@@ -20,8 +20,8 @@ export default () => {
|
|
|
20
20
|
const goodMax = controller.useMemo(s => s.freightListState.goodMax, []);
|
|
21
21
|
|
|
22
22
|
/** 按钮是否禁用 */
|
|
23
|
-
const disabled = React.useMemo(() =>{
|
|
24
|
-
return
|
|
23
|
+
const disabled = React.useMemo(() => {
|
|
24
|
+
return typeof goodMax === 'number' ? goodsNum >= goodMax : false
|
|
25
25
|
}, [goodMax, goodsNum])
|
|
26
26
|
|
|
27
27
|
const onClick = React.useCallback(async () => {
|
|
@@ -46,11 +46,21 @@ async function addGood(controller: InvoiceController) {
|
|
|
46
46
|
await controller.wait();
|
|
47
47
|
await controller.run(async (s) => {
|
|
48
48
|
if (s.freightListState.editGood) {
|
|
49
|
-
message.error({
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
// message.error({
|
|
50
|
+
// content: '你正在编辑一个货物运输行',
|
|
51
|
+
// key: '你正在编辑一个货物运输行',
|
|
52
|
+
// });
|
|
53
|
+
// return;
|
|
54
|
+
await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
|
|
55
|
+
if (err) {
|
|
56
|
+
const firstError: any = Object.values(err)[0];
|
|
57
|
+
message.error({
|
|
58
|
+
content: firstError.errors[0].message,
|
|
59
|
+
key: '你正在编辑一个货物',
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
52
63
|
});
|
|
53
|
-
return;
|
|
54
64
|
}
|
|
55
65
|
s.freightListState.editGood = await controller.addFreight({});
|
|
56
66
|
});
|
|
@@ -67,7 +67,7 @@ export const onChangeQuantity = lazyFn(
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
70
|
-
const quantity =
|
|
70
|
+
const quantity = values.quantity;
|
|
71
71
|
await controller.setEditGood({ quantity });
|
|
72
72
|
form.setFieldsValue({ quantity });
|
|
73
73
|
|
|
@@ -76,16 +76,16 @@ export const onChangeQuantity = lazyFn(
|
|
|
76
76
|
// 含税
|
|
77
77
|
if (!err.priceIncludeTax && values.priceIncludeTax) {
|
|
78
78
|
// 可以找到 单价(含税)
|
|
79
|
-
const priceIncludeTax =
|
|
79
|
+
const priceIncludeTax = values.priceIncludeTax;
|
|
80
80
|
const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
81
81
|
form.setFieldsValue({ lineAmountIncludeTax });
|
|
82
82
|
await controller.setEditGood({ lineAmountIncludeTax });
|
|
83
83
|
} else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
84
84
|
// 可以找到 金额(含税)
|
|
85
85
|
const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
86
|
-
const priceIncludeTax =
|
|
87
|
-
evaluate(`${lineAmountIncludeTax} / ${quantity}`)
|
|
88
|
-
|
|
86
|
+
const priceIncludeTax =
|
|
87
|
+
evaluate(`${lineAmountIncludeTax} / ${quantity}`)
|
|
88
|
+
;
|
|
89
89
|
form.setFieldsValue({ priceIncludeTax });
|
|
90
90
|
await controller.setEditGood({ priceIncludeTax });
|
|
91
91
|
}
|
|
@@ -96,14 +96,14 @@ export const onChangeQuantity = lazyFn(
|
|
|
96
96
|
// 不含税
|
|
97
97
|
if (!err.priceExcludeTax && values.priceExcludeTax) {
|
|
98
98
|
// 可以找到 单价(不含税)
|
|
99
|
-
const priceExcludeTax =
|
|
99
|
+
const priceExcludeTax = values.priceExcludeTax;
|
|
100
100
|
const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
101
101
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
102
102
|
await controller.setEditGood({ lineAmountExcludeTax, quantity });
|
|
103
103
|
} else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
104
104
|
// 可以找到 金额(不含税)
|
|
105
105
|
const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
106
|
-
const priceExcludeTax =
|
|
106
|
+
const priceExcludeTax = evaluate(`${lineAmountExcludeTax} / ${quantity}`);
|
|
107
107
|
form.setFieldsValue({ priceExcludeTax });
|
|
108
108
|
await controller.setEditGood({ priceExcludeTax, quantity });
|
|
109
109
|
}
|
|
@@ -136,19 +136,19 @@ export const onChangePriceIncludeTax = lazyFn(
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
139
|
-
const priceIncludeTax =
|
|
139
|
+
const priceIncludeTax = values.priceIncludeTax;
|
|
140
140
|
await controller.setEditGood({ priceIncludeTax });
|
|
141
141
|
form.setFieldsValue({ priceIncludeTax });
|
|
142
142
|
|
|
143
143
|
// 是否有数量
|
|
144
144
|
if (!err.quantity && values.quantity) {
|
|
145
|
-
const quantity =
|
|
145
|
+
const quantity = values.quantity;
|
|
146
146
|
const lineAmountIncludeTax = format2(evaluate(`${quantity} * ${priceIncludeTax}`));
|
|
147
147
|
form.setFieldsValue({ lineAmountIncludeTax });
|
|
148
148
|
await controller.setEditGood({ lineAmountIncludeTax });
|
|
149
149
|
} else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
150
150
|
const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
151
|
-
const quantity =
|
|
151
|
+
const quantity = evaluate(`${lineAmountIncludeTax} / ${priceIncludeTax}`);
|
|
152
152
|
form.setFieldsValue({ quantity });
|
|
153
153
|
await controller.setEditGood({ quantity });
|
|
154
154
|
}
|
|
@@ -180,22 +180,22 @@ export const onChangePriceExcludeTax = lazyFn(
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
183
|
-
const priceExcludeTax =
|
|
183
|
+
const priceExcludeTax = values.priceExcludeTax;
|
|
184
184
|
await controller.setEditGood({ priceExcludeTax });
|
|
185
185
|
form.setFieldsValue({ priceExcludeTax });
|
|
186
186
|
|
|
187
187
|
// 是否有数量
|
|
188
188
|
if (!err.quantity && values.quantity) {
|
|
189
|
-
const quantity =
|
|
189
|
+
const quantity = values.quantity;
|
|
190
190
|
const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
191
191
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
192
192
|
await controller.setEditGood({ lineAmountExcludeTax });
|
|
193
193
|
} else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
194
194
|
const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
195
|
-
const quantity =
|
|
196
|
-
evaluate(`${lineAmountExcludeTax} / ${priceExcludeTax}`)
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
const quantity =
|
|
196
|
+
evaluate(`${lineAmountExcludeTax} / ${priceExcludeTax}`)
|
|
197
|
+
|
|
198
|
+
;
|
|
199
199
|
form.setFieldsValue({ quantity });
|
|
200
200
|
await controller.setEditGood({ quantity });
|
|
201
201
|
}
|
|
@@ -365,7 +365,7 @@ export const onChangeTaxAmount = lazyFn(
|
|
|
365
365
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
366
366
|
|
|
367
367
|
const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
|
|
370
370
|
form.setFieldsValue({ priceExcludeTax });
|
|
371
371
|
|
|
@@ -587,12 +587,22 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
587
587
|
|
|
588
588
|
await controller.run(async s => {
|
|
589
589
|
if (s.goodsListState.editGood) {
|
|
590
|
-
message.error({
|
|
591
|
-
|
|
592
|
-
|
|
590
|
+
// message.error({
|
|
591
|
+
// content: '你正在编辑一个货物',
|
|
592
|
+
// key: '你正在编辑一个货物',
|
|
593
|
+
// });
|
|
594
|
+
|
|
595
|
+
// return;
|
|
596
|
+
await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
|
|
597
|
+
if (err) {
|
|
598
|
+
const firstError: any = Object.values(err)[0];
|
|
599
|
+
message.error({
|
|
600
|
+
content: firstError.errors[0].message,
|
|
601
|
+
key: '你正在编辑一个货物',
|
|
602
|
+
});
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
593
605
|
});
|
|
594
|
-
|
|
595
|
-
return;
|
|
596
606
|
}
|
|
597
607
|
|
|
598
608
|
s.goodsListState.isTaxIncluded = isTaxIncluded;
|
|
@@ -381,7 +381,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
381
381
|
rules: [
|
|
382
382
|
...getReplenishRules('lineAmountIncludeTax'),
|
|
383
383
|
{ required: true, message: '金额不能为空' },
|
|
384
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '
|
|
384
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
|
|
385
385
|
{
|
|
386
386
|
validator: async (_, value, callback) => {
|
|
387
387
|
if (`${value}`.split('.')[0].length > priceIntegerDigit) {
|
|
@@ -400,6 +400,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
400
400
|
})(
|
|
401
401
|
<MyInput
|
|
402
402
|
style={{ textAlign: 'right' }}
|
|
403
|
+
max={99999999999999999999}
|
|
403
404
|
loading={isCipher(changeField, 'lineAmountIncludeTax')}
|
|
404
405
|
onChange={() => {
|
|
405
406
|
setChangeField('lineAmountIncludeTax');
|
|
@@ -430,7 +431,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
430
431
|
rules: [
|
|
431
432
|
...getReplenishRules('lineAmountExcludeTax'),
|
|
432
433
|
{ required: true, message: '金额不能为空' },
|
|
433
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '
|
|
434
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
|
|
434
435
|
{
|
|
435
436
|
validator: async (_, value: string, callback) => {
|
|
436
437
|
if (`${value}`.split('.')[0].length > priceIntegerDigit) {
|
|
@@ -23,8 +23,8 @@ export default () => {
|
|
|
23
23
|
const goodMax = controller.useMemo(s => s.goodsListState.goodMax, []);
|
|
24
24
|
|
|
25
25
|
/** 按钮是否禁用 */
|
|
26
|
-
const disabled = React.useMemo(() =>{
|
|
27
|
-
return
|
|
26
|
+
const disabled = React.useMemo(() => {
|
|
27
|
+
return typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue
|
|
28
28
|
}, [goodMax, goodsNum, searchValue])
|
|
29
29
|
|
|
30
30
|
const onClick = React.useCallback(async () => {
|
|
@@ -49,11 +49,21 @@ async function addGood(controller: InvoiceController) {
|
|
|
49
49
|
await controller.wait();
|
|
50
50
|
await controller.run(async (s) => {
|
|
51
51
|
if (s.goodsListState.editGood) {
|
|
52
|
-
message.error({
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
// message.error({
|
|
53
|
+
// content: '你正在编辑一个货物',
|
|
54
|
+
// key: '你正在编辑一个货物',
|
|
55
|
+
// });
|
|
56
|
+
// return;
|
|
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
|
+
}
|
|
55
66
|
});
|
|
56
|
-
return;
|
|
57
67
|
}
|
|
58
68
|
s.goodsListState.editGood = await controller.addGood({ taxRate: s.goodsListState.defaultRate, lineAttribute: LineAttributeType.正常 });
|
|
59
69
|
});
|
|
@@ -21,11 +21,21 @@ export default function Search() {
|
|
|
21
21
|
await controller.saveEditGood();
|
|
22
22
|
await controller.wait();
|
|
23
23
|
if (controller.state.goodsListState.editGood) {
|
|
24
|
-
message.error({
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// message.error({
|
|
25
|
+
// content: '你正在编辑一个货物',
|
|
26
|
+
// key: '你正在编辑一个货物',
|
|
27
|
+
// });
|
|
28
|
+
// return;
|
|
29
|
+
await controller.state.goodsListState.form?.validateFields(async (err: any, values: any) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
const firstError: any = Object.values(err)[0];
|
|
32
|
+
message.error({
|
|
33
|
+
content: firstError.errors[0].message,
|
|
34
|
+
key: '你正在编辑一个货物',
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
27
38
|
});
|
|
28
|
-
return;
|
|
29
39
|
}
|
|
30
40
|
}, [])
|
|
31
41
|
|