@bit-sun/business-component 2.0.40 → 2.0.41-alpha.2
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.d.ts +1 -1
- package/dist/index.esm.js +125 -16
- package/dist/index.js +126 -17
- package/dist/utils/checkUtils.d.ts +3 -0
- package/dist/utils/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Functional/AddSelect/index.tsx +24 -1
- package/src/components/Functional/BillEntry/index.tsx +31 -1
- package/src/components/Functional/DataImport/index.tsx +0 -6
- package/src/components/Functional/DataValidation/index.md +0 -1
- package/src/components/Functional/DataValidation/index.tsx +2 -8
- package/src/index.ts +2 -2
- package/src/utils/checkUtils.ts +39 -0
- package/src/utils/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './utils/
|
|
1
|
+
import './utils/index';
|
|
2
2
|
export { default as DataValidation } from './components/Functional/DataValidation';
|
|
3
3
|
export { default as DataImport } from './components/Functional/DataImport';
|
|
4
4
|
export { default as QueryMutipleInput } from './components/Functional/QueryMutipleInput';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useLayoutEffect, createRef } from 'react';
|
|
3
2
|
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Popover, Typography, Alert, Anchor, Breadcrumb, Image, Card, Avatar, Drawer, List, Tree, Row, Col, Tabs } from 'antd';
|
|
3
|
+
import _, { omit, debounce, cloneDeep as cloneDeep$1 } from 'lodash';
|
|
4
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useLayoutEffect, createRef } from 'react';
|
|
4
5
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
5
6
|
import { UnorderedListOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, CopyOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined } from '@ant-design/icons';
|
|
6
|
-
import _, { omit, debounce, cloneDeep as cloneDeep$1 } from 'lodash';
|
|
7
7
|
import { useDebounceFn } from 'ahooks';
|
|
8
8
|
import { stringify } from 'querystring';
|
|
9
9
|
import { Resizable } from 'react-resizable';
|
|
@@ -723,6 +723,52 @@ function _nonIterableRest() {
|
|
|
723
723
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
|
|
727
|
+
var errorMessage = _objectSpread2({
|
|
728
|
+
showTips: true,
|
|
729
|
+
tipsMessage: null
|
|
730
|
+
}, errorInfo);
|
|
731
|
+
|
|
732
|
+
if (_.trim(value)) {
|
|
733
|
+
var target = "".concat(value);
|
|
734
|
+
|
|
735
|
+
if (target.includes(".")) {
|
|
736
|
+
if (target.split(".")[1].length > accuracy) {
|
|
737
|
+
if (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.showTips) {
|
|
738
|
+
message.warning((errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.tipsMessage) || "\u7CFB\u7EDF\u8BBE\u7F6E\u6570\u91CF\u6700\u5927\u7CBE\u5EA6\u4E3A".concat(accuracy, "\u4F4D"));
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return true;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
var precisionQuantity = function precisionQuantity(num, accuracy) {
|
|
750
|
+
if (_.trim(num)) {
|
|
751
|
+
var target = "".concat(num);
|
|
752
|
+
|
|
753
|
+
if (target.includes(".")) {
|
|
754
|
+
if (target.split(".")[1].length > accuracy) {
|
|
755
|
+
var _target$split$;
|
|
756
|
+
|
|
757
|
+
var beforeDot = target.split(".")[0];
|
|
758
|
+
var afterDot = (_target$split$ = target.split(".")[1]) === null || _target$split$ === void 0 ? void 0 : _target$split$.slice(0, accuracy);
|
|
759
|
+
var result = accuracy == 0 ? Number("".concat(beforeDot)) : Number("".concat(beforeDot, ".").concat(afterDot));
|
|
760
|
+
return result;
|
|
761
|
+
} else if (target.split(".")[1].length < accuracy) {
|
|
762
|
+
return Number(Number(num).toFixed(Math.abs(accuracy)));
|
|
763
|
+
} else {
|
|
764
|
+
return Number(num);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return '';
|
|
770
|
+
};
|
|
771
|
+
|
|
726
772
|
function styleInject(css, ref) {
|
|
727
773
|
if ( ref === void 0 ) ref = {};
|
|
728
774
|
var insertAt = ref.insertAt;
|
|
@@ -763,7 +809,7 @@ var luckysheet; // const mapping = [
|
|
|
763
809
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
764
810
|
// ]
|
|
765
811
|
|
|
766
|
-
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']
|
|
812
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']]); // for dnd
|
|
767
813
|
|
|
768
814
|
|
|
769
815
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1073,7 +1119,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1073
1119
|
_this.resetData = function () {
|
|
1074
1120
|
var _this$props = _this.props,
|
|
1075
1121
|
validDataUrl = _this$props.validDataUrl,
|
|
1076
|
-
validDataParams = _this$props.validDataParams,
|
|
1077
1122
|
updateData = _this$props.updateData,
|
|
1078
1123
|
columns = _this$props.columns,
|
|
1079
1124
|
isBrandAuth = _this$props.isBrandAuth,
|
|
@@ -1093,7 +1138,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1093
1138
|
};
|
|
1094
1139
|
}
|
|
1095
1140
|
|
|
1096
|
-
axios.post(validDataUrl, _objectSpread2(_objectSpread2(
|
|
1141
|
+
axios.post(validDataUrl, _objectSpread2(_objectSpread2({}, otherParams), {}, {
|
|
1097
1142
|
columns: columns,
|
|
1098
1143
|
data: resultData,
|
|
1099
1144
|
checkStockNum: isCheckStockNum
|
|
@@ -1390,7 +1435,7 @@ var luckysheet$1; // const mapping = [
|
|
|
1390
1435
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1391
1436
|
// ]
|
|
1392
1437
|
|
|
1393
|
-
var mapping$1 = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']
|
|
1438
|
+
var mapping$1 = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']]); // for dnd
|
|
1394
1439
|
|
|
1395
1440
|
|
|
1396
1441
|
var reorder$1 = function reorder(list, startIndex, endIndex) {
|
|
@@ -4021,14 +4066,42 @@ var AddSelect = function AddSelect(props) {
|
|
|
4021
4066
|
inputIndex++;
|
|
4022
4067
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
4023
4068
|
render: function render(text, record, index) {
|
|
4069
|
+
var _record$packingUnitLi, _record$packingUnitLi2;
|
|
4070
|
+
|
|
4024
4071
|
// let
|
|
4025
4072
|
if (record.needFocus === true && currentIndex === 0) ;
|
|
4026
4073
|
|
|
4027
|
-
|
|
4028
|
-
|
|
4074
|
+
var precisionObj = {};
|
|
4075
|
+
var unitAccuracy = (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi[0]) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.unitAccuracy;
|
|
4076
|
+
var isCountUnitAccuracyCheck = item.dataIndex == 'count' && unitAccuracy !== undefined;
|
|
4077
|
+
|
|
4078
|
+
if (isCountUnitAccuracyCheck) {
|
|
4079
|
+
precisionObj = {
|
|
4080
|
+
onBlur: function onBlur(e) {
|
|
4081
|
+
var value = e.target.value;
|
|
4082
|
+
|
|
4083
|
+
if (!checkQuantityAccuracy(value, Number(unitAccuracy))) {
|
|
4084
|
+
record[item.dataIndex] = precisionQuantity(value, Number(unitAccuracy));
|
|
4085
|
+
var newPopValue = popvalue.map(function (i) {
|
|
4086
|
+
if (i.skuCode == record.skuCode) {
|
|
4087
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
return i;
|
|
4091
|
+
});
|
|
4092
|
+
setPopValue(newPopValue);
|
|
4093
|
+
}
|
|
4094
|
+
} // precision: unitAccuracy
|
|
4095
|
+
|
|
4096
|
+
};
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
return /*#__PURE__*/React.createElement(InputNumber, _objectSpread2(_objectSpread2({
|
|
4100
|
+
value: text || '',
|
|
4029
4101
|
min: 0,
|
|
4030
4102
|
autoFocus: record.needFocus,
|
|
4031
|
-
keyboard: false
|
|
4103
|
+
keyboard: false
|
|
4104
|
+
}, precisionObj), {}, {
|
|
4032
4105
|
onChange: function onChange(value) {
|
|
4033
4106
|
record[item.dataIndex] = value;
|
|
4034
4107
|
},
|
|
@@ -4141,7 +4214,7 @@ var AddSelect = function AddSelect(props) {
|
|
|
4141
4214
|
e.preventDefault();
|
|
4142
4215
|
}
|
|
4143
4216
|
}
|
|
4144
|
-
});
|
|
4217
|
+
}));
|
|
4145
4218
|
}
|
|
4146
4219
|
});
|
|
4147
4220
|
}
|
|
@@ -4330,6 +4403,8 @@ styleInject(css_248z$5);
|
|
|
4330
4403
|
var _this = undefined;
|
|
4331
4404
|
|
|
4332
4405
|
var InputElement = function InputElement(_ref) {
|
|
4406
|
+
var _record$packingUnitLi, _record$packingUnitLi2;
|
|
4407
|
+
|
|
4333
4408
|
var record = _ref.record,
|
|
4334
4409
|
text = _ref.text,
|
|
4335
4410
|
currentIndex = _ref.currentIndex,
|
|
@@ -4597,6 +4672,31 @@ var InputElement = function InputElement(_ref) {
|
|
|
4597
4672
|
}));
|
|
4598
4673
|
};
|
|
4599
4674
|
|
|
4675
|
+
var precisionObj = {};
|
|
4676
|
+
var unitAccuracy = (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi[0]) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.unitAccuracy;
|
|
4677
|
+
var isCountUnitAccuracyCheck = item.dataIndex == 'count' && unitAccuracy !== undefined;
|
|
4678
|
+
|
|
4679
|
+
if (isCountUnitAccuracyCheck) {
|
|
4680
|
+
precisionObj = {
|
|
4681
|
+
onBlur: function onBlur(e) {
|
|
4682
|
+
var value = e.target.value;
|
|
4683
|
+
|
|
4684
|
+
if (!checkQuantityAccuracy(value, Number(unitAccuracy))) {
|
|
4685
|
+
record[item.dataIndex] = precisionQuantity(value, Number(unitAccuracy));
|
|
4686
|
+
var newData = data.map(function (i, innerIndex) {
|
|
4687
|
+
if (innerIndex == index) {
|
|
4688
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
return i;
|
|
4692
|
+
});
|
|
4693
|
+
setData(newData);
|
|
4694
|
+
}
|
|
4695
|
+
} // precision: unitAccuracy
|
|
4696
|
+
|
|
4697
|
+
};
|
|
4698
|
+
}
|
|
4699
|
+
|
|
4600
4700
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
4601
4701
|
placement: "bottomLeft",
|
|
4602
4702
|
destroyTooltipOnHide: {
|
|
@@ -4740,13 +4840,22 @@ var InputElement = function InputElement(_ref) {
|
|
|
4740
4840
|
}
|
|
4741
4841
|
}
|
|
4742
4842
|
}) : /*#__PURE__*/React.createElement(InputNumber // onBlur={() => {updateHoverVisibled(false)}}
|
|
4743
|
-
, {
|
|
4843
|
+
, _objectSpread2(_objectSpread2({
|
|
4744
4844
|
// onBlur={() => {updateHoverVisibled(false)}}
|
|
4745
|
-
|
|
4845
|
+
value: text || '',
|
|
4746
4846
|
min: 0,
|
|
4747
|
-
keyboard: false
|
|
4847
|
+
keyboard: false
|
|
4848
|
+
}, precisionObj), {}, {
|
|
4748
4849
|
onChange: function onChange(value) {
|
|
4749
4850
|
record[item.dataIndex] = value;
|
|
4851
|
+
var newData = data.map(function (i, innerIndex) {
|
|
4852
|
+
if (innerIndex == index) {
|
|
4853
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4854
|
+
}
|
|
4855
|
+
|
|
4856
|
+
return i;
|
|
4857
|
+
});
|
|
4858
|
+
setData(newData);
|
|
4750
4859
|
},
|
|
4751
4860
|
onKeyDown: function onKeyDown(e) {
|
|
4752
4861
|
// if (e.keyCode === 13 && e.ctrlKey) {
|
|
@@ -4856,7 +4965,7 @@ var InputElement = function InputElement(_ref) {
|
|
|
4856
4965
|
}]));
|
|
4857
4966
|
}
|
|
4858
4967
|
}
|
|
4859
|
-
}));
|
|
4968
|
+
})));
|
|
4860
4969
|
};
|
|
4861
4970
|
|
|
4862
4971
|
var BillEntry = function BillEntry(_ref3) {
|
|
@@ -4891,9 +5000,9 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
4891
5000
|
dataIndex: 'selectUnitCode',
|
|
4892
5001
|
width: 100,
|
|
4893
5002
|
render: function render(text, record) {
|
|
4894
|
-
var _record$
|
|
5003
|
+
var _record$packingUnitLi3;
|
|
4895
5004
|
|
|
4896
|
-
if (record === null || record === void 0 ? void 0 : (_record$
|
|
5005
|
+
if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi3 = record.packingUnitList) === null || _record$packingUnitLi3 === void 0 ? void 0 : _record$packingUnitLi3.length) {
|
|
4897
5006
|
var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
|
|
4898
5007
|
record.selectUnitCode = basePackUnit.unitCode;
|
|
4899
5008
|
return basePackUnit.name || basePackUnit.unitCode;
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var axios = require('axios');
|
|
6
|
-
var React = require('react');
|
|
7
6
|
var antd = require('antd');
|
|
7
|
+
var _ = require('lodash');
|
|
8
|
+
var React = require('react');
|
|
8
9
|
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
9
10
|
var icons = require('@ant-design/icons');
|
|
10
|
-
var _ = require('lodash');
|
|
11
11
|
var ahooks = require('ahooks');
|
|
12
12
|
var querystring = require('querystring');
|
|
13
13
|
var reactResizable = require('react-resizable');
|
|
@@ -25,8 +25,8 @@ var reactDndHtml5Backend = require('react-dnd-html5-backend');
|
|
|
25
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
26
|
|
|
27
27
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
28
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
28
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
29
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
30
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual$1);
|
|
31
31
|
var ProLayout__default = /*#__PURE__*/_interopDefaultLegacy(ProLayout);
|
|
32
32
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
@@ -737,6 +737,52 @@ function _nonIterableRest() {
|
|
|
737
737
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
+
var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
|
|
741
|
+
var errorMessage = _objectSpread2({
|
|
742
|
+
showTips: true,
|
|
743
|
+
tipsMessage: null
|
|
744
|
+
}, errorInfo);
|
|
745
|
+
|
|
746
|
+
if (___default['default'].trim(value)) {
|
|
747
|
+
var target = "".concat(value);
|
|
748
|
+
|
|
749
|
+
if (target.includes(".")) {
|
|
750
|
+
if (target.split(".")[1].length > accuracy) {
|
|
751
|
+
if (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.showTips) {
|
|
752
|
+
antd.message.warning((errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.tipsMessage) || "\u7CFB\u7EDF\u8BBE\u7F6E\u6570\u91CF\u6700\u5927\u7CBE\u5EA6\u4E3A".concat(accuracy, "\u4F4D"));
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
return true;
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
var precisionQuantity = function precisionQuantity(num, accuracy) {
|
|
764
|
+
if (___default['default'].trim(num)) {
|
|
765
|
+
var target = "".concat(num);
|
|
766
|
+
|
|
767
|
+
if (target.includes(".")) {
|
|
768
|
+
if (target.split(".")[1].length > accuracy) {
|
|
769
|
+
var _target$split$;
|
|
770
|
+
|
|
771
|
+
var beforeDot = target.split(".")[0];
|
|
772
|
+
var afterDot = (_target$split$ = target.split(".")[1]) === null || _target$split$ === void 0 ? void 0 : _target$split$.slice(0, accuracy);
|
|
773
|
+
var result = accuracy == 0 ? Number("".concat(beforeDot)) : Number("".concat(beforeDot, ".").concat(afterDot));
|
|
774
|
+
return result;
|
|
775
|
+
} else if (target.split(".")[1].length < accuracy) {
|
|
776
|
+
return Number(Number(num).toFixed(Math.abs(accuracy)));
|
|
777
|
+
} else {
|
|
778
|
+
return Number(num);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
return '';
|
|
784
|
+
};
|
|
785
|
+
|
|
740
786
|
function styleInject(css, ref) {
|
|
741
787
|
if ( ref === void 0 ) ref = {};
|
|
742
788
|
var insertAt = ref.insertAt;
|
|
@@ -777,7 +823,7 @@ var luckysheet; // const mapping = [
|
|
|
777
823
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
778
824
|
// ]
|
|
779
825
|
|
|
780
|
-
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']
|
|
826
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']]); // for dnd
|
|
781
827
|
|
|
782
828
|
|
|
783
829
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1087,7 +1133,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1087
1133
|
_this.resetData = function () {
|
|
1088
1134
|
var _this$props = _this.props,
|
|
1089
1135
|
validDataUrl = _this$props.validDataUrl,
|
|
1090
|
-
validDataParams = _this$props.validDataParams,
|
|
1091
1136
|
updateData = _this$props.updateData,
|
|
1092
1137
|
columns = _this$props.columns,
|
|
1093
1138
|
isBrandAuth = _this$props.isBrandAuth,
|
|
@@ -1107,7 +1152,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1107
1152
|
};
|
|
1108
1153
|
}
|
|
1109
1154
|
|
|
1110
|
-
axios__default['default'].post(validDataUrl, _objectSpread2(_objectSpread2(
|
|
1155
|
+
axios__default['default'].post(validDataUrl, _objectSpread2(_objectSpread2({}, otherParams), {}, {
|
|
1111
1156
|
columns: columns,
|
|
1112
1157
|
data: resultData,
|
|
1113
1158
|
checkStockNum: isCheckStockNum
|
|
@@ -1404,7 +1449,7 @@ var luckysheet$1; // const mapping = [
|
|
|
1404
1449
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1405
1450
|
// ]
|
|
1406
1451
|
|
|
1407
|
-
var mapping$1 = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']
|
|
1452
|
+
var mapping$1 = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']]); // for dnd
|
|
1408
1453
|
|
|
1409
1454
|
|
|
1410
1455
|
var reorder$1 = function reorder(list, startIndex, endIndex) {
|
|
@@ -4035,14 +4080,42 @@ var AddSelect = function AddSelect(props) {
|
|
|
4035
4080
|
inputIndex++;
|
|
4036
4081
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
4037
4082
|
render: function render(text, record, index) {
|
|
4083
|
+
var _record$packingUnitLi, _record$packingUnitLi2;
|
|
4084
|
+
|
|
4038
4085
|
// let
|
|
4039
4086
|
if (record.needFocus === true && currentIndex === 0) ;
|
|
4040
4087
|
|
|
4041
|
-
|
|
4042
|
-
|
|
4088
|
+
var precisionObj = {};
|
|
4089
|
+
var unitAccuracy = (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi[0]) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.unitAccuracy;
|
|
4090
|
+
var isCountUnitAccuracyCheck = item.dataIndex == 'count' && unitAccuracy !== undefined;
|
|
4091
|
+
|
|
4092
|
+
if (isCountUnitAccuracyCheck) {
|
|
4093
|
+
precisionObj = {
|
|
4094
|
+
onBlur: function onBlur(e) {
|
|
4095
|
+
var value = e.target.value;
|
|
4096
|
+
|
|
4097
|
+
if (!checkQuantityAccuracy(value, Number(unitAccuracy))) {
|
|
4098
|
+
record[item.dataIndex] = precisionQuantity(value, Number(unitAccuracy));
|
|
4099
|
+
var newPopValue = popvalue.map(function (i) {
|
|
4100
|
+
if (i.skuCode == record.skuCode) {
|
|
4101
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
return i;
|
|
4105
|
+
});
|
|
4106
|
+
setPopValue(newPopValue);
|
|
4107
|
+
}
|
|
4108
|
+
} // precision: unitAccuracy
|
|
4109
|
+
|
|
4110
|
+
};
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, _objectSpread2(_objectSpread2({
|
|
4114
|
+
value: text || '',
|
|
4043
4115
|
min: 0,
|
|
4044
4116
|
autoFocus: record.needFocus,
|
|
4045
|
-
keyboard: false
|
|
4117
|
+
keyboard: false
|
|
4118
|
+
}, precisionObj), {}, {
|
|
4046
4119
|
onChange: function onChange(value) {
|
|
4047
4120
|
record[item.dataIndex] = value;
|
|
4048
4121
|
},
|
|
@@ -4155,7 +4228,7 @@ var AddSelect = function AddSelect(props) {
|
|
|
4155
4228
|
e.preventDefault();
|
|
4156
4229
|
}
|
|
4157
4230
|
}
|
|
4158
|
-
});
|
|
4231
|
+
}));
|
|
4159
4232
|
}
|
|
4160
4233
|
});
|
|
4161
4234
|
}
|
|
@@ -4344,6 +4417,8 @@ styleInject(css_248z$5);
|
|
|
4344
4417
|
var _this = undefined;
|
|
4345
4418
|
|
|
4346
4419
|
var InputElement = function InputElement(_ref) {
|
|
4420
|
+
var _record$packingUnitLi, _record$packingUnitLi2;
|
|
4421
|
+
|
|
4347
4422
|
var record = _ref.record,
|
|
4348
4423
|
text = _ref.text,
|
|
4349
4424
|
currentIndex = _ref.currentIndex,
|
|
@@ -4611,6 +4686,31 @@ var InputElement = function InputElement(_ref) {
|
|
|
4611
4686
|
}));
|
|
4612
4687
|
};
|
|
4613
4688
|
|
|
4689
|
+
var precisionObj = {};
|
|
4690
|
+
var unitAccuracy = (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi[0]) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.unitAccuracy;
|
|
4691
|
+
var isCountUnitAccuracyCheck = item.dataIndex == 'count' && unitAccuracy !== undefined;
|
|
4692
|
+
|
|
4693
|
+
if (isCountUnitAccuracyCheck) {
|
|
4694
|
+
precisionObj = {
|
|
4695
|
+
onBlur: function onBlur(e) {
|
|
4696
|
+
var value = e.target.value;
|
|
4697
|
+
|
|
4698
|
+
if (!checkQuantityAccuracy(value, Number(unitAccuracy))) {
|
|
4699
|
+
record[item.dataIndex] = precisionQuantity(value, Number(unitAccuracy));
|
|
4700
|
+
var newData = data.map(function (i, innerIndex) {
|
|
4701
|
+
if (innerIndex == index) {
|
|
4702
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4705
|
+
return i;
|
|
4706
|
+
});
|
|
4707
|
+
setData(newData);
|
|
4708
|
+
}
|
|
4709
|
+
} // precision: unitAccuracy
|
|
4710
|
+
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4614
4714
|
return /*#__PURE__*/React__default['default'].createElement(antd.Popover, {
|
|
4615
4715
|
placement: "bottomLeft",
|
|
4616
4716
|
destroyTooltipOnHide: {
|
|
@@ -4754,13 +4854,22 @@ var InputElement = function InputElement(_ref) {
|
|
|
4754
4854
|
}
|
|
4755
4855
|
}
|
|
4756
4856
|
}) : /*#__PURE__*/React__default['default'].createElement(antd.InputNumber // onBlur={() => {updateHoverVisibled(false)}}
|
|
4757
|
-
, {
|
|
4857
|
+
, _objectSpread2(_objectSpread2({
|
|
4758
4858
|
// onBlur={() => {updateHoverVisibled(false)}}
|
|
4759
|
-
|
|
4859
|
+
value: text || '',
|
|
4760
4860
|
min: 0,
|
|
4761
|
-
keyboard: false
|
|
4861
|
+
keyboard: false
|
|
4862
|
+
}, precisionObj), {}, {
|
|
4762
4863
|
onChange: function onChange(value) {
|
|
4763
4864
|
record[item.dataIndex] = value;
|
|
4865
|
+
var newData = data.map(function (i, innerIndex) {
|
|
4866
|
+
if (innerIndex == index) {
|
|
4867
|
+
i[item.dataIndex] = record[item.dataIndex];
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4870
|
+
return i;
|
|
4871
|
+
});
|
|
4872
|
+
setData(newData);
|
|
4764
4873
|
},
|
|
4765
4874
|
onKeyDown: function onKeyDown(e) {
|
|
4766
4875
|
// if (e.keyCode === 13 && e.ctrlKey) {
|
|
@@ -4870,7 +4979,7 @@ var InputElement = function InputElement(_ref) {
|
|
|
4870
4979
|
}]));
|
|
4871
4980
|
}
|
|
4872
4981
|
}
|
|
4873
|
-
}));
|
|
4982
|
+
})));
|
|
4874
4983
|
};
|
|
4875
4984
|
|
|
4876
4985
|
var BillEntry = function BillEntry(_ref3) {
|
|
@@ -4905,9 +5014,9 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
4905
5014
|
dataIndex: 'selectUnitCode',
|
|
4906
5015
|
width: 100,
|
|
4907
5016
|
render: function render(text, record) {
|
|
4908
|
-
var _record$
|
|
5017
|
+
var _record$packingUnitLi3;
|
|
4909
5018
|
|
|
4910
|
-
if (record === null || record === void 0 ? void 0 : (_record$
|
|
5019
|
+
if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi3 = record.packingUnitList) === null || _record$packingUnitLi3 === void 0 ? void 0 : _record$packingUnitLi3.length) {
|
|
4911
5020
|
var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
|
|
4912
5021
|
record.selectUnitCode = basePackUnit.unitCode;
|
|
4913
5022
|
return basePackUnit.name || basePackUnit.unitCode;
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import _ from "lodash"
|
|
|
9
9
|
import './index.less';
|
|
10
10
|
import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
11
11
|
import { Resizable } from 'react-resizable';
|
|
12
|
+
import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
|
|
12
13
|
|
|
13
14
|
const loadSelectSource = (url: string, params?: any) => {
|
|
14
15
|
return new Promise((resolve, reject) => {
|
|
@@ -715,13 +716,35 @@ const AddSelect = (props: any) => {
|
|
|
715
716
|
// let
|
|
716
717
|
if(record.needFocus === true && currentIndex === 0) {
|
|
717
718
|
|
|
719
|
+
}
|
|
720
|
+
let precisionObj={};
|
|
721
|
+
const unitAccuracy = record.packingUnitList?.[0]?.unitAccuracy
|
|
722
|
+
const isCountUnitAccuracyCheck = item.dataIndex =='count' && unitAccuracy !== undefined
|
|
723
|
+
if(isCountUnitAccuracyCheck) {
|
|
724
|
+
precisionObj = {
|
|
725
|
+
onBlur: (e: any) => {
|
|
726
|
+
const { target: { value } } = e;
|
|
727
|
+
if(!checkQuantityAccuracy(value,Number(unitAccuracy))) {
|
|
728
|
+
record[item.dataIndex] = precisionQuantity(value,Number(unitAccuracy))
|
|
729
|
+
const newPopValue = popvalue.map((i: any) => {
|
|
730
|
+
if(i.skuCode == record.skuCode) {
|
|
731
|
+
i[item.dataIndex] = record[item.dataIndex]
|
|
732
|
+
}
|
|
733
|
+
return i
|
|
734
|
+
})
|
|
735
|
+
setPopValue(newPopValue)
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
// precision: unitAccuracy
|
|
739
|
+
}
|
|
718
740
|
}
|
|
719
741
|
return (
|
|
720
742
|
<InputNumber
|
|
721
|
-
|
|
743
|
+
value={text || ''}
|
|
722
744
|
min={0}
|
|
723
745
|
autoFocus={record.needFocus}
|
|
724
746
|
keyboard={false}
|
|
747
|
+
{...precisionObj}
|
|
725
748
|
onChange={(value) => {
|
|
726
749
|
record[item.dataIndex] = value
|
|
727
750
|
}}
|
|
@@ -5,6 +5,7 @@ import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/i
|
|
|
5
5
|
import { stringify } from 'querystring';
|
|
6
6
|
import './index.less';
|
|
7
7
|
import axios from 'axios';
|
|
8
|
+
import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
|
|
8
9
|
|
|
9
10
|
const InputElement = ({
|
|
10
11
|
record, text, currentIndex, inputLength, index, setData, data, item, callSelectItem
|
|
@@ -212,6 +213,27 @@ const InputElement = ({
|
|
|
212
213
|
</div>
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
let precisionObj={};
|
|
217
|
+
const unitAccuracy = record.packingUnitList?.[0]?.unitAccuracy
|
|
218
|
+
const isCountUnitAccuracyCheck = item.dataIndex =='count' && unitAccuracy !== undefined
|
|
219
|
+
if(isCountUnitAccuracyCheck) {
|
|
220
|
+
precisionObj = {
|
|
221
|
+
onBlur: (e: any) => {
|
|
222
|
+
const { target: { value } } = e;
|
|
223
|
+
if(!checkQuantityAccuracy(value,Number(unitAccuracy))) {
|
|
224
|
+
record[item.dataIndex] = precisionQuantity(value,Number(unitAccuracy))
|
|
225
|
+
const newData = data.map((i: any, innerIndex: number) => {
|
|
226
|
+
if(innerIndex == index) {
|
|
227
|
+
i[item.dataIndex] = record[item.dataIndex]
|
|
228
|
+
}
|
|
229
|
+
return i
|
|
230
|
+
})
|
|
231
|
+
setData(newData)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// precision: unitAccuracy
|
|
235
|
+
}
|
|
236
|
+
}
|
|
215
237
|
|
|
216
238
|
return (
|
|
217
239
|
<Popover placement="bottomLeft" destroyTooltipOnHide={{ keepParent: false }} title="" trigger="" content={SearchDataTable(hoverVisibled)} visible={hoverVisibled} onVisibleChange={(disabled) => { updateHoverVisibled(disabled) }}>
|
|
@@ -313,11 +335,19 @@ const InputElement = ({
|
|
|
313
335
|
:
|
|
314
336
|
<InputNumber
|
|
315
337
|
// onBlur={() => {updateHoverVisibled(false)}}
|
|
316
|
-
|
|
338
|
+
value={text || ''}
|
|
317
339
|
min={0}
|
|
318
340
|
keyboard={false}
|
|
341
|
+
{...precisionObj}
|
|
319
342
|
onChange={(value) => {
|
|
320
343
|
record[item.dataIndex] = value
|
|
344
|
+
const newData = data.map((i: any, innerIndex: number) => {
|
|
345
|
+
if(innerIndex == index) {
|
|
346
|
+
i[item.dataIndex] = record[item.dataIndex]
|
|
347
|
+
}
|
|
348
|
+
return i
|
|
349
|
+
})
|
|
350
|
+
setData(newData)
|
|
321
351
|
}}
|
|
322
352
|
onKeyDown={(e) => {
|
|
323
353
|
// if (e.keyCode === 13 && e.ctrlKey) {
|
|
@@ -58,12 +58,6 @@ const mapping = new Map([
|
|
|
58
58
|
['newUniqueCode', '新唯一码'],
|
|
59
59
|
['relationRecordCode', '单据编码'],
|
|
60
60
|
['remark', '备注'],
|
|
61
|
-
['externalCode', 'JDE商品编码'],
|
|
62
|
-
['realWarehouseCode', '仓库编码'],
|
|
63
|
-
['syncRate', '按百分比'],
|
|
64
|
-
['assignQuantity', '按指定数量'],
|
|
65
|
-
['retainQuantity', ' 按保留数量'],
|
|
66
|
-
['priority', ' 优先级'],
|
|
67
61
|
]);
|
|
68
62
|
|
|
69
63
|
// for dnd
|
|
@@ -26,7 +26,6 @@ export default () => {
|
|
|
26
26
|
// columns={['skuCode', 'quantity', 'price']}
|
|
27
27
|
columns={["skuCode", "quantity", "price"]} // 需要哪些列展示,以及展示的顺序
|
|
28
28
|
validDataUrl="/wms-ops/recordDetailImport/check" // 校验的接口url
|
|
29
|
-
validDataParams={{ recordCode: '111' }}
|
|
30
29
|
onRef={(ref) => {
|
|
31
30
|
dataValidationRef = ref;
|
|
32
31
|
}}
|
|
@@ -58,12 +58,7 @@ const mapping = new Map([
|
|
|
58
58
|
['newUniqueCode', '新唯一码'],
|
|
59
59
|
['relationRecordCode', '单据编码'],
|
|
60
60
|
['remark', '备注'],
|
|
61
|
-
['externalCode', 'JDE商品编码']
|
|
62
|
-
['realWarehouseCode', '仓库编码'],
|
|
63
|
-
['syncRate', '按百分比'],
|
|
64
|
-
['assignQuantity', '按指定数量'],
|
|
65
|
-
['retainQuantity', ' 按保留数量'],
|
|
66
|
-
['priority', ' 优先级'],
|
|
61
|
+
['externalCode', 'JDE商品编码']
|
|
67
62
|
]);
|
|
68
63
|
|
|
69
64
|
// for dnd
|
|
@@ -406,7 +401,7 @@ class DataValidation extends React.Component {
|
|
|
406
401
|
};
|
|
407
402
|
|
|
408
403
|
resetData = () => {
|
|
409
|
-
const { validDataUrl,
|
|
404
|
+
const { validDataUrl, updateData, columns, isBrandAuth, isCheckStockNum = true } = this.props;
|
|
410
405
|
const resultData = this.getData().filter(d => {
|
|
411
406
|
return _.compact(Object.values(d)).length
|
|
412
407
|
})
|
|
@@ -420,7 +415,6 @@ class DataValidation extends React.Component {
|
|
|
420
415
|
axios
|
|
421
416
|
.post(validDataUrl, {
|
|
422
417
|
...otherParams,
|
|
423
|
-
...validDataParams,
|
|
424
418
|
columns: columns,
|
|
425
419
|
data: resultData,
|
|
426
420
|
checkStockNum: isCheckStockNum
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
// import 'antd/dist/antd.css';
|
|
9
|
-
import './utils/
|
|
9
|
+
import './utils/index';
|
|
10
10
|
|
|
11
11
|
export { default as DataValidation } from './components/Functional/DataValidation';
|
|
12
12
|
export { default as DataImport } from './components/Functional/DataImport';
|
|
@@ -28,4 +28,4 @@ export { default as ColumnSettingTable} from './components/Business/columnSettin
|
|
|
28
28
|
export { default as DetailPageWrapper } from './components/Business/DetailPageWrapper';
|
|
29
29
|
export { default as HomePageWrapper } from './components/Business/HomePageWrapper';
|
|
30
30
|
export { default as BsSulaQueryTable } from './components/Business/BsSulaQueryTable';
|
|
31
|
-
export { default as BsLayout } from './components/Business/BsLayouts'
|
|
31
|
+
export { default as BsLayout } from './components/Business/BsLayouts'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { message } from 'antd';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
|
|
4
|
+
const checkQuantityAccuracy = (value: any, accuracy: any, errorInfo?: any) => {
|
|
5
|
+
let errorMessage= {showTips: true, tipsMessage: null,...errorInfo}
|
|
6
|
+
if (_.trim(value)) {
|
|
7
|
+
const target = `${value}`;
|
|
8
|
+
if (target.includes(".")) {
|
|
9
|
+
if (target.split(".")[1].length > accuracy) {
|
|
10
|
+
if(errorMessage?.showTips) {
|
|
11
|
+
message.warning(errorMessage?.tipsMessage || `系统设置数量最大精度为${accuracy}位`)
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const precisionQuantity = (num: any, accuracy: any) => {
|
|
21
|
+
if (_.trim(num)) {
|
|
22
|
+
const target = `${num}`;
|
|
23
|
+
if (target.includes(".")) {
|
|
24
|
+
if (target.split(".")[1].length > accuracy) {
|
|
25
|
+
const beforeDot = target.split(".")[0];
|
|
26
|
+
const afterDot = target.split(".")[1]?.slice(0,accuracy)
|
|
27
|
+
const result = accuracy == 0 ? Number(`${beforeDot}`) : Number(`${beforeDot}.${afterDot}`)
|
|
28
|
+
return result
|
|
29
|
+
} else if (target.split(".")[1].length < accuracy) {
|
|
30
|
+
return Number(Number(num).toFixed(Math.abs(accuracy)))
|
|
31
|
+
} else {
|
|
32
|
+
return Number(num)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return ''
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { checkQuantityAccuracy, precisionQuantity }
|