diff --git a/src/views/counter/detail.vue b/src/views/counter/detail.vue
index 970f55c..2dbbf50 100644
--- a/src/views/counter/detail.vue
+++ b/src/views/counter/detail.vue
@@ -9,8 +9,16 @@
v-if="flag"
>
- 配置管理
+
+
+
+
+
+
+
import { fetchDeviceList, fetchDeviceLogs } from '@/api/counter'
import Screen from './components/screen'
+import Chart from './components/chart'
export default {
name: 'deviceDetail',
components: {
- Screen
+ Screen,
+ Chart
},
data() {
return {
+ lineChartData: {
+ total: {
+ historyData: [],
+ xAxis: [],
+ title: 'Trend'
+ }
+ },
listLoading: true,
deviceLogs: [],
activeName: 'screen',
total: 0,
lastItem: {},
status: 0,
+ showChat: false,
flag: false
}
},
+ // watch: {
+ // activeName(val) {
+ // if (val === 'chart') {
+ // this.showChat = true
+ // }
+ // }
+ // },
methods: {
getDeviceLogs(params) {
fetchDeviceLogs(params).then(response => {
+ const dateList = []
this.deviceLogs = response.data.results
+ this.deviceLogs.forEach((item, index) => {
+ this.lineChartData.total.historyData.push(item.mosq_count)
+ dateList.push(item.calc_time.substr(11))
+ })
this.total = response.data.count
+ this.lineChartData.total.xAxis = dateList.reverse()
this.listLoading = false
this.lastItem = this.deviceLogs[0]
this.flag = true
@@ -111,7 +142,7 @@ export default {
this.getDeviceLogs({ device_id, page })
},
handleTabClick(tab, event) {
- console.log(tab, event)
+ // console.log(tab, event)
}
},
created() {