kts-component-invoice-operate 3.2.119 → 3.2.120
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/tools/calculate/index.d.ts +8 -0
- package/dist/index.esm.js +42 -28
- package/dist/index.js +41 -27
- package/package.json +1 -1
- package/src/Invoice/tools/calculate/index.ts +22 -14
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +7 -6
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +7 -6
|
@@ -38,3 +38,11 @@ export declare function countPrice(amount: string | number, quantity: string | n
|
|
|
38
38
|
* @returns 数量
|
|
39
39
|
*/
|
|
40
40
|
export declare function countQuantity(amount: string | number, price: string | number, calculatingDigits?: number): number | undefined | '';
|
|
41
|
+
/**
|
|
42
|
+
* 将数值转化为非科学计数法的字符串,忽略小数多余的0
|
|
43
|
+
* 无法转化的返回空字符串
|
|
44
|
+
* @param value 数值或字符串
|
|
45
|
+
* @param precision 精度
|
|
46
|
+
* @returns 字符串
|
|
47
|
+
*/
|
|
48
|
+
export declare function nonScientificNotation(value: number | string | undefined, precision?: number): string;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
|
|
2
2
|
import React, { createElement, createContext, useContext, useEffect, forwardRef, Children, isValidElement } from 'react';
|
|
3
3
|
import GreyReactBox, { decorator } from 'grey-react-box';
|
|
4
|
-
import { chain as chain$1, bignumber, create, all } from 'mathjs';
|
|
4
|
+
import { chain as chain$1, bignumber, format as format$1, create, all } from 'mathjs';
|
|
5
5
|
import { message, Form, Input, Icon as Icon$1, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover as Popover$1, Table as Table$1, Tree, Modal as Modal$1, Row as Row$1, Col as Col$1 } from 'kts-components-antd-x3';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Dropdown as Dropdown$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal, Tree as Tree$1 } from 'kts-xui';
|
|
@@ -1389,7 +1389,7 @@ var format15 = function format15(value) {
|
|
|
1389
1389
|
if ("".concat(value) === 'NaN') return '';
|
|
1390
1390
|
if (typeof value === 'string') value = parseFloat(value);
|
|
1391
1391
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
1392
|
-
return
|
|
1392
|
+
return nonScientificNotation(value, fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits);
|
|
1393
1393
|
};
|
|
1394
1394
|
/**
|
|
1395
1395
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -1456,23 +1456,36 @@ function countQuantity(amount, price, calculatingDigits) {
|
|
|
1456
1456
|
if (!price && price !== 0) return undefined;
|
|
1457
1457
|
return format15(chain$1(bignumber(amount)).divide(bignumber(price)).done().toNumber(), calculatingDigits);
|
|
1458
1458
|
}
|
|
1459
|
-
/**
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1459
|
+
/**
|
|
1460
|
+
* 将数值转化为非科学计数法的字符串,忽略小数多余的0
|
|
1461
|
+
* 无法转化的返回空字符串
|
|
1462
|
+
* @param value 数值或字符串
|
|
1463
|
+
* @param precision 精度
|
|
1464
|
+
* @returns 字符串
|
|
1465
|
+
*/
|
|
1463
1466
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
arr.pop();
|
|
1469
|
-
return arr.join('');
|
|
1467
|
+
function nonScientificNotation(value, precision) {
|
|
1468
|
+
try {
|
|
1469
|
+
if (!value && value !== 0) {
|
|
1470
|
+
return '';
|
|
1470
1471
|
} else {
|
|
1471
|
-
|
|
1472
|
+
// 先按照精度fixed
|
|
1473
|
+
if (precision) {
|
|
1474
|
+
value = format$1(bignumber(value), {
|
|
1475
|
+
notation: 'fixed',
|
|
1476
|
+
precision: precision
|
|
1477
|
+
});
|
|
1478
|
+
} // 去掉小数位多余的0
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
return format$1(bignumber(value), {
|
|
1482
|
+
notation: 'fixed'
|
|
1483
|
+
});
|
|
1472
1484
|
}
|
|
1485
|
+
} catch (e) {
|
|
1486
|
+
console.error(e);
|
|
1487
|
+
return '';
|
|
1473
1488
|
}
|
|
1474
|
-
|
|
1475
|
-
return '0';
|
|
1476
1489
|
}
|
|
1477
1490
|
|
|
1478
1491
|
var calculator = /*#__PURE__*/Object.freeze({
|
|
@@ -1483,7 +1496,8 @@ var calculator = /*#__PURE__*/Object.freeze({
|
|
|
1483
1496
|
countAmountExcludeTax: countAmountExcludeTax,
|
|
1484
1497
|
countTaxAmount: countTaxAmount,
|
|
1485
1498
|
countPrice: countPrice,
|
|
1486
|
-
countQuantity: countQuantity
|
|
1499
|
+
countQuantity: countQuantity,
|
|
1500
|
+
nonScientificNotation: nonScientificNotation
|
|
1487
1501
|
});
|
|
1488
1502
|
|
|
1489
1503
|
/**
|
|
@@ -13173,7 +13187,7 @@ var useColumns = (function (form) {
|
|
|
13173
13187
|
render: function render(value, record) {
|
|
13174
13188
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13175
13189
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
|
|
13176
|
-
initialValue: editGood.quantity,
|
|
13190
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
13177
13191
|
getValueFromEvent: onNumberValueChange,
|
|
13178
13192
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
13179
13193
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13254,7 +13268,7 @@ var useColumns = (function (form) {
|
|
|
13254
13268
|
style: {
|
|
13255
13269
|
padding: '0 10px'
|
|
13256
13270
|
}
|
|
13257
|
-
}, value);
|
|
13271
|
+
}, nonScientificNotation(value));
|
|
13258
13272
|
}
|
|
13259
13273
|
}
|
|
13260
13274
|
}, {
|
|
@@ -13268,7 +13282,7 @@ var useColumns = (function (form) {
|
|
|
13268
13282
|
render: function render(value, record) {
|
|
13269
13283
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13270
13284
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
13271
|
-
initialValue: editGood.priceIncludeTax,
|
|
13285
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
13272
13286
|
getValueFromEvent: onNumberValueChange,
|
|
13273
13287
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
13274
13288
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13329,7 +13343,7 @@ var useColumns = (function (form) {
|
|
|
13329
13343
|
style: {
|
|
13330
13344
|
padding: '0 10px'
|
|
13331
13345
|
}
|
|
13332
|
-
}, value);
|
|
13346
|
+
}, nonScientificNotation(value));
|
|
13333
13347
|
}
|
|
13334
13348
|
}
|
|
13335
13349
|
}, {
|
|
@@ -13343,7 +13357,7 @@ var useColumns = (function (form) {
|
|
|
13343
13357
|
render: function render(value, record) {
|
|
13344
13358
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13345
13359
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
13346
|
-
initialValue: editGood.priceExcludeTax,
|
|
13360
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
13347
13361
|
getValueFromEvent: onNumberValueChange,
|
|
13348
13362
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
13349
13363
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13404,7 +13418,7 @@ var useColumns = (function (form) {
|
|
|
13404
13418
|
style: {
|
|
13405
13419
|
padding: '0 10px'
|
|
13406
13420
|
}
|
|
13407
|
-
}, value);
|
|
13421
|
+
}, nonScientificNotation(value));
|
|
13408
13422
|
}
|
|
13409
13423
|
}
|
|
13410
13424
|
}, {
|
|
@@ -19802,7 +19816,7 @@ var useColumns$1 = (function (form) {
|
|
|
19802
19816
|
render: function render(value, record) {
|
|
19803
19817
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19804
19818
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
|
|
19805
|
-
initialValue: editGood.quantity,
|
|
19819
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
19806
19820
|
getValueFromEvent: onNumberValueChange,
|
|
19807
19821
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
19808
19822
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19883,7 +19897,7 @@ var useColumns$1 = (function (form) {
|
|
|
19883
19897
|
style: {
|
|
19884
19898
|
padding: '0 10px'
|
|
19885
19899
|
}
|
|
19886
|
-
}, value);
|
|
19900
|
+
}, nonScientificNotation(value));
|
|
19887
19901
|
}
|
|
19888
19902
|
}
|
|
19889
19903
|
}, {
|
|
@@ -19897,7 +19911,7 @@ var useColumns$1 = (function (form) {
|
|
|
19897
19911
|
render: function render(value, record) {
|
|
19898
19912
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19899
19913
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
19900
|
-
initialValue: editGood.priceIncludeTax,
|
|
19914
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
19901
19915
|
getValueFromEvent: onNumberValueChange,
|
|
19902
19916
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
19903
19917
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19958,7 +19972,7 @@ var useColumns$1 = (function (form) {
|
|
|
19958
19972
|
style: {
|
|
19959
19973
|
padding: '0 10px'
|
|
19960
19974
|
}
|
|
19961
|
-
}, value);
|
|
19975
|
+
}, nonScientificNotation(value));
|
|
19962
19976
|
}
|
|
19963
19977
|
}
|
|
19964
19978
|
}, {
|
|
@@ -19972,7 +19986,7 @@ var useColumns$1 = (function (form) {
|
|
|
19972
19986
|
render: function render(value, record) {
|
|
19973
19987
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19974
19988
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
19975
|
-
initialValue: editGood.priceExcludeTax,
|
|
19989
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
19976
19990
|
getValueFromEvent: onNumberValueChange,
|
|
19977
19991
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
19978
19992
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -20033,7 +20047,7 @@ var useColumns$1 = (function (form) {
|
|
|
20033
20047
|
style: {
|
|
20034
20048
|
padding: '0 10px'
|
|
20035
20049
|
}
|
|
20036
|
-
}, value);
|
|
20050
|
+
}, nonScientificNotation(value));
|
|
20037
20051
|
}
|
|
20038
20052
|
}
|
|
20039
20053
|
}, {
|
package/dist/index.js
CHANGED
|
@@ -1399,7 +1399,7 @@ var format15 = function format15(value) {
|
|
|
1399
1399
|
if ("".concat(value) === 'NaN') return '';
|
|
1400
1400
|
if (typeof value === 'string') value = parseFloat(value);
|
|
1401
1401
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
1402
|
-
return
|
|
1402
|
+
return nonScientificNotation(value, fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits);
|
|
1403
1403
|
};
|
|
1404
1404
|
/**
|
|
1405
1405
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -1466,23 +1466,36 @@ function countQuantity(amount, price, calculatingDigits) {
|
|
|
1466
1466
|
if (!price && price !== 0) return undefined;
|
|
1467
1467
|
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(price)).done().toNumber(), calculatingDigits);
|
|
1468
1468
|
}
|
|
1469
|
-
/**
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1469
|
+
/**
|
|
1470
|
+
* 将数值转化为非科学计数法的字符串,忽略小数多余的0
|
|
1471
|
+
* 无法转化的返回空字符串
|
|
1472
|
+
* @param value 数值或字符串
|
|
1473
|
+
* @param precision 精度
|
|
1474
|
+
* @returns 字符串
|
|
1475
|
+
*/
|
|
1473
1476
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
arr.pop();
|
|
1479
|
-
return arr.join('');
|
|
1477
|
+
function nonScientificNotation(value, precision) {
|
|
1478
|
+
try {
|
|
1479
|
+
if (!value && value !== 0) {
|
|
1480
|
+
return '';
|
|
1480
1481
|
} else {
|
|
1481
|
-
|
|
1482
|
+
// 先按照精度fixed
|
|
1483
|
+
if (precision) {
|
|
1484
|
+
value = mathjs.format(mathjs.bignumber(value), {
|
|
1485
|
+
notation: 'fixed',
|
|
1486
|
+
precision: precision
|
|
1487
|
+
});
|
|
1488
|
+
} // 去掉小数位多余的0
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
return mathjs.format(mathjs.bignumber(value), {
|
|
1492
|
+
notation: 'fixed'
|
|
1493
|
+
});
|
|
1482
1494
|
}
|
|
1495
|
+
} catch (e) {
|
|
1496
|
+
console.error(e);
|
|
1497
|
+
return '';
|
|
1483
1498
|
}
|
|
1484
|
-
|
|
1485
|
-
return '0';
|
|
1486
1499
|
}
|
|
1487
1500
|
|
|
1488
1501
|
var calculator = /*#__PURE__*/Object.freeze({
|
|
@@ -1493,7 +1506,8 @@ var calculator = /*#__PURE__*/Object.freeze({
|
|
|
1493
1506
|
countAmountExcludeTax: countAmountExcludeTax,
|
|
1494
1507
|
countTaxAmount: countTaxAmount,
|
|
1495
1508
|
countPrice: countPrice,
|
|
1496
|
-
countQuantity: countQuantity
|
|
1509
|
+
countQuantity: countQuantity,
|
|
1510
|
+
nonScientificNotation: nonScientificNotation
|
|
1497
1511
|
});
|
|
1498
1512
|
|
|
1499
1513
|
/**
|
|
@@ -13183,7 +13197,7 @@ var useColumns = (function (form) {
|
|
|
13183
13197
|
render: function render(value, record) {
|
|
13184
13198
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13185
13199
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
|
|
13186
|
-
initialValue: editGood.quantity,
|
|
13200
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
13187
13201
|
getValueFromEvent: onNumberValueChange,
|
|
13188
13202
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
13189
13203
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13264,7 +13278,7 @@ var useColumns = (function (form) {
|
|
|
13264
13278
|
style: {
|
|
13265
13279
|
padding: '0 10px'
|
|
13266
13280
|
}
|
|
13267
|
-
}, value);
|
|
13281
|
+
}, nonScientificNotation(value));
|
|
13268
13282
|
}
|
|
13269
13283
|
}
|
|
13270
13284
|
}, {
|
|
@@ -13278,7 +13292,7 @@ var useColumns = (function (form) {
|
|
|
13278
13292
|
render: function render(value, record) {
|
|
13279
13293
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13280
13294
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
13281
|
-
initialValue: editGood.priceIncludeTax,
|
|
13295
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
13282
13296
|
getValueFromEvent: onNumberValueChange,
|
|
13283
13297
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
13284
13298
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13339,7 +13353,7 @@ var useColumns = (function (form) {
|
|
|
13339
13353
|
style: {
|
|
13340
13354
|
padding: '0 10px'
|
|
13341
13355
|
}
|
|
13342
|
-
}, value);
|
|
13356
|
+
}, nonScientificNotation(value));
|
|
13343
13357
|
}
|
|
13344
13358
|
}
|
|
13345
13359
|
}, {
|
|
@@ -13353,7 +13367,7 @@ var useColumns = (function (form) {
|
|
|
13353
13367
|
render: function render(value, record) {
|
|
13354
13368
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
13355
13369
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
13356
|
-
initialValue: editGood.priceExcludeTax,
|
|
13370
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
13357
13371
|
getValueFromEvent: onNumberValueChange,
|
|
13358
13372
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
13359
13373
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -13414,7 +13428,7 @@ var useColumns = (function (form) {
|
|
|
13414
13428
|
style: {
|
|
13415
13429
|
padding: '0 10px'
|
|
13416
13430
|
}
|
|
13417
|
-
}, value);
|
|
13431
|
+
}, nonScientificNotation(value));
|
|
13418
13432
|
}
|
|
13419
13433
|
}
|
|
13420
13434
|
}, {
|
|
@@ -19812,7 +19826,7 @@ var useColumns$1 = (function (form) {
|
|
|
19812
19826
|
render: function render(value, record) {
|
|
19813
19827
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19814
19828
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
|
|
19815
|
-
initialValue: editGood.quantity,
|
|
19829
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
19816
19830
|
getValueFromEvent: onNumberValueChange,
|
|
19817
19831
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
19818
19832
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19893,7 +19907,7 @@ var useColumns$1 = (function (form) {
|
|
|
19893
19907
|
style: {
|
|
19894
19908
|
padding: '0 10px'
|
|
19895
19909
|
}
|
|
19896
|
-
}, value);
|
|
19910
|
+
}, nonScientificNotation(value));
|
|
19897
19911
|
}
|
|
19898
19912
|
}
|
|
19899
19913
|
}, {
|
|
@@ -19907,7 +19921,7 @@ var useColumns$1 = (function (form) {
|
|
|
19907
19921
|
render: function render(value, record) {
|
|
19908
19922
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19909
19923
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
19910
|
-
initialValue: editGood.priceIncludeTax,
|
|
19924
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
19911
19925
|
getValueFromEvent: onNumberValueChange,
|
|
19912
19926
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
19913
19927
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19968,7 +19982,7 @@ var useColumns$1 = (function (form) {
|
|
|
19968
19982
|
style: {
|
|
19969
19983
|
padding: '0 10px'
|
|
19970
19984
|
}
|
|
19971
|
-
}, value);
|
|
19985
|
+
}, nonScientificNotation(value));
|
|
19972
19986
|
}
|
|
19973
19987
|
}
|
|
19974
19988
|
}, {
|
|
@@ -19982,7 +19996,7 @@ var useColumns$1 = (function (form) {
|
|
|
19982
19996
|
render: function render(value, record) {
|
|
19983
19997
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19984
19998
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
19985
|
-
initialValue: editGood.priceExcludeTax,
|
|
19999
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
19986
20000
|
getValueFromEvent: onNumberValueChange,
|
|
19987
20001
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
19988
20002
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -20043,7 +20057,7 @@ var useColumns$1 = (function (form) {
|
|
|
20043
20057
|
style: {
|
|
20044
20058
|
padding: '0 10px'
|
|
20045
20059
|
}
|
|
20046
|
-
}, value);
|
|
20060
|
+
}, nonScientificNotation(value));
|
|
20047
20061
|
}
|
|
20048
20062
|
}
|
|
20049
20063
|
}, {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { chain, bignumber,
|
|
2
|
+
import { chain, bignumber, format } from 'mathjs';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/** 格式化 保留2位小数 */
|
|
@@ -18,7 +18,7 @@ export const format15 = (value: number | string, defaultFractionDigits: number =
|
|
|
18
18
|
if (typeof value === 'string') value = parseFloat(value);
|
|
19
19
|
|
|
20
20
|
const fractionDigits = 15 - `${value || 0}`.indexOf('.');
|
|
21
|
-
return
|
|
21
|
+
return nonScientificNotation(value, fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits) as number | undefined | '';
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
|
|
@@ -107,19 +107,27 @@ export function countQuantity(amount: string | number, price: string | number, c
|
|
|
107
107
|
.toNumber(), calculatingDigits)
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
/**
|
|
111
|
+
* 将数值转化为非科学计数法的字符串,忽略小数多余的0
|
|
112
|
+
* 无法转化的返回空字符串
|
|
113
|
+
* @param value 数值或字符串
|
|
114
|
+
* @param precision 精度
|
|
115
|
+
* @returns 字符串
|
|
116
|
+
*/
|
|
117
|
+
export function nonScientificNotation (value: number | string | undefined, precision?: number ): string {
|
|
118
|
+
try {
|
|
119
|
+
if (!value && value !== 0) {
|
|
120
|
+
return ''
|
|
120
121
|
} else {
|
|
121
|
-
|
|
122
|
+
// 先按照精度fixed
|
|
123
|
+
if (precision) {
|
|
124
|
+
value = format(bignumber(value), {notation: 'fixed', precision});
|
|
125
|
+
}
|
|
126
|
+
// 去掉小数位多余的0
|
|
127
|
+
return format(bignumber(value), {notation: 'fixed'})
|
|
122
128
|
}
|
|
129
|
+
} catch (e){
|
|
130
|
+
console.error(e);
|
|
131
|
+
return ''
|
|
123
132
|
}
|
|
124
|
-
return '0';
|
|
125
133
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from './autoFillFn';
|
|
21
21
|
import { getItemNameWithShorthand } from '../../../../../tools/itemName';
|
|
22
22
|
import Drag from './ui/Drag';
|
|
23
|
+
import { nonScientificNotation } from '../../../../../tools/calculate';
|
|
23
24
|
|
|
24
25
|
export default (form: WrappedFormUtils) => {
|
|
25
26
|
const { getFieldDecorator, getFieldValue } = form;
|
|
@@ -261,7 +262,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
261
262
|
return (
|
|
262
263
|
<Form.Item>
|
|
263
264
|
{getFieldDecorator('quantity', {
|
|
264
|
-
initialValue: editGood.quantity,
|
|
265
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
265
266
|
getValueFromEvent: onNumberValueChange,
|
|
266
267
|
rules: [
|
|
267
268
|
...getReplenishRules('quantity'),
|
|
@@ -290,7 +291,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
290
291
|
</Form.Item>
|
|
291
292
|
);
|
|
292
293
|
} else {
|
|
293
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
294
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
294
295
|
}
|
|
295
296
|
},
|
|
296
297
|
},
|
|
@@ -305,7 +306,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
305
306
|
return (
|
|
306
307
|
<Form.Item>
|
|
307
308
|
{getFieldDecorator('priceIncludeTax', {
|
|
308
|
-
initialValue: editGood.priceIncludeTax,
|
|
309
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
309
310
|
getValueFromEvent: onNumberValueChange,
|
|
310
311
|
rules: [
|
|
311
312
|
...getReplenishRules('priceIncludeTax'),
|
|
@@ -334,7 +335,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
334
335
|
</Form.Item>
|
|
335
336
|
);
|
|
336
337
|
} else {
|
|
337
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
338
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
338
339
|
}
|
|
339
340
|
},
|
|
340
341
|
},
|
|
@@ -349,7 +350,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
349
350
|
return (
|
|
350
351
|
<Form.Item>
|
|
351
352
|
{getFieldDecorator('priceExcludeTax', {
|
|
352
|
-
initialValue: editGood.priceExcludeTax,
|
|
353
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
353
354
|
getValueFromEvent: onNumberValueChange,
|
|
354
355
|
rules: [
|
|
355
356
|
...getReplenishRules('priceExcludeTax'),
|
|
@@ -378,7 +379,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
378
379
|
</Form.Item>
|
|
379
380
|
);
|
|
380
381
|
} else {
|
|
381
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
382
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
382
383
|
}
|
|
383
384
|
},
|
|
384
385
|
},
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
onChangeItemName,
|
|
21
21
|
} from './autoFillFn';
|
|
22
22
|
import Drag from './ui/Drag';
|
|
23
|
+
import { nonScientificNotation } from '../../../../../tools/calculate';
|
|
23
24
|
|
|
24
25
|
export default (form: WrappedFormUtils) => {
|
|
25
26
|
const { getFieldDecorator, getFieldValue } = form;
|
|
@@ -231,7 +232,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
231
232
|
return (
|
|
232
233
|
<Form.Item>
|
|
233
234
|
{getFieldDecorator('quantity', {
|
|
234
|
-
initialValue: editGood.quantity,
|
|
235
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
235
236
|
getValueFromEvent: onNumberValueChange,
|
|
236
237
|
rules: [
|
|
237
238
|
...getReplenishRules('quantity'),
|
|
@@ -260,7 +261,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
260
261
|
</Form.Item>
|
|
261
262
|
);
|
|
262
263
|
} else {
|
|
263
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
264
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
264
265
|
}
|
|
265
266
|
},
|
|
266
267
|
},
|
|
@@ -275,7 +276,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
275
276
|
return (
|
|
276
277
|
<Form.Item>
|
|
277
278
|
{getFieldDecorator('priceIncludeTax', {
|
|
278
|
-
initialValue: editGood.priceIncludeTax,
|
|
279
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
279
280
|
getValueFromEvent: onNumberValueChange,
|
|
280
281
|
rules: [
|
|
281
282
|
...getReplenishRules('priceIncludeTax'),
|
|
@@ -304,7 +305,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
304
305
|
</Form.Item>
|
|
305
306
|
);
|
|
306
307
|
} else {
|
|
307
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
308
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
308
309
|
}
|
|
309
310
|
},
|
|
310
311
|
},
|
|
@@ -319,7 +320,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
319
320
|
return (
|
|
320
321
|
<Form.Item>
|
|
321
322
|
{getFieldDecorator('priceExcludeTax', {
|
|
322
|
-
initialValue: editGood.priceExcludeTax,
|
|
323
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
323
324
|
getValueFromEvent: onNumberValueChange,
|
|
324
325
|
rules: [
|
|
325
326
|
...getReplenishRules('priceExcludeTax'),
|
|
@@ -348,7 +349,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
348
349
|
</Form.Item>
|
|
349
350
|
);
|
|
350
351
|
} else {
|
|
351
|
-
return <span style={{ padding: '0 10px' }}>{value}</span>;
|
|
352
|
+
return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
|
|
352
353
|
}
|
|
353
354
|
},
|
|
354
355
|
},
|