Initial commit: workspace files
This commit is contained in:
@@ -0,0 +1,344 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>销售分析看板</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
color: white;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 32px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.header p {
|
||||
font-size: 14px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.kpi-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.kpi-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.kpi-value.sales { color: #667eea; }
|
||||
.kpi-value.profit { color: #48bb78; }
|
||||
.kpi-value.margin { color: #ed8936; }
|
||||
.kpi-value.orders { color: #e53e3e; }
|
||||
|
||||
.chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.chart-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.full-width {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.three-col {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.chart-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.three-col {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.kpi-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>销售分析看板</h1>
|
||||
<p>数据时间范围:{{DATE_RANGE}} | 生成时间:{{GENERATED_TIME}}</p>
|
||||
</div>
|
||||
|
||||
<!-- KPI 指标卡片区 -->
|
||||
<div class="kpi-grid">
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-label">总销售额</div>
|
||||
<div class="kpi-value sales">¥{{TOTAL_SALES}}</div>
|
||||
</div>
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-label">总毛利润</div>
|
||||
<div class="kpi-value profit">¥{{TOTAL_PROFIT}}</div>
|
||||
</div>
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-label">平均毛利率</div>
|
||||
<div class="kpi-value margin">{{AVG_MARGIN}}%</div>
|
||||
</div>
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-label">订单总数</div>
|
||||
<div class="kpi-value orders">{{TOTAL_ORDERS}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第二行:区域销售对比 + 产品销售占比 -->
|
||||
<div class="chart-grid">
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">区域销售对比</div>
|
||||
<div id="regionChart" class="chart-container"></div>
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">产品销售占比</div>
|
||||
<div id="productChart" class="chart-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第三行:月度销售趋势(全宽) -->
|
||||
<div class="chart-grid">
|
||||
<div class="chart-card full-width">
|
||||
<div class="chart-title">月度销售趋势</div>
|
||||
<div id="trendChart" class="chart-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第四行:材质分布 + 销售员排名 + 客户级别 -->
|
||||
<div class="three-col">
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">材质分布</div>
|
||||
<div id="materialChart" class="chart-container"></div>
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">销售员排名 TOP10</div>
|
||||
<div id="salespersonChart" class="chart-container"></div>
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">客户级别分布</div>
|
||||
<div id="customerChart" class="chart-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 数据占位符 - 实际生成时替换为真实数据
|
||||
const data = {
|
||||
region: {{REGION_DATA}},
|
||||
product: {{PRODUCT_DATA}},
|
||||
trend: {{TREND_DATA}},
|
||||
material: {{MATERIAL_DATA}},
|
||||
salesperson: {{SALESPERSON_DATA}},
|
||||
customer: {{CUSTOMER_DATA}}
|
||||
};
|
||||
|
||||
// 区域销售对比 - 柱状图
|
||||
const regionChart = echarts.init(document.getElementById('regionChart'));
|
||||
regionChart.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: data.region.map(item => item.region),
|
||||
axisLabel: { rotate: 30 }
|
||||
},
|
||||
yAxis: { type: 'value', name: '订单金额(元)' },
|
||||
series: [{
|
||||
type: 'bar',
|
||||
data: data.region.map(item => item.amount),
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: '#667eea' },
|
||||
{ offset: 1, color: '#764ba2' }
|
||||
])
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
// 产品销售占比 - 饼图
|
||||
const productChart = echarts.init(document.getElementById('productChart'));
|
||||
productChart.setOption({
|
||||
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
|
||||
legend: { orient: 'vertical', left: 'left' },
|
||||
series: [{
|
||||
type: 'pie',
|
||||
radius: '60%',
|
||||
data: data.product.map(item => ({
|
||||
name: item.product,
|
||||
value: item.amount
|
||||
})),
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
// 月度销售趋势 - 折线图
|
||||
const trendChart = echarts.init(document.getElementById('trendChart'));
|
||||
trendChart.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: data.trend.map(item => item.month)
|
||||
},
|
||||
yAxis: { type: 'value', name: '订单金额(元)' },
|
||||
series: [{
|
||||
type: 'line',
|
||||
data: data.trend.map(item => item.amount),
|
||||
smooth: true,
|
||||
lineStyle: { width: 3 },
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(102, 126, 234, 0.3)' },
|
||||
{ offset: 1, color: 'rgba(102, 126, 234, 0.05)' }
|
||||
])
|
||||
},
|
||||
itemStyle: { color: '#667eea' }
|
||||
}]
|
||||
});
|
||||
|
||||
// 材质分布 - 环形图
|
||||
const materialChart = echarts.init(document.getElementById('materialChart'));
|
||||
materialChart.setOption({
|
||||
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
|
||||
legend: { orient: 'vertical', left: 'left' },
|
||||
series: [{
|
||||
type: 'pie',
|
||||
radius: ['40%', '70%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: { show: false },
|
||||
emphasis: {
|
||||
label: { show: true, fontSize: '16', fontWeight: 'bold' }
|
||||
},
|
||||
data: data.material.map(item => ({
|
||||
name: item.material,
|
||||
value: item.amount
|
||||
}))
|
||||
}]
|
||||
});
|
||||
|
||||
// 销售员排名 - 条形图
|
||||
const salespersonChart = echarts.init(document.getElementById('salespersonChart'));
|
||||
salespersonChart.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
xAxis: { type: 'value', name: '订单金额(元)' },
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: data.salesperson.map(item => item.salesperson).reverse(),
|
||||
axisLabel: { width: 80, overflow: 'truncate' }
|
||||
},
|
||||
series: [{
|
||||
type: 'bar',
|
||||
data: data.salesperson.map(item => item.amount).reverse(),
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
||||
{ offset: 0, color: '#48bb78' },
|
||||
{ offset: 1, color: '#38b2ac' }
|
||||
])
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
// 客户级别分布 - 饼图
|
||||
const customerChart = echarts.init(document.getElementById('customerChart'));
|
||||
customerChart.setOption({
|
||||
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
|
||||
legend: { orient: 'vertical', left: 'left' },
|
||||
series: [{
|
||||
type: 'pie',
|
||||
radius: '60%',
|
||||
data: data.customer.map(item => ({
|
||||
name: item.level,
|
||||
value: item.count
|
||||
})),
|
||||
label: {
|
||||
formatter: '{b}\n{c}单'
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
// 响应式调整
|
||||
window.addEventListener('resize', () => {
|
||||
regionChart.resize();
|
||||
productChart.resize();
|
||||
trendChart.resize();
|
||||
materialChart.resize();
|
||||
salespersonChart.resize();
|
||||
customerChart.resize();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user