优化页面不显示小数
This commit is contained in:
@@ -70,6 +70,13 @@
|
||||
return api.list({ ...params, direction: currentDirection.value })
|
||||
}
|
||||
|
||||
function formatInteger(val: unknown): string {
|
||||
if (val === '' || val === null || val === undefined) return '-'
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
if (!Number.isFinite(n)) return '-'
|
||||
return String(Math.trunc(n))
|
||||
}
|
||||
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
Object.assign(searchParams, { ...params, direction: currentDirection.value })
|
||||
getData()
|
||||
@@ -117,7 +124,13 @@
|
||||
align: 'center',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{ prop: 'real_ev', label: 'page.table.realEv', width: 110, align: 'center' },
|
||||
{
|
||||
prop: 'real_ev',
|
||||
label: 'page.table.realEv',
|
||||
width: 110,
|
||||
align: 'center',
|
||||
formatter: (row: Record<string, any>) => formatInteger(row?.real_ev)
|
||||
},
|
||||
{ prop: 'remark', label: 'page.table.remark', minWidth: 80, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'weight', label: 'page.table.weight', width: 110, align: 'center' }
|
||||
]
|
||||
|
||||
@@ -60,7 +60,11 @@
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span>{{ formatInteger(row?.real_ev) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('page.weightShared.colUiText')"
|
||||
prop="ui_text"
|
||||
@@ -250,6 +254,13 @@
|
||||
import api from '../../../api/reward/index'
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
function formatInteger(val: unknown): string {
|
||||
if (val === '' || val === null || val === undefined) return '-'
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
if (!Number.isFinite(n)) return '-'
|
||||
return String(Math.trunc(n))
|
||||
}
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -54,7 +54,11 @@
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span>{{ formatInteger(row?.real_ev) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('page.weightShared.colUiText')"
|
||||
prop="ui_text"
|
||||
@@ -315,6 +319,13 @@
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
function formatInteger(val: unknown): string {
|
||||
if (val === '' || val === null || val === undefined) return '-'
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
if (!Number.isFinite(n)) return '-'
|
||||
return String(Math.trunc(n))
|
||||
}
|
||||
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user