kts-component-invoice-operate 3.2.119 → 3.2.121
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 +50 -30
- package/dist/index.js +49 -29
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/readOnly/index.tsx +2 -2
- 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
- package/src/Invoice/ui/digtal/Sign/index.tsx +3 -3
|
@@ -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
|
}, {
|
|
@@ -17142,7 +17156,11 @@ var SignDigtal = decorator(Form.create())(function (props) {
|
|
|
17142
17156
|
style: {
|
|
17143
17157
|
height: '100%'
|
|
17144
17158
|
}
|
|
17145
|
-
}) : /*#__PURE__*/React.createElement(MyDiv$1,
|
|
17159
|
+
}) : /*#__PURE__*/React.createElement(MyDiv$1, {
|
|
17160
|
+
style: {
|
|
17161
|
+
whiteSpace: 'pre'
|
|
17162
|
+
}
|
|
17163
|
+
})))), /*#__PURE__*/React.createElement(Form, {
|
|
17146
17164
|
layout: 'inline',
|
|
17147
17165
|
className: 'digtal-readOnly-form'
|
|
17148
17166
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -17191,7 +17209,9 @@ var MyDiv$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
17191
17209
|
_createClass(MyDiv, [{
|
|
17192
17210
|
key: "render",
|
|
17193
17211
|
value: function render() {
|
|
17194
|
-
return /*#__PURE__*/React.createElement("div",
|
|
17212
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17213
|
+
style: this.props.style
|
|
17214
|
+
}, this.props.value);
|
|
17195
17215
|
}
|
|
17196
17216
|
}]);
|
|
17197
17217
|
|
|
@@ -19802,7 +19822,7 @@ var useColumns$1 = (function (form) {
|
|
|
19802
19822
|
render: function render(value, record) {
|
|
19803
19823
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19804
19824
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
|
|
19805
|
-
initialValue: editGood.quantity,
|
|
19825
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
19806
19826
|
getValueFromEvent: onNumberValueChange,
|
|
19807
19827
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
19808
19828
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19883,7 +19903,7 @@ var useColumns$1 = (function (form) {
|
|
|
19883
19903
|
style: {
|
|
19884
19904
|
padding: '0 10px'
|
|
19885
19905
|
}
|
|
19886
|
-
}, value);
|
|
19906
|
+
}, nonScientificNotation(value));
|
|
19887
19907
|
}
|
|
19888
19908
|
}
|
|
19889
19909
|
}, {
|
|
@@ -19897,7 +19917,7 @@ var useColumns$1 = (function (form) {
|
|
|
19897
19917
|
render: function render(value, record) {
|
|
19898
19918
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19899
19919
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
19900
|
-
initialValue: editGood.priceIncludeTax,
|
|
19920
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
19901
19921
|
getValueFromEvent: onNumberValueChange,
|
|
19902
19922
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
19903
19923
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19958,7 +19978,7 @@ var useColumns$1 = (function (form) {
|
|
|
19958
19978
|
style: {
|
|
19959
19979
|
padding: '0 10px'
|
|
19960
19980
|
}
|
|
19961
|
-
}, value);
|
|
19981
|
+
}, nonScientificNotation(value));
|
|
19962
19982
|
}
|
|
19963
19983
|
}
|
|
19964
19984
|
}, {
|
|
@@ -19972,7 +19992,7 @@ var useColumns$1 = (function (form) {
|
|
|
19972
19992
|
render: function render(value, record) {
|
|
19973
19993
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19974
19994
|
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
19975
|
-
initialValue: editGood.priceExcludeTax,
|
|
19995
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
19976
19996
|
getValueFromEvent: onNumberValueChange,
|
|
19977
19997
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
19978
19998
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -20033,7 +20053,7 @@ var useColumns$1 = (function (form) {
|
|
|
20033
20053
|
style: {
|
|
20034
20054
|
padding: '0 10px'
|
|
20035
20055
|
}
|
|
20036
|
-
}, value);
|
|
20056
|
+
}, nonScientificNotation(value));
|
|
20037
20057
|
}
|
|
20038
20058
|
}
|
|
20039
20059
|
}, {
|
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
|
}, {
|
|
@@ -17152,7 +17166,11 @@ var SignDigtal = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(funct
|
|
|
17152
17166
|
style: {
|
|
17153
17167
|
height: '100%'
|
|
17154
17168
|
}
|
|
17155
|
-
}) : /*#__PURE__*/React__default['default'].createElement(MyDiv$1,
|
|
17169
|
+
}) : /*#__PURE__*/React__default['default'].createElement(MyDiv$1, {
|
|
17170
|
+
style: {
|
|
17171
|
+
whiteSpace: 'pre'
|
|
17172
|
+
}
|
|
17173
|
+
})))), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form, {
|
|
17156
17174
|
layout: 'inline',
|
|
17157
17175
|
className: 'digtal-readOnly-form'
|
|
17158
17176
|
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
@@ -17201,7 +17219,9 @@ var MyDiv$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
17201
17219
|
_createClass(MyDiv, [{
|
|
17202
17220
|
key: "render",
|
|
17203
17221
|
value: function render() {
|
|
17204
|
-
return /*#__PURE__*/React__default['default'].createElement("div",
|
|
17222
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17223
|
+
style: this.props.style
|
|
17224
|
+
}, this.props.value);
|
|
17205
17225
|
}
|
|
17206
17226
|
}]);
|
|
17207
17227
|
|
|
@@ -19812,7 +19832,7 @@ var useColumns$1 = (function (form) {
|
|
|
19812
19832
|
render: function render(value, record) {
|
|
19813
19833
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19814
19834
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
|
|
19815
|
-
initialValue: editGood.quantity,
|
|
19835
|
+
initialValue: nonScientificNotation(editGood.quantity),
|
|
19816
19836
|
getValueFromEvent: onNumberValueChange,
|
|
19817
19837
|
rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
|
|
19818
19838
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19893,7 +19913,7 @@ var useColumns$1 = (function (form) {
|
|
|
19893
19913
|
style: {
|
|
19894
19914
|
padding: '0 10px'
|
|
19895
19915
|
}
|
|
19896
|
-
}, value);
|
|
19916
|
+
}, nonScientificNotation(value));
|
|
19897
19917
|
}
|
|
19898
19918
|
}
|
|
19899
19919
|
}, {
|
|
@@ -19907,7 +19927,7 @@ var useColumns$1 = (function (form) {
|
|
|
19907
19927
|
render: function render(value, record) {
|
|
19908
19928
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19909
19929
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
19910
|
-
initialValue: editGood.priceIncludeTax,
|
|
19930
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
19911
19931
|
getValueFromEvent: onNumberValueChange,
|
|
19912
19932
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
19913
19933
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -19968,7 +19988,7 @@ var useColumns$1 = (function (form) {
|
|
|
19968
19988
|
style: {
|
|
19969
19989
|
padding: '0 10px'
|
|
19970
19990
|
}
|
|
19971
|
-
}, value);
|
|
19991
|
+
}, nonScientificNotation(value));
|
|
19972
19992
|
}
|
|
19973
19993
|
}
|
|
19974
19994
|
}, {
|
|
@@ -19982,7 +20002,7 @@ var useColumns$1 = (function (form) {
|
|
|
19982
20002
|
render: function render(value, record) {
|
|
19983
20003
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
19984
20004
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
19985
|
-
initialValue: editGood.priceExcludeTax,
|
|
20005
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
19986
20006
|
getValueFromEvent: onNumberValueChange,
|
|
19987
20007
|
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
19988
20008
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
@@ -20043,7 +20063,7 @@ var useColumns$1 = (function (form) {
|
|
|
20043
20063
|
style: {
|
|
20044
20064
|
padding: '0 10px'
|
|
20045
20065
|
}
|
|
20046
|
-
}, value);
|
|
20066
|
+
}, nonScientificNotation(value));
|
|
20047
20067
|
}
|
|
20048
20068
|
}
|
|
20049
20069
|
}, {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export default () => {
|
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
(async () => {
|
|
11
11
|
await controller.run(async s => { s.model = 'readOnly' }); // 设置只读
|
|
12
|
-
await controller.run(async s => { s.stakeholder.enables = ['remarks'] });
|
|
12
|
+
// await controller.run(async s => { s.stakeholder.enables = ['remarks'] });
|
|
13
13
|
await controller.formList.get('invoiceHeader')?.setFieldsValue({
|
|
14
14
|
no: '2029292029201920291029',
|
|
15
15
|
invoicingDate: '2023年7月6日',
|
|
@@ -31,7 +31,7 @@ export default () => {
|
|
|
31
31
|
sellerAccount: '9550880218186900195',
|
|
32
32
|
})
|
|
33
33
|
await controller.formList.get('sign')?.setFieldsValue({
|
|
34
|
-
remarks: '
|
|
34
|
+
remarks: '备注\n换行备注',
|
|
35
35
|
drawer: '张自豪',
|
|
36
36
|
})
|
|
37
37
|
})()
|
|
@@ -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
|
},
|
|
@@ -56,7 +56,7 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
|
|
|
56
56
|
})(
|
|
57
57
|
isEnables('remarks')
|
|
58
58
|
? <Input.TextArea placeholder='请输入' style={{ height: '100%' }} />
|
|
59
|
-
: <MyDiv />
|
|
59
|
+
: <MyDiv style={{whiteSpace: 'pre'}} />
|
|
60
60
|
)}
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
@@ -91,10 +91,10 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
class MyDiv extends React.Component<{ value?: string }> {
|
|
94
|
+
class MyDiv extends React.Component<{ value?: string, style?: React.CSSProperties }> {
|
|
95
95
|
render(): React.ReactNode {
|
|
96
96
|
return (
|
|
97
|
-
<div>{this.props.value}</div>
|
|
97
|
+
<div style={this.props.style}>{this.props.value}</div>
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
}
|