首頁UI修改

This commit is contained in:
huliang 2025-04-23 16:54:47 +08:00
parent 67b20ff94f
commit be68eb3568
5 changed files with 140 additions and 24 deletions

View File

@ -21,7 +21,14 @@ const alarmDataStore = useAlarmDataStore();
</thead>
<tbody>
<tr v-for="(item, index) in alarmDataStore.alarmData" :key="index">
<td>{{ item.name }}</td>
<td>
<font-awesome-icon
v-if="item.alarmCount > 0"
:icon="['fas', 'exclamation-circle']"
class="text-rose-600 text-lg animate-pulse -ms-5"
/>
{{ item.name }}
</td>
<td>{{ item.alarmCount }}</td>
<td>{{ item.unackedCount }}</td>
<td>

View File

@ -1,6 +1,6 @@
<script setup>
import { ref, onMounted } from "vue";
import * as echarts from "echarts"; // echarts
import * as echarts from "echarts";
//
const yesterdayTodayData = {
@ -51,29 +51,70 @@ const weekComparisonChart = ref(null);
onMounted(() => {
//
const yesterdayTodayEChart = echarts.init(yesterdayTodayChart.value);
yesterdayTodayEChart.setOption(getBarChartOptions(yesterdayTodayData));
yesterdayTodayEChart.setOption(
generateCylinderChartOption(yesterdayTodayData)
);
//
const weekComparisonEChart = echarts.init(weekComparisonChart.value);
weekComparisonEChart.setOption(getBarChartOptions(weekComparisonData));
weekComparisonEChart.setOption(
generateCylinderChartOption(weekComparisonData)
);
});
//
const getBarChartOptions = (data) => {
// option
const generateCylinderChartOption = (data) => {
const barWidth = 15;
const color1 = {
//
type: "linear",
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{ offset: 0, color: "#1890ff" }, //
{ offset: 0.5, color: "#acd7e4" }, //
{ offset: 1, color: "#1890ff" }, //
],
};
const color2 = {
//
type: "linear",
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{ offset: 0, color: "#91cc75" }, //
{ offset: 0.5, color: "#d2f0c2" }, //
{ offset: 1, color: "#91cc75" }, //
],
};
return {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
// bar
const barData = params.filter((item) => item.seriesType === "bar");
return barData
.map((item) => `${item.seriesName}: ${item.data}`)
.join("<br/>");
},
},
legend: {
data: data.values.map((item) => item.name),
bottom: "0%",
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
left: "2%",
right: "2%",
top: "5%",
bottom: "10%",
containLabel: true,
},
xAxis: {
@ -83,15 +124,82 @@ const getBarChartOptions = (data) => {
yAxis: {
type: "value",
},
series: data.values.map((item) => ({
name: item.name,
type: "bar",
barGap: 0.1,
emphasis: {
focus: "series",
series: [
{
name: data.values[0].name,
type: "bar",
barWidth: barWidth,
data: data.values[0].value,
itemStyle: {
color: color1,
},
},
data: item.value,
})),
{
name: data.values[1].name,
type: "bar",
barWidth: barWidth,
data: data.values[1].value,
itemStyle: {
color: color2,
},
},
//
{
name: null,
type: "pictorialBar",
symbolSize: [barWidth, 5],
symbolOffset: [-9, -4], //
symbolPosition: "end",
data: data.values[0].value,
z: 12,
itemStyle: {
color: "#acd7e4",
borderWidth: 0,
borderColor: "#fff",
borderType: "solid",
},
},
{
name: null,
type: "pictorialBar",
symbolSize: [barWidth, 5],
symbolOffset: [9, -4], //
symbolPosition: "end",
data: data.values[1].value,
itemStyle: {
color: "#d2f0c2",
borderWidth: 1,
borderColor: "#91cc75",
borderType: "solid",
},
z: 12,
},
//
{
name: null,
type: "pictorialBar",
symbolSize: [barWidth, 5],
symbolOffset: [-9, 4], //
symbolPosition: "start",
data: data.values[0].value,
z: 12,
itemStyle: {
color: "#1890ff",
},
},
{
name: null,
type: "pictorialBar",
symbolSize: [barWidth, 5],
symbolOffset: [9, 4], //
symbolPosition: "start",
data: data.values[1].value,
itemStyle: {
color: "#91cc75",
},
z: 12,
},
],
};
};
</script>
@ -107,5 +215,4 @@ const getBarChartOptions = (data) => {
</a-row>
</template>
<style scoped>
</style>
<style scoped></style>

View File

@ -33,10 +33,10 @@ const mockData = [
<a-card class="number">
<a-row :gutter="24" align="middle" justify="space-between">
<a-col :span="18">
<span>{{ item.label }}</span>
<h3>
{{ item.value }}<small>{{ item.unit }}</small>
</h3>
<span>{{ item.label }}</span>
</a-col>
<a-col :span="6" class="pl-0">
<div class="icon-box">
@ -60,7 +60,7 @@ const mockData = [
.number h3 {
font-weight: 700;
margin-bottom: 0;
font-size: 30px;
font-size: 33px;
}
.number h3 small {
font-weight: 500;

View File

@ -53,7 +53,7 @@ const handleClick = (ord) => {
</script>
<template>
<a-card class="card h-full">
<a-card class="card h-full mb-4">
<div class="flex items-cemter justify-between mb-4">
<h5>System</h5>
<NavBuild />

View File

@ -22,7 +22,8 @@ import {
faAngleDown,
faLeaf,
faBolt,
faChargingStation
faChargingStation,
faExclamationCircle,
} from "@fortawesome/free-solid-svg-icons";
library.add(
faTv,
@ -40,7 +41,8 @@ library.add(
faAngleDown,
faLeaf,
faBolt,
faChargingStation
faChargingStation,
faExclamationCircle,
);
const pinia = createPinia();
const app = createApp(App);