# bug fixed, 添加device logs hisory api

This commit is contained in:
xianfuxing 2018-09-24 21:45:46 +08:00
parent 781960bf17
commit be79586a4d
2 changed files with 14 additions and 5 deletions

View File

@ -9,8 +9,17 @@ export function fetchDeviceList(query) {
}) })
} }
// device log api // device log list api
export function fetchDeviceLogs(query) { export function fetchDeviceLogs(query) {
return request({
url: '/api/counter/logs/',
method: 'get',
params: query
})
}
// device logs history api
export function fetchDeviceLogsHistory(query) {
return request({ return request({
url: '/api/counter/device/logs/history/', url: '/api/counter/device/logs/history/',
method: 'get', method: 'get',

View File

@ -58,7 +58,7 @@
</template> </template>
<script> <script>
import { fetchDeviceList, fetchDeviceLogs } from '@/api/counter' import { fetchDeviceList, fetchDeviceLogsHistory } from '@/api/counter'
import Screen from './components/screen' import Screen from './components/screen'
import Chart from './components/chart' import Chart from './components/chart'
@ -100,8 +100,8 @@ export default {
} }
}, },
methods: { methods: {
getDeviceLogs(params) { getDeviceLogsHistory(params) {
fetchDeviceLogs(params).then(response => { fetchDeviceLogsHistory(params).then(response => {
const dateList = [] const dateList = []
this.deviceLogs = response.data.results this.deviceLogs = response.data.results
this.deviceLogs.forEach((item, index) => { this.deviceLogs.forEach((item, index) => {
@ -142,7 +142,7 @@ export default {
}, },
created() { created() {
const device_id = this.$store.getters.deviceID const device_id = this.$store.getters.deviceID
this.getDeviceLogs({ device_id }) this.getDeviceLogsHistory({ device_id })
this.getDevices({ device_id }) this.getDevices({ device_id })
} }
} }