|
@@ -0,0 +1,143 @@
|
|
|
+<template>
|
|
|
+ <div class="screen-common-component">
|
|
|
+ <ScreenComHeader :module-id="moduleId" title="设备状态" />
|
|
|
+ <div class="charts-container">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in data"
|
|
|
+ :key="index"
|
|
|
+ class="device-status-desc"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <div :style="{ backgroundColor: colors[index] }" class="icon"></div>
|
|
|
+ <div :style="{ color: colors[index] }" class="type">
|
|
|
+ {{ item.type }}
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <div :style="{ color: colors[index] }" class="count">
|
|
|
+ {{ item.count }}台
|
|
|
+ </div>
|
|
|
+ <div :style="{ color: colors[index] }" class="count">
|
|
|
+ {{ item.count }}%
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <div ref="chartRef" style="width: 100%; height: 600px"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import ScreenComHeader from "@/views/screens/configs/screenComHeader.vue";
|
|
|
+
|
|
|
+import * as echarts from "echarts";
|
|
|
+
|
|
|
+const chartRef = ref(null);
|
|
|
+onMounted(() => {
|
|
|
+ const chart = echarts.init(chartRef.value, "dark");
|
|
|
+ chart.setOption(option);
|
|
|
+});
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ moduleId: {
|
|
|
+ type: String,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const colors = ["#4caf50", "#ffc107", "#b61945", "#607d8b"];
|
|
|
+
|
|
|
+const data = ref<any[]>([
|
|
|
+ {
|
|
|
+ type: "运行",
|
|
|
+ count: 100,
|
|
|
+ percent: 20,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "待机",
|
|
|
+ count: 10,
|
|
|
+ percent: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "故障",
|
|
|
+ count: 5,
|
|
|
+ percent: 5,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "离线",
|
|
|
+ count: 0,
|
|
|
+ percent: 0,
|
|
|
+ },
|
|
|
+]);
|
|
|
+
|
|
|
+const option = {
|
|
|
+ color: colors,
|
|
|
+ backgroundColor: "transparent",
|
|
|
+ tooltip: {
|
|
|
+ trigger: "item",
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ bottom: "5%",
|
|
|
+ left: "center",
|
|
|
+ },
|
|
|
+
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "设备状态",
|
|
|
+ type: "pie",
|
|
|
+ radius: ["40%", "70%"],
|
|
|
+ avoidLabelOverlap: false,
|
|
|
+ padAngle: 5,
|
|
|
+ itemStyle: {
|
|
|
+ borderRadius: 10,
|
|
|
+ },
|
|
|
+
|
|
|
+ labelLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ show: false,
|
|
|
+ position: "inside",
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ { value: 1048, name: "运行" },
|
|
|
+ { value: 735, name: "待机" },
|
|
|
+ { value: 580, name: "故障" },
|
|
|
+ { value: 484, name: "离线" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.device-status-desc {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 5px 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+
|
|
|
+ s .icon {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-right: 10px;
|
|
|
+ background-color: #ff7373;
|
|
|
+ }
|
|
|
+
|
|
|
+ .type {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+ line-height: 1.5;
|
|
|
+ }
|
|
|
+
|
|
|
+ .count {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #666;
|
|
|
+ line-height: 1.5;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|