Data24.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div>
  3. <el-breadcrumb separator-class="el-icon-arrow-right">
  4. <el-breadcrumb-item>环境监测系统</el-breadcrumb-item>
  5. <el-breadcrumb-item :to="{ path: '/index/envi' }">环境监测</el-breadcrumb-item>
  6. <el-breadcrumb-item>24小时数据</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <el-card class="box-card">
  9. <el-table :data="data24" stripe style="width: 100%">
  10. <el-table-column prop="e" label="传感器通道"></el-table-column>
  11. <el-table-column prop="name" label="通道名称"></el-table-column>
  12. <el-table-column prop="min" label="最小值"></el-table-column>
  13. <el-table-column prop="mintime" label="最小时间">
  14. <template v-if="scope.row.mintime" slot-scope="scope">{{scope.row.mintime*1000 | formatTime}}</template>
  15. </el-table-column>
  16. <el-table-column prop="max" label="最大值"></el-table-column>
  17. <el-table-column prop="maxtime" label="最大时间">
  18. <template v-if="scope.row.maxtime" slot-scope="scope">{{scope.row.maxtime*1000 | formatTime}}</template>
  19. </el-table-column>
  20. </el-table>
  21. <el-pagination background layout="prev, pager, next" :total="0"></el-pagination>
  22. </el-card>
  23. </div>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. //24小时数据
  30. data24: [],
  31. id: this.$route.params.id
  32. }
  33. },
  34. mounted() {
  35. this.get24List(this.id)
  36. },
  37. methods: {
  38. // 24小时数据
  39. get24List(id) {
  40. this.$axios({
  41. method: 'POST',
  42. url: '/api/api_gateway?method=weather.weather.qxz_day_data',
  43. data: this.qs.stringify({ device_id: id })
  44. }).then((res) => {
  45. let arr = new Array()
  46. let conf = res.data.data.conf
  47. let data = res.data.data.data
  48. if (conf && data && data.length > 0) {
  49. for (let i = 1; i < 31; i++) {
  50. for (let i1 in conf) {
  51. if (i == i1.slice(1)) {
  52. let obj = {}
  53. if (conf[i1]) {
  54. obj.e = i1
  55. let arr1 = conf[i1].split('#')
  56. obj.name = `${arr1[0]}(${arr1[1]})`
  57. if (data) {
  58. for (let item of data) {
  59. if (item.ekey == i1) {
  60. obj.min = item.min
  61. obj.mintime = item.mintime
  62. obj.max = item.max
  63. obj.maxtime = item.maxtime
  64. }
  65. }
  66. arr.push({
  67. e: obj.e,
  68. name: obj.name,
  69. min: obj.min,
  70. mintime:obj.mintime,
  71. max: obj.max,
  72. maxtime:obj.maxtime
  73. })
  74. }
  75. }
  76. }
  77. }
  78. }
  79. this.data24 = arr
  80. } else {
  81. this.data24 = []
  82. }
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang='less' scoped>
  89. </style>