refactor(workbench): 将工具函数移至utils/目录,修复税率浮点精度,调整趋势图与饼图宽度比例

This commit is contained in:
小蟑螂
2026-05-18 01:19:01 +08:00
parent 1216f8560e
commit b727f33113
9 changed files with 9 additions and 8 deletions
@@ -19,7 +19,7 @@ import {
salesTaxColumnHint,
} from '#/utils/overview-table-hints';
import { formatYuanDetail, yuanToWanNum } from '../../workbench-money';
import { formatYuanDetail, yuanToWanNum } from '../../utils/money';
defineOptions({ name: 'WorkbenchPeriodCompareTab' });
@@ -6,7 +6,7 @@ import { nextTick, onMounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { formatWanShort, formatYuanDetail } from '../../../workbench-money';
import { formatWanShort, formatYuanDetail } from '../../../utils/money';
defineOptions({ name: 'WorkbenchFinanceCostPieChart' });
@@ -3,7 +3,7 @@ import type { WorkbenchVO } from '#/api/ecommerce/workbench/types';
import { Tooltip } from 'ant-design-vue';
import { formatWanShort, formatYuanDetail } from '../../../workbench-money';
import { formatWanShort, formatYuanDetail } from '../../../utils/money';
defineOptions({ name: 'WorkbenchFinanceKpiGrid' });
@@ -6,7 +6,7 @@ import { nextTick, onMounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { formatWanWithYuanDetail, yuanToWanNum } from '../../../workbench-money';
import { formatWanWithYuanDetail, yuanToWanNum } from '../../../utils/money';
defineOptions({ name: 'WorkbenchFinanceTrendChart' });
@@ -13,7 +13,7 @@ import {
buildCategoryOverviewFromDimRows,
buildPlatformOverviewFromDimRows,
buildShopOverviewFromDimRows,
} from '../../workbench-overview-bridge';
} from '../../utils/overview-bridge';
defineOptions({ name: 'WorkbenchFinanceTab' });
@@ -76,10 +76,11 @@ defineExpose({ redraw });
:yoy-compare-date-start="finance.yoyCompareDateStart"
:yoy-compare-date-end="finance.yoyCompareDateEnd"
/>
<div class="grid grid-cols-1 gap-6 xl:grid-cols-2">
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3">
<FinanceTrendChart
ref="trendChartRef"
:trend="finance.gmvTrend"
class="xl:col-span-2"
/>
<FinanceCostPieChart
ref="costPieRef"
@@ -11,7 +11,7 @@ import {
formatWanShort,
formatYuanDetail,
yuanToWanNum,
} from '../../../workbench-money';
} from '../../../utils/money';
defineOptions({ name: 'WorkbenchDimChartsCard' });
@@ -33,7 +33,7 @@ const formatTaxRate = (value: null | number | string | undefined) => {
if (value === null || value === undefined || value === '') return '';
const num = Number(value);
if (!Number.isFinite(num)) return '';
return `${num * 100}%`;
return `${Math.round(num * 100 * 1e10) / 1e10}%`;
};
const parseTaxRate = (value: string | undefined) => {