kts-component-invoice-operate 3.1.11 → 3.1.13
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/ui/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/index.esm.js +295 -312
- package/dist/index.js +295 -312
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +1 -1
- package/src/Invoice/InvoiceController/fns/saveEditGood.ts +1 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +26 -9
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +12 -0
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export default async (state: InvoiceControllerState) => {
|
|
|
7
7
|
const editGood = state.goodsListState.editGood;
|
|
8
8
|
const form = state.goodsListState.form;
|
|
9
9
|
|
|
10
|
-
if (!editGood || !form || state.goodsListState.importGoods.isVisibleDrawer) return;
|
|
10
|
+
if (!editGood || !form || state.goodsListState.importGoods.isVisibleDrawer || state.calculating) return;
|
|
11
11
|
if ((await validateFields(form)).err) return;
|
|
12
12
|
|
|
13
13
|
state.goodsListState.goodsList = state.goodsListState.goodsList.map((e) =>
|
|
@@ -47,6 +47,9 @@ const promptErr = (err: any) => {
|
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** 清除计算中启动字段 */
|
|
51
|
+
export const clearCalculatingField = async (controller: InvoiceController) => controller.run(async s => s.calculating = '');
|
|
52
|
+
|
|
50
53
|
/** 数量改变了 */
|
|
51
54
|
export const onChangeQuantity = lazyFn(
|
|
52
55
|
(controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
@@ -55,9 +58,13 @@ export const onChangeQuantity = lazyFn(
|
|
|
55
58
|
|
|
56
59
|
if (!values.quantity && values.quantity !== 0) {
|
|
57
60
|
await controller.setEditGood({ quantity: undefined });
|
|
61
|
+
await clearCalculatingField(controller);
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
|
-
if (err.quantity)
|
|
64
|
+
if (err.quantity) {
|
|
65
|
+
await clearCalculatingField(controller);
|
|
66
|
+
return
|
|
67
|
+
};
|
|
61
68
|
|
|
62
69
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
63
70
|
const quantity = format15(values.quantity, calculatingDigits);
|
|
@@ -104,7 +111,7 @@ export const onChangeQuantity = lazyFn(
|
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
// 清楚 计算中启动字段
|
|
107
|
-
controller
|
|
114
|
+
await clearCalculatingField(controller);
|
|
108
115
|
});
|
|
109
116
|
},
|
|
110
117
|
1000,
|
|
@@ -118,9 +125,13 @@ export const onChangePriceIncludeTax = lazyFn(
|
|
|
118
125
|
|
|
119
126
|
if (!values.priceIncludeTax && values.priceIncludeTax !== 0) {
|
|
120
127
|
await controller.setEditGood({ priceIncludeTax: undefined, priceExcludeTax: undefined });
|
|
128
|
+
await clearCalculatingField(controller);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (err.priceIncludeTax) {
|
|
132
|
+
await clearCalculatingField(controller);
|
|
121
133
|
return;
|
|
122
134
|
}
|
|
123
|
-
if (err.priceIncludeTax) return;
|
|
124
135
|
|
|
125
136
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
126
137
|
const priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
@@ -144,7 +155,7 @@ export const onChangePriceIncludeTax = lazyFn(
|
|
|
144
155
|
updateUnitPriceExcludingTax(controller, form, record);
|
|
145
156
|
|
|
146
157
|
// 清楚 计算中启动字段
|
|
147
|
-
controller
|
|
158
|
+
await clearCalculatingField(controller);
|
|
148
159
|
});
|
|
149
160
|
},
|
|
150
161
|
1000,
|
|
@@ -158,9 +169,13 @@ export const onChangePriceExcludeTax = lazyFn(
|
|
|
158
169
|
|
|
159
170
|
if (!values.priceExcludeTax && values.priceExcludeTax !== 0) {
|
|
160
171
|
await controller.setEditGood({ priceIncludeTax: undefined, priceExcludeTax: undefined });
|
|
172
|
+
await clearCalculatingField(controller);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (err.priceExcludeTax) {
|
|
176
|
+
await clearCalculatingField(controller);
|
|
161
177
|
return;
|
|
162
178
|
}
|
|
163
|
-
if (err.priceExcludeTax) return;
|
|
164
179
|
|
|
165
180
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
166
181
|
const priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
@@ -187,7 +202,7 @@ export const onChangePriceExcludeTax = lazyFn(
|
|
|
187
202
|
updateUnitPriceTax(controller, form, record);
|
|
188
203
|
|
|
189
204
|
// 清楚 计算中启动字段
|
|
190
|
-
controller
|
|
205
|
+
await clearCalculatingField(controller);
|
|
191
206
|
});
|
|
192
207
|
},
|
|
193
208
|
1000,
|
|
@@ -203,6 +218,7 @@ export const onChangeLineAmountIncludeTax = lazyFn(
|
|
|
203
218
|
// 更新不含税
|
|
204
219
|
await controller.setEditGood({ lineAmountIncludeTax: undefined, lineAmountExcludeTax: undefined });
|
|
205
220
|
updateUnitPriceExcludingTax(controller, form, record);
|
|
221
|
+
await clearCalculatingField(controller);
|
|
206
222
|
return;
|
|
207
223
|
}
|
|
208
224
|
|
|
@@ -228,7 +244,7 @@ export const onChangeLineAmountIncludeTax = lazyFn(
|
|
|
228
244
|
updateUnitPriceExcludingTax(controller, form, record);
|
|
229
245
|
|
|
230
246
|
// 清楚 计算中启动字段
|
|
231
|
-
controller
|
|
247
|
+
await clearCalculatingField(controller);
|
|
232
248
|
});
|
|
233
249
|
},
|
|
234
250
|
1000,
|
|
@@ -243,6 +259,7 @@ export const onChangeLineAmountExcludeTax = lazyFn(
|
|
|
243
259
|
// 更新含税
|
|
244
260
|
await controller.setEditGood({ lineAmountIncludeTax: undefined, lineAmountExcludeTax: undefined });
|
|
245
261
|
updateUnitPriceTax(controller, form, record);
|
|
262
|
+
await clearCalculatingField(controller);
|
|
246
263
|
return;
|
|
247
264
|
}
|
|
248
265
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
@@ -267,7 +284,7 @@ export const onChangeLineAmountExcludeTax = lazyFn(
|
|
|
267
284
|
updateUnitPriceTax(controller, form, record);
|
|
268
285
|
|
|
269
286
|
// 清楚 计算中启动字段
|
|
270
|
-
controller
|
|
287
|
+
await clearCalculatingField(controller);
|
|
271
288
|
});
|
|
272
289
|
},
|
|
273
290
|
1000,
|
|
@@ -304,7 +321,7 @@ export const onChangeTaxRate = lazyFn(
|
|
|
304
321
|
}
|
|
305
322
|
|
|
306
323
|
// 清楚 计算中启动字段
|
|
307
|
-
controller
|
|
324
|
+
await clearCalculatingField(controller);
|
|
308
325
|
});
|
|
309
326
|
},
|
|
310
327
|
1000,
|
|
@@ -55,6 +55,13 @@ export default (form: WrappedFormUtils) => {
|
|
|
55
55
|
/** 计算中启动字段 */
|
|
56
56
|
const setChangeField = React.useCallback((value: string) => controller.run(async s => { s.calculating = value }), []);
|
|
57
57
|
|
|
58
|
+
const onNumberValueChange = React.useCallback((e) => {
|
|
59
|
+
const value = e?.target?.value;
|
|
60
|
+
if (value) {
|
|
61
|
+
return value.replace(/[^0-9-\.]/g, '');
|
|
62
|
+
}
|
|
63
|
+
}, [])
|
|
64
|
+
|
|
58
65
|
/** 获取补充校验规则 */
|
|
59
66
|
const getReplenishRules = React.useCallback((id: string) => {
|
|
60
67
|
return columnsReplenish[id] ? columnsReplenish[id].rules || [] : []
|
|
@@ -207,6 +214,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
207
214
|
<Form.Item>
|
|
208
215
|
{getFieldDecorator('quantity', {
|
|
209
216
|
initialValue: editGood.quantity,
|
|
217
|
+
getValueFromEvent: onNumberValueChange,
|
|
210
218
|
rules: [
|
|
211
219
|
...getReplenishRules('quantity'),
|
|
212
220
|
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
|
|
@@ -250,6 +258,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
250
258
|
<Form.Item>
|
|
251
259
|
{getFieldDecorator('priceIncludeTax', {
|
|
252
260
|
initialValue: editGood.priceIncludeTax,
|
|
261
|
+
getValueFromEvent: onNumberValueChange,
|
|
253
262
|
rules: [
|
|
254
263
|
...getReplenishRules('priceIncludeTax'),
|
|
255
264
|
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
@@ -293,6 +302,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
293
302
|
<Form.Item>
|
|
294
303
|
{getFieldDecorator('priceExcludeTax', {
|
|
295
304
|
initialValue: editGood.priceExcludeTax,
|
|
305
|
+
getValueFromEvent: onNumberValueChange,
|
|
296
306
|
rules: [
|
|
297
307
|
...getReplenishRules('priceExcludeTax'),
|
|
298
308
|
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
@@ -336,6 +346,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
336
346
|
<Form.Item>
|
|
337
347
|
{getFieldDecorator('lineAmountIncludeTax', {
|
|
338
348
|
initialValue: editGood.lineAmountIncludeTax,
|
|
349
|
+
getValueFromEvent: onNumberValueChange,
|
|
339
350
|
rules: [
|
|
340
351
|
...getReplenishRules('lineAmountIncludeTax'),
|
|
341
352
|
{ required: true, message: '金额不能为空' },
|
|
@@ -384,6 +395,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
384
395
|
<Form.Item>
|
|
385
396
|
{getFieldDecorator('lineAmountExcludeTax', {
|
|
386
397
|
initialValue: editGood.lineAmountExcludeTax,
|
|
398
|
+
getValueFromEvent: onNumberValueChange,
|
|
387
399
|
rules: [
|
|
388
400
|
...getReplenishRules('lineAmountExcludeTax'),
|
|
389
401
|
{ required: true, message: '金额不能为空' },
|