feat_html
This commit is contained in:
parent
9ad80c5159
commit
932cc7a06a
@ -279,15 +279,6 @@
|
|||||||
<p>本月新增</p>
|
<p>本月新增</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
|
||||||
<div class="stat-icon">
|
|
||||||
<i class="fas fa-box"></i>
|
|
||||||
</div>
|
|
||||||
<div class="stat-info">
|
|
||||||
<h3 id="totalProducts">0</h3>
|
|
||||||
<p>产品数</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-icon">
|
<div class="stat-icon">
|
||||||
<i class="fas fa-check-circle"></i>
|
<i class="fas fa-check-circle"></i>
|
||||||
@ -297,6 +288,15 @@
|
|||||||
<p>已完成</p>
|
<p>已完成</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="stat-card">
|
||||||
|
<div class="stat-icon">
|
||||||
|
<i class="fas fa-users"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stat-info">
|
||||||
|
<h3 id="totalProducts">0</h3>
|
||||||
|
<p>客户总数</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="stat-card stat-card-highlight">
|
<div class="stat-card stat-card-highlight">
|
||||||
<div class="stat-icon">
|
<div class="stat-icon">
|
||||||
<i class="fas fa-user-check"></i>
|
<i class="fas fa-user-check"></i>
|
||||||
|
|||||||
@ -1045,7 +1045,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}).map(c => c.customerName).filter(c => c)
|
}).map(c => c.customerName).filter(c => c)
|
||||||
).size;
|
).size;
|
||||||
|
|
||||||
const products = new Set(customers.map(c => c.version)).size;
|
// 客户总数:统计去重的客户名称数量(与totalCustomers一致)
|
||||||
|
const totalCustomersCount = new Set(customers.map(c => c.customerName).filter(c => c)).size;
|
||||||
|
|
||||||
const completed = new Set(
|
const completed = new Set(
|
||||||
customers.filter(c =>
|
customers.filter(c =>
|
||||||
@ -1055,7 +1056,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
document.getElementById('totalCustomers').textContent = totalCustomers;
|
document.getElementById('totalCustomers').textContent = totalCustomers;
|
||||||
document.getElementById('newCustomers').textContent = newCustomers;
|
document.getElementById('newCustomers').textContent = newCustomers;
|
||||||
document.getElementById('totalProducts').textContent = products;
|
document.getElementById('totalProducts').textContent = totalCustomersCount;
|
||||||
document.getElementById('completedTasks').textContent = completed;
|
document.getElementById('completedTasks').textContent = completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1119,7 +1120,24 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
responsive: true,
|
responsive: true,
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: {
|
legend: {
|
||||||
position: 'bottom'
|
position: 'left',
|
||||||
|
labels: {
|
||||||
|
generateLabels: function (chart) {
|
||||||
|
const data = chart.data;
|
||||||
|
if (data.labels.length && data.datasets.length) {
|
||||||
|
return data.labels.map((label, i) => {
|
||||||
|
const value = data.datasets[0].data[i];
|
||||||
|
return {
|
||||||
|
text: `${label}: ${value}`,
|
||||||
|
fillStyle: data.datasets[0].backgroundColor[i],
|
||||||
|
hidden: false,
|
||||||
|
index: i
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
@ -1144,12 +1162,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
formatter: (value, ctx) => {
|
formatter: (value, ctx) => {
|
||||||
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
|
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
|
||||||
const percentage = ((value / total) * 100).toFixed(1);
|
const percentage = ((value / total) * 100).toFixed(1);
|
||||||
return percentage + '%';
|
// 显示具体数值和百分比
|
||||||
|
return `${value}\n(${percentage}%)`;
|
||||||
},
|
},
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
font: {
|
font: {
|
||||||
weight: 'bold',
|
weight: 'bold',
|
||||||
size: 14
|
size: 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1208,7 +1227,24 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
responsive: true,
|
responsive: true,
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: {
|
legend: {
|
||||||
position: 'bottom'
|
position: 'left',
|
||||||
|
labels: {
|
||||||
|
generateLabels: function (chart) {
|
||||||
|
const data = chart.data;
|
||||||
|
if (data.labels.length && data.datasets.length) {
|
||||||
|
return data.labels.map((label, i) => {
|
||||||
|
const value = data.datasets[0].data[i];
|
||||||
|
return {
|
||||||
|
text: `${label}: ${value}`,
|
||||||
|
fillStyle: data.datasets[0].backgroundColor[i],
|
||||||
|
hidden: false,
|
||||||
|
index: i
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
@ -1233,12 +1269,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
formatter: (value, ctx) => {
|
formatter: (value, ctx) => {
|
||||||
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
|
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
|
||||||
const percentage = ((value / total) * 100).toFixed(1);
|
const percentage = ((value / total) * 100).toFixed(1);
|
||||||
return percentage + '%';
|
// 显示具体数值和百分比
|
||||||
|
return `${value}\n(${percentage}%)`;
|
||||||
},
|
},
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
font: {
|
font: {
|
||||||
weight: 'bold',
|
weight: 'bold',
|
||||||
size: 14
|
size: 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user