|
@@ -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) {
|