# up history table

This commit is contained in:
xianfuxing 2018-08-14 11:24:14 +08:00
parent 27db1ba5d4
commit 13cfaeba7b
3 changed files with 35 additions and 9 deletions

View File

@ -55,6 +55,7 @@ export default {
getDevices() { getDevices() {
fetchDeviceList().then(response => { fetchDeviceList().then(response => {
this.deviceList = response.data.results this.deviceList = response.data.results
console.log(this.deviceList)
this.listLoading = false this.listLoading = false
}) })
} }

View File

@ -2,10 +2,10 @@
<div> <div>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="deviceList" :data="historyList"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="id" prop="oid"
label="序号" label="序号"
min-width="80"> min-width="80">
</el-table-column> </el-table-column>
@ -24,12 +24,33 @@
</template> </template>
<script> <script>
import { fetchLogStatisticHistory } from '@/api/counter'
export default { export default {
name: 'LogHistoryTable' name: 'LogHistoryTable',
data() {
return {
listLoading: true,
historyList: []
}
},
methods: {
getLogStatisticHistory() {
fetchLogStatisticHistory().then(response => {
this.historyList = response.data.results
this.historyList.forEach((item, index) => {
item.oid = index + 1
})
this.listLoading = false
// console.log(this.historyList)
})
}
},
created() {
this.getLogStatisticHistory()
}
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
</style> </style>

View File

@ -16,7 +16,7 @@
</el-row> </el-row>
<el-row> <el-row>
<log-history-table></log-history-table> <log-history-table :historyList="historyList"></log-history-table>
</el-row> </el-row>
<!-- <el-row :gutter="32"> <!-- <el-row :gutter="32">
@ -63,7 +63,11 @@ import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable' import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList' import TodoList from './components/TodoList'
import BoxCard from './components/BoxCard' import BoxCard from './components/BoxCard'
import { fetchDeviceLogStatistic, fetchDeviceInfoStatistic } from '@/api/counter' import
{
fetchDeviceLogStatistic,
fetchDeviceInfoStatistic
} from '@/api/counter'
const lineChartData = { const lineChartData = {
newVisitis: { newVisitis: {
@ -104,7 +108,9 @@ export default {
totalCount: 0, totalCount: 0,
dailyCount: 0, dailyCount: 0,
onlineCount: 0, onlineCount: 0,
offlineCount: 0 offlineCount: 0,
historyList: [],
historyLoading: true
} }
}, },
methods: { methods: {
@ -116,7 +122,6 @@ export default {
const infoData = response.data const infoData = response.data
this.onlineCount = infoData['online_count'] this.onlineCount = infoData['online_count']
this.offlineCount = infoData['offline_count'] this.offlineCount = infoData['offline_count']
console.log(this.totalCount)
}) })
}, },
getDeviceLogStatistic() { getDeviceLogStatistic() {
@ -124,7 +129,6 @@ export default {
const logData = response.data const logData = response.data
this.totalCount = logData['total_count'] this.totalCount = logData['total_count']
this.dailyCount = logData['daily_count'] this.dailyCount = logData['daily_count']
console.log(this.onlineCount)
}) })
} }
}, },