红字显示
This commit is contained in:
@ -151,7 +151,7 @@
|
|||||||
<el-table-column prop="debitAmount" align="right" header-align="center" label="借方金额">
|
<el-table-column prop="debitAmount" align="right" header-align="center" label="借方金额">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="!scope.row.editing || scope.row.columnIndex !== 3" :class="{redWord:isRedWord(scope.row.debitAmount)}">
|
<span v-if="!scope.row.editing || scope.row.columnIndex !== 3" :class="{redWord:isRedWord(scope.row.debitAmount)}">
|
||||||
{{ formatAmount(scope.row.debitAmount) }}
|
{{ formatAmountRed(scope.row.debitAmount) }}
|
||||||
</span>
|
</span>
|
||||||
<el-input v-else v-model="scope.row.debitAmount"
|
<el-input v-else v-model="scope.row.debitAmount"
|
||||||
@change="createTableData(scope.row, 1)"
|
@change="createTableData(scope.row, 1)"
|
||||||
@ -162,7 +162,7 @@
|
|||||||
<el-table-column prop="creditAmount" align="right" header-align="center" label="贷方金额">
|
<el-table-column prop="creditAmount" align="right" header-align="center" label="贷方金额">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="!scope.row.editing || scope.row.columnIndex !== 4">
|
<span v-if="!scope.row.editing || scope.row.columnIndex !== 4">
|
||||||
{{ formatAmount(scope.row.creditAmount) }}
|
{{ formatAmountRed(scope.row.creditAmount) }}
|
||||||
</span>
|
</span>
|
||||||
<el-input v-else v-model="scope.row.creditAmount"
|
<el-input v-else v-model="scope.row.creditAmount"
|
||||||
@change="createTableData(scope.row, 2)"
|
@change="createTableData(scope.row, 2)"
|
||||||
@ -668,6 +668,14 @@ const formatAmount = (value: any) => {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatAmountRed = (value: any) => {
|
||||||
|
if (!value && value !== 0) return '';
|
||||||
|
if(new Decimal(value).lt(0)){
|
||||||
|
value = new Decimal(0).minus(new Decimal(value))
|
||||||
|
}
|
||||||
|
return formatAmount(value)
|
||||||
|
}
|
||||||
|
|
||||||
const isRedWord = (value: any) => {
|
const isRedWord = (value: any) => {
|
||||||
if (!value ||value=="") {
|
if (!value ||value=="") {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user