|
@@ -0,0 +1,384 @@
|
|
|
+<template>
|
|
|
+ <div class="trend-card">近三天报警趋势</div>
|
|
|
+
|
|
|
+ <div class="home_count">
|
|
|
+ <div class="ant-card-body">
|
|
|
+ <div class="card-left">
|
|
|
+ <img src="/src/assets/images/home/06.png" class="right-img" />
|
|
|
+ <div class="left-title">前天</div>
|
|
|
+ </div>
|
|
|
+ <div class="card-right">
|
|
|
+ <div class="echart" id="echart1"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="ant-card-body">
|
|
|
+ <div class="card-left">
|
|
|
+ <img src="/src/assets/images/home/07.png" class="right-img" />
|
|
|
+ <div class="left-title">昨天</div>
|
|
|
+ </div>
|
|
|
+ <div class="card-right">
|
|
|
+ <div class="echart" id="echart2"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="ant-card-body">
|
|
|
+ <div class="card-left">
|
|
|
+ <img src="/src/assets/images/home/08.png" class="right-img" />
|
|
|
+ <div class="left-title">今天</div>
|
|
|
+ </div>
|
|
|
+ <div class="card-right">
|
|
|
+ <div class="echart" id="echart3"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="SysTrendCard">
|
|
|
+ import * as echarts from 'echarts'
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getEcharts1()
|
|
|
+ getEcharts2()
|
|
|
+ getEcharts3()
|
|
|
+ })
|
|
|
+ const getEcharts1 = () => {
|
|
|
+ let Echarts = echarts.init(document.getElementById('echart1'))
|
|
|
+ const option = {
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ axisPointer: {
|
|
|
+ type: 'cross',
|
|
|
+ crossStyle: {
|
|
|
+ color: '#999'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '0',
|
|
|
+ top: '15px',
|
|
|
+ right: '0',
|
|
|
+ bottom: '15px',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: [
|
|
|
+ '00:00-03:00',
|
|
|
+ '03:00-06:00',
|
|
|
+ '06:00-09:00',
|
|
|
+ '09:00-12:00',
|
|
|
+ '12:00-15:00',
|
|
|
+ '15:00-18:00',
|
|
|
+ '18:00-21:00',
|
|
|
+ '21:00-24:00'
|
|
|
+ ],
|
|
|
+
|
|
|
+ axisPointer: {
|
|
|
+ type: 'shadow'
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ //展示角度
|
|
|
+ rotate: 40,
|
|
|
+ color: '#666',
|
|
|
+ show: false // 不显示坐标标签
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: false, // 不显示坐标标签
|
|
|
+ lineStyle: {
|
|
|
+ color: '#ddd'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ minInterval: 1,
|
|
|
+ axisLabel: {
|
|
|
+ show: false // 不显示 y 轴的数值
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ type: 'dashed',
|
|
|
+ color: '#eee'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '报警次数',
|
|
|
+ data: [12, 34, 41, 5, 28, 19, 4, 36],
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: false,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 1,
|
|
|
+ color: '#6c2bfb'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#8249fa'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ // 绘制图表
|
|
|
+ Echarts.setOption(option)
|
|
|
+ // 自适应大小
|
|
|
+ window.onresize = () => {
|
|
|
+ Echarts.resize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const getEcharts2 = () => {
|
|
|
+ let Echarts = echarts.init(document.getElementById('echart2'))
|
|
|
+ const option = {
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ axisPointer: {
|
|
|
+ type: 'cross',
|
|
|
+ crossStyle: {
|
|
|
+ color: '#999'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '0',
|
|
|
+ top: '15px',
|
|
|
+ right: '0',
|
|
|
+ bottom: '15px',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: [
|
|
|
+ '00:00-03:00',
|
|
|
+ '03:00-06:00',
|
|
|
+ '06:00-09:00',
|
|
|
+ '09:00-12:00',
|
|
|
+ '12:00-15:00',
|
|
|
+ '15:00-18:00',
|
|
|
+ '18:00-21:00',
|
|
|
+ '21:00-24:00'
|
|
|
+ ],
|
|
|
+ axisPointer: {
|
|
|
+ type: 'shadow'
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ //展示角度
|
|
|
+ rotate: 40,
|
|
|
+ color: '#666',
|
|
|
+ show: false // 不显示坐标标签
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: false, // 不显示坐标标签
|
|
|
+ lineStyle: {
|
|
|
+ color: '#ddd'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ minInterval: 1,
|
|
|
+ axisLabel: {
|
|
|
+ show: false // 不显示 y 轴的数值
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ type: 'dashed',
|
|
|
+ color: '#eee'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '报警次数',
|
|
|
+ data: [6, 64, 34, 10, 30, 21, 49, 14],
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: false,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 1,
|
|
|
+ color: '#3175fb'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#96b8fa'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ // 绘制图表
|
|
|
+ Echarts.setOption(option)
|
|
|
+ // 自适应大小
|
|
|
+ window.onresize = () => {
|
|
|
+ Echarts.resize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const getEcharts3 = () => {
|
|
|
+ let Echarts = echarts.init(document.getElementById('echart3'))
|
|
|
+ const option = {
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ axisPointer: {
|
|
|
+ type: 'cross',
|
|
|
+ crossStyle: {
|
|
|
+ color: '#999'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '0',
|
|
|
+ top: '15px',
|
|
|
+ right: '0',
|
|
|
+ bottom: '15px',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: [
|
|
|
+ '00:00-03:00',
|
|
|
+ '03:00-06:00',
|
|
|
+ '06:00-09:00',
|
|
|
+ '09:00-12:00',
|
|
|
+ '12:00-15:00',
|
|
|
+ '15:00-18:00',
|
|
|
+ '18:00-21:00',
|
|
|
+ '21:00-24:00'
|
|
|
+ ],
|
|
|
+ axisPointer: {
|
|
|
+ type: 'shadow'
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ //展示角度
|
|
|
+ rotate: 40,
|
|
|
+ color: '#666',
|
|
|
+ show: false // 不显示坐标标签
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: false, // 不显示坐标标签
|
|
|
+ lineStyle: {
|
|
|
+ color: '#ddd'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ minInterval: 1,
|
|
|
+ axisLabel: {
|
|
|
+ show: false // 不显示 y 轴的数值
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ type: 'dashed',
|
|
|
+ color: '#eee'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '报警次数',
|
|
|
+ data: [10, 25, 51, 3, 4, 0, 0, 0],
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: false,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 1,
|
|
|
+ color: '#3ac9a2'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#4ef6f5'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ // 绘制图表
|
|
|
+ Echarts.setOption(option)
|
|
|
+ // 自适应大小
|
|
|
+ window.onresize = () => {
|
|
|
+ Echarts.resize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+ .trend-card {
|
|
|
+ width: 100%;
|
|
|
+ padding: 15px 25px;
|
|
|
+ background: #ffffff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home_count {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .ant-card-body {
|
|
|
+ flex: 1;
|
|
|
+ width: 100%;
|
|
|
+ height: 250px;
|
|
|
+ padding: 0 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-radius: 5px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .card-left {
|
|
|
+ width: 10%;
|
|
|
+ text-align: center;
|
|
|
+ .left-title {
|
|
|
+ padding-top: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-right {
|
|
|
+ width: 90%;
|
|
|
+ height: 100%;
|
|
|
+ .echart {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-card-body:nth-child(5n) {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|