# 优化表格数据
This commit is contained in:
parent
669cd3dedc
commit
6fb2612469
|
@ -178,6 +178,8 @@ export default {
|
||||||
trendChart: 'Trend chart',
|
trendChart: 'Trend chart',
|
||||||
region: 'Region',
|
region: 'Region',
|
||||||
deviceName: 'Device Name',
|
deviceName: 'Device Name',
|
||||||
humitureChart: 'Humiture chart'
|
humitureChart: 'Humiture chart',
|
||||||
|
temperature: 'Temperature',
|
||||||
|
humidity: 'Humidity'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,8 @@ export default {
|
||||||
trendChart: '趋势图',
|
trendChart: '趋势图',
|
||||||
region: '地区',
|
region: '地区',
|
||||||
deviceName: '设备名称',
|
deviceName: '设备名称',
|
||||||
humitureChart: '温湿度'
|
humitureChart: '温湿度',
|
||||||
|
temperature: '温度',
|
||||||
|
humidity: '湿度'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-show="!showHumiture"
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="deviceLogs"
|
:data="deviceLogs"
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
|
@ -55,14 +56,48 @@
|
||||||
min-width="100">
|
min-width="100">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
|
||||||
class="pagination"
|
<div v-show="!showHumiture" class="pagination-container">
|
||||||
background
|
<el-pagination background
|
||||||
layout="total, prev, pager, next, jumper"
|
:current-page="1"
|
||||||
@current-change="handleCurrentChange"
|
:page-sizes="[10,20,30,50]"
|
||||||
@size-change="handleSizeChange"
|
:page-size="20"
|
||||||
:total="total">
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
</el-pagination>
|
:total="logsTotal" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- humiture table -->
|
||||||
|
<el-table
|
||||||
|
v-show="showHumiture"
|
||||||
|
v-loading="tempLoading"
|
||||||
|
:data="deviceTempTableLogs"
|
||||||
|
style="width: 100%">
|
||||||
|
<el-table-column
|
||||||
|
prop="create_time"
|
||||||
|
:label="$t('counter.date')"
|
||||||
|
min-width="100">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="temperature"
|
||||||
|
:label="$t('counter.temperature')"
|
||||||
|
min-width="80">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="humidity"
|
||||||
|
:label="$t('counter.humidity')"
|
||||||
|
min-width="80">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- humiture paging -->
|
||||||
|
<div v-show="showHumiture" class="pagination-container">
|
||||||
|
<el-pagination background
|
||||||
|
:current-page="1"
|
||||||
|
:page-sizes="[10,20,30,50]"
|
||||||
|
:page-size="20"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="tempTotal" @size-change="handleTempSizeChange" @current-change="handleTempCurrentChange" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -72,12 +107,6 @@ 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'
|
||||||
|
|
||||||
// const defaultLastItem = {
|
|
||||||
// count: '0',
|
|
||||||
// status: '0',
|
|
||||||
// signal: '0',
|
|
||||||
// energy: '0'
|
|
||||||
// }
|
|
||||||
export default {
|
export default {
|
||||||
name: 'deviceDetail',
|
name: 'deviceDetail',
|
||||||
components: {
|
components: {
|
||||||
|
@ -105,10 +134,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
|
tempLoading: true,
|
||||||
deviceLogs: [],
|
deviceLogs: [],
|
||||||
|
deviceTempLogs: [],
|
||||||
|
deviceTempTableLogs: [],
|
||||||
activeName: 'screen',
|
activeName: 'screen',
|
||||||
total: 0,
|
logsTotal: 0,
|
||||||
|
tempTotal: 0,
|
||||||
lastItem: {},
|
lastItem: {},
|
||||||
|
showScreen: true,
|
||||||
showChart: false,
|
showChart: false,
|
||||||
showHumiture: false,
|
showHumiture: false,
|
||||||
flag: false
|
flag: false
|
||||||
|
@ -133,12 +167,18 @@ export default {
|
||||||
this.lineChartData.total.historyData.push(item.total)
|
this.lineChartData.total.historyData.push(item.total)
|
||||||
dateList.push(item.date.substr(5))
|
dateList.push(item.date.substr(5))
|
||||||
})
|
})
|
||||||
this.total = response.data.count
|
|
||||||
this.lineChartData.total.historyData = this.lineChartData.total.historyData.reverse()
|
this.lineChartData.total.historyData = this.lineChartData.total.historyData.reverse()
|
||||||
this.lineChartData.total.xAxis = dateList.reverse()
|
this.lineChartData.total.xAxis = dateList.reverse()
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getDeviceLogsTableHistory(params) {
|
||||||
|
fetchDeviceLogsHistory(params).then(response => {
|
||||||
|
this.deviceLogs = response.data.results
|
||||||
|
this.logsTotal = response.data.count
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
getDeviceTempLog(params) {
|
getDeviceTempLog(params) {
|
||||||
fetchDeviceTempLog(params).then(response => {
|
fetchDeviceTempLog(params).then(response => {
|
||||||
const dateList = []
|
const dateList = []
|
||||||
|
@ -151,7 +191,14 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.HumitureData.total.xAxis = dateList
|
this.HumitureData.total.xAxis = dateList
|
||||||
console.log(this.HumitureData.total)
|
this.tempLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getDeviceTempTableLog(params) {
|
||||||
|
fetchDeviceTempLog(params).then(response => {
|
||||||
|
this.deviceTempTableLogs = response.data.results
|
||||||
|
this.tempTotal = response.data.count
|
||||||
|
this.tempLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDevices(params) {
|
getDevices(params) {
|
||||||
|
@ -164,8 +211,7 @@ export default {
|
||||||
this.$store.dispatch('changeDeviceID', device_id)
|
this.$store.dispatch('changeDeviceID', device_id)
|
||||||
console.log(device_id)
|
console.log(device_id)
|
||||||
}
|
}
|
||||||
// console.log(this.lastItem)
|
this.getDeviceLogsHistory({ device_id, limit: 20 })
|
||||||
this.getDeviceLogsHistory({ device_id })
|
|
||||||
if (typeof (this.lastItem.count) === 'number') {
|
if (typeof (this.lastItem.count) === 'number') {
|
||||||
this.lastItem.count = this.lastItem.count.toString()
|
this.lastItem.count = this.lastItem.count.toString()
|
||||||
}
|
}
|
||||||
|
@ -178,12 +224,22 @@ export default {
|
||||||
handleCurrentChange(page) {
|
handleCurrentChange(page) {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
const device_id = this.$store.getters.deviceID
|
const device_id = this.$store.getters.deviceID
|
||||||
this.getDeviceLogsHistory({ device_id, page })
|
this.getDeviceLogsTableHistory({ device_id, page, limit: 20 })
|
||||||
},
|
},
|
||||||
handleSizeChange(page) {
|
handleSizeChange(page) {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
const device_id = this.$store.getters.deviceID
|
const device_id = this.$store.getters.deviceID
|
||||||
this.getDeviceLogsHistory({ device_id, page })
|
this.getDeviceLogsTableHistory({ device_id, page, limit: 20 })
|
||||||
|
},
|
||||||
|
handleTempCurrentChange(page) {
|
||||||
|
this.tempLoading = true
|
||||||
|
const device_id = this.$store.getters.deviceID
|
||||||
|
this.getDeviceTempTableLog({ device_id, limit: 20, page })
|
||||||
|
},
|
||||||
|
handleTempSizeChange(page) {
|
||||||
|
this.tempLoading = true
|
||||||
|
const device_id = this.$store.getters.deviceID
|
||||||
|
this.getDeviceTempTableLog({ device_id, limit: 20, page })
|
||||||
},
|
},
|
||||||
handleTabClick(tab, event) {
|
handleTabClick(tab, event) {
|
||||||
// console.log(tab, event)
|
// console.log(tab, event)
|
||||||
|
@ -194,12 +250,17 @@ export default {
|
||||||
if (tab.name === 'humiture') {
|
if (tab.name === 'humiture') {
|
||||||
this.showChart = false
|
this.showChart = false
|
||||||
}
|
}
|
||||||
|
if (tab.name === 'screen') {
|
||||||
|
this.showHumiture = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
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.getDeviceLogsTableHistory({ device_id, limit: 20 })
|
||||||
this.getDeviceTempLog({ device_id, last_day: 1, limit: 30 })
|
this.getDeviceTempLog({ device_id, last_day: 1, limit: 30 })
|
||||||
|
this.getDeviceTempTableLog({ device_id, limit: 20 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue