|
@@ -32,25 +32,25 @@
|
|
|
</div>
|
|
|
<!-- 左上循环滑动 -->
|
|
|
<div class="left-top-content">
|
|
|
- <swiper style="height: 600px; margin-top: auto; margin-bottom: auto;" class="swiper" :options="swiperOption">
|
|
|
- <swiper-slide v-for="item in 10" :key="item">
|
|
|
- <swiper-content :list="swiperData"></swiper-content>
|
|
|
+ <swiper style="height: 600px; margin-top: auto; margin-bottom: auto;" ref="mySwiper" class="swiper" :options="swiperOption">
|
|
|
+ <swiper-slide v-for="item in swiperData" :key="item.roomId">
|
|
|
+ <swiper-content @getRoomId="getRoomId" :list="item" @onLeave="onLeave" @onEnter="onEnter"></swiper-content>
|
|
|
</swiper-slide>
|
|
|
</swiper>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="left-middle">
|
|
|
- <chart-board
|
|
|
- :title="'单元用水量'"
|
|
|
- :ifDate="true"
|
|
|
+ <chart-board
|
|
|
+ :title=" roomName + '用水量'"
|
|
|
+ :ifDate="true"
|
|
|
@emitDates="getWaterDates">
|
|
|
<chart-line :data="waterData" :id="1"></chart-line>
|
|
|
</chart-board>
|
|
|
</div>
|
|
|
<div class="left-bottom">
|
|
|
- <chart-board
|
|
|
- :title="'整栋用电量'"
|
|
|
- :ifDate="true"
|
|
|
+ <chart-board
|
|
|
+ :title=" roomName + '整栋用电量'"
|
|
|
+ :ifDate="true"
|
|
|
@emitDates="getElecDates">
|
|
|
<chart-line-and :data="waterData" :id="2"></chart-line-and>
|
|
|
</chart-board>
|
|
@@ -63,17 +63,17 @@
|
|
|
</div>
|
|
|
<div class="right-bottom">
|
|
|
<div class="right-bottom-left">
|
|
|
- <chart-board
|
|
|
- :title="'单元用水量'"
|
|
|
+ <chart-board
|
|
|
+ :title=" roomName + '温度'"
|
|
|
@emitDates="getWaterDates">
|
|
|
- <chart-line :data="waterData" :id="4"></chart-line>
|
|
|
+ <chart-line :data="tempData" :id="4"></chart-line>
|
|
|
</chart-board>
|
|
|
</div>
|
|
|
<div class="right-bottom-right">
|
|
|
- <chart-board
|
|
|
- :title="'单元用水量'"
|
|
|
+ <chart-board
|
|
|
+ :title=" roomName +'湿度'"
|
|
|
@emitDates="getWaterDates">
|
|
|
- <chart-line :data="waterData" :id="5"></chart-line>
|
|
|
+ <chart-line :data="rhData" :id="5"></chart-line>
|
|
|
</chart-board>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -90,6 +90,8 @@ 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} from "@/utils/api";
|
|
|
+import { timeDate, Debounce } from "@/utils";
|
|
|
|
|
|
export default {
|
|
|
name: "Zoology",
|
|
@@ -117,46 +119,15 @@ export default {
|
|
|
{ id: 8, name: '1111111' },
|
|
|
],
|
|
|
swiperOption: { // 左上 —— 循环滑动
|
|
|
- direction: 'vertical',
|
|
|
- slidesPerView: 3,
|
|
|
- slidesPerColumn: 1,
|
|
|
- slidesPerGroup: 3,
|
|
|
- // spaceBetween: 30,
|
|
|
+ slidesPerView: 4,
|
|
|
autoplay: {
|
|
|
delay: 3000,
|
|
|
- disableOnInteraction: false
|
|
|
+ stopOnLastSlide: true,
|
|
|
+ disableOnInteraction: true
|
|
|
},
|
|
|
- // pagination: {
|
|
|
- // el: '.swiper-pagination',
|
|
|
- // clickable: true
|
|
|
- // }
|
|
|
+ loop: true,
|
|
|
},
|
|
|
- swiperData: [
|
|
|
- {
|
|
|
- id: '121',
|
|
|
- title: '育肥1栋1单元',
|
|
|
- temp: 31.5,
|
|
|
- rh: 81
|
|
|
- },
|
|
|
- {
|
|
|
- id: '121a',
|
|
|
- title: '育肥1栋1单元',
|
|
|
- temp: 31.5,
|
|
|
- rh: 84
|
|
|
- },
|
|
|
- {
|
|
|
- id: '121s',
|
|
|
- title: '育肥1栋1单元',
|
|
|
- temp: 31.5,
|
|
|
- rh: 81
|
|
|
- },
|
|
|
- {
|
|
|
- id: '121d',
|
|
|
- title: '育肥1栋1单元',
|
|
|
- temp: 31.5,
|
|
|
- rh: 81
|
|
|
- }
|
|
|
- ],
|
|
|
+ swiperData: [],
|
|
|
waterDates: [], // 用水量模拟
|
|
|
waterData: { // 左中 —— 模拟数据
|
|
|
xAxisName: '',
|
|
@@ -164,10 +135,35 @@ export default {
|
|
|
yAxisName: '吨',
|
|
|
yAxisData: [37.1, 37.4, 36.8, 37.9, 34.2]
|
|
|
},
|
|
|
+ tempData: {
|
|
|
+ xAxisName: '',
|
|
|
+ xAxisData: [],
|
|
|
+ yAxisName: '℃',
|
|
|
+ yAxisData: [],
|
|
|
+ },
|
|
|
+ rhData: {
|
|
|
+ xAxisName: '',
|
|
|
+ xAxisData: [],
|
|
|
+ yAxisName: 'RH',
|
|
|
+ yAxisData: [],
|
|
|
+ },
|
|
|
+ roomName: '',
|
|
|
elecDates: [] // 用电量时间
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ swipers() {
|
|
|
+ return this.$refs.mySwiper.swiper;
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ getEnv({}).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.swiperData = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
leftTopSelect() { // 左上角的选择是否显示
|
|
|
this.leftTopSelected = !this.leftTopSelected
|
|
|
},
|
|
@@ -176,8 +172,80 @@ export default {
|
|
|
},
|
|
|
getElecDates(value) { // 左下 获取时间
|
|
|
this.elecDates = value
|
|
|
- }
|
|
|
+ },
|
|
|
+ getRoomId: Debounce(function(id) {
|
|
|
+ let params = {
|
|
|
+ roomId: id,
|
|
|
+ endDate: timeDate(new Date().getTime()),
|
|
|
+ type: 1
|
|
|
+ }
|
|
|
+ getByRoom(params).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.setTempAndRh(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let params1 = {
|
|
|
+ roomId: id,
|
|
|
+ endDate: timeDate(new Date().getTime()),
|
|
|
+ type: 2
|
|
|
+ }
|
|
|
+ getListWater(params1).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.setWeather(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }),
|
|
|
+
|
|
|
+ setTempAndRh(data) {
|
|
|
+ this.tempData.xAxisData = [];
|
|
|
+ this.tempData.yAxisData = [];
|
|
|
+ this.rhData.xAxisData = [];
|
|
|
+ this.rhData.yAxisData = [];
|
|
|
+ this.roomName = data.roomName;
|
|
|
+ data.semperatures.forEach(item => {
|
|
|
+ this.tempData.xAxisData.push(item.createTime);
|
|
|
+ this.tempData.yAxisData.push(item.value);
|
|
|
+ })
|
|
|
+ data.humidities.forEach(item => {
|
|
|
+ this.rhData.xAxisData.push(item.createTime);
|
|
|
+ this.rhData.yAxisData.push(item.value);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setWeather(data) {
|
|
|
+ this.waterData.xAxisData = [];
|
|
|
+ this.waterData.yAxisData = [];
|
|
|
+ data.data.forEach(item => {
|
|
|
+ this.waterData.xAxisData.push(item.createTime);
|
|
|
+ this.waterData.yAxisData.push(item.value)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initData() {
|
|
|
+ getByRoom({}).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.setTempAndRh(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let params1 = {
|
|
|
+ endDate: timeDate(new Date().getTime()),
|
|
|
+ type: 2
|
|
|
+ }
|
|
|
+ getListWater(params1).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.setWeather(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onEnter() {
|
|
|
+ this.swipers.autoplay.stop();
|
|
|
+ },
|
|
|
+ onLeave() {
|
|
|
+ this.swipers.autoplay.start();
|
|
|
+ },
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.init()
|
|
|
+ this.initData();
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -324,4 +392,4 @@ export default {
|
|
|
margin-left: 10px;
|
|
|
width: 50%;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|