shuifeiL.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view>
  3. <view :class="['info', equipInfo.is_online == 1 ? 'on' : 'off']">
  4. <view class="">
  5. 设备ID:{{ equipInfo.device_id }}
  6. </view>
  7. <view class="">
  8. 设备名称:{{ equipInfo.device_name == "" ? "无" : equipInfo.device_name }}水肥机
  9. </view>
  10. <view class="">
  11. 设备类型:{{ equipInfo.dver_num }}
  12. </view>
  13. <view class="">
  14. 设备地址:{{ equipInfo.city }}
  15. </view>
  16. </view>
  17. <view class="infoText">设备变量</view>
  18. <view class="realtime">
  19. <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
  20. <table class="table">
  21. <tr class="tr">
  22. <th class="th" v-for="(item, index) in thdata" :key="'a' + index">{{ item }}</th>
  23. </tr>
  24. <tr class="tr" v-for="(items, indexs) in statusList" :key="items.d_id" v-if="statusList.length > 0">
  25. <td class="td">{{ items.d_id }}</td>
  26. <td class="td">{{ items.name }}</td>
  27. <td class="td"><u-button type="success" size="mini" @click="goHistory(items)">历史记录</u-button></td>
  28. </tr>
  29. <tr class="tr" v-else>
  30. <td class="td" v-for="item in 4">暂无数据</td>
  31. </tr>
  32. </table>
  33. </scroll-view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. equipInfo: {},
  42. statusList: [],
  43. thdata: [
  44. '变量ID',
  45. '变量名称',
  46. '操作'
  47. ]
  48. }
  49. },
  50. methods: {
  51. copy(item) {
  52. uni.setClipboardData({
  53. data: item.imei || item.device_id,
  54. success: function () {
  55. console.log('success');
  56. }
  57. });
  58. },
  59. goHistory(items) {
  60. uni.navigateTo({
  61. url: `./history?device_id=${items.d_id}&type=${items.types}`
  62. })
  63. },
  64. async geDetail() {
  65. const res = await this.$myRequest({
  66. url: '/api/api_gateway?method=irrigation_system.waterfertilizer.water_fertilizer_list',
  67. data: {
  68. content: this.equipInfo.device_id,
  69. }
  70. })
  71. if (res.data.length > 0) {
  72. this.equipInfo = res.data[0]
  73. }
  74. },
  75. async geList() {
  76. const res = await this.$myRequest({
  77. url: '/api/api_gateway?method=irrigation_system.waterfertilizer.water_fertilizer_data_list',
  78. data: {
  79. device_id: this.equipInfo.device_id,
  80. }
  81. })
  82. if (res.length > 0) {
  83. this.statusList = res
  84. }
  85. },
  86. },
  87. onLoad(option) {
  88. var times = new Date()
  89. this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
  90. this.equipInfo = JSON.parse(option.detail);
  91. this.geDetail()
  92. this.geList()
  93. },
  94. }
  95. </script>
  96. <style lang='less'>
  97. page {
  98. padding: 20rpx;
  99. box-sizing: border-box;
  100. .infoText {
  101. color: #0DC6B6;
  102. }
  103. .info {
  104. padding: 20rpx 40rpx;
  105. color: #fff;
  106. line-height: 50rpx;
  107. font-size: 26rpx;
  108. background-size: 100% auto;
  109. background-repeat: no-repeat;
  110. background-color: #0DC6B6;
  111. background-position: top left;
  112. box-sizing: border-box;
  113. width: 100%;
  114. margin-bottom: 20rpx;
  115. .tishi {
  116. width: 28rpx;
  117. height: 28rpx;
  118. margin: 0rpx 0 0 20rpx;
  119. }
  120. }
  121. .on {
  122. background-image: url('https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cb/onBg.png')
  123. }
  124. .off {
  125. background-image: url('https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cb/offBg.png')
  126. }
  127. .caobox {
  128. display: flex;
  129. flex-wrap: wrap;
  130. text-align: center;
  131. font-size: 28rpx;
  132. color: #666;
  133. line-height: 50rpx;
  134. image {
  135. width: 52rpx;
  136. }
  137. .caobox_item {
  138. padding: 20rpx 0;
  139. box-sizing: border-box;
  140. flex-basis: 25%;
  141. }
  142. }
  143. .realtime {
  144. display: flex;
  145. flex-wrap: wrap;
  146. width: 100%;
  147. box-shadow: 0 0 10rpx #bcb9ca;
  148. margin: 20rpx auto 30rpx;
  149. .scroll-X {
  150. width: 95%;
  151. margin: 20rpx auto;
  152. .tr {
  153. display: flex;
  154. overflow: hidden;
  155. .th,
  156. .td {
  157. display: inline-block;
  158. padding: 5rpx;
  159. width: 300rpx;
  160. text-align: center;
  161. height: 52rpx;
  162. line-height: 52rpx;
  163. border: 2rpx solid #f1f1f1;
  164. }
  165. }
  166. .tr:nth-child(2n-1) {
  167. background-color: #f5fff8;
  168. }
  169. .tr:first-child {
  170. background-color: #57c878;
  171. color: #fff;
  172. }
  173. }
  174. }
  175. }
  176. .btn-box {
  177. text-align: center;
  178. padding: 20rpx 30rpx;
  179. }
  180. /deep/.u-calendar__action {
  181. display: flex;
  182. justify-content: space-around;
  183. .u-calendar__action__text {
  184. line-height: 25px;
  185. }
  186. }
  187. </style>