go-view-fetch/src/packages/components/Charts/MyComponents/DeviceStatus/index.vue

150 lines
4.0 KiB
Vue
Raw Normal View History

2025-08-20 12:44:02 +08:00
<template>
<div class="go-device-status">
2025-08-20 16:58:08 +08:00
<div class="header">
<div class="title">
<svg-icon icon-class="rocket" class="title-icon" :style="{ color: option.iconColor }"></svg-icon>
<span :style="{ color: option.titleColor, fontSize: option.titleSize + 'px' }">{{ option.title }}</span>
</div>
</div>
<div class="status-section">
<div class="online-rate">
<div class="rate-circle">
<span class="rate-text">{{ option.onlineRate }}%</span>
2025-08-20 12:44:02 +08:00
</div>
2025-08-20 16:58:08 +08:00
<span class="rate-label">设备在线率</span>
</div>
<div class="progress-bar">
<div class="progress" :style="{ width: option.onlineRate + '%' }"></div>
</div>
<div class="device-count">
<span>{{ option.onlineDevice }}</span> / <span>{{ option.totalDevice }}</span>
</div>
</div>
<div class="table-header" :style="{ backgroundColor: option.headerBackgroundColor, height: option.headerHeight + 'px' }">
<div v-for="header in option.header" :key="header" class="header-item" :style="{ color: option.headerTextColor, fontSize: option.fontSize + 'px' }">
{{ header }}
</div>
</div>
<div class="table-body">
<div v-for="(item, index) in option.dataset" :key="index" class="table-row" :style="{ backgroundColor: option.itemBackgroundColor, height: option.itemHeight + 'px' }">
<div class="row-item" :style="{ color: option.textColor, fontSize: option.fontSize + 'px' }">{{ item.enterprise }}</div>
<div class="row-item" :style="{ color: option.textColor, fontSize: option.fontSize + 'px' }">{{ item.deviceType }}</div>
<div class="row-item" :style="{ color: option.textColor, fontSize: option.fontSize + 'px' }">{{ item.deviceName }}</div>
<div class="row-item time" :style="{ color: option.timeColor, fontSize: option.fontSize + 'px' }">{{ item.time }}</div>
2025-08-20 12:44:02 +08:00
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { option as configOption } from './config'
const props = defineProps({
chartConfig: {
type: Object as PropType<{ option: typeof configOption }>,
required: true
}
})
const option = computed(() => props.chartConfig.option)
</script>
<style lang="scss" scoped>
.go-device-status {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
2025-08-20 16:58:08 +08:00
background-color: #0F233E;
color: #ffffff;
padding: 10px;
box-sizing: border-box;
2025-08-20 12:44:02 +08:00
2025-08-20 16:58:08 +08:00
.header {
display: flex;
align-items: center;
margin-bottom: 10px;
.title {
display: flex;
align-items: center;
.title-icon {
font-size: 24px;
margin-right: 10px;
}
}
2025-08-20 12:44:02 +08:00
}
2025-08-20 16:58:08 +08:00
.status-section {
2025-08-20 12:44:02 +08:00
display: flex;
align-items: center;
2025-08-20 16:58:08 +08:00
margin-bottom: 10px;
.online-rate {
display: flex;
align-items: center;
.rate-circle {
width: 50px;
height: 50px;
border: 2px solid #00E5FF;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-right: 10px;
.rate-text {
color: #00E5FF;
font-size: 16px;
}
}
.rate-label {
font-size: 14px;
}
}
.progress-bar {
flex: 1;
height: 10px;
background-color: #1A385A;
border-radius: 5px;
margin: 0 10px;
overflow: hidden;
.progress {
height: 100%;
background-color: #00E5FF;
}
}
.device-count {
font-size: 14px;
}
2025-08-20 12:44:02 +08:00
}
2025-08-20 16:58:08 +08:00
.table-header {
2025-08-20 12:44:02 +08:00
display: flex;
2025-08-20 16:58:08 +08:00
justify-content: space-between;
2025-08-20 12:44:02 +08:00
align-items: center;
2025-08-20 16:58:08 +08:00
padding: 0 10px;
.header-item {
flex: 1;
text-align: center;
2025-08-20 12:44:02 +08:00
}
}
2025-08-20 16:58:08 +08:00
.table-body {
flex: 1;
overflow-y: auto;
.table-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
border-bottom: 1px solid #1A385A;
.row-item {
flex: 1;
text-align: center;
&.time {
color: #FF4D4F;
}
2025-08-20 12:44:02 +08:00
}
}
}
}
2025-08-20 16:58:08 +08:00
</style>