|
@@ -28,12 +28,21 @@
|
|
|
class="date-picker"
|
|
|
></el-date-picker>
|
|
|
<article v-if="temperatureData || humidityData">
|
|
|
- <chart-a v-if="temperatureData" :data="temperatureData" :time="temperatureTime" class="charts"></chart-a>
|
|
|
+ <chart-a
|
|
|
+ v-if="temperatureData"
|
|
|
+ :data="temperatureData"
|
|
|
+ :time="temperatureTime"
|
|
|
+ class="charts"
|
|
|
+ ></chart-a>
|
|
|
<p v-else class="hint">当前时间段无温度数据...</p>
|
|
|
- <chart-b v-if="humidityData" :data="humidityData" :time="humidityTime" class="charts"></chart-b>
|
|
|
+ <chart-b
|
|
|
+ v-if="humidityData"
|
|
|
+ :data="humidityData"
|
|
|
+ :time="humidityTime"
|
|
|
+ class="charts"
|
|
|
+ ></chart-b>
|
|
|
<p v-else class="hint">当前时间段无温度数据...</p>
|
|
|
</article>
|
|
|
-
|
|
|
</section>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -111,8 +120,8 @@ export default {
|
|
|
|
|
|
pickerOptions,
|
|
|
value2: null,
|
|
|
- SData: Math.floor((new Date().getTime() - 3600 * 1000 * 6) / 1000), // 默认最近六小时
|
|
|
- EData: Math.ceil(new Date().getTime() / 1000)
|
|
|
+ SDate: Math.floor((new Date().getTime() - 3600 * 1000 * 6) / 1000), // 默认最近六小时
|
|
|
+ EDate: Math.ceil(new Date().getTime() / 1000)
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -128,9 +137,9 @@ export default {
|
|
|
// 事件选择器值改变
|
|
|
pickerChange(value) {
|
|
|
console.log(value);
|
|
|
- this.SData = Math.floor(new Date(value[0]).getTime() / 1000);
|
|
|
- this.EData = Math.ceil(new Date(value[1]).getTime() / 1000);
|
|
|
- console.log(this.SData, this.EData);
|
|
|
+ this.SDate = Math.floor(new Date(value[0]).getTime() / 1000);
|
|
|
+ this.EDate = Math.ceil(new Date(value[1]).getTime() / 1000);
|
|
|
+ console.log(this.SDate, this.EDate);
|
|
|
this.getHumitureList(1);
|
|
|
this.getHumitureList(2);
|
|
|
},
|
|
@@ -140,19 +149,26 @@ export default {
|
|
|
this.fetch({
|
|
|
api: "/analyse/hm/device/history/by-device-id",
|
|
|
method: "GET",
|
|
|
- data: { deviceId: this.mainInfo.id, type, date: "2020-07-20" },
|
|
|
+ data: {
|
|
|
+ deviceId: this.mainInfo.id,
|
|
|
+ type,
|
|
|
+ fromDate: this.SDate,
|
|
|
+ toDate: this.EDate,
|
|
|
+ page: 1,
|
|
|
+ size: 10000
|
|
|
+ },
|
|
|
// data: { deviceId: 666, type },
|
|
|
success: res => {
|
|
|
console.log(res);
|
|
|
console.log(type);
|
|
|
if (type == 1) {
|
|
|
- res.forEach(item => {
|
|
|
+ res.content.forEach(item => {
|
|
|
this.temperatureData.push(item.value);
|
|
|
this.temperatureTime.push(item.created);
|
|
|
});
|
|
|
console.log(this.temperature);
|
|
|
} else if (type == 2) {
|
|
|
- res.forEach(item => {
|
|
|
+ res.content.forEach(item => {
|
|
|
this.humidityData.push(item.value);
|
|
|
this.humidityTime.push(item.created);
|
|
|
});
|