7/17 修复添加车辆上传样式,校验上传文件不能是exe;

This commit is contained in:
Zy
2026-07-17 15:24:02 +08:00
parent 725bdfa3fe
commit 37970c547b
6 changed files with 263 additions and 231 deletions

View File

@@ -98,9 +98,20 @@ function toBig(num: string | number | undefined | null): Big {
* @returns 保留2位小数字符串
*/
export function moneyAdd(a: number | string = 0, b: number | string = 0): string {
return new Big(a).plus(b).toFixed(2);
return toBig(a).plus(b).toFixed(2);
}
// 数组高精度求和
export function sum(arr: Array<string | number>): number {
const total = arr.reduce((acc, cur) => acc.plus(toBig(cur)), new Big(0));
return Number(total);
}
// 取较大值
export function maxMoney(a: string | number, b: string | number): number {
const bigA = toBig(a);
const bigB = toBig(b);
return Number(bigA.gt(bigB) ? bigA : bigB);
}
/**
* 减法 a - b
*/
@@ -141,7 +152,6 @@ export function toFixedMoney(num: string | number, digit = 2): number {
return Number(toBig(num).toFixed(digit, Big.roundHalfUp));
}
/**
* 智能金额格式化(带单位:元/万元/亿元)
* 兼容数字、字符串、null、undefined