kts-component-invoice-operate 3.2.181-2 → 3.2.181-21
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/BuyerState/index.d.ts +1 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.d.ts +1 -1
- package/dist/index.esm.js +961 -387
- package/dist/index.js +952 -378
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.tsx +7 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +2 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +2 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +1 -1
- package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +2 -3
- package/src/Invoice/tools/calculate/index.ts +1 -1
- package/src/Invoice/ui/default/Buyer/ui/BuyerNameInput/index.tsx +2 -2
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +1 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +92 -36
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +43 -14
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +4 -1
- package/src/Invoice/ui/default/GoodsList/index.tsx +6 -6
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +449 -139
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +3 -3
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/index.tsx +1 -1
- package/src/Invoice/ui/default/ImportBuyerDrawer/index.tsx +1 -1
- package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +27 -14
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +9 -2
- package/src/Invoice/ui/digtal/Sign/index.tsx +2 -2
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +28 -17
package/package.json
CHANGED
|
@@ -28,6 +28,8 @@ export interface IBuyerInfo {
|
|
|
28
28
|
|
|
29
29
|
/** 购买方开户行及账号 */
|
|
30
30
|
buyerBank?: string;
|
|
31
|
+
|
|
32
|
+
customerCode?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/** 自动填充 */
|
|
@@ -46,6 +48,11 @@ export default class BuyerState {
|
|
|
46
48
|
dataIndex: 'buyerName',
|
|
47
49
|
key: 'buyerName',
|
|
48
50
|
},
|
|
51
|
+
{
|
|
52
|
+
title: '客户代码',
|
|
53
|
+
dataIndex: 'customerCode',
|
|
54
|
+
key: 'customerCode',
|
|
55
|
+
},
|
|
49
56
|
{
|
|
50
57
|
title: '纳税人识别号',
|
|
51
58
|
dataIndex: 'buyerNo',
|
|
@@ -10,8 +10,7 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
|
|
|
10
10
|
Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
|
|
11
11
|
|
|
12
12
|
// 没用 被编辑的货物 和 form 就退出
|
|
13
|
-
if (!s.goodsListState.editGood || !s.goodsListState.form) return;
|
|
14
|
-
|
|
13
|
+
if (!s.goodsListState.editGood || !s.goodsListState.form) return;
|
|
15
14
|
// 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
|
|
16
15
|
record.quantity = undefined;
|
|
17
16
|
record.lineAmountExcludeTax = undefined;
|
|
@@ -31,7 +30,7 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
|
|
|
31
30
|
between.lineAmountIncludeTax = record.lineAmountIncludeTax;
|
|
32
31
|
between.lineAmountExcludeTax = record.lineAmountExcludeTax;
|
|
33
32
|
between.taxRate = record.taxRate;
|
|
34
|
-
between.taxAmount = record.taxAmount;
|
|
33
|
+
between.taxAmount = record.taxAmount;
|
|
35
34
|
|
|
36
35
|
// 设置编辑货物
|
|
37
36
|
const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
|
|
@@ -20,7 +20,7 @@ export const format15 = (value: number | string, defaultFractionDigits: number =
|
|
|
20
20
|
const fractionDigits = 15 - `${value || 0}`.indexOf('.');
|
|
21
21
|
return nonScientificNotation(value, fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits) as number | undefined | '';
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -86,7 +86,7 @@ export default (props: IBuyerNameInputProps) => {
|
|
|
86
86
|
onBuyNameChange(e.target.value);
|
|
87
87
|
}, [dataSource])
|
|
88
88
|
|
|
89
|
-
React.useEffect(() => {
|
|
89
|
+
React.useEffect(() => {
|
|
90
90
|
visible && onBuyNameChange(props.value)
|
|
91
91
|
}, [visible, props.value])
|
|
92
92
|
|
|
@@ -134,7 +134,7 @@ function useDataSource() {
|
|
|
134
134
|
const autoContainer = controller.useMemo(s => s.buyerState.autoContainer, []);
|
|
135
135
|
|
|
136
136
|
const onBuyNameChange = React.useCallback(async (e?: string | undefined) => {
|
|
137
|
-
if (!autoContainer) return;
|
|
137
|
+
if (!autoContainer) return;
|
|
138
138
|
setLoading(true);
|
|
139
139
|
setDataSource(await autoContainer.onBuyNameChange(e));
|
|
140
140
|
setLoading(false);
|
|
@@ -476,8 +476,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
476
476
|
const addProductionByTax = async (params: any) => {
|
|
477
477
|
if (controller.addProductionByTax) {
|
|
478
478
|
controller.addProductionByTax(params)
|
|
479
|
-
};
|
|
480
|
-
// const goodsTaxRateList = await controller.getGoodsTaxRateList(good.taxClassificationCode);
|
|
479
|
+
};
|
|
481
480
|
}
|
|
482
481
|
// 确定
|
|
483
482
|
const onSubmit = React.useCallback(values => {
|
|
@@ -49,6 +49,71 @@ const promptErr = (err: any) => {
|
|
|
49
49
|
export const clearCalculatingField = async (controller: InvoiceController) => controller.run(async s => s.calculatingField = '');
|
|
50
50
|
|
|
51
51
|
/** 数量改变了 */
|
|
52
|
+
// export const onChangeQuantity = lazyFn(
|
|
53
|
+
// (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
54
|
+
// form.validateFields(async (err, values) => {
|
|
55
|
+
// err = err || {};
|
|
56
|
+
|
|
57
|
+
// if (!values.quantity && values.quantity !== 0) {
|
|
58
|
+
// await controller.setEditGood({ quantity: undefined });
|
|
59
|
+
// await clearCalculatingField(controller);
|
|
60
|
+
// return;
|
|
61
|
+
// }
|
|
62
|
+
// if (err.quantity) {
|
|
63
|
+
// await clearCalculatingField(controller);
|
|
64
|
+
// return
|
|
65
|
+
// };
|
|
66
|
+
|
|
67
|
+
// const calculatingDigits = controller.state.calculatingDigits;
|
|
68
|
+
// const quantity = format15(values.quantity, calculatingDigits);
|
|
69
|
+
// await controller.setEditGood({ quantity });
|
|
70
|
+
// form.setFieldsValue({ quantity });
|
|
71
|
+
|
|
72
|
+
// // 是否含税
|
|
73
|
+
// if (controller.state.goodsListState.isTaxIncluded) {
|
|
74
|
+
// // 含税
|
|
75
|
+
// if (!err.priceIncludeTax && values.priceIncludeTax) {
|
|
76
|
+
// // 可以找到 单价(含税)
|
|
77
|
+
// const priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
78
|
+
// const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
79
|
+
// form.setFieldsValue({ lineAmountIncludeTax });
|
|
80
|
+
// await controller.setEditGood({ lineAmountIncludeTax });
|
|
81
|
+
// } else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
82
|
+
// // 可以找到 金额(含税)
|
|
83
|
+
// const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
84
|
+
// const priceIncludeTax = format15(
|
|
85
|
+
// evaluate(`${lineAmountIncludeTax} / ${quantity}`),
|
|
86
|
+
// calculatingDigits);
|
|
87
|
+
// form.setFieldsValue({ priceIncludeTax });
|
|
88
|
+
// await controller.setEditGood({ priceIncludeTax });
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// // 更新不含税
|
|
92
|
+
// await updateUnitPriceExcludingTax(controller, form, record);
|
|
93
|
+
// } else {
|
|
94
|
+
// // 不含税
|
|
95
|
+
// if (!err.priceExcludeTax && values.priceExcludeTax) {
|
|
96
|
+
// const priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
97
|
+
// const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
98
|
+
// form.setFieldsValue({ lineAmountExcludeTax });
|
|
99
|
+
// await controller.setEditGood({ lineAmountExcludeTax, quantity });
|
|
100
|
+
// } else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
101
|
+
// const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
102
|
+
// const priceExcludeTax = format15(evaluate(`${lineAmountExcludeTax} / ${quantity}`), calculatingDigits);
|
|
103
|
+
// form.setFieldsValue({ priceExcludeTax });
|
|
104
|
+
// await controller.setEditGood({ priceExcludeTax, quantity });
|
|
105
|
+
// }
|
|
106
|
+
|
|
107
|
+
// // 更新含税
|
|
108
|
+
// await updateUnitPriceTax(controller, form, record);
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
// // 清楚 计算中启动字段
|
|
112
|
+
// await clearCalculatingField(controller);
|
|
113
|
+
// });
|
|
114
|
+
// },
|
|
115
|
+
// 1000,
|
|
116
|
+
// );
|
|
52
117
|
export const onChangeQuantity = lazyFn(
|
|
53
118
|
(controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
54
119
|
form.validateFields(async (err, values) => {
|
|
@@ -61,8 +126,8 @@ export const onChangeQuantity = lazyFn(
|
|
|
61
126
|
}
|
|
62
127
|
if (err.quantity) {
|
|
63
128
|
await clearCalculatingField(controller);
|
|
64
|
-
return
|
|
65
|
-
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
66
131
|
|
|
67
132
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
68
133
|
const quantity = format15(values.quantity, calculatingDigits);
|
|
@@ -71,50 +136,41 @@ export const onChangeQuantity = lazyFn(
|
|
|
71
136
|
|
|
72
137
|
// 是否含税
|
|
73
138
|
if (controller.state.goodsListState.isTaxIncluded) {
|
|
74
|
-
//
|
|
75
|
-
if (!err.
|
|
76
|
-
// 可以找到 单价(含税)
|
|
77
|
-
const priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
78
|
-
const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
79
|
-
form.setFieldsValue({ lineAmountIncludeTax });
|
|
80
|
-
await controller.setEditGood({ lineAmountIncludeTax });
|
|
81
|
-
} else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
82
|
-
// 可以找到 金额(含税)
|
|
139
|
+
// 含税:只根据金额反算单价
|
|
140
|
+
if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
83
141
|
const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
84
142
|
const priceIncludeTax = format15(
|
|
85
143
|
evaluate(`${lineAmountIncludeTax} / ${quantity}`),
|
|
86
|
-
|
|
144
|
+
8
|
|
145
|
+
);
|
|
87
146
|
form.setFieldsValue({ priceIncludeTax });
|
|
88
147
|
await controller.setEditGood({ priceIncludeTax });
|
|
89
148
|
}
|
|
90
149
|
|
|
91
|
-
//
|
|
150
|
+
// 更新不含税单价(反算)
|
|
92
151
|
await updateUnitPriceExcludingTax(controller, form, record);
|
|
152
|
+
|
|
93
153
|
} else {
|
|
94
|
-
//
|
|
95
|
-
if (!err.
|
|
96
|
-
const priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
97
|
-
const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
98
|
-
form.setFieldsValue({ lineAmountExcludeTax });
|
|
99
|
-
await controller.setEditGood({ lineAmountExcludeTax, quantity });
|
|
100
|
-
} else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
154
|
+
// 不含税:只根据金额反算单价
|
|
155
|
+
if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
101
156
|
const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
102
|
-
const priceExcludeTax = format15(
|
|
157
|
+
const priceExcludeTax = format15(
|
|
158
|
+
evaluate(`${lineAmountExcludeTax} / ${quantity}`),
|
|
159
|
+
8
|
|
160
|
+
);
|
|
103
161
|
form.setFieldsValue({ priceExcludeTax });
|
|
104
|
-
await controller.setEditGood({ priceExcludeTax
|
|
162
|
+
await controller.setEditGood({ priceExcludeTax });
|
|
105
163
|
}
|
|
106
164
|
|
|
107
|
-
//
|
|
165
|
+
// 更新含税单价(反算)
|
|
108
166
|
await updateUnitPriceTax(controller, form, record);
|
|
109
167
|
}
|
|
110
168
|
|
|
111
|
-
// 清楚 计算中启动字段
|
|
112
169
|
await clearCalculatingField(controller);
|
|
113
170
|
});
|
|
114
171
|
},
|
|
115
172
|
1000,
|
|
116
173
|
);
|
|
117
|
-
|
|
118
174
|
/** 单价(含税) */
|
|
119
175
|
export const onChangePriceIncludeTax = lazyFn(
|
|
120
176
|
(controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
@@ -132,7 +188,7 @@ export const onChangePriceIncludeTax = lazyFn(
|
|
|
132
188
|
}
|
|
133
189
|
|
|
134
190
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
135
|
-
const priceIncludeTax = format15(values.priceIncludeTax,
|
|
191
|
+
const priceIncludeTax = format15(values.priceIncludeTax, 8);
|
|
136
192
|
await controller.setEditGood({ priceIncludeTax });
|
|
137
193
|
form.setFieldsValue({ priceIncludeTax });
|
|
138
194
|
|
|
@@ -176,7 +232,7 @@ export const onChangePriceExcludeTax = lazyFn(
|
|
|
176
232
|
}
|
|
177
233
|
|
|
178
234
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
179
|
-
const priceExcludeTax = format15(values.priceExcludeTax,
|
|
235
|
+
const priceExcludeTax = format15(values.priceExcludeTax, 8);
|
|
180
236
|
await controller.setEditGood({ priceExcludeTax });
|
|
181
237
|
form.setFieldsValue({ priceExcludeTax });
|
|
182
238
|
|
|
@@ -228,11 +284,11 @@ export const onChangeLineAmountIncludeTax = lazyFn(
|
|
|
228
284
|
// 是否有数量
|
|
229
285
|
if (!err.quantity && values.quantity) {
|
|
230
286
|
const quantity = format15(values.quantity, calculatingDigits);
|
|
231
|
-
const priceIncludeTax = format15(evaluate(`${lineAmountIncludeTax} / ${quantity}`),
|
|
287
|
+
const priceIncludeTax = format15(evaluate(`${lineAmountIncludeTax} / ${quantity}`), 8);
|
|
232
288
|
form.setFieldsValue({ priceIncludeTax });
|
|
233
289
|
await controller.setEditGood({ priceIncludeTax });
|
|
234
290
|
} else if (!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0)) {
|
|
235
|
-
const priceIncludeTax = format15(values.priceIncludeTax,
|
|
291
|
+
const priceIncludeTax = format15(values.priceIncludeTax, 8);
|
|
236
292
|
const quantity = format15(evaluate(`${lineAmountIncludeTax} / ${priceIncludeTax}`), calculatingDigits);
|
|
237
293
|
form.setFieldsValue({ quantity });
|
|
238
294
|
await controller.setEditGood({ quantity });
|
|
@@ -268,11 +324,11 @@ export const onChangeLineAmountExcludeTax = lazyFn(
|
|
|
268
324
|
// 是否有数量
|
|
269
325
|
if (!err.quantity && values.quantity) {
|
|
270
326
|
const quantity = format15(values.quantity, calculatingDigits);
|
|
271
|
-
const priceExcludeTax = format15(evaluate(`${lineAmountExcludeTax} / ${quantity}`),
|
|
327
|
+
const priceExcludeTax = format15(evaluate(`${lineAmountExcludeTax} / ${quantity}`), 8);
|
|
272
328
|
form.setFieldsValue({ priceExcludeTax });
|
|
273
329
|
await controller.setEditGood({ priceExcludeTax });
|
|
274
330
|
} else if (!err.priceExcludeTax && values.priceExcludeTax) {
|
|
275
|
-
const priceExcludeTax = format15(values.priceExcludeTax,
|
|
331
|
+
const priceExcludeTax = format15(values.priceExcludeTax, 8);
|
|
276
332
|
const quantity = format15(evaluate(`${lineAmountExcludeTax} / ${priceExcludeTax}`), calculatingDigits);
|
|
277
333
|
form.setFieldsValue({ quantity });
|
|
278
334
|
await controller.setEditGood({ quantity });
|
|
@@ -435,7 +491,7 @@ export const updateUnitPriceTax = async (controller: InvoiceController, form: Wr
|
|
|
435
491
|
// 单价(含税) = 金额(含税) / (數量)
|
|
436
492
|
// 是否有数量
|
|
437
493
|
if (!err.quantity && values.quantity) {
|
|
438
|
-
const priceIncludeTax = format15(evaluate(`${lineAmountIncludeTax} / ${values.quantity}`),
|
|
494
|
+
const priceIncludeTax = format15(evaluate(`${lineAmountIncludeTax} / ${values.quantity}`), 8);
|
|
439
495
|
await controller.setEditGood({ priceIncludeTax });
|
|
440
496
|
}
|
|
441
497
|
|
|
@@ -593,12 +649,12 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
593
649
|
needRefresh = true;
|
|
594
650
|
}
|
|
595
651
|
const quantity: any = format15(sourceQuantity, calculatingDigits);
|
|
596
|
-
const priceIncludeTax: any = format15(sourcePriceIncludeTax,
|
|
652
|
+
const priceIncludeTax: any = format15(sourcePriceIncludeTax, 8);
|
|
597
653
|
|
|
598
654
|
const lineAmountIncludeTax: any = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
599
655
|
const taxAmount: any = countTaxAmount(lineAmountIncludeTax, controller.state.goodsListState.deduction, taxRate as any);
|
|
600
656
|
const lineAmountExcludeTax: any = countAmountExcludeTax(lineAmountIncludeTax, taxAmount);
|
|
601
|
-
const priceExcludeTax: any = countPrice(lineAmountExcludeTax, quantity,
|
|
657
|
+
const priceExcludeTax: any = countPrice(lineAmountExcludeTax, quantity, 8);
|
|
602
658
|
|
|
603
659
|
return {
|
|
604
660
|
...good,
|
|
@@ -618,11 +674,11 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
618
674
|
needRefresh = true;
|
|
619
675
|
}
|
|
620
676
|
const quantity: any = format15(sourceQuantity, calculatingDigits);
|
|
621
|
-
const priceExcludeTax: any = format15(sourcePriceExcludeTax,
|
|
677
|
+
const priceExcludeTax: any = format15(sourcePriceExcludeTax, 8);
|
|
622
678
|
|
|
623
679
|
const lineAmountExcludeTax: any = format2(evaluate(`${priceExcludeTax} * ${quantity}`));
|
|
624
680
|
const lineAmountIncludeTax: any = format2(evaluate(`${lineAmountExcludeTax} * (1+(${taxRate}/100))`));
|
|
625
|
-
const priceIncludeTax: any = format15(evaluate(`${lineAmountIncludeTax} / ${quantity}`),
|
|
681
|
+
const priceIncludeTax: any = format15(evaluate(`${lineAmountIncludeTax} / ${quantity}`), 8);
|
|
626
682
|
const taxAmount: any = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
|
|
627
683
|
|
|
628
684
|
return {
|
|
@@ -320,18 +320,33 @@ export default (form: WrappedFormUtils) => {
|
|
|
320
320
|
return (
|
|
321
321
|
<Form.Item>
|
|
322
322
|
{getFieldDecorator('priceIncludeTax', {
|
|
323
|
-
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
323
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax, 8),
|
|
324
324
|
getValueFromEvent: onNumberValueChange,
|
|
325
325
|
rules: [
|
|
326
326
|
...getReplenishRules('priceIncludeTax'),
|
|
327
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
327
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
328
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
|
|
329
|
+
{
|
|
330
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d{1,8})?$/,
|
|
331
|
+
message: '单价必须为数字且最多保留8位小数'
|
|
332
|
+
},
|
|
328
333
|
{
|
|
329
334
|
validator: async (_, value, callback) => {
|
|
330
335
|
await controller.wait();
|
|
331
|
-
const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
332
|
-
const isvalue = !!value || value === 0;
|
|
333
|
-
if (isvalue || isQuantity === isvalue) return;
|
|
334
|
-
callback('请输入单价');
|
|
336
|
+
// const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
337
|
+
// const isvalue = !!value || value === 0;
|
|
338
|
+
// if (isvalue || isQuantity === isvalue) return;
|
|
339
|
+
// callback('请输入单价');
|
|
340
|
+
const quantity = getFieldValue('quantity');
|
|
341
|
+
const isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
|
|
342
|
+
const isValueValid = value !== undefined && value !== null && value !== '';
|
|
343
|
+
|
|
344
|
+
// if (isValueValid && isQuantityValid) return;
|
|
345
|
+
// 允许两者都为空
|
|
346
|
+
if (!isValueValid && !isQuantityValid) return;
|
|
347
|
+
|
|
348
|
+
if (!isValueValid) return callback('金额不能为空');
|
|
349
|
+
if (!isQuantityValid) return callback('数量不能为空');
|
|
335
350
|
}
|
|
336
351
|
}
|
|
337
352
|
],
|
|
@@ -349,7 +364,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
349
364
|
</Form.Item>
|
|
350
365
|
);
|
|
351
366
|
} else {
|
|
352
|
-
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
367
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value, 8)}</span>;
|
|
353
368
|
}
|
|
354
369
|
},
|
|
355
370
|
},
|
|
@@ -364,18 +379,32 @@ export default (form: WrappedFormUtils) => {
|
|
|
364
379
|
return (
|
|
365
380
|
<Form.Item>
|
|
366
381
|
{getFieldDecorator('priceExcludeTax', {
|
|
367
|
-
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
382
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax, 8),
|
|
368
383
|
getValueFromEvent: onNumberValueChange,
|
|
369
384
|
rules: [
|
|
370
385
|
...getReplenishRules('priceExcludeTax'),
|
|
371
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
386
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
387
|
+
{
|
|
388
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d{1,8})?$/,
|
|
389
|
+
message: '单价必须为数字且最多保留8位小数'
|
|
390
|
+
},
|
|
372
391
|
{
|
|
373
392
|
validator: async (_, value, callback) => {
|
|
374
393
|
await controller.wait();
|
|
375
|
-
const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
376
|
-
const isvalue = !!value || value === 0;
|
|
377
|
-
if (isvalue || isQuantity === isvalue) return;
|
|
378
|
-
callback('请输入单价');
|
|
394
|
+
// const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
395
|
+
// const isvalue = !!value || value === 0;
|
|
396
|
+
// if (isvalue || isQuantity === isvalue) return;
|
|
397
|
+
// callback('请输入单价');
|
|
398
|
+
const quantity = getFieldValue('quantity');
|
|
399
|
+
const isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
|
|
400
|
+
const isValueValid = value !== undefined && value !== null && value !== '';
|
|
401
|
+
|
|
402
|
+
// if (isValueValid && isQuantityValid) return;
|
|
403
|
+
// 允许两者都为空
|
|
404
|
+
if (!isValueValid && !isQuantityValid) return;
|
|
405
|
+
|
|
406
|
+
if (!isValueValid) return callback('金额不能为空');
|
|
407
|
+
if (!isQuantityValid) return callback('数量不能为空');
|
|
379
408
|
}
|
|
380
409
|
}
|
|
381
410
|
],
|
|
@@ -393,7 +422,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
393
422
|
</Form.Item>
|
|
394
423
|
);
|
|
395
424
|
} else {
|
|
396
|
-
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
425
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value, 8)}</span>;
|
|
397
426
|
}
|
|
398
427
|
},
|
|
399
428
|
},
|
package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx
CHANGED
|
@@ -16,7 +16,10 @@ export default (goods: IGood) => {
|
|
|
16
16
|
const onClick = React.useCallback(() => {
|
|
17
17
|
controller.delGood(goods.$index);
|
|
18
18
|
}, [controller, goods.$index]);
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
if (goods.lineAttribute === LineAttributeType.正常 && goods?.referenceLines && goods?.referenceLines?.length > 0 ) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
20
23
|
if (goods.lineAttribute === LineAttributeType.被折扣行) {
|
|
21
24
|
return undefined;
|
|
22
25
|
}
|
|
@@ -25,7 +25,7 @@ import Invoice from '../../..';
|
|
|
25
25
|
import './index.less';
|
|
26
26
|
|
|
27
27
|
import useEndowCodeButton from './ui/BulkMenu/hooks/useEndowCodeButton';
|
|
28
|
-
import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
|
|
28
|
+
import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
|
|
29
29
|
import useAddDiscountRowButton from './ui/BulkMenu/hooks/useAddDiscountRowButton';
|
|
30
30
|
import useMergeDetails from './ui/BulkMenu/hooks/useMergeDetails';
|
|
31
31
|
import useMergeDiscount from './ui/BulkMenu/hooks/useMergeDiscount';
|
|
@@ -49,7 +49,7 @@ export interface IGoodsListProps {
|
|
|
49
49
|
isSwitchTax?: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export default class GoodsList extends React.Component<IGoodsListProps>{
|
|
52
|
+
export default class GoodsList extends React.Component<IGoodsListProps> {
|
|
53
53
|
render() {
|
|
54
54
|
return <Main {...this.props} />
|
|
55
55
|
}
|
|
@@ -85,8 +85,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
85
85
|
const delRowButton = useDelRowButton();
|
|
86
86
|
|
|
87
87
|
/** 添加折扣行 */
|
|
88
|
-
const addDiscountRowButton = useAddDiscountRowButton();
|
|
89
|
-
|
|
88
|
+
const addDiscountRowButton = useAddDiscountRowButton();
|
|
90
89
|
/** 全单合并明细 */
|
|
91
90
|
const mergeDetails = useMergeDetails()
|
|
92
91
|
|
|
@@ -147,7 +146,8 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
147
146
|
|
|
148
147
|
{/* 批量删除 */}
|
|
149
148
|
{delRowButton.button}
|
|
150
|
-
|
|
149
|
+
{/* 加载折扣 */}
|
|
150
|
+
{addDiscountRowButton.button}
|
|
151
151
|
{/* 全单合并明细 */}
|
|
152
152
|
{mergeDetails.button}
|
|
153
153
|
|
|
@@ -155,7 +155,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
|
|
|
155
155
|
{mergeDiscount.button}
|
|
156
156
|
|
|
157
157
|
{/* 添加折扣行 */}
|
|
158
|
-
{addDiscountRowButton.drawer}
|
|
158
|
+
{/* {addDiscountRowButton.drawer} */}
|
|
159
159
|
|
|
160
160
|
{/* 销售折让 */}
|
|
161
161
|
{salesDiscount.button}
|