2023-09-08 08:03:33 +00:00
|
|
|
<template>
|
|
|
|
<div class="board-bar">
|
|
|
|
<div class="bb-top">
|
|
|
|
<div class="dev-title">
|
|
|
|
<div class="title-item" v-for="(item, index) in header" :style="{ width: computedWidth(columnWidth[index]) }">
|
|
|
|
<text>{{ item }}</text></div>
|
|
|
|
</div>
|
|
|
|
<ZdScrollBoard ref="devList" class="dev-list" :config="config" />
|
|
|
|
</div>
|
|
|
|
<div class="bb-bottom">
|
2023-09-09 04:01:37 +00:00
|
|
|
<BarChart style="width: 100%;height: 100%;" :xData="prop.xData"
|
|
|
|
:seriesData="prop.seriesData"></BarChart>
|
2023-09-08 08:03:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang='ts'>
|
|
|
|
import ZdScrollBoard from "@/components/data-view/index.vue";
|
|
|
|
import BarChart from './BarChart.vue'
|
|
|
|
|
|
|
|
import { getCurrentInstance, onMounted, reactive, ref, computed, watch } from "vue";
|
|
|
|
|
|
|
|
|
|
|
|
const devList = ref(null);
|
|
|
|
const prop = defineProps({
|
|
|
|
data: {
|
|
|
|
type: Array,
|
2023-09-09 04:01:37 +00:00
|
|
|
default: []
|
|
|
|
},
|
|
|
|
xData: {
|
|
|
|
type: Array,
|
|
|
|
default: ['1050910', '1050269']
|
|
|
|
},
|
|
|
|
seriesData: {
|
|
|
|
type: Array,
|
|
|
|
default: [ ]
|
2023-09-08 08:03:33 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
let header = ['序号', '设备名称', '设备编码', '稼动率', '状态']
|
|
|
|
let columnWidth = [90, 290, 140, 120, 120, 120];
|
|
|
|
let sum = 850;
|
|
|
|
|
|
|
|
let computedWidth = (width: number) => {
|
|
|
|
return width / sum * 100 + '%'
|
|
|
|
}
|
|
|
|
let config = reactive({
|
|
|
|
// header: ['序号', '设备名称', '设备编码', '稼动率', '状态'],//, '故障率'
|
|
|
|
headerBGC: '#0E0E0E',
|
|
|
|
oddRowBGC: '#000F1D',
|
|
|
|
evenRowBGC: '#000F1D',
|
|
|
|
wrap: [false, false, false, false, false],
|
|
|
|
columnWidth: [80, 290, 120, 120, 120, 120],
|
|
|
|
align: ['center', 'center', 'center', 'center', 'center', 'center'],
|
|
|
|
rowNum: 2,
|
2023-09-09 04:01:37 +00:00
|
|
|
waitTime: 3000,
|
2023-09-08 08:03:33 +00:00
|
|
|
data: [
|
|
|
|
]
|
|
|
|
})
|
|
|
|
const handleData = () => {
|
|
|
|
|
|
|
|
config.data = prop.data.map((items: any) => {
|
|
|
|
return items.map((item: any, index: number) => {
|
|
|
|
if (index == (items.length - 1)) {
|
|
|
|
return statusHtml(status_color[item])
|
|
|
|
}
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2023-09-09 04:01:37 +00:00
|
|
|
watch(()=>prop.data, (newVal, oldVal) => {
|
|
|
|
handleData()
|
|
|
|
},{deep:true}
|
|
|
|
)
|
2023-09-08 08:03:33 +00:00
|
|
|
|
|
|
|
const status_color = {
|
|
|
|
'0': '#FF6E76',
|
|
|
|
'1': '#FDDD60',
|
|
|
|
'2': '#7CFFB2',
|
|
|
|
'3': '#FDDD60',
|
|
|
|
}
|
|
|
|
|
|
|
|
let statusHtml = (color) => {
|
|
|
|
return `<div style="width: 100%;height: 100%;display: flex;justify-content: center;align-items: center;"><div style="width:24px;height:24px;border-radius: 50%;background-color:${color}"></div></div>`
|
|
|
|
// return `<div style="display: inline-block;width:20px;height:20px;border-radius: 50%;background-color:${color}"></div>`
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
handleData()
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.board-bar {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.dev-title {
|
|
|
|
width: 100%;
|
|
|
|
height: 50px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-item {
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-item text {
|
|
|
|
line-height: 50px;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 18px;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #fff;
|
|
|
|
padding: 5px 10px;
|
|
|
|
background: url(@/assets/img/title_bg.svg) no-repeat center center / 100% 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.bb-top {
|
|
|
|
width: 100%;
|
|
|
|
height: 35%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dev-list {
|
|
|
|
width: 100%;
|
|
|
|
height: calc(100% - 50px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.bb-bottom {
|
|
|
|
width: 100%;
|
|
|
|
height: 65%;
|
|
|
|
|
|
|
|
}</style>
|