首頁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> </thead>
<tbody> <tbody>
<tr v-for="(item, index) in alarmDataStore.alarmData" :key="index"> <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.alarmCount }}</td>
<td>{{ item.unackedCount }}</td> <td>{{ item.unackedCount }}</td>
<td> <td>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import * as echarts from "echarts"; // echarts import * as echarts from "echarts";
// //
const yesterdayTodayData = { const yesterdayTodayData = {
@ -51,29 +51,70 @@ const weekComparisonChart = ref(null);
onMounted(() => { onMounted(() => {
// //
const yesterdayTodayEChart = echarts.init(yesterdayTodayChart.value); const yesterdayTodayEChart = echarts.init(yesterdayTodayChart.value);
yesterdayTodayEChart.setOption(getBarChartOptions(yesterdayTodayData)); yesterdayTodayEChart.setOption(
generateCylinderChartOption(yesterdayTodayData)
);
// //
const weekComparisonEChart = echarts.init(weekComparisonChart.value); const weekComparisonEChart = echarts.init(weekComparisonChart.value);
weekComparisonEChart.setOption(getBarChartOptions(weekComparisonData)); weekComparisonEChart.setOption(
generateCylinderChartOption(weekComparisonData)
);
}); });
// // option
const getBarChartOptions = (data) => { 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 { return {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
axisPointer: { axisPointer: {
type: "shadow", 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: { legend: {
data: data.values.map((item) => item.name), data: data.values.map((item) => item.name),
bottom: "0%",
}, },
grid: { grid: {
left: "3%", left: "2%",
right: "4%", right: "2%",
bottom: "3%", top: "5%",
bottom: "10%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
@ -83,15 +124,82 @@ const getBarChartOptions = (data) => {
yAxis: { yAxis: {
type: "value", type: "value",
}, },
series: data.values.map((item) => ({ series: [
name: item.name, {
type: "bar", name: data.values[0].name,
barGap: 0.1, type: "bar",
emphasis: { barWidth: barWidth,
focus: "series", 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> </script>
@ -107,5 +215,4 @@ const getBarChartOptions = (data) => {
</a-row> </a-row>
</template> </template>
<style scoped> <style scoped></style>
</style>

View File

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

View File

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

View File

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