x-humiture.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. },
  42. data() {
  43. return {
  44. current: 0,
  45. loadingMore: true,
  46. pageSize: 10,
  47. currentPage: 1,
  48. tIds: [],
  49. humitureData: [],
  50. loading: ''
  51. }
  52. },
  53. mounted() {
  54. // this.getProbe()
  55. },
  56. methods: {
  57. getlist(num) {
  58. this.currentPage = 1
  59. this.getList(num)
  60. },
  61. getList(tIds) {
  62. this.loadingMore = true;
  63. this.tIds = []
  64. this.tIds.push(tIds)
  65. function methods1(arr) {
  66. return Array.from(new Set(arr));
  67. }
  68. this.tIds = methods1(this.tIds)
  69. let params = {
  70. t_ids: this.tIds,
  71. taskId: this.taskId,
  72. waybillNo: this.waybillNo,
  73. page: this.currentPage,
  74. pageSize: this.pageSize,
  75. }
  76. this.$api.post('/api/waybill-task/data', params).then(res => {
  77. if (res.code == 200) {
  78. const data = res.data.list
  79. if (this.loadingMore == true && data) {
  80. this.humitureData = this.humitureData.concat(data);
  81. }
  82. if (this.humitureData.length < this.pageSize) {
  83. this.loadingMore = true
  84. this.loading = '没有更多了'
  85. } else {
  86. this.loadingMore = false
  87. this.currentPage++
  88. }
  89. }
  90. })
  91. },
  92. sectionChange1(value) {
  93. this.current = value
  94. this.currentPage = 1
  95. this.humitureData = []
  96. const num = this.probeList[value].T_id
  97. this.getList(num)
  98. },
  99. // 滚动加载更多
  100. loadMore() {
  101. this.getList(this.tIds[0]);
  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: 500rpx;
  140. overflow: hidden;
  141. }
  142. </style>