# up device_id search

This commit is contained in:
xianfuxing 2018-08-19 15:22:33 +08:00
parent d737117b25
commit d7fc6a8585
1 changed files with 34 additions and 18 deletions

View File

@ -1,8 +1,23 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<p class="warn-content"> <el-form :inline="true" :model="DeviceSearchForm" @submit.native.prevent>
无线智能设备信息表 <el-form-item
</p> prop="device_id"
>
<el-input
size="mini"
type="text"
v-model="DeviceSearchForm.device_id"
style="width: 10rem"
auto-complete="off"
@keyup.enter.native="onSubmit"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="onSubmit">提交</el-button>
<el-button size="mini" @click="resetSearch">重置</el-button>
</el-form-item>
</el-form>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="deviceList" :data="deviceList"
@ -65,24 +80,29 @@ export default {
data() { data() {
return { return {
deviceList: [], deviceList: [],
listLoading: true listLoading: true,
DeviceSearchForm: {
device_id: null,
status: null
}
} }
}, },
methods: { methods: {
getDevices() { getDevices(params) {
fetchDeviceList().then(response => { fetchDeviceList(params).then(response => {
this.deviceList = response.data.results this.deviceList = response.data.results
console.log(this.deviceList) console.log(this.deviceList)
this.listLoading = false this.listLoading = false
}) })
},
onSubmit() {
const device_id = this.DeviceSearchForm.device_id
this.getDevices({ device_id })
},
resetSearch() {
this.DeviceSearchForm.device_id = ''
this.getDevices()
} }
// handleStatusStyle({ row, column, rowIndex, columnIndex }) {
// if (rowIndex === 1 && columnIndex === 1) {
// return 'color: #67C23A'
// } else {
// return ''
// }
// }
}, },
created() { created() {
this.getDevices() this.getDevices()
@ -94,10 +114,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.device-online { .search-input {
color: #67C23A
}
.device-offline {
color: #F56C6C
} }
</style> </style>