forecastResult.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="bigBox">
  3. <u-card :show-head="false" margin="0rpx 20rpx" :show-foot="false">
  4. <view class="cardBox" slot="body">
  5. <view class="selecttimes" @click="tiemshow = !tiemshow">
  6. <view class="timesbox">
  7. <image
  8. :src="$imageURL+'/bigdata_app/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
  9. mode=""></image>
  10. <p>{{ initTime ? '出苗期' : begintime }}</p>
  11. <p class="or">~</p>
  12. <p>{{ initTime ? '收获期' : end }}</p>
  13. <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
  14. </view>
  15. <u-calendar v-model="tiemshow" mode="range" @change="tiemchange" range-color="#999"
  16. btn-type="success"
  17. active-bg-color="#0BBC58"
  18. range-bg-color="rgba(11,188,88,0.13)"></u-calendar>
  19. </view>
  20. <view class="empty" v-if="initTime">
  21. 请先选择出苗期和收获期
  22. </view>
  23. <view class="empty" v-else-if="list.length == 0">
  24. 数据为空
  25. </view>
  26. <scroll-view scroll-top="0" scroll-x="true" class="scroll-X" v-else>
  27. <table class="table">
  28. <tr class="tr">
  29. <th class="th" v-for="(value, key) in param" :key="'a' + key">
  30. {{ value }}
  31. </th>
  32. </tr>
  33. <tr class="tr" v-for="(items, indexs) in list" :key="'b' + indexs">
  34. <td class="td" v-for="(value, key) in param">{{ items[key]}}</td>
  35. </tr>
  36. </table>
  37. </scroll-view>
  38. </view>
  39. <view class="" slot="foot"><u-icon name="chat-fill" size="34" color="" label="30评论"></u-icon></view>
  40. </u-card>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. tiemshow: false,
  48. initTime: true,
  49. forecastId:'',
  50. end:'',
  51. begintime:'',
  52. list: [],
  53. param: {
  54. ciDai: '代/次',
  55. sTime: '本次侵染开始时间',
  56. eTime: '本次侵染结束时间',
  57. awsDeg: '本次侵染程度',
  58. awsFen: '本次侵染的分值',
  59. awsYao: '是否使用预报数据',
  60. }
  61. }
  62. },
  63. onLoad(option) {
  64. this.forecastId = option.id;
  65. this.end = parseInt(+new Date() / 1000);
  66. this.begintime = parseInt(this.end - 24 * 60 * 60);
  67. },
  68. methods: {
  69. async histprydatas() {
  70. //表格历史数据
  71. const res = await this.$myRequest({
  72. url: "/api/api_gateway?method=wheat.potato.potato_time",
  73. data: {
  74. device_id: this.forecastId,
  75. start:this.begintime,
  76. end: this.end
  77. },
  78. });
  79. console.log(res);
  80. this.list = res.data.list;
  81. },
  82. tiemchange(e) {
  83. console.log(e);
  84. this.initTime = false;
  85. //切换时间
  86. // this.begintime = parseInt(+new Date(e.startDate) / 1000);
  87. this.begintime = e.startDate;
  88. this.end = e.endDate;
  89. this.histprydatas();
  90. }
  91. }
  92. }
  93. </script>
  94. <style scoped lang="less">
  95. .bigBox {
  96. width: 100vw;
  97. height: calc(100vh - 80rpx);
  98. background: #eee;
  99. box-sizing: border-box;
  100. padding-top: 20rpx;
  101. overflow: hidden;
  102. .cardBox {
  103. height: 75vh;
  104. overflow-y: auto;
  105. padding-top: 20rpx;
  106. .empty{
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. height: calc(100% - 60rpx);
  111. }
  112. .selecttimes {
  113. width: 90%;
  114. box-shadow: 0 0 10rpx #bcb9ca;
  115. padding: 10rpx 20rpx;
  116. box-sizing: border-box;
  117. margin: 0 auto;
  118. font-size: 28rpx;
  119. .timesbox {
  120. display: flex;
  121. justify-content: space-around;
  122. image {
  123. width: 30rpx;
  124. height: 30rpx;
  125. margin-top: 6rpx;
  126. }
  127. .icon {
  128. color: #949494;
  129. text-align: right;
  130. margin-left: 30rpx;
  131. }
  132. }
  133. /deep/.u-calendar__action {
  134. display: flex;
  135. justify-content: space-around;
  136. .u-calendar__action__text {
  137. line-height: 25px;
  138. }
  139. }
  140. }
  141. .scroll-X {
  142. width: 100%;
  143. margin: 20rpx auto;
  144. height: calc(100% - 120rpx);
  145. overflow-y: auto;
  146. .tr {
  147. display: flex;
  148. overflow: hidden;
  149. .th,
  150. .td {
  151. display: inline-block;
  152. padding: 5rpx;
  153. width: 300rpx;
  154. text-align: center;
  155. height: 52rpx;
  156. line-height: 52rpx;
  157. border: 2rpx solid #f1f1f1;
  158. }
  159. }
  160. .tr:nth-child(2n-1) {
  161. background-color: #f5fff8;
  162. }
  163. .tr:first-child {
  164. background-color: #57c878;
  165. color: #fff;
  166. }
  167. }
  168. }
  169. }
  170. </style>