From cc970a89e221f414e6ee09d28ee5bb6eb9485a69 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 29 十二月 2025 10:50:48 +0800
Subject: [PATCH] 代码调整8
---
src/views/index.vue | 1207 +++++++++++++++++++++++++++-----------------------------
1 files changed, 583 insertions(+), 624 deletions(-)
diff --git a/src/views/index.vue b/src/views/index.vue
index f6ae965..afd379b 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -1,624 +1,583 @@
-<template>
- <div class="app-container home">
- <div style="display: flex;">
- <div>
- <div class="card-top-left">
- <div class="title">
- <span style="font-weight: bold">鏈湀閿�鍞�侀噰璐儏鍐佃鍒�</span>
- </div>
- <div class="card-group">
- <div class="info-card">
- <div class="info-message">
- <div class="info-number">{{ contractAmount }}</div>
- <div class="info-title">鍚堝悓閲戦(鍏�)</div>
- </div>
- <img src="@/assets/images/icon1.png" alt="" style="width: 63px;height: 63px">
- </div>
- <div class="info-card1">
- <div class="info-message">
- <div class="info-number">{{ invoiceAmount }}</div>
- <div class="info-title">寮�绁ㄩ噾棰�(鍏�)</div>
- </div>
- <img src="@/assets/images/icon2.png" alt="" style="width: 63px;height: 63px">
- </div>
- <div class="info-card2">
- <div class="info-message">
- <div class="info-number">{{ receiptAmount }}</div>
- <div class="info-title">鍥炴閲戦(鍏�)</div>
- </div>
- <img src="@/assets/images/icon%203.png" alt="" style="width: 63px;height: 63px">
- </div>
- </div>
- </div>
- <div class="card-top-left">
- <div class="title">
- <span style="font-weight: bold">鏈湀搴旀敹銆佸簲浠樻儏鍐佃鍒�</span>
- </div>
- <div class="pie">
- <div class="card-group">
- <div class="pie-group">
- <div style="margin-right: 80px">
- <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStyle" :series="materialPieSeries"
- :tooltip="pieTooltip"></Echarts>
- </div>
- <div class="info-message2">
- <div class="info-message1">
- <div class="pie-title">鏈湀鍥炴閲戦</div>
- <div class="pie-info"><span class="pie-number">{{ receiveAmount }}</span>鍏� <span
- class="pie-number">{{ receiveAmountPercentage }}</span>%</div>
- </div>
- <div class="info-message1">
- <div class="pie-title">搴旀敹娆鹃噾棰�</div>
- <div class="pie-info"><span class="pie-number">{{ contractAmountMonth }}</span>鍏�</div>
- </div>
- </div>
- </div>
- </div>
- <div class="card-group">
- <div class="pie-group">
- <div style="margin-right: 80px">
- <Echarts ref="chart" :options="options" :legend="pieLegend" :chartStyle="chartStyle"
- :series="materialPieSeries1" :tooltip="pieTooltip1"></Echarts>
- </div>
- <div class="info-message2">
- <div class="info-message1">
- <div class="pie-title1">鏈湀浠樻閲戦</div>
- <div class="pie-info"><span class="pie-number1">{{ paymentAmount }}</span>鍏� <span
- class="pie-number1">{{ payableAmountPercentage }}</span>%</div>
- </div>
- <div class="info-message1">
- <div class="pie-title1">搴斾粯娆鹃噾棰�</div>
- <div class="pie-info"><span class="pie-number1">{{ payableAmount }}</span>鍏�</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div>
- <div class="card-top-right">
- <div class="title">
- <span style="font-weight: bold">瀹㈡埛鍚堝悓閲戦TOP5缁熻</span>
- </div>
- <div>
- <Echarts ref="chart" :chartStyle="chartStyle1" :grid="grid" :legend="barLegend" :series="barSeries"
- :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" style="height: 42vh;"></Echarts>
- </div>
- </div>
- </div>
- </div>
- <div>
- <div>
- <div class="card-bottom">
- <div class="title">
- <span style="font-weight: bold">鍥炴銆佸紑绁ㄨ繎鍗婂勾璧板娍鍥�</span>
- </div>
- <div>
- <Echarts ref="chart" :chartStyle="chartStyle1" :grid="grid" :legend="barLegend" :series="lineSeries"
- :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 27vh;"></Echarts>
- </div>
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script setup name="Index">
-const { proxy } = getCurrentInstance()
-import * as echarts from 'echarts';
-import Echarts from "@/components/Echarts/echarts.vue";
-import {
- getAmountHalfYear,
- getAmountMouth,
- getContractAmount,
- getInvoiceAmount,
- getReceiptAmount,
- getTopFiveList, paymentMonthList
-} from "@/api/viewIndex.js";
-
-const pieLegend = reactive({
- show: false,
-})
-const contractAmount = ref(0)
-const invoiceAmount = ref(0)
-const receiptAmount = ref(0)
-const receiveAmount = ref(0)
-const contractAmountMonth = ref(0)
-const receiveAmountPercentage = ref(0)
-const paymentAmount = ref(0)
-const payableAmount = ref(0)
-const payableAmountPercentage = ref(0)
-const options = reactive({
- graphic: {
- type: 'circle',
- left: 'center',
- top: 'middle',
- shape: {
- r: '70%' // 鍦嗗舰鍗婂緞涓庨ゼ鍥惧鍦堢浉鍚�
- },
- }
-})
-const pieTooltip = reactive({
- trigger: 'item',
- formatter: function (params) {
- // 鍔ㄦ�佺敓鎴愭彁绀轰俊鎭紝鍩轰簬鏁版嵁椤圭殑 name 灞炴��
- const description = params.name === '鏈湀鍥炴閲戦' ? '鏈湀鍥炴閲戦' : '搴旀敹娆鹃噾棰�';
- return `${description} ${formatNumber(params.value)}鍏� ${params.percent}%`;
- },
- position: 'right'
-})
-const pieTooltip1 = reactive({
- trigger: 'item',
- formatter: function (params) {
- // 鍔ㄦ�佺敓鎴愭彁绀轰俊鎭紝鍩轰簬鏁版嵁椤圭殑 name 灞炴��
- const description = params.name === '鏈湀浠樻閲戦' ? '鏈湀浠樻閲戦' : '搴斾粯娆鹃噾棰�';
- return `${description} ${formatNumber(params.value)}鍏� ${params.percent}%`;
- },
- position: 'right'
-})
-// 鏁板瓧鏍煎紡鍖栧嚱鏁帮紝娣诲姞閫楀彿浣滀负鍗冧綅鍒嗛殧绗�
-function formatNumber(num) {
- return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
-}
-const materialPieSeries = ref([
- {
- type: 'pie',
- radius: '92%',
- avoidLabelOverlap: false,
- itemStyle: {
- borderColor: '#fff',
- borderWidth: 2
- },
- label: {
- show: false
- },
- data: [
- { value: 0, name: '鏈湀鍥炴閲戦', itemStyle: { color: '#2D99FF' } },
- { value: 0, name: '搴旀敹娆鹃噾棰�', itemStyle: { color: '#D4DDFF' } },
- ]
- }
-])
-const materialPieSeries1 = ref([
- {
- type: 'pie',
- radius: '92%',
- avoidLabelOverlap: false,
- itemStyle: {
- borderColor: '#fff',
- borderWidth: 2
- },
- label: {
- show: false
- },
- data: [
- { value: 0, name: '鏈湀浠樻閲戦', itemStyle: { color: '#1EBFAC' } },
- { value: 0, name: '搴斾粯娆鹃噾棰�', itemStyle: { color: '#D0EFE1' } },
- ]
- }
-])
-const chartStyle = {
- width: '150%',
- height: '120%' // 璁剧疆鍥捐〃瀹瑰櫒鐨勯珮搴�
-}
-const chartStyle1 = {
- width: '100%',
- height: '100%' // 璁剧疆鍥捐〃瀹瑰櫒鐨勯珮搴�
-}
-const grid = {
- left: '2%', // 澧炲ぇ宸︿晶鐣欑櫧
- right: '10%',
- bottom: '15%',
- top: '10%',
- containLabel: true // 纭繚鍖呭惈鏍囩
-}
-const tooltip = {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
-}
-const tooltipLine = {
- trigger: 'axis',
-}
-const yAxis1 = ref([
- {
- type: 'value',
- }
-])
-const xAxis1 = ref([
- {
- type: 'category',
- data: []
- }
-])
-const yAxis2 = ref([
- {
- type: 'value',
- }
-])
-const xAxis2 = ref([
- {
- type: 'category',
- data: []
- }
-])
-const barLegend = reactive({})
-const barSeries = ref([
- {
- type: 'bar',
- data: [],
- label: {
- show: true
- },
- },
-])
-const lineSeries = ref([
- {
- type: 'line',
- data: [],
- label: {
- show: true
- },
- },
-])
-// 鍚堝悓閲戦
-const getContractAmountNum = () => {
- getContractAmount().then((res) => {
- contractAmount.value = res.data
- })
-}
-// 寮�绁ㄩ噾棰�
-const getInvoiceAmountNum = () => {
- getInvoiceAmount().then((res) => {
- invoiceAmount.value = res.data
- })
-}
-// 鍥炴閲戦
-const getReceiptAmountNum = () => {
- getReceiptAmount().then((res) => {
- receiptAmount.value = res.data
- })
-}
-// 鏈堝洖娆鹃噾棰濋ゼ鍥�
-const getAmountMouthNum = () => {
- getAmountMouth().then((res) => {
- receiveAmount.value = res.data.receiveAmount
- contractAmountMonth.value = res.data.contractAmount
- const percentage = (receiveAmount.value / contractAmountMonth.value) * 100;
- receiveAmountPercentage.value = percentage.toFixed(2)
- materialPieSeries.value[0].data[0].value = receiveAmount.value
- materialPieSeries.value[0].data[1].value = contractAmountMonth.value
- })
-}
-// 鏈堜粯娆鹃噾棰濋ゼ鍥�
-const paymentMonthListNum = () => {
- paymentMonthList().then((res) => {
- paymentAmount.value = res.data.paymentAmount
- payableAmount.value = res.data.payableAmount
- const percentage = (paymentAmount.value / payableAmount.value) * 100;
- payableAmountPercentage.value = percentage.toFixed(2)
- materialPieSeries1.value[0].data[0].value = paymentAmount.value
- materialPieSeries1.value[0].data[1].value = payableAmount.value
- })
-}
-// 瀹㈡埛top5
-const getTopFiveListNum = async () => {
- const res = await getTopFiveList()
- const customerName = []
- const totalAmount = []
- res.data.forEach(item => {
- customerName.push(item.customerName)
- totalAmount.push(item.totalAmount)
- })
- // 姝g‘鍝嶅簲寮忚祴鍊硷細鍒涘缓鏂扮殑 xAxis 鍜� series 瀵硅薄
- xAxis1.value = [
- {
- type: 'category',
- data: customerName
- }
- ]
- barSeries.value = [
- {
- type: 'bar',
- data: totalAmount,
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- { offset: 0, color: '#F7D2FF' },
- { offset: 1, color: '#826AF9' }
- ])
- },
- emphasis: {
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- { offset: 1, color: '#826AF9' }
- ])
- }
- },
- }
- ]
-}
-// 绾垮舰鍥�
-const getAmountHalfYearNum = async () => {
- const res = await getAmountHalfYear()
- console.log(res)
- const monthName = []
- const receiptAmount = []
- const invoiceAmount = []
- res.data.forEach(item => {
- monthName.push(item.month)
- receiptAmount.push(item.receiptAmount)
- invoiceAmount.push(item.invoiceAmount)
- })
- // 姝g‘鍝嶅簲寮忚祴鍊硷細鍒涘缓鏂扮殑 xAxis 鍜� series 瀵硅薄
- xAxis2.value = [
- {
- type: 'category',
- data: monthName
- }
- ]
- lineSeries.value = [
- {
- name: '寮�绁�',
- type: 'line',
- data: receiptAmount,
- smooth: true,
- stack: 'Total',
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: 'rgba(131, 207, 255, 1)'
- },
- {
- offset: 1,
- color: 'rgba(186, 228, 255, 1)'
- }
- ])
- },
- // 璁剧疆灏忓渾鐐圭殑棰滆壊
- itemStyle: {
- color: '#2D99FF', // 灏忓渾鐐归鑹茶缃负#2D99FF
- borderColor: '#2D99FF' // 濡傛灉闇�瑕佺殑璇濓紝鍙互璁剧疆杈规棰滆壊
- },
- emphasis: {
- focus: 'series'
- },
- lineStyle: {
- width: 0
- },
- showSymbol: false,
- },
- {
- name: '鍥炴',
- type: 'line',
- data: invoiceAmount,
- smooth: true,
- stack: 'Total',
- lineStyle: {
- width: 0
- },
- // 璁剧疆灏忓渾鐐圭殑棰滆壊
- itemStyle: {
- color: '#83CFFF', // 灏忓渾鐐归鑹茶缃负#83CFFF
- borderColor: '#83CFFF' // 濡傛灉闇�瑕佺殑璇濓紝鍙互璁剧疆杈规棰滆壊
- },
- showSymbol: false,
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: 'rgba(54, 153, 255, 1)'
- },
- {
- offset: 1,
- color: 'rgba(89, 169, 254, 1)'
- }
- ])
- },
- emphasis: {
- focus: 'series'
- },
- }
- ]
-}
-getContractAmountNum()
-getInvoiceAmountNum()
-getReceiptAmountNum()
-getTopFiveListNum()
-getAmountMouthNum()
-paymentMonthListNum()
-getAmountHalfYearNum()
-</script>
-
-<style scoped>
-.card-top-left {
- padding: 16px;
- background: #fff;
- height: 24vh;
- width: 56vw;
- margin-bottom: 20px;
-}
-
-.card-top-right {
- padding: 16px;
- background: #fff;
- height: 50.6vh;
- width: 28vw;
- margin-bottom: 20px;
- margin-left: 20px;
-}
-
-.card-bottom {
- padding: 16px;
- background: #fff;
- height: 34vh;
- width: 85.2vw;
- margin-bottom: 20px;
-}
-
-.title {
- position: relative;
- font-size: 18px;
- color: #333;
- font-weight: 400;
- padding-left: 10px;
- margin-bottom: 26px;
-}
-
-.title::before {
- position: absolute;
- left: 0;
- top: 4px;
- content: '';
- width: 4px;
- height: 18px;
- background-color: #002FA7;
- border-radius: 2px;
-}
-
-.card-group {
- display: flex;
-}
-
-.info-card {
- width: 300px;
- height: 126px;
- background-image: url("../assets/images/Rectangle 76@2x.png");
- background-size: 100% 100%;
- display: flex;
- justify-content: space-around;
- align-items: center;
-}
-
-.info-card1 {
- width: 300px;
- height: 126px;
- background-image: url("../assets/images/Rectangle 77@2x.png");
- background-size: 100% 100%;
- margin: 0 40px;
- display: flex;
- justify-content: space-around;
- align-items: center;
-}
-
-.info-card2 {
- width: 300px;
- height: 126px;
- background-image: url("../assets/images/Rectangle 77@2x(1).png");
- background-size: 100% 100%;
- display: flex;
- justify-content: space-around;
- align-items: center;
-}
-
-.info-message {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.info-message1 {
- font-weight: bold;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
-}
-
-.info-message2 {
- font-weight: bold;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-around;
-}
-
-.info-number {
- font-weight: bold;
- font-size: 32px;
- color: #FFFFFF;
- margin-bottom: 10px;
-}
-
-.info-title {
- font-weight: bold;
- font-size: 18px;
- color: #FFFFFF;
-}
-
-.pie {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
-}
-
-.pie-group {
- display: flex;
-}
-
-.pie-title {
- font-size: 14px;
- line-height: 24px;
- color: #2853FD;
- padding-left: 16px;
- position: relative;
-}
-
-.pie-title::before {
- content: '';
- width: 6px;
- /* 钃濈偣鐨勫搴� */
- height: 6px;
- /* 钃濈偣鐨勯珮搴� */
- background-color: #2853FD;
- /* 钃濈偣鐨勯鑹� */
- border-radius: 50%;
- /* 灏嗘鏂瑰舰鍙樹负鍦嗗舰 */
- position: absolute;
- left: 0;
- /* 瀹氫綅鍒板乏杈� */
- top: 9px;
- /* 鍨傜洿灞呬腑瀵归綈锛屾牴鎹楂樿皟鏁� */
-}
-
-.pie-title1 {
- font-size: 14px;
- line-height: 24px;
- color: #1EBFAC;
- padding-left: 16px;
- position: relative;
-}
-
-.pie-title1::before {
- content: '';
- width: 6px;
- /* 钃濈偣鐨勫搴� */
- height: 6px;
- /* 钃濈偣鐨勯珮搴� */
- background-color: #1EBFAC;
- /* 钃濈偣鐨勯鑹� */
- border-radius: 50%;
- /* 灏嗘鏂瑰舰鍙樹负鍦嗗舰 */
- position: absolute;
- left: 0;
- /* 瀹氫綅鍒板乏杈� */
- top: 9px;
- /* 鍨傜洿灞呬腑瀵归綈锛屾牴鎹楂樿皟鏁� */
-}
-
-.pie-info {
- padding-left: 16px;
- font-size: 14px;
- line-height: 24px;
-}
-
-.pie-number {
- color: #2853FD;
-}
-
-.pie-number1 {
- color: #1EBFAC;
-}
-</style>
+<template>
+ <div class="dashboard">
+ <!-- 椤堕儴妯悜涓ゆ爮 -->
+ <div class="dashboard-top">
+ <!-- 宸︼細绯荤粺姒傝+鏁版嵁鍗$墖 -->
+ <div class="top-left">
+ <div class="system-info">
+ <div class="section-title">宸ヨ壓鎶ヨ浼樺寲绠$悊绯荤粺</div>
+ <div style="display: flex;align-items: center;gap: 20px">
+ <div class="system-card">
+ <div class="system-name">宸ヨ壓鎶ヨ浼樺寲绠$悊绯荤粺</div>
+ <div class="system-meta">瀹炴椂鐩戞帶 路 鏅鸿兘鍒嗘瀽 路 楂樻晥澶勭悊</div>
+ </div>
+ <div style="display: flex;align-items: center;gap: 8px">
+ <el-icon color="#5053B5" size="22"><Clock /></el-icon>
+ <span>褰撳墠鏃堕棿锛歿{ currentTime }}</span>
+ </div>
+ </div>
+ </div>
+ <div class="data-cards">
+ <div class="data-card total">
+ <div class="data-title">鎬绘姤璀︽暟</div>
+ <div class="data-value">{{ alarmStats.total }}</div>
+ <div class="data-desc">宸插鐞� {{ alarmStats.handled }} | 鏈鐞� {{ alarmStats.pending }}</div>
+ </div>
+ <div class="data-card pending">
+ <div class="data-title">鏈鐞嗘姤璀�</div>
+ <div class="data-value">{{ alarmStats.pending }}</div>
+ <div class="data-desc">涓ラ噸 {{ alarmStats.severePending }} | 涓瓑 {{ alarmStats.moderatePending }} | 杞诲井 {{ alarmStats.minorPending }}</div>
+ </div>
+ <div class="data-card today">
+ <div class="data-title">浠婃棩鎶ヨ</div>
+ <div class="data-value">{{ alarmStats.today }}</div>
+ <div class="data-desc">鍚屾瘮 {{ alarmStats.today鍚屾瘮 }}% | 鐜瘮 {{ alarmStats.today鐜瘮 }}%</div>
+ </div>
+ </div>
+ </div>
+ <!-- 鍙筹細寰呭鐞嗘姤璀﹀垪琛� -->
+ <div class="alarm-panel">
+ <div class="section-title">寰呭鐞嗘姤璀�</div>
+ <ul class="alarm-list" v-if="pendingAlarms.length > 0">
+ <li v-for="item in pendingAlarms" :key="item.id">
+ <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 10px">
+ <div style="display: flex;justify-content: space-between;align-items: center;">
+ <div class="alarm-title">{{ item.equipmentName }} - {{ item.parameter }}</div>
+ <el-tag :type="getAlarmLevelType(item.alarmLevel)">{{ item.alarmLevel }}</el-tag>
+ </div>
+ <div style="display: flex;justify-content: space-between;align-items: center;">
+ <div class="alarm-value">鎶ヨ鍊�: {{ item.alarmValue }} | 闃堝��: {{ item.threshold }}</div>
+ <div class="alarm-time">{{ item.alarmTime }}</div>
+ </div>
+ </div>
+ </li>
+ </ul>
+ <div v-else style="text-align: center; color: #909399; padding: 20px;">
+ 鏆傛棤寰呭鐞嗘姤璀�
+ </div>
+ </div>
+ </div>
+
+ <!-- 涓儴妯悜涓ゆ爮 -->
+ <div class="dashboard-row">
+ <div class="main-panel">
+ <div class="section-title">鎶ヨ瓒嬪娍鍒嗘瀽</div>
+ <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries" :tooltip="tooltipLine" :xAxis="xAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
+ </div>
+ <div class="main-panel">
+ <div class="section-title">鎶ヨ绾у埆鍒嗗竷</div>
+ <div style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 300px;">
+ <div style="width: 50%;">
+ <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie" :series="levelPieSeries" :tooltip="pieTooltip"></Echarts>
+ </div>
+ <ul class="level-list" style="width: 50%;">
+ <li v-for="item in levelPieSeries[0].data" :key="item.name">
+ <div style="display: flex;align-items: center;justify-content: space-between;width: 100%">
+ <div class="line" :style="{color: item.itemStyle.color}">鈼弡{ item.name }}</div>
+ <div style="width: 60px;">{{ item.value }}娆�</div>
+ <div style="width: 60px;">{{ item.rate }}%</div>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <!-- 搴曢儴妯悜涓ゆ爮 -->
+ <div class="dashboard-row">
+ <div class="main-panel">
+ <div class="section-title">璁惧鎶ヨ缁熻</div>
+ <Echarts ref="chart" :color="barColors" :chartStyle="chartStyle" :grid="grid" :series="equipmentBarSeries" :tooltip="tooltip" :xAxis="equipmentXAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
+ </div>
+ <div class="main-panel">
+ <div class="section-title">鎶ヨ澶勭悊鏃舵晥鍒嗘瀽</div>
+ <Echarts ref="chart" :color="barColors" :chartStyle="chartStyle" :grid="grid" :series="handlingTimeSeries" :tooltip="tooltip" :xAxis="handlingTimeXAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted, reactive, computed } from 'vue'
+import Echarts from "@/components/Echarts/echarts.vue";
+import { Clock } from '@element-plus/icons-vue';
+
+// 褰撳墠鏃堕棿
+const currentTime = computed(() => {
+ const now = new Date();
+ return now.toLocaleString('zh-CN');
+});
+
+// 鎶ヨ缁熻鏁版嵁
+const alarmStats = reactive({
+ total: 425,
+ handled: 398,
+ pending: 27,
+ severePending: 8,
+ moderatePending: 12,
+ minorPending: 7,
+ today: 35,
+ today鍚屾瘮: '+12.5',
+ today鐜瘮: '-8.3'
+});
+
+// 寰呭鐞嗘姤璀﹀垪琛�
+const pendingAlarms = ref([
+ {
+ id: 1,
+ equipmentName: '鍙嶅簲閲淎',
+ parameter: '娓╁害',
+ alarmValue: '185掳C',
+ threshold: '鈮�180掳C',
+ alarmLevel: '涓ラ噸',
+ alarmTime: '2025-12-16 14:30:23'
+ },
+ {
+ id: 2,
+ equipmentName: '绂诲績鏈築',
+ parameter: '鎸姩',
+ alarmValue: '0.8mm/s',
+ threshold: '鈮�0.5mm/s',
+ alarmLevel: '涓瓑',
+ alarmTime: '2025-12-16 14:28:15'
+ },
+ {
+ id: 3,
+ equipmentName: '鍙嶅簲閲淒',
+ parameter: 'pH鍊�',
+ alarmValue: '4.2',
+ threshold: '5.0-7.0',
+ alarmLevel: '涓瓑',
+ alarmTime: '2025-12-16 14:22:18'
+ },
+ {
+ id: 4,
+ equipmentName: '骞茬嚗鏈篍',
+ parameter: '婀垮害',
+ alarmValue: '15%',
+ threshold: '鈮�10%',
+ alarmLevel: '杞诲井',
+ alarmTime: '2025-12-16 14:18:55'
+ }
+]);
+
+// 鍥捐〃鏍峰紡
+const chartStyle = {
+ width: '100%',
+ height: '100%'
+};
+
+const chartStylePie = {
+ width: '100%',
+ height: '100%'
+};
+
+const grid = {
+ left: '3%',
+ right: '4%',
+ bottom: '3%',
+ containLabel: true
+};
+
+// 鎶ヨ瓒嬪娍鍒嗘瀽 - 鎶樼嚎鍥�
+const lineLegend = {
+ show: true,
+ data: ['涓ラ噸', '涓瓑', '杞诲井']
+};
+
+const tooltipLine = {
+ trigger: 'axis',
+ axisPointer: {
+ type: 'cross'
+ }
+};
+
+const xAxis = ref({
+ type: 'category',
+ data: ['12-01', '12-02', '12-03', '12-04', '12-05', '12-06', '12-07']
+});
+
+const yAxis = ref({
+ type: 'value',
+ name: '鎶ヨ鏁伴噺'
+});
+
+const lineSeries = ref([
+ {
+ name: '涓ラ噸',
+ type: 'line',
+ data: [8, 12, 9, 15, 11, 13, 10],
+ itemStyle: {
+ color: '#f56c6c'
+ },
+ lineStyle: {
+ width: 2
+ },
+ showSymbol: true
+ },
+ {
+ name: '涓瓑',
+ type: 'line',
+ data: [22, 25, 20, 28, 24, 26, 23],
+ itemStyle: {
+ color: '#e6a23c'
+ },
+ lineStyle: {
+ width: 2
+ },
+ showSymbol: true
+ },
+ {
+ name: '杞诲井',
+ type: 'line',
+ data: [35, 38, 32, 40, 36, 39, 34],
+ itemStyle: {
+ color: '#67c23a'
+ },
+ lineStyle: {
+ width: 2
+ },
+ showSymbol: true
+ }
+]);
+
+// 鎶ヨ绾у埆鍒嗗竷 - 楗煎浘
+const pieLegend = {
+ show: false
+};
+
+const pieTooltip = {
+ trigger: 'item',
+ formatter: '{b}: {c}娆� ({d}%)'
+};
+
+const levelPieSeries = ref([
+ {
+ type: 'pie',
+ radius: ['60%', '80%'],
+ avoidLabelOverlap: false,
+ itemStyle: {
+ borderColor: '#fff',
+ borderWidth: 2
+ },
+ label: {
+ show: false
+ },
+ data: [
+ {
+ name: '涓ラ噸',
+ value: 78,
+ rate: 18.35,
+ itemStyle: { color: '#f56c6c' }
+ },
+ {
+ name: '涓瓑',
+ value: 178,
+ rate: 41.88,
+ itemStyle: { color: '#e6a23c' }
+ },
+ {
+ name: '杞诲井',
+ value: 169,
+ rate: 39.76,
+ itemStyle: { color: '#67c23a' }
+ }
+ ]
+ }
+]);
+
+// 璁惧鎶ヨ缁熻 - 鏌辩姸鍥�
+const barColors = ['#409eff', '#67c23a', '#e6a23c', '#f56c6c', '#909399'];
+
+const tooltip = {
+ trigger: 'axis',
+ axisPointer: {
+ type: 'shadow'
+ }
+};
+
+const equipmentXAxis = ref({
+ type: 'category',
+ data: ['鍙嶅簲閲�', '绂诲績鏈�', '杈撻�佹车', '骞茬嚗鏈�', '鍘嬬缉鏈�']
+});
+
+const equipmentBarSeries = ref([
+ {
+ name: '鎶ヨ鏁伴噺',
+ type: 'bar',
+ data: [125, 85, 78, 65, 72],
+ itemStyle: {
+ color: function(params) {
+ return barColors[params.dataIndex % barColors.length];
+ }
+ },
+ label: {
+ show: true,
+ position: 'top'
+ }
+ }
+]);
+
+// 鎶ヨ澶勭悊鏃舵晥鍒嗘瀽 - 鏌辩姸鍥�
+const handlingTimeXAxis = ref({
+ type: 'category',
+ data: ['0-30鍒嗛挓', '30-60鍒嗛挓', '1-2灏忔椂', '2灏忔椂浠ヤ笂']
+});
+
+const handlingTimeSeries = ref([
+ {
+ name: '澶勭悊鏁伴噺',
+ type: 'bar',
+ data: [280, 75, 45, 25],
+ itemStyle: {
+ color: function(params) {
+ return barColors[params.dataIndex % barColors.length];
+ }
+ },
+ label: {
+ show: true,
+ position: 'top'
+ }
+ }
+]);
+
+// 鑾峰彇鎶ヨ绾у埆鏍峰紡
+const getAlarmLevelType = (level) => {
+ switch(level) {
+ case '涓ラ噸': return 'danger';
+ case '涓瓑': return 'warning';
+ case '杞诲井': return 'info';
+ default: return 'info';
+ }
+};
+
+onMounted(() => {
+ // 椤甸潰鍔犺浇瀹屾垚鍚庣殑鍒濆鍖栨搷浣�
+});
+</script>
+
+<style scoped>
+.dashboard {
+ background: #f5f7fa;
+ min-height: 100vh;
+ padding: 20px;
+ box-sizing: border-box;
+}
+
+.dashboard-top {
+ display: flex;
+ gap: 20px;
+ margin-bottom: 20px;
+}
+
+.system-info {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 20px;
+ min-width: 0;
+ background-color: #EFF2FB;
+ border-radius: 12px;
+ height: 138px;
+}
+
+.system-card {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ position: relative;
+ padding-right: 15px;
+}
+
+.system-name {
+ font-weight: 600;
+ font-size: 18px;
+ color: #161A9A;
+}
+
+.system-meta {
+ font-weight: 400;
+ font-size: 12px;
+ color: #818185;
+}
+
+.data-cards {
+ display: flex;
+ gap: 16px;
+ justify-content: flex-start;
+ background: #ffffff;
+ border-radius: 12px;
+ padding: 20px;
+}
+
+.data-card {
+ background: #fff;
+ border-radius: 12px;
+ padding: 16px;
+ min-width: 160px;
+ box-shadow: 0 2px 8px #eee;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 32%;
+ height: 140px;
+ transition: all 0.3s ease;
+}
+
+.data-card:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
+}
+
+.data-card.total {
+ background: linear-gradient(135deg, #409eff 0%, #66b1ff 100%);
+ color: #fff;
+}
+
+.data-card.pending {
+ background: linear-gradient(135deg, #f56c6c 0%, #f78989 100%);
+ color: #fff;
+}
+
+.data-card.today {
+ background: linear-gradient(135deg, #67c23a 0%, #85ce61 100%);
+ color: #fff;
+}
+
+.data-title {
+ font-weight: 600;
+ font-size: 16px;
+ margin-bottom: 12px;
+}
+
+.data-value {
+ font-size: 32px;
+ font-weight: bold;
+ margin-bottom: 8px;
+}
+
+.data-desc {
+ font-size: 12px;
+ opacity: 0.9;
+}
+
+.top-left {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ width: 60%;
+}
+
+.alarm-panel {
+ background: #fff;
+ border-radius: 12px;
+ padding: 20px;
+ width: 40%;
+}
+
+.alarm-list {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ font-size: 14px;
+ overflow-y: auto;
+ height: 260px;
+}
+
+.alarm-list li {
+ border-radius: 8px;
+ margin-bottom: 12px;
+ padding: 12px 20px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: #f8f9fa;
+ border-left: 4px solid #409eff;
+ transition: all 0.3s ease;
+}
+
+.alarm-list li:hover {
+ background: #e9ecef;
+ transform: translateX(4px);
+}
+
+.alarm-title {
+ font-weight: 600;
+ font-size: 14px;
+ color: #303133;
+}
+
+.alarm-value {
+ font-size: 12px;
+ color: #606266;
+}
+
+.alarm-time {
+ font-size: 12px;
+ color: #909399;
+}
+
+.dashboard-row {
+ display: flex;
+ gap: 20px;
+ margin-bottom: 20px;
+}
+
+.main-panel {
+ background: #fff;
+ border-radius: 12px;
+ padding: 20px;
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+}
+
+.section-title {
+ position: relative;
+ font-size: 18px;
+ color: #333;
+ padding-left: 10px;
+ margin-bottom: 20px;
+ font-weight: 700;
+}
+
+.section-title::before {
+ position: absolute;
+ left: 0;
+ top: 4px;
+ content: '';
+ width: 4px;
+ height: 18px;
+ background-color: #409eff;
+ border-radius: 2px;
+}
+
+.level-list {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ height: 200px;
+ overflow-y: auto;
+ width: 100%;
+}
+
+.level-list li {
+ margin-bottom: 15px;
+ padding: 10px;
+ background: #f8f9fa;
+ border-radius: 6px;
+ transition: all 0.3s ease;
+}
+
+.level-list li:hover {
+ background: #e9ecef;
+}
+
+.line {
+ position: relative;
+ width: 80px;
+ font-weight: 500;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3