# 优化查询

This commit is contained in:
xianfuxing 2020-06-03 18:01:41 +08:00
parent 2e55a1729d
commit 6121f74334
1 changed files with 14 additions and 3 deletions

View File

@ -133,6 +133,12 @@ export default {
title: ['temperature', 'humidity'] title: ['temperature', 'humidity']
} }
}, },
deviceTempListQuery: {
device_id: undefined,
page: 1,
limit: 20,
ordering: '-create_time'
},
listLoading: true, listLoading: true,
tempLoading: true, tempLoading: true,
deviceLogs: [], deviceLogs: [],
@ -233,13 +239,17 @@ export default {
}, },
handleTempCurrentChange(page) { handleTempCurrentChange(page) {
this.tempLoading = true this.tempLoading = true
this.deviceTempListQuery.page = page
this.deviceTempListQuery.device_id = device_id
const device_id = this.$store.getters.deviceID const device_id = this.$store.getters.deviceID
this.getDeviceTempTableLog({ device_id, limit: 20, page }) this.getDeviceTempTableLog(this.deviceTempListQuery)
}, },
handleTempSizeChange(page) { handleTempSizeChange(page) {
this.tempLoading = true this.tempLoading = true
this.deviceTempListQuery.page = page
this.deviceTempListQuery.device_id = device_id
const device_id = this.$store.getters.deviceID const device_id = this.$store.getters.deviceID
this.getDeviceTempTableLog({ device_id, limit: 20, page }) this.getDeviceTempTableLog(this.deviceTempListQuery)
}, },
handleTabClick(tab, event) { handleTabClick(tab, event) {
// console.log(tab, event) // console.log(tab, event)
@ -257,10 +267,11 @@ export default {
}, },
created() { created() {
const device_id = this.$store.getters.deviceID const device_id = this.$store.getters.deviceID
this.deviceTempListQuery.device_id = device_id
this.getDevices({ device_id }) this.getDevices({ device_id })
this.getDeviceLogsTableHistory({ device_id, limit: 20 }) this.getDeviceLogsTableHistory({ device_id, limit: 20 })
this.getDeviceTempLog({ device_id, last_day: 1, limit: 30 }) this.getDeviceTempLog({ device_id, last_day: 1, limit: 30 })
this.getDeviceTempTableLog({ device_id, limit: 20 }) this.getDeviceTempTableLog(this.deviceTempListQuery)
} }
} }
</script> </script>