x-humiture.vue 3.6 KB

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