湖里大屏(数字工地):完成塔吊设备布局

This commit is contained in:
Jack 2022-08-05 09:34:04 +08:00
parent 9dd38f2ed4
commit 11f35805b4
3 changed files with 34 additions and 5 deletions

View File

@ -16,8 +16,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="content">
<slot></slot> <slot></slot>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -75,5 +77,8 @@ export default {
} }
} }
} }
.content {
height: calc(100% - 84px);
}
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<Card :title="title"> <Card :title="title">
<DeviceCard :leftCount="{ value: 22, label: '塔吊设备数' }" :rightCount="{ value: 65, label: '今日报警数' }"> <DeviceCard :leftCount="{ value: 22, label: '塔吊设备数' }" :rightCount="{ value: 65, label: '今日报警数' }">
hello <JBarChart :tooltip="{}" :xData="xData" :yData="yData" />
</DeviceCard> </DeviceCard>
</Card> </Card>
</template> </template>
@ -9,8 +9,9 @@
<script> <script>
import Card from '../components/Card.vue' import Card from '../components/Card.vue'
import DeviceCard from './components/DeviceCard.vue' import DeviceCard from './components/DeviceCard.vue'
import JBarChart from '../jChart/bar/JBarChart.vue'
export default { export default {
components: { Card, DeviceCard }, components: { Card, DeviceCard, JBarChart },
props: { props: {
title: { title: {
type: String, type: String,
@ -18,7 +19,25 @@ export default {
} }
}, },
data() { data() {
return {} const yData = [23, 44, 63, 12, 45, 78, 34, 67].map((value, i) => {
if (i > 4 && i < 7) {
return {
name: '离线',
value,
itemStyle: { color: '#FF6C7F' }
}
} else {
return {
name: '报警数',
value,
itemStyle: { color: '#3CABFD' }
}
}
})
return {
xData: ['1号', '2号', '3号', '4号', '5号', '6号', '7号', '8号'],
yData
}
} }
} }
</script> </script>

View File

@ -12,6 +12,10 @@ export default {
text: '' text: ''
}) })
}, },
tooltip: {
type: Object,
default: () => ({ show: false })
},
grid: { grid: {
type: Array, type: Array,
default: () => ['15%', '2%', '2%', '2%'] default: () => ['15%', '2%', '2%', '2%']
@ -43,7 +47,7 @@ export default {
}, },
methods: { methods: {
createChart() { createChart() {
const { title, grid, color, xData, yData, series } = this const { title, tooltip, grid, color, xData, yData, series } = this
const configSeries = (series => { const configSeries = (series => {
if (series.length) { if (series.length) {
return series.map(item => ({ data: item.data, type: 'bar', barWidth: 15 })) return series.map(item => ({ data: item.data, type: 'bar', barWidth: 15 }))
@ -62,6 +66,7 @@ export default {
fontWeight: 'normal' fontWeight: 'normal'
} }
}, },
tooltip,
grid: { grid: {
top: grid[0], top: grid[0],
right: grid[1], right: grid[1],