Browse Source

Merge branch 'master' of http://192.168.1.7:3000/xsh1997/hyyfClient

East 3 years ago
parent
commit
b4171aeb16
3 changed files with 90 additions and 34 deletions
  1. 9 0
      src/utils/api.js
  2. 0 1
      src/views/Video/VideoAdmin.vue
  3. 81 33
      src/views/dashboard/dashboard.vue

+ 9 - 0
src/utils/api.js

@@ -596,3 +596,12 @@ export function editEarpFarm(data) {
     data: data
   })
 }
+
+/** 首页报警之类 **/
+export function getListClientHome(data) {
+  return axios({
+    url: 'produce/prodSales/listClientHome',
+    method: 'get',
+    params: data
+  })
+}

+ 0 - 1
src/views/Video/VideoAdmin.vue

@@ -397,7 +397,6 @@ export default {
        getVideo(params).then(res => {
          if(res.code === 10000) {
            this.isVideo = true;
-           // this.cameraTitle = res.data[0].cameraName;
            this.cameraOne = res.data[0].wsUrl;
            this.cameraTwo = res.data[0].rtspUrl;
            this.last = res.data[0].lastId;

+ 81 - 33
src/views/dashboard/dashboard.vue

@@ -2,7 +2,7 @@
   <div class="box">
     <div class="header">
       <el-row :gutter="20">
-        <el-col v-for="(item, i) in iocnList" :key="i" :span="6">
+        <el-col v-for="(item, i) in iconList" :key="i" :span="6">
           <el-card class="box-card">
             <div class="card-flex">
               <div class="flex-left">
@@ -10,7 +10,7 @@
               </div>
               <div class="flex-right">
                 <p :style="{marginBottom: '8px', color: color}">{{item.name}}</p>
-                <p>15</p>
+                <p>{{item.num}}{{item.unit}}</p>
               </div>
             </div>
           </el-card>
@@ -164,9 +164,10 @@ import ChartWsd from "./chart/ChartWsd";
 import ChartDl from'./chart/ChartDl';
 import ChartWater from "./chart/ChartWater";
 import ChartPig from "./chart/ChartPig";
-import { getByFloor, getByRoom, getListWater, getSchool, getUid} from "../../utils/api";
+import {getByFloor, getByRoom, getListClientHome, getListWater, getSchool, getUid} from "../../utils/api";
 import {timeDate} from "../../utils";
 import { getTheSales } from "../../utils/chenApi";
+import axios from 'axios';
 export default {
   name: "dashboard",
   components: {
@@ -179,22 +180,26 @@ export default {
   data() {
     return {
       dialogVisible: false,
-      iocnList: [
+      iconList: [
         {
           icon: 'el-icon-s-order',
-          name: '今日报警总数'
+          name: '今日报警总数',
+          unit: '条'
         },
         {
           icon:  'el-icon-shopping-bag-1',
-          name: '昨日卖猪总数'
+          name: '昨日卖猪总数',
+          unit: '头'
         },
         {
           icon:  'el-icon-coin',
-          name: '昨日出栏总数'
+          name: '昨日卖猪金额',
+          unit: '元'
         },
         {
           icon:   'el-icon-finished',
-          name: '近7天卖猪总数'
+          name: '近7天卖猪总数',
+          unit: '头'
         },
       ],
       elements: [
@@ -295,7 +300,9 @@ export default {
         // }
       ],
       day: 2,
-      TempAndHumList: {},
+      TempAndHumList: {
+        humidities: [],
+      },
       waterList: [],
       waterRoom: '',
       weekWater: 0,
@@ -396,34 +403,75 @@ export default {
       }
     },
     getTempAndHum() {
-      getByRoom({type: 2}).then(res => {
-        if(res.code === 10000) {
-          this.TempAndHumList = res.data;
+      let that = this;
+      axios.all([
+        getListClientHome({}),
+        getByRoom({type: 2}),
+        getListWater({type: 2}),
+        getTheSales({type: 2})
+      ]).then(axios.spread(function(res1, res2, res3, res4) {
+        if(res1.code === 10000) {
+          const { money, quantity, warning, weekQuantity  } = res1.data || {};
+          that.iconList[0].num = warning;
+          that.iconList[1].num = quantity;
+          that.iconList[2].num = money;
+          that.iconList[3].num = weekQuantity
+          // that.incon
         }
-      })
-      getListWater({type: 2}).then(res => {
-        if(res.code === 10000) {
-          this.waterList = res.data.data;
-          this.waterRoom = res.data.room;
-          this.weekWater = res.data.weekWater;
-          this.weekWeekPercent = res.data.weekWeekPercent;
-          this.monthWater = res.data.monthWater;
-          this.monthWeekPercent = res.data.monthWeekPercent;
+        if(res2.code === 10000) {
+          that.TempAndHumList = res2.data;
+          console.log(that.TempAndHumList)
         }
-      })
-      getTheSales({type: 2}).then(res => {
-        if (res.code === 10000) {
-          this.weekSales = res.data.money;
-          this.weekSalesChange = res.data.moneyPercent;
-          this.weekSalesVolume = res.data.quantity;
-          this.weekSalesVolumeChange = res.data.quantityPercent;
-          this.salesChartData = {
-            moneyList: res.data.moneyList,
-            quantityList: res.data.quantityList,
-            timeList: res.data.timeList,
+        if(res3.code === 10000) {
+          that.waterList = res3.data.data;
+          that.waterRoom = res3.data.room;
+          that.weekWater = res3.data.weekWater;
+          that.weekWeekPercent = res3.data.weekWeekPercent;
+          that.monthWater = res3.data.monthWater;
+          that.monthWeekPercent = res3.data.monthWeekPercent;
+        }
+        if (res4.code === 10000) {
+          that.weekSales = res4.data.money;
+          that.weekSalesChange = res4.data.moneyPercent;
+          that.weekSalesVolume = res4.data.quantity;
+          that.weekSalesVolumeChange = res4.data.quantityPercent;
+          that.salesChartData = {
+            moneyList: res4.data.moneyList,
+            quantityList: res4.data.quantityList,
+            timeList: res4.data.timeList,
           };
         }
-      })
+      }))
+      // getListClientHome({}).then(res => {
+      // })
+      // getByRoom({type: 2}).then(res => {
+      //   if(res.code === 10000) {
+      //     this.TempAndHumList = res.data;
+      //   }
+      // })
+      // getListWater({type: 2}).then(res => {
+      //   if(res.code === 10000) {
+      //     this.waterList = res.data.data;
+      //     this.waterRoom = res.data.room;
+      //     this.weekWater = res.data.weekWater;
+      //     this.weekWeekPercent = res.data.weekWeekPercent;
+      //     this.monthWater = res.data.monthWater;
+      //     this.monthWeekPercent = res.data.monthWeekPercent;
+      //   }
+      // })
+      // getTheSales({type: 2}).then(res => {
+      //   if (res.code === 10000) {
+      //     this.weekSales = res.data.money;
+      //     this.weekSalesChange = res.data.moneyPercent;
+      //     this.weekSalesVolume = res.data.quantity;
+      //     this.weekSalesVolumeChange = res.data.quantityPercent;
+      //     this.salesChartData = {
+      //       moneyList: res.data.moneyList,
+      //       quantityList: res.data.quantityList,
+      //       timeList: res.data.timeList,
+      //     };
+      //   }
+      // })
     },
     jump(num) {
       if(num === 1) {