Ver código fonte

生物安防

xsh 3 anos atrás
pai
commit
a313327547

+ 0 - 132
public/static/weather/index.html

@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Document</title>
-    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
-    <script src="./js/echarts.min.js"></script>
-    <style>
-        #echarts-weather {
-            width: 800px;
-            height: 400px;
-        }
-    </style>
-</head>
-<body style="margin: 0; text-align: center">
-    <div id="he-plugin-standard" style="margin: 0 auto"></div>
-    <div id="echarts-weather"></div>
-<script>
-    WIDGET = {
-        "CONFIG": {
-            "layout": "1",
-            "width": "800",
-            "height": "400",
-            "background": "1",
-            "dataColor": "FFFFFF",
-            "textAlign": 'center',
-            "borderRadius": "0",
-            "key": "bfab9d72ee5d4719a5e96fb50436c396"
-        }
-    }
-    let farmId = localStorage.getItem('lastFarmId');
-    const token = localStorage.getItem('accessToken');
-    var myChart = echarts.init(document.getElementById('echarts-weather'))
-    let options = {
-      title: {
-        text: '未来24小时温度变化',
-        left: 'center',
-        color: '#fff',
-        textStyle : {
-          color: '#fff'
-        }
-      },
-      tooltip: {
-        trigger: 'axis',
-      },
-      color: ['#FFFFFF'],
-      xAxis: [
-        {
-          type: 'category',
-          data: [],
-          axisPointer: {
-            type: 'shadow'
-          },
-          axisLine: {
-            show: false,
-            lineStyle: {
-              color: '#fff',
-            }
-          },
-          axisTick:{
-            show:false
-          },
-        }
-      ],
-      yAxis: [
-        {
-          type: 'value',
-          axisLabel: {
-            formatter: '{value}℃'
-          },
-          axisLine: {
-            show: false,
-            lineStyle: {
-              color: '#fff',
-            }
-          },
-          axisTick:{
-            show:false
-          },
-        }
-      ],
-      series: [
-        {
-          name: '温度',
-          type: 'line',
-          // stack: 'Total',
-          smooth: true,
-          areaStyle: {},
-          emphasis: {
-            focus: 'series'
-          },
-          itemStyle : {
-            color: '#fff',
-            borderColor: '#fff',
-            normal: {
-              label : {
-                show: true,
-                textStyle: {
-                  fontSize: 14
-                }
-              }
-            }
-          },
-          data: []
-        }
-      ]
-    }
-    $.ajax({
-      url: `http://120.27.234.126:8010/produce/weather/info?farmId=${farmId}`,
-      type: 'POST',
-      headers: {
-        accessToken: token
-      },
-      success: function(res) {
-        if(res.code === 10000) {
-          options.series[0].data = res.data.tempList;
-          let arr = [];
-          res.data.timeList.forEach(item => {
-            arr.push(item.substring(5, 16))
-          })
-          options.xAxis[0].data = arr;
-          myChart.setOption(options)
-        }
-      }
-    })
-</script>
-<script src="https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0"></script>
-</body>
-</html>
-

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 12
public/static/weather/js/echarts.min.js


BIN
src/assets/Home/diwen.png


BIN
src/assets/Home/gaowen.png


BIN
src/assets/Home/shandian.png


BIN
src/assets/weather/wu.png


+ 17 - 0
src/utils/api.js

@@ -370,4 +370,21 @@ export function getUid(data) {
   })
 }
 
+/** 用料 **/
+export function getFodder(data) {
+  return axios({
+    url: '/env/sysFodder/getFodder',
+    method: 'post',
+    data: data
+  })
+}
+
+/** 天气预报报警 **/
+export function InfoWeater(data) {
+  return axios({
+    url: '/produce/threshold/listWarningInfoWeater',
+    method: 'post',
+    data: data
+  })
+}
 

+ 2 - 1
src/views/Alarm/Alarm.vue

@@ -86,7 +86,7 @@
             <div class="alarm-title-right"></div>
           </div>
           <div class="alarm-content">
-            <chart-pie v-if="pieData.length > 0" :id="'1'" :data="pieData"></chart-pie>
+            <chart-pie v-if="pieData.length > 0" :text="'今日事件总量'" :id="'1'" :data="pieData"></chart-pie>
             <div v-else style="line-height: 250px; text-align: center; width: 100%; font-size: 18px; color: white;">暂无数据</div>
           </div>
         </div>
@@ -470,6 +470,7 @@ export default {
               this.barData.salvProValue.push(item.value);
             })
             this.pieData = res.data;
+            console.log(this.pieData);
           }
           this.pieLoading = false;
         } else {

+ 20 - 15
src/views/Alarm/chart/ChartPie.vue

@@ -16,22 +16,26 @@ export default {
       type: String,
       default: () => '0'
     },
+    text: {
+      type: String,
+      default: () => '今日报警总量'
+    },
     data: {
       type: Array,
       default: () => []
     }
   },
   watch: {
-    data: {
-      handler(newVal) {
-        if(newVal) {
-          console.log('watch')
-          this.myChart.clear()
-          this.init();
-        }
-      },
-      deep: true
-    }
+    // data: {
+    //   handler(newVal) {
+    //     if(newVal) {
+    //       console.log('watch')
+    //       this.myChart.clear()
+    //       this.init();
+    //     }
+    //   },
+    //   deep: true
+    // }
   },
   methods: {
     init() {
@@ -137,18 +141,18 @@ export default {
         graphic: [
           {
             type: 'text',
-            left: '22%',
-            top: '43%',
+            left: '20%',
+            top: '45%',
             style: {
-              text: '今日报警总量',
+              text: this.text,
               fontSize: 15,
               fill: 'rgb(192, 188, 189)'
             }
           },
           {
             type: 'text',
-            left: '22%',
-            top: '53%',
+            left: '21%',
+            top: '55%',
             style: {
               text: num + '条',
               fontSize: 22,
@@ -330,6 +334,7 @@ export default {
     window.addEventListener("resize", function () {
       that.myChart.resize()
     })
+    this.init();
   },
   beforeDestroy() {
     clearInterval(this.timer1);

+ 2 - 2
src/views/Environment/Environment.vue

@@ -67,7 +67,7 @@
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.8)">
-        <pro-board :title="'污水'">
+        <pro-board :title="'污水流量'">
           <div class="env-side-item-content">
             <chart-dashboard :id="5" :data="liuData"></chart-dashboard>
           </div>
@@ -127,7 +127,7 @@ export default {
       liuData: {
         data: 0,
         splitNumber: 12,
-        max: 0.6,
+        max: 12,
         unit: 'L/s'
       },
       nhData: {

+ 1 - 1
src/views/Home/Home.vue

@@ -203,7 +203,7 @@
           <div class="case-title">ph</div>
           <div class="case-content">
             <div class="case-two">
-              <span><strong class="sign">{{envList.ph ? envList.ph : '设备暂无数据'}}</strong>{{envList.ph ? 'mg/L' : ''}}</span>
+              <span><strong class="sign">{{envList.ph ? envList.ph : '设备暂无数据'}}</strong></span>
             </div>
           </div>
         </div>

+ 121 - 0
src/views/Home/chart/chartWeather.vue

@@ -0,0 +1,121 @@
+<template>
+  <div id="chartWeather"></div>
+</template>
+
+<script>
+export default {
+  name: "chartWeather",
+  data() {
+    return {
+      myChart: null
+    }
+  },
+  props: {
+    data: {
+      type: Array,
+      default: () => [[], []]
+    }
+  },
+  methods: {
+    init() {
+      let time = [];
+      this.data[0].forEach(item => {
+        time.push(item.slice(5, 12))
+      })
+      let options = {
+        title: {
+          text: '未来24小时气温',
+          left: 'center',
+          textStyle: {
+            color: '#fff'
+          }
+        },
+        tooltip: {
+          trigger: 'axis',
+        },
+        color: ['#49e3e3'],
+        // dataZoom: [{
+        //   type: 'inside',
+        //   startValue: start,
+        //   endValue: end,
+        //   show: false
+        //
+        // }],
+        xAxis: [
+          {
+            type: 'category',
+            data: time,
+            axisPointer: {
+              type: 'shadow'
+            },
+            axisLine: {
+              show: false,
+              lineStyle: {
+                color: '#fff',
+              }
+            },
+            axisTick:{
+              show:false
+            },
+          }
+        ],
+        yAxis: [
+          {
+            type: 'value',
+            name: '温度统计',
+            axisLabel: {
+              formatter: '{value} ℃'
+            },
+            axisLine: {
+              show: false,
+              lineStyle: {
+                color: '#fff',
+              }
+            },
+            axisTick:{
+              show:false
+            },
+          }
+        ],
+        series: [
+          {
+            name: '水量',
+            type: 'line',
+            // stack: 'Total',
+            smooth: true,
+            areaStyle: {},
+            emphasis: {
+              focus: 'series'
+            },
+            itemStyle : {
+              color: '#49e3e3',
+              borderColor: '#49e3e3',
+              normal: {
+                label : {
+                  show: true,
+                  textStyle: {
+                    fontSize: 14
+                  }
+                }
+              }
+            },
+            data: this.data[1]
+          }
+        ]
+      }
+      this.myChart.setOption(options)
+    }
+  },
+  mounted() {
+    this.myChart = this.$echarts.init(document.getElementById('chartWeather'));
+    this.init()
+  }
+}
+</script>
+
+<style scoped>
+ #chartWeather {
+   width: 100%;
+   height: 100%;
+ }
+</style>

+ 173 - 47
src/views/MainLayout.vue

@@ -1,9 +1,9 @@
 <template>
-  <div class="MainLayout">
+  <div class="MainLayout" @click="showWeather = false">
     <div class="main-title">{{title}}</div>
     <div class="main-left">
       <!--  天气    -->
-      <div v-show="isHome" class="main-home" @click="showWeather = true">
+      <div v-show="isHome" class="main-home" @click.stop="showWeather = true">
         <div class="weatherBox" v-if="Object.keys(weather).length !== 0">
           <div class="box-left">
             <i class="qing" v-if="weather.day_weather === '晴'"></i>
@@ -16,7 +16,8 @@
             <i class="xxue" v-else-if="weather.day_weather === '小雪'"></i>
             <i class="zxue" v-else-if="weather.day_weather === '中雪'"></i>
             <i class="dxue" v-else-if="weather.day_weather === '大雪'"></i>
-            <i class="bxue" v-else-if="weather.day_weather === '暴学'"></i>
+            <i class="bxue" v-else-if="weather.day_weather === '暴雪'"></i>
+            <i class="wu" v-else-if="weather.day_weather === '雾'"></i>
           </div>
           <div class="box-right">
             <p class="fontSize">{{weather.day_weather}}</p>
@@ -29,71 +30,72 @@
       <div v-show="!isHome" class="main-back" @click="back">首页</div>
     </div>
     <div class="main-right">
-      <!-- 时间     -->
-<!--      <div v-show="isHome" class="main-time">-->
-<!--        <div v-if="Object.keys(weatherInfo).length !== 0">111</div>-->
-<!--      </div>-->
-<!--      &lt;!&ndash;  天气    &ndash;&gt;-->
-<!--      <div v-show="!isHome" class="main-home" @click="showWeather = true">-->
-<!--        <div class="weatherBox" v-if="Object.keys(weather).length !== 0">-->
-<!--          <div class="box-left">-->
-<!--            <i class="qing" v-if="weather.day_weather === '晴'"></i>-->
-<!--            <i class="duoyun" v-else-if="weather.day_weather === '多云'"></i>-->
-<!--            <i class="yin" v-else-if="weather.day_weather === '阴'"></i>-->
-<!--            <i class="xiaoyu" v-else-if="weather.day_weather === '小雨'"></i>-->
-<!--            <i class="zyu" v-else-if="weather.day_weather === '中雨'"></i>-->
-<!--            <i class="dyu" v-else-if="weather.day_weather === '大雨'"></i>-->
-<!--            <i class="byu" v-else-if="weather.day_weather === '暴雨'"></i>-->
-<!--            <i class="xxue" v-else-if="weather.day_weather === '小雪'"></i>-->
-<!--            <i class="zxue" v-else-if="weather.day_weather === '中雪'"></i>-->
-<!--            <i class="dxue" v-else-if="weather.day_weather === '大雪'"></i>-->
-<!--            <i class="bxue" v-else-if="weather.day_weather === '暴学'"></i>-->
-<!--          </div>-->
-<!--          <div class="box-right">-->
-<!--            <p class="fontSize">{{weather.day_weather}}</p>-->
-<!--            <p class="fontSize">{{weather.min_degree}}-{{weather.max_degree}}℃</p>-->
-<!--          </div>-->
-<!--        </div>-->
-<!--        <div v-else @click="refresh">抓取天气数据失败,请重试</div>-->
-<!--      </div>-->
+      <i class="maxTem" v-if="alarm.maxTem" @click="openShow(0)"></i>
+      <i class="minTem" v-if="alarm.minTem" @click="openShow(1)"></i>
+      <i class="shan" v-if="Object.keys(weatherInfo).length > 0" @click="openShow(2)"></i>
     </div>
     <div class="time" v-show="isHome">{{currentTime}}</div>
-    <div class="main-bottom">青莲食品</div>
+    <div class="main-bottom">
+      <p style="margin: 0">青莲食品</p>
+      <p style="font-size: 12px; margin: 0; color: #fff; opacity: 0.4">本软件由杭州慧牧提供技术支持</p>
+    </div>
     <div class="content">
       <router-view></router-view>
     </div>
     <transition :name=" isHome ? 'moveL' : 'moveR' ">
       <div id="weather" :class="[isHome ? 'weather1' : 'weather2']" v-if="showWeather">
-        <div style="text-align: left">
-          <i class="el-icon-back" style="font-size: 24px; color: #fff; cursor: pointer" @click="showWeather = false"></i>
+        <h2 style="color:white;">{{getFarmName()}}</h2>
+        <div class="weatherList">
+          <div class="grid">
+            <div class="grid-title">今天</div>
+            <div class="grid-content">当前天气:{{weather.day_weather}}</div>
+            <div class="grid-content">当前气温:{{weather.degree}}℃</div>
+            <div class="grid-content">最低温度:{{weather.min_degree}}℃</div>
+            <div class="grid-content">最高温度:{{weather.max_degree}}℃</div>
+          </div>
+          <div class="grid">
+            <div class="grid-title">明天</div>
+            <div class="grid-content">当天天气:{{weather.tomorrow.day_weather}}</div>
+            <div class="grid-content">最低温度:{{weather.tomorrow.min_degree}}℃</div>
+            <div class="grid-content">最高温度:{{weather.tomorrow.max_degree}}℃</div>
+          </div>
+          <div class="grid">
+            <div class="grid-title">后天</div>
+            <div class="grid-content">当天天气:{{weather.towTomorrow.day_weather}}</div>
+            <div class="grid-content">最低温度:{{weather.towTomorrow.min_degree}}℃</div>
+            <div class="grid-content">最高温度:{{weather.towTomorrow.max_degree}}℃</div>
+          </div>
+        </div>
+        <div class="chart">
+          <chart-weather :data="weatherList"></chart-weather>
         </div>
-        <iframe style="width: 800px; height: 800px; z-index: 9999" src="static/weather/index.html" frameborder="0"></iframe>
       </div>
     </transition>
-<!--    <div class="bio-dialog" v-show="isShow" @click="isShow = false">-->
-<!--      <div class="dialog-content">-->
-<!--        <h2>牧场列表</h2>-->
-<!--        <div class="div-text" v-for="item in farmList" :key="item.id" @click="jumps(item.url)">{{item.name}}</div>-->
-<!--      </div>-->
-<!--    </div>-->
     <div class="farm">
       <label>当前牧场:</label>
       <el-select @change="onChange" v-model="farmId" size="mini" style="width: 150px;">
         <el-option v-for="item in getFarmList" :key="item.id" :label="item.farmName" :value="item.id"></el-option>
       </el-select>
     </div>
+    <div class="alarm" v-show="alarmType">
+      <p style="color: white">{{alarmList[active]}}</p>
+      <p style="color: white">{{str}}</p>
+    </div>
   </div>
 </template>
 
 <script>
-import {getFarmId, getWeather, findUpdate} from "@/utils/api";
+import {getFarmId, getWeather, findUpdate, InfoWeater} from "@/utils/api";
 import { mapActions, mapState } from 'vuex';
 import { Select } from "element-ui";
+import chartWeather from "@/views/Home/chart/chartWeather";
 
 export default {
   name: "MainLayout",
   components: {
-    'el-select': Select
+    'el-select': Select,
+    chartWeather
+
   },
   data() {
     return {
@@ -108,6 +110,17 @@ export default {
       xList: [],
       isShow: false,
       getFarmList: [],
+      alarm: {
+        maxTem: false,
+        minTem: false,
+        maxTemStr: '',
+        minTemStr: '',
+      },
+      alarmList: ['高温报警', '低温报警', '恶劣天气报警'],
+      active: 0,
+      str: '',
+      alarmType: false,
+      weatherList: [],
     }
   },
   watch: {
@@ -184,10 +197,20 @@ export default {
     },
     // 刷新拿到数据
     refresh() {
-      getWeather({}).then(res => {
+      getWeather({}).then(async res => {
         if(res.code === 10000) {
           this.weather = res.data;
           this.weatherInfo = JSON.parse(res.data.alarm)
+          this.weatherList = [res.data.timeList, res.data.tempList]
+          let params = {
+            maxTem: res.data.max_degree,
+            minTem: res.data.min_degree
+          }
+          await InfoWeater(params).then(res => {
+            if(res.code === 10000) {
+              this.alarm = res.data;
+            }
+          })
         }
       })
     },
@@ -206,6 +229,29 @@ export default {
         location.reload();
       }, 100)
     },
+    openShow(num) {
+      this.active = num;
+      this.alarmType = true;
+      if(num === 0) {
+        this.str = this.alarm.maxTemStr;
+      } else if(num === 1) {
+        this.str = this.alarm.minTemStr
+      } else {
+        this.str = '';
+      }
+      setTimeout(() => {
+        this.alarmType = false;
+      }, 5000)
+    },
+    getFarmName() {
+      let str = '';
+      this.farmList.forEach(item => {
+        if(item.id === this.farmId) {
+          str = item.farmName
+        }
+      })
+      return str
+    }
   },
   mounted() {
     this.init()
@@ -266,8 +312,8 @@ export default {
     width: 180px;
     height: 40px;
     position: absolute;
-    top: 15px;
-    right: 150px;
+    top: 0;
+    right: 125px;
   }
   .main-home {
     width: 100%;
@@ -286,7 +332,7 @@ export default {
     height: 50px;
     /*background-color: red;*/
     position: absolute;
-    line-height: 50px;
+    /*line-height: 50px;*/
     color: #66FFFF;
     font-size: 24px;
     font-weight: 600;
@@ -305,7 +351,7 @@ export default {
     cursor: pointer;
   }
   #weather {
-    background-color: rgba(0, 0, 0, .5);
+    background-color: rgba(0, 0, 0, .8);
     position: absolute;
     width: 800px;
     height: 800px;
@@ -442,6 +488,13 @@ export default {
     background: url("../assets/weather/baoxue.png") no-repeat;
     background-size: 100% 100%;
   }
+  .wu {
+    width: 100%;
+    height: 100%;
+    display: inline-block;
+    background: url("../assets/weather/wu.png") no-repeat;
+    background-size: 100% 100%;
+  }
   .time {
     position: absolute;
     bottom: 35px;
@@ -501,4 +554,77 @@ export default {
     color: #fff;
     font-size: 16px;
   }
+  .maxTem {
+    display: inline-block;
+    width: 24px;
+    height: 24px;
+    background: url('../assets/Home/gaowen.png');
+    background-size: contain;
+    margin-top: 10px;
+    cursor: pointer;
+  }
+  .minTem {
+    display: inline-block;
+    width: 24px;
+    height: 24px;
+    background: url('../assets/Home/diwen.png');
+    background-size: contain;
+    margin-top: 10px;
+    cursor: pointer;
+  }
+  .shan {
+    display: inline-block;
+    width: 24px;
+    height: 24px;
+    background: url('../assets/Home/shandian.png');
+    background-size: contain;
+    margin-top: 10px;
+    cursor: pointer;
+  }
+  .alarm {
+    width: 200px;
+    height: 100px;
+    position: absolute;
+    bottom: 500px;
+    right: 100px;
+    border: 1px solid red;
+    animation: myfirst 1s;
+  }
+  @keyframes myfirst {
+    0% {
+      opacity: 0;
+    }
+    100% {
+      opacity: 1;
+    }
+  }
+  .weatherList {
+    width: 100%;
+    height: 200px;
+    display: grid;
+    grid-template-columns: repeat(3, 1fr);
+    grid-template-rows: 1fr;
+    grid-column-gap: 0;
+    grid-row-gap: 0;
+  }
+  .grid {
+    width: 100%;
+    height: 100%;
+    color: white;
+  }
+  .grid-title {
+    line-height: 50px;
+    font-size: 24px;
+  }
+  .grid-content {
+    box-sizing: border-box;
+    line-height: 30px;
+    font-size: 16px;
+    text-align: left;
+    padding-left: 80px;
+  }
+  .chart {
+    width: 100%;
+    height: calc(100% - 250px);
+  }
 </style>

+ 1 - 1
src/views/Production/board/ProBoard.vue

@@ -76,7 +76,7 @@ export default {
   background-size: 100% 100%;
   line-height: 26px;
   color: white;
-  font-size: 16px;
+  font-size: 12px;
 }
 .title-right {
   width: 325px;

+ 58 - 13
src/views/Zoology/Zoology.vue

@@ -96,18 +96,34 @@
         </chart-board>
       </div>
       <div class="left-bottom">
-        <chart-board
-          :title="roomName + '整栋用电量' "
-          :ifDate="true"
-          @emitDates="getElecDates"
-        >
-          <template v-if="elecData.yAxisData.length > 0">
-            <chart-line-and :data="elecData" :id="2"></chart-line-and>
-          </template>
-          <template v-else>
-            <div style="font-size: 18px; line-height: 150px; color: white">暂无数据</div>
-          </template>
-        </chart-board>
+        <div class="flex-center">
+          <chart-board
+            :title="'整栋用电量'"
+            :ifDate="true"
+            @emitDates="getElecDates"
+          >
+            <template v-if="elecData.yAxisData.length > 0">
+              <chart-line-and :data="elecData" :id="2"></chart-line-and>
+            </template>
+            <template v-else>
+              <div style="font-size: 18px; line-height: 150px; color: white">暂无数据</div>
+            </template>
+          </chart-board>
+        </div>
+        <div class="flex-center">
+          <chart-board
+            :title="'整栋本周用料量'"
+            :ifDate="true"
+            @emitDates="getElecDates"
+          >
+            <template v-if="fodderData.yAxisData.length > 0">
+              <chart-line :data="fodderData" :id="2"></chart-line>
+            </template>
+            <template v-else>
+              <div style="font-size: 18px; line-height: 150px; color: white">暂无数据</div>
+            </template>
+          </chart-board>
+        </div>
       </div>
     </div>
 
@@ -177,7 +193,7 @@ import SwiperContent from "./leftTop/SwiperContent.vue";
 import ChartBoard from "./charts/ChartBoard.vue";
 import ChartLine from "./charts/ChartLine.vue";
 import ChartLineAnd from "./charts/ChartLineAnd.vue";
-import {getEnv, getByRoom, getListWater, getRoomVideo, getLastVideo, getSchool, getByFloor, getUid} from "@/utils/api";
+import {getEnv, getByRoom, getListWater, getRoomVideo, getLastVideo, getSchool, getByFloor, getUid, getFodder} from "@/utils/api";
 import { timeDate, Debounce } from "@/utils";
 import { Form, FormItem ,Select } from "element-ui";
 
@@ -247,6 +263,12 @@ export default {
         yAxisName: "KW/h",
         yAxisData: [],
       },
+      fodderData: {
+        xAxisName: "饲料",
+        xAxisData: [],
+        yAxisName: 'Kg',
+        yAxisData: [],
+      },
       roomName: "",
       elecDates: [], // 用电量时间
       isVideo: false,
@@ -414,8 +436,26 @@ export default {
         this.unitList = res.data;
       });
     },
+    setFodder(data) {
+      this.fodderData.xAxisData = [];
+      this.fodderData.yAxisData = [];
+      data.fodderList.forEach(item => {
+        this.fodderData.xAxisData.push(item.createTime);
+        this.fodderData.yAxisData.push(item.value);
+      })
+    },
     handUnit(val) {
       this.getRoomId(val);
+      let params1 = {
+        endDate: timeDate(new Date().getTime()),
+        floorId: this.schoolId,
+        type: 1
+      }
+      getFodder(params1).then(res => {
+        if(res.code === 10000) {
+          this.setFodder(res.data)
+        }
+      })
     }
   },
   mounted() {
@@ -541,8 +581,13 @@ export default {
   background-color: rgb(228, 32, 32);
   width: 100%;
   height: 26.3%;
+  display: flex;
 }
 
+.flex-center {
+  width: 50%;
+  height: 100%;
+}
 /** 右边 */
 .right {
   width: 55%;

+ 14 - 5
src/views/Zoology/charts/ChartLine.vue

@@ -26,18 +26,24 @@ export default {
   },
   methods: {
     init() {
-      console.log('拿到数据了')
-      console.log(this.data)
+      let start = this.data.xAxisData.length - 7;
+      let end = this.data.xAxisData.length - 1;
       let options = {
         tooltip: {
           trigger: "axis",
         },
         grid: {
-          top: "10%",
-          left: "10%",
+          top: "8%",
+          left: "15%",
           bottom: "20%",
           right: "10%",
         },
+        dataZoom: [{
+          type: 'inside',
+          startValue: start,
+          endValue: end,
+          show: false
+        }],
         xAxis: [
           {
             type: "category",
@@ -65,7 +71,7 @@ export default {
         //[
         yAxis: {
           type: "value",
-          name: this.data.yAxisName,
+          // name: this.data.yAxisName,
           nameTextStyle: {
             color: "red",
           },
@@ -101,6 +107,9 @@ export default {
                 lineStyle: {
                   color: "#3aa0ff",
                 },
+                label: {
+                  show: true,
+                }
               },
             },
           },