|
@@ -66,7 +66,7 @@ export function addDateRange(params, dateRange, propName) {
|
|
|
return search;
|
|
|
}
|
|
|
|
|
|
-// 回显数据字典
|
|
|
+// 回显数据字典
|
|
|
export function selectDictLabel(datas, value) {
|
|
|
var actions = [];
|
|
|
Object.keys(datas).some((key) => {
|
|
@@ -273,7 +273,7 @@ export function DateToStr(date) {
|
|
|
export function KeepDecimals(num,len =2 ){
|
|
|
let numStr = typeof(num) == "number" ? `${num}` : num // 判断类型,统一转字符串处理
|
|
|
if(!numStr)return ''; // 空值return 空字符串
|
|
|
- numStr=numStr.replace(/[^0-9.]/g,'') // 限制值只能为0-9和字符‘.’
|
|
|
+ numStr=numStr.replace(/^-?\[^0-9.]/g,'') // 限制值只能为0-9和字符‘.’
|
|
|
let isDecimalIndex = numStr.indexOf('.') // 判断存不存在小数位
|
|
|
if(isDecimalIndex === -1)return `${Number(numStr)}` // 不存在小数位,返回处理后的数字
|
|
|
let integer = numStr.slice(0,isDecimalIndex) // 获取整数位
|