This commit is contained in:
zjf committed 2025-09-28 19:00:53 +08:00
1 parent 7c6cc51751
commit 8bf898adec
8 files changed
+454 -70

No files matched your search

@@ -14,18 +14,18 @@
</div>
</div>
</template>
<el-table
:data="data"
stripe
<el-table
:data="data"
stripe
:loading="loading"
@row-click="handleRowClick"
class="ranking-table"
>
<el-table-column prop="ranking" label="排名" width="60" align="center">
<template #default="{ row }">
<el-tag
:type="getRankingTagType(row.ranking)"
<el-tag
:type="getRankingTagType(row.ranking)"
size="small"
class="ranking-tag"
>
@@ -33,7 +33,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="productName" label="商品名称" min-width="150" show-overflow-tooltip>
<template #default="{ row }">
<div class="product-info">
@@ -42,27 +42,27 @@
</div>
</template>
</el-table-column>
<el-table-column prop="categoryName" label="分类" width="100" show-overflow-tooltip />
<el-table-column prop="salesAmount" label="销售额" width="120" align="right">
<template #default="{ row }">
<div class="amount-cell">
<div class="amount-value">{{ formatCurrency(row.salesAmount) }}</div>
<div v-if="row.yearOverYearGrowthRate !== undefined" class="growth-rate">
<el-icon
v-if="row.yearOverYearGrowthRate > 0"
<el-icon
v-if="row.yearOverYearGrowthRate > 0"
class="growth-icon up"
>
<ArrowUp />
</el-icon>
<el-icon
v-else-if="row.yearOverYearGrowthRate < 0"
<el-icon
v-else-if="row.yearOverYearGrowthRate < 0"
class="growth-icon down"
>
<ArrowDown />
</el-icon>
<span
<span
:class="getGrowthRateClass(row.yearOverYearGrowthRate)"
>
{{ Math.abs(row.yearOverYearGrowthRate).toFixed(1) }}%
@@ -71,44 +71,44 @@
</div>
</template>
</el-table-column>
<el-table-column prop="salesQuantity" label="销量" width="100" align="right">
<template #default="{ row }">
{{ formatNumber(row.salesQuantity) }}
</template>
</el-table-column>
<el-table-column prop="salesCount" label="笔数" width="80" align="right">
<template #default="{ row }">
{{ formatNumber(row.salesCount) }}
</template>
</el-table-column>
<el-table-column prop="averagePrice" label="均价" width="100" align="right">
<template #default="{ row }">
{{ formatCurrency(row.averagePrice) }}
</template>
</el-table-column>
<el-table-column prop="marketShare" label="市场份额" width="100" align="right">
<template #default="{ row }">
<div class="market-share">
<div class="share-value">{{ (row.marketShare * 100).toFixed(1) }}%</div>
<div class="share-bar">
<div
class="share-progress"
<div
class="share-progress"
:style="{ width: (row.marketShare * 100) + '%' }"
></div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
size="small"
<el-button
type="primary"
size="small"
text
@click.stop="viewDetail(row)"
>
@@ -117,7 +117,7 @@
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div v-if="showPagination" class="pagination-wrapper">
<el-pagination
@@ -31,7 +31,7 @@ let chartInstance: echarts.ECharts | null = null;
// 初始化图表
const initChart = () => {
if (!chartContainer.value) return;
chartInstance = echarts.init(chartContainer.value);
updateChart();
};
@@ -39,7 +39,7 @@ const initChart = () => {
// 更新图表
const updateChart = () => {
if (!chartInstance) return;
const option = getChartOption();
chartInstance.setOption(option, true);
};
@@ -79,7 +79,7 @@ const getChartOption = () => {
...item,
})),
};
case 'bar':
return {
...baseOption,
@@ -95,7 +95,7 @@ const getChartOption = () => {
...item,
})),
};
case 'pie':
return {
...baseOption,
@@ -121,7 +121,7 @@ const getChartOption = () => {
},
}],
};
case 'area':
return {
...baseOption,
@@ -139,7 +139,7 @@ const getChartOption = () => {
...item,
})),
};
default:
return baseOption;
}
@@ -46,17 +46,17 @@ const formattedValue = computed(() => {
if (typeof props.value === 'string') {
return props.value;
}
switch (props.format) {
case 'currency':
return new Intl.NumberFormat('zh-CN', {
style: 'currency',
currency: 'CNY',
}).format(props.value);
case 'percent':
return `${props.value.toFixed(2)}%`;
case 'number':
default:
return new Intl.NumberFormat('zh-CN').format(props.value);