doway-coms 1.4.0 → 1.4.1
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/package.json +1 -1
- package/packages/utils/common.js +22 -0
package/package.json
CHANGED
package/packages/utils/common.js
CHANGED
|
@@ -490,4 +490,26 @@ export function setIndustryVersionFields(fields){
|
|
|
490
490
|
XEUtils.remove(fields,i)
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* 计算数量保留位数及判断取整方向
|
|
497
|
+
* @param {行数据信息} rowInfo
|
|
498
|
+
* @param {数值} number
|
|
499
|
+
* @param {位数} digits
|
|
500
|
+
* @param {取整方向} round
|
|
501
|
+
*/
|
|
502
|
+
export function numberDigitsRound(rowInfo, colInfo) {
|
|
503
|
+
// 向上、向下、四舍五入
|
|
504
|
+
switch (rowInfo[colInfo.round]) {
|
|
505
|
+
case 'ceiling':
|
|
506
|
+
XEUtils.ceil(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
507
|
+
break;
|
|
508
|
+
case 'floor':
|
|
509
|
+
XEUtils.floor(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
510
|
+
break;
|
|
511
|
+
case 'round':
|
|
512
|
+
rowInfo[colInfo.number] = rowInfo[colInfo.number].toFixed(rowInfo[colInfo.digits])
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
493
515
|
}
|