| | |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import {onMounted} from "vue"; |
| | | import {getCompanyMessage, getDailywarningCount} from "@/api/monitor/screenCharts"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | onMounted(()=>{ |
| | | initChart() |
| | | getList() |
| | | |
| | | }) |
| | | |
| | | const initChart =()=>{ |
| | | |
| | | const getList = async () => { |
| | | const res = await getDailywarningCount() |
| | | if(res.code == 200){ |
| | | if(res.data && Array.isArray(res.data) && res.data.length>0){ |
| | | initChart(res.data) |
| | | }else{ |
| | | initChart([]) |
| | | } |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const initChart =(data)=>{ |
| | | var chartDom = document.getElementById('preWarning'); |
| | | var myChart = echarts.init(chartDom); |
| | | var option; |
| | |
| | | ], |
| | | xAxis: { |
| | | type: 'category', |
| | | data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], |
| | | data: data.map(i=>i.day) || [], |
| | | axisLabel:{ |
| | | color: '#fff' |
| | | }, |
| | |
| | | ], |
| | | series: [ |
| | | { |
| | | data: [150, 230, 224, 218, 135, 147, 260], |
| | | data: data.map(i=>i.count) || [], |
| | | type: 'line', |
| | | label:{ |
| | | show: true, |