# up 温度
This commit is contained in:
parent
c9d28e4cc8
commit
a56751b0b6
|
@ -53,3 +53,13 @@ export function fetchLogStatisticHistory(query) {
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// device temp log statistic api
|
||||||
|
|
||||||
|
export function fetchDeviceTempLog(query) {
|
||||||
|
return request({
|
||||||
|
url: '/api/mosq/temp/',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ export default {
|
||||||
},
|
},
|
||||||
showChart(val) {
|
showChart(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log(val)
|
|
||||||
this.chart.resize()
|
this.chart.resize()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -166,7 +165,6 @@ export default {
|
||||||
},
|
},
|
||||||
initChart() {
|
initChart() {
|
||||||
this.chart = echarts.init(this.$el, 'macarons')
|
this.chart = echarts.init(this.$el, 'macarons')
|
||||||
console.log(this.chartData)
|
|
||||||
// this.setOptions(this.chartData)
|
// this.setOptions(this.chartData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
chartData: {
|
HumitureData: {
|
||||||
type: Object
|
type: Object
|
||||||
},
|
},
|
||||||
showHumiture: {
|
showHumiture: {
|
||||||
|
@ -86,7 +86,7 @@ export default {
|
||||||
this.chart = null
|
this.chart = null
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chartData: {
|
HumitureData: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler(val) {
|
handler(val) {
|
||||||
this.setOptions(val)
|
this.setOptions(val)
|
||||||
|
@ -94,7 +94,6 @@ export default {
|
||||||
},
|
},
|
||||||
showHumiture(val) {
|
showHumiture(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log(val)
|
|
||||||
this.chart.resize()
|
this.chart.resize()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,10 +101,10 @@ export default {
|
||||||
this.screenWidth = val
|
this.screenWidth = val
|
||||||
if (val <= 400) {
|
if (val <= 400) {
|
||||||
this.rotate = 30
|
this.rotate = 30
|
||||||
this.setOptions(this.chartData)
|
this.setOptions(this.HumitureData)
|
||||||
} else {
|
} else {
|
||||||
this.rotate = 0
|
this.rotate = 0
|
||||||
this.setOptions(this.chartData)
|
this.setOptions(this.HumitureData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -166,8 +165,8 @@ export default {
|
||||||
},
|
},
|
||||||
initChart() {
|
initChart() {
|
||||||
this.chart = echarts.init(this.$el, 'macarons')
|
this.chart = echarts.init(this.$el, 'macarons')
|
||||||
console.log(this.chartData)
|
console.log(this.HumitureData)
|
||||||
// this.setOptions(this.chartData)
|
// this.setOptions(this.HumitureData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<el-tab-pane :label="$t('counter.humitureChart')" name="humiture">
|
<el-tab-pane :label="$t('counter.humitureChart')" name="humiture">
|
||||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||||
<humiture
|
<humiture
|
||||||
:chart-data="lineChartData.total"
|
:humiture-data="HumitureData.total"
|
||||||
:showHumiture="showHumiture"
|
:showHumiture="showHumiture"
|
||||||
>
|
>
|
||||||
</humiture>
|
</humiture>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchDeviceList, fetchDeviceLogsHistory } from '@/api/counter'
|
import { fetchDeviceList, fetchDeviceLogsHistory, fetchDeviceTempLog } from '@/api/counter'
|
||||||
import Screen from './components/screen'
|
import Screen from './components/screen'
|
||||||
import Chart from './components/chart'
|
import Chart from './components/chart'
|
||||||
import Humiture from './components/humiture'
|
import Humiture from './components/humiture'
|
||||||
|
@ -94,6 +94,13 @@ export default {
|
||||||
title: 'Trend'
|
title: 'Trend'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
HumitureData: {
|
||||||
|
total: {
|
||||||
|
historyData: [],
|
||||||
|
xAxis: [],
|
||||||
|
title: 'Humiture'
|
||||||
|
}
|
||||||
|
},
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
deviceLogs: [],
|
deviceLogs: [],
|
||||||
activeName: 'screen',
|
activeName: 'screen',
|
||||||
|
@ -129,6 +136,20 @@ export default {
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getDeviceTempLog(params) {
|
||||||
|
fetchDeviceTempLog(params).then(response => {
|
||||||
|
const dateList = []
|
||||||
|
this.deviceTempLogs = response.data.results
|
||||||
|
this.deviceTempLogs.forEach((item, index) => {
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
this.HumitureData.total.historyData.push(item.temperature)
|
||||||
|
dateList.push(item.last_time.substr(11, 5))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.HumitureData.total.xAxis = dateList
|
||||||
|
console.log(this.HumitureData.total)
|
||||||
|
})
|
||||||
|
},
|
||||||
getDevices(params) {
|
getDevices(params) {
|
||||||
let device_id = params.device_id
|
let device_id = params.device_id
|
||||||
fetchDeviceList(params).then(response => {
|
fetchDeviceList(params).then(response => {
|
||||||
|
@ -174,6 +195,7 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
const device_id = this.$store.getters.deviceID
|
const device_id = this.$store.getters.deviceID
|
||||||
this.getDevices({ device_id })
|
this.getDevices({ device_id })
|
||||||
|
this.getDeviceTempLog({ device_id, last_day: 1, limit: 30 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue