独墅湖高教创新区危化品智慧管控平台(新危化品)
马宇豪
2025-04-22 91f2640c8919e7cbe41c8c437e4f7fd60345e062
src/views/hazardousChemicals/bigScreen/components/midBottom.vue
@@ -6,12 +6,29 @@
<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;
@@ -31,7 +48,7 @@
    ],
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      data: data.map(i=>i.day) || [],
      axisLabel:{
        color: '#fff'
      },
@@ -60,7 +77,7 @@
    ],
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        data: data.map(i=>i.count) || [],
        type: 'line',
        label:{
          show: true,