onedaythedata.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 64px;">
  5. <view style="position: fixed;z-index: 100;width: 100%;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="24小时数据"></uni-nav-bar>
  7. </view>
  8. <view class="nonedata" v-if="olddata.length == 0">
  9. 暂无数据
  10. </view>
  11. <view class="datatimes" v-if="olddata.length != 0">
  12. <view class="datatimes_box" v-for="(item,index) in olddata" :key="index">
  13. <view class="datatimes_title" @click="textshowtf(index)">
  14. <p class="datatimes_title_headline">{{item.ekey}}</p>
  15. <p class="datatimes_title_chunk">{{item.enum[1]+item.enum[2]}}</p>
  16. </view>
  17. <view class="datatimes_text" v-show="textshow[index]">
  18. <view class="datatimes_text_max">
  19. <view class="">
  20. <p>最大值</p>
  21. <p>{{item.max==-99.99?"N/A":item.max}}</p>
  22. </view>
  23. <p>{{item.maxtime|timeFormat()}}</p>
  24. </view>
  25. <view class="datatimes_text_min">
  26. <view class="">
  27. <p>最小值</p>
  28. <p>{{item.min==-99.99?"N/A":item.min}}</p>
  29. </view>
  30. <p>{{item.mintime|timeFormat()}}</p>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. textshow: {},
  43. olddata: {}
  44. }
  45. },
  46. methods: {
  47. async daydatas(data) { //设备列表
  48. const res = await this.$myRequest({
  49. url: '/api/api_gateway?method=weather.weather.qxz_day_data',
  50. data: {
  51. device_id: data
  52. }
  53. })
  54. this.olddata = res.data
  55. for (let i = 0; i < this.olddata.length; i++) {
  56. this.textshow[i] = false
  57. }
  58. },
  59. textshowtf(index) {
  60. this.textshow[index] = !this.textshow[index]
  61. this.$forceUpdate()
  62. },
  63. clickLeft() {
  64. uni.navigateBack({
  65. delta: 1
  66. })
  67. }
  68. },
  69. onLoad(option) {
  70. this.daydatas(option.id)
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .nonedata {
  76. position: absolute;
  77. top: 54px;
  78. width: 90%;
  79. left: 5%;
  80. text-align: center;
  81. font-size: 32rpx;
  82. }
  83. .datatimes {
  84. position: absolute;
  85. top: 54px;
  86. width: 90%;
  87. left: 5%;
  88. .datatimes_box {
  89. margin-bottom: 40rpx;
  90. }
  91. .datatimes_title {
  92. display: flex;
  93. .datatimes_title_headline {
  94. height: 58rpx;
  95. line-height: 58rpx;
  96. }
  97. .datatimes_title_chunk {
  98. box-shadow: 0 0 10rpx #bcb9ca;
  99. margin-left: 50rpx;
  100. width: 90%;
  101. padding: 10rpx;
  102. }
  103. }
  104. .datatimes_text {
  105. width: 88%;
  106. padding-left: 12%;
  107. .datatimes_text_max,
  108. .datatimes_text_min {
  109. display: flex;
  110. width: 100%;
  111. padding: 10rpx;
  112. background-color: #F2F2F2;
  113. margin-top: 20rpx;
  114. font-size: 24rpx;
  115. justify-content: space-between;
  116. align-items: center;
  117. box-sizing: border-box;
  118. }
  119. }
  120. }
  121. </style>