|
@@ -116,19 +116,21 @@
|
|
|
</div>
|
|
|
</article>
|
|
|
<article class="carousel">
|
|
|
- <div class="contianer" v-if="empty[0].length>0">
|
|
|
- <el-carousel height="360px" indicator-position="none" :interval="3000">
|
|
|
+ <div class="contianer" v-if="img1" style="height:480px;width:700px; overflow: hidden;">
|
|
|
+ <!-- <el-carousel height="480px" indicator-position="none" :interval="300000">
|
|
|
<el-carousel-item v-for="(item, index) in empty[0]" :key="index">
|
|
|
<img :src="item" style="width:100%" />
|
|
|
</el-carousel-item>
|
|
|
- </el-carousel>
|
|
|
+ </el-carousel>-->
|
|
|
+ <img :src="img1" style="width:700px" />
|
|
|
</div>
|
|
|
- <div class="contianer" v-if="empty[1].length>0">
|
|
|
- <el-carousel height="360px" indicator-position="none" :interval="3000">
|
|
|
+ <div class="contianer" v-if="img2" style="height:480px;700px; overflow: hidden;">
|
|
|
+ <!-- <el-carousel height="480px" indicator-position="none" :interval="300000">
|
|
|
<el-carousel-item v-for="(item, index) in empty[1]" :key="index">
|
|
|
<img :src="item" style="width:100%" />
|
|
|
</el-carousel-item>
|
|
|
- </el-carousel>
|
|
|
+ </el-carousel>-->
|
|
|
+ <img :src="img2" style="width:700px;" />
|
|
|
</div>
|
|
|
</article>
|
|
|
<article class="charts">
|
|
@@ -216,12 +218,6 @@ import EEleT from "./charts/EEleT";
|
|
|
import EEnvT from "./charts/EEnvT";
|
|
|
import ESowT from "./charts/ESowT";
|
|
|
|
|
|
-import empty1 from "../../../assets/img/empty1.jpg";
|
|
|
-import empty2 from "../../../assets/img/empty2.jpg";
|
|
|
-import empty3 from "../../../assets/img/empty3.jpg";
|
|
|
-import empty4 from "../../../assets/img/empty4.jpg";
|
|
|
-import empty5 from "../../../assets/img/empty5.jpg";
|
|
|
-
|
|
|
import {
|
|
|
reqBedInfo,
|
|
|
reqPiggyData,
|
|
@@ -276,23 +272,25 @@ export default {
|
|
|
bed: null,
|
|
|
date: "",
|
|
|
format: {
|
|
|
- f1: (percentage) => {
|
|
|
+ f1: percentage => {
|
|
|
return `产仔数:${this.bed.litter.deliverNumber}`;
|
|
|
},
|
|
|
- f2:(percentage) => {
|
|
|
+ f2: percentage => {
|
|
|
return `活仔数:${this.bed.litter.deliverNumber}`;
|
|
|
},
|
|
|
- f3:(percentage) => {
|
|
|
+ f3: percentage => {
|
|
|
return `存活率:${percentage}%`;
|
|
|
},
|
|
|
- f4:(percentage) => {
|
|
|
+ f4: percentage => {
|
|
|
return `预计断奶剩余天数:${30}`;
|
|
|
},
|
|
|
- f5:(percentage) => {
|
|
|
+ f5: percentage => {
|
|
|
return `仔猪日龄:${30}`;
|
|
|
}
|
|
|
},
|
|
|
empty: [[], []],
|
|
|
+ img1: null,
|
|
|
+ img2: null,
|
|
|
isShow: false,
|
|
|
containerT: [],
|
|
|
containertime: [],
|
|
@@ -301,14 +299,21 @@ export default {
|
|
|
animalTemp: [],
|
|
|
battery: [],
|
|
|
piggyData: null,
|
|
|
- imgData: null
|
|
|
+ imgData: null,
|
|
|
+ timer: null
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
//this.$route.query.id bed.litter.mother.earTagNo
|
|
|
this.getDeliveryTable(this.$route.query.code);
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ //this.getPiggyData(this.bed.deviceId, this.bed.deviceCh);
|
|
|
+ this.getDeliveryTable(this.$route.query.code);
|
|
|
+ }, 1000 * 30);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.timer)
|
|
|
},
|
|
|
- beforeDestroy() {},
|
|
|
methods: {
|
|
|
getDeliveryTable(code) {
|
|
|
let data = { code };
|
|
@@ -338,11 +343,15 @@ export default {
|
|
|
this.animalTemp = [];
|
|
|
this.battery = [];
|
|
|
res.content.forEach(item => {
|
|
|
- this.time.unshift(item.time);
|
|
|
- this.envTemp.unshift(item.envTemp);
|
|
|
- this.animalTemp.unshift(item.animalTemp);
|
|
|
- this.battery.unshift(item.battery * 100);
|
|
|
+ this.time.push(item.time);
|
|
|
+ this.envTemp.push(item.envTemp);
|
|
|
+ this.animalTemp.push(item.animalTemp);
|
|
|
+ this.battery.push(item.battery * 100);
|
|
|
});
|
|
|
+ this.time.reverse()
|
|
|
+ this.envTemp.reverse()
|
|
|
+ this.animalTemp.reverse()
|
|
|
+ this.battery.reverse()
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.error(err);
|
|
@@ -358,30 +367,34 @@ export default {
|
|
|
if (this.piggyData.length > 0) {
|
|
|
this.containerT = [];
|
|
|
this.containertime = [];
|
|
|
+ //加载一张图片
|
|
|
+ this.loadImage(this.piggyData[0]);
|
|
|
for (let i = 0; i < this.piggyData.length; i++) {
|
|
|
- this.loadImage(this.piggyData[i], i);
|
|
|
+ // this.loadImage(this.piggyData[i], i);
|
|
|
//
|
|
|
- this.containerT.unshift(this.piggyData[i].temp);
|
|
|
- this.containertime.unshift(
|
|
|
+ this.containerT.push(this.piggyData[i].temp);
|
|
|
+ this.containertime.push(
|
|
|
this.piggyData[i].created
|
|
|
);
|
|
|
}
|
|
|
+ this.containerT.reverse()
|
|
|
+ this.containertime.reverse()
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.error(err);
|
|
|
});
|
|
|
},
|
|
|
- loadImage(piggydata, y) {
|
|
|
+ loadImage(piggydata) {
|
|
|
//每个有两个图片
|
|
|
let file1 = piggydata.file1;
|
|
|
let ai1 = JSON.parse(piggydata.aiData1);
|
|
|
- this.drawImage(file1, ai1, 0, y);
|
|
|
+ this.drawImage(file1, ai1, 1);
|
|
|
let file2 = piggydata.file2;
|
|
|
let ai2 = JSON.parse(piggydata.aiData2);
|
|
|
- this.drawImage(file2, ai2, 1, y);
|
|
|
+ this.drawImage(file2, ai2, 2);
|
|
|
},
|
|
|
- drawImage(file, ai, x, y) {
|
|
|
+ drawImage(file, ai, x) {
|
|
|
//x一维,y二维
|
|
|
let canvas = new fabric.Canvas(file);
|
|
|
canvas.clear();
|
|
@@ -407,7 +420,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
let tmp = canvas.toDataURL("image/png");
|
|
|
- this.empty[x][y] = tmp;
|
|
|
+ if (x === 1) this.$set(this, "img1", tmp);
|
|
|
+ else this.$set(this, "img2", tmp);
|
|
|
+ // this.empty[x][y] = tmp;
|
|
|
this.$forceUpdate();
|
|
|
};
|
|
|
img.crossOrigin = "Anonymous";
|
|
@@ -503,7 +518,7 @@ export default {
|
|
|
margin: 30px;
|
|
|
> div {
|
|
|
width: 700px;
|
|
|
- height: 400px;
|
|
|
+ height: 500px;
|
|
|
// border: 1px solid #00f;
|
|
|
}
|
|
|
}
|