x-humiture.vue 3.1 KB

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