x-humiture.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view style="width: 100%;">
  3. <view class="sub_card" v-if="probeList.length > 0">
  4. <u-subsection :list="probeList" :current="current" keyName="T_name" @change="sectionChange1"></u-subsection>
  5. </view>
  6. <view class="card_humiture border_humiture" v-if="humitureData.length > 0">
  7. <view class="headline_item w_wsd">温度(°C)</view>
  8. <view class="headline_item w_wsd">湿度(Rh)</view>
  9. <view class="headline_item w_time">时间</view>
  10. </view>
  11. <view class="card_record" v-if="humitureData.length > 0">
  12. <scroll-view class="scroll-view" scroll-y="true" @scrolltolower="loadMore">
  13. <view class="card_humiture" v-for="(item,index) in humitureData" :key="index">
  14. <view class="title_item w_wsd">{{item.T_t || ''}}</view>
  15. <view class="title_item w_wsd">{{item.T_rh || ''}}</view>
  16. <view class="title_item w_time">{{item.T_time || ''}}</view>
  17. </view>
  18. </scroll-view>
  19. </view>
  20. <view v-else style="padding: 30rpx 0rpx;">
  21. <u-empty mode="data" text="暂无温湿度记录"></u-empty>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'Xhumiture',
  28. props: {
  29. probeList: {
  30. type: Array,
  31. default: () => [],
  32. },
  33. waybillNo: {
  34. type: String,
  35. default: () => '',
  36. },
  37. taskId: {
  38. type: Number,
  39. default: () => null,
  40. },
  41. startTime: {
  42. type: String,
  43. default: () => '',
  44. },
  45. endTime: {
  46. type: String,
  47. default: () => '',
  48. },
  49. },
  50. data() {
  51. return {
  52. current: 0,
  53. loadingMore: true,
  54. pageSize: 10,
  55. currentPage: 1,
  56. tIds: [],
  57. humitureData: [],
  58. loading: ''
  59. }
  60. },
  61. mounted() {
  62. // this.getProbe()
  63. },
  64. methods: {
  65. getlistil(num) {
  66. this.currentPage = 1
  67. this.getList(num)
  68. },
  69. getList(tIds) {
  70. this.loadingMore = true;
  71. this.tIds = []
  72. this.tIds.push(tIds)
  73. function methods1(arr) {
  74. return Array.from(new Set(arr));
  75. }
  76. this.tIds = methods1(this.tIds)
  77. let params = {
  78. t_ids: this.tIds,
  79. taskId: this.taskId,
  80. waybillNo: this.waybillNo,
  81. page: this.currentPage,
  82. pageSize: this.pageSize,
  83. startTime: this.startTime,
  84. endTime: this.endTime,
  85. }
  86. this.$api.post('/api/waybill-task/data', params).then(res => {
  87. if (res.code == 200) {
  88. const data = res.data.list
  89. if (this.loadingMore == true && data) {
  90. this.humitureData = this.humitureData.concat(data);
  91. }
  92. if (this.humitureData.length < this.pageSize) {
  93. this.loadingMore = true
  94. this.loading = '没有更多了'
  95. } else {
  96. this.loadingMore = false
  97. this.currentPage++
  98. }
  99. }
  100. })
  101. },
  102. sectionChange1(value) {
  103. this.current = value
  104. this.currentPage = 1
  105. this.humitureData = []
  106. const num = this.probeList[value].T_id
  107. this.getList(num)
  108. },
  109. // 滚动加载更多
  110. loadMore() {
  111. this.getList(this.tIds[0]);
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .sub_card {
  118. margin: 0rpx 20rpx 20rpx 20rpx;
  119. }
  120. .card_humiture {
  121. width: 100%;
  122. display: flex;
  123. align-items: center;
  124. padding: 20rpx 0rpx;
  125. margin-bottom: 10rpx;
  126. }
  127. .border_humiture {
  128. border-bottom: 1rpx solid #EBEEF5;
  129. }
  130. .headline_item {
  131. font-size: 30rpx;
  132. font-weight: 600;
  133. }
  134. .title_item {
  135. font-size: 28rpx
  136. }
  137. .w_wsd {
  138. text-align: center;
  139. width: 27%;
  140. }
  141. .w_time {
  142. text-align: center;
  143. width: 46%;
  144. }
  145. .card_record {
  146. margin-bottom: 20rpx;
  147. }
  148. .scroll-view {
  149. max-height: 500rpx;
  150. overflow: hidden;
  151. }
  152. </style>