onedaythedata.vue 2.6 KB

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