feat(numberCurrency): 币种符号改为人民币

This commit is contained in:
woody 2025-06-11 10:33:43 +08:00
parent 16c5c39896
commit 3232521cf1
2 changed files with 11 additions and 16 deletions

View File

@ -10,11 +10,10 @@ export function stateFormat(row, column, cellValue) {
return Number(cellValue) return Number(cellValue)
.toFixed(2) .toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { .replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
return $1 + ','
return $1 + ',';
}) })
.replace(/\.$/, ""); .replace(/\.$/, '')
} }
} }
// 千分号 // 千分号
@ -36,7 +35,6 @@ export function numberToCurrencyNo(value) {
return intPartFormat + '.' + floatPart return intPartFormat + '.' + floatPart
// 使用JS内置 API toLocaleString实现数字、金额等等数值的格式化 // 使用JS内置 API toLocaleString实现数字、金额等等数值的格式化
// xxx.toLocaleString() // xxx.toLocaleString()
} }
return intPartFormat + floatPart return intPartFormat + floatPart
} }
@ -67,7 +65,7 @@ export function isOther(value) {
} }
// 海外添加当地币 // 海外添加当地币
export function isLocals(value) { export function isLocals(value) {
return '$' return ''
} }
// let userAll = JSON.parse(localStorage.getItem('userAll')) // let userAll = JSON.parse(localStorage.getItem('userAll'))
// console.error(userAll) // console.error(userAll)
@ -79,18 +77,16 @@ export function isLocalSymbol(value) {
} else { } else {
return '¥' return '¥'
} }
} }
export function toThousandthAndKeepDecimal(element, decimal = 2) { export function toThousandthAndKeepDecimal(element, decimal = 2) {
if (!element || element === '') {//值不存在 或为空 if (!element || element === '') { // 值不存在 或为空
return '0.00' return '0.00'
} else if (typeof element == 'string') { } else if (typeof element === 'string') {
return Number(element).toLocaleString(undefined, { minimumFractionDigits: decimal, maximumFractionDigits: decimal }); return Number(element).toLocaleString(undefined, { minimumFractionDigits: decimal, maximumFractionDigits: decimal })
} else if (typeof element == 'number') { } else if (typeof element === 'number') {
return element.toLocaleString(undefined, { minimumFractionDigits: decimal, maximumFractionDigits: decimal }); return element.toLocaleString(undefined, { minimumFractionDigits: decimal, maximumFractionDigits: decimal })
} else { } else {
return element; return element
} }
} }

View File

@ -106,8 +106,7 @@
</el-col> </el-col>
<el-col class="el-col-20"> <el-col class="el-col-20">
<el-form-item <el-form-item
label=" label="单位"
单位"
prop="unit" prop="unit"
> >
<el-select <el-select