detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view>
  3. <view :class="['info',equipInfo.is_online==1?'on':'off']">
  4. <view class="" @click="copy(equipInfo)">
  5. 设备ID:{{equipInfo.imei||equipInfo.device_id}}
  6. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode="" class="tishi">
  7. </image>
  8. </view>
  9. <view class="">
  10. 设备名称:{{equipInfo.device_name==""?"无":equipInfo.device_name}}
  11. </view>
  12. <view class="">
  13. 设备类型:病虫害可视监测
  14. </view>
  15. <view class="">
  16. 最新上报时间:{{equipInfo.addtime||equipInfo.uptime | timeFormat}}
  17. </view>
  18. <view class="">
  19. 设备地址:{{equipInfo.address}}
  20. </view>
  21. </view>
  22. <view class="caobox">
  23. <view class="caobox_item" v-if="$QueryPermission(187)" @click="tophoto">
  24. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/1.png" mode="widthFix"></image>
  25. <view class="">
  26. 查看图片
  27. </view>
  28. </view>
  29. <view class="caobox_item" v-if="$QueryPermission(181)" @click="tohis">
  30. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/2.png" mode="widthFix"></image>
  31. <view class="">
  32. 历史数据
  33. </view>
  34. </view>
  35. </view>
  36. <view class="realtime">
  37. <view class="realtime_title">
  38. <p>实时数据</p>
  39. </view>
  40. <view class="realtime_text">
  41. <view class="realtime_item">
  42. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/xy2.0/wendu.png" mode=""></image>
  43. <view class="text">
  44. <p>环境温度</p>
  45. <p>{{at}}℃</p>
  46. </view>
  47. </view>
  48. <view class="realtime_item">
  49. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/xy2.0/shidu.png" mode=""></image>
  50. <view class="text">
  51. <p>环境湿度</p>
  52. <p>{{ah}}%RH</p>
  53. </view>
  54. </view>
  55. <view class="realtime_item">
  56. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/icon02.png" mode=""></image>
  57. <view class="text">
  58. <p>开机状态</p>
  59. <p>{{status == 1 ? '开机' : '关机'}}</p>
  60. </view>
  61. </view>
  62. <view class="realtime_item">
  63. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/xy2.0/yujing.png" mode=""></image>
  64. <view class="text">
  65. <p>版本号</p>
  66. <p>{{version}}</p>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. equipInfo: {},
  78. trapnum: 1,
  79. at: "",
  80. ah: "",
  81. status: "",
  82. version: "",
  83. xyErr: "",
  84. xyErrtime: "",
  85. decoytime: "",
  86. yxShow: false,
  87. tiemshow: false,
  88. date: "",
  89. fieldstyle: { //输入框样式
  90. border: "2rpx solid #f6f6f6",
  91. "border-radius": "24px",
  92. "padding-left": "20rpx",
  93. "background-color": "#f6f6f6"
  94. },
  95. tishitext:""
  96. }
  97. },
  98. methods: {
  99. tophoto() {
  100. uni.navigateTo({
  101. url: "./imgList?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id
  102. })
  103. },
  104. tohis() {
  105. uni.navigateTo({
  106. url: "./history?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id
  107. })
  108. },
  109. copy(item) {
  110. console.log(item)
  111. uni.setClipboardData({
  112. data: item.imei || item.device_id,
  113. success: function() {
  114. console.log('success');
  115. }
  116. });
  117. },
  118. async getatah() {
  119. const res = await this.$myRequest({
  120. url: '/api/api_gateway?method=forecast.worm_lamp.color_attract_data',
  121. data: {
  122. device_id: this.equipInfo.imei,
  123. }
  124. })
  125. console.log(res)
  126. if (res) {
  127. this.at = res.at/10
  128. this.ah = res.ah / 10
  129. this.status = res.ds
  130. this.version = res.dver
  131. } else {
  132. this.at = "暂无"
  133. this.ah = "暂无"
  134. }
  135. },
  136. },
  137. onLoad(option) {
  138. var times = new Date()
  139. this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
  140. this.equipInfo = JSON.parse(option.detail);
  141. console.log(this.equipInfo)
  142. this.getatah()
  143. // console.log(this.equipInfo)
  144. // this.getbaseinfo()
  145. },
  146. }
  147. </script>
  148. <style lang='less'>
  149. page {
  150. padding: 20rpx;
  151. box-sizing: border-box;
  152. .info {
  153. padding: 20rpx 40rpx;
  154. color: #fff;
  155. line-height: 50rpx;
  156. font-size: 26rpx;
  157. background-size: 100% auto;
  158. background-repeat: no-repeat;
  159. background-color: #0DC6B6;
  160. background-position: top left;
  161. box-sizing: border-box;
  162. width: 100%;
  163. .tishi {
  164. width: 28rpx;
  165. height: 28rpx;
  166. margin: 0rpx 0 0 20rpx;
  167. }
  168. }
  169. .on {
  170. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png')
  171. }
  172. .off {
  173. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png')
  174. }
  175. .caobox {
  176. display: flex;
  177. flex-wrap: wrap;
  178. text-align: center;
  179. font-size: 28rpx;
  180. color: #666;
  181. line-height: 50rpx;
  182. image {
  183. width: 52rpx;
  184. }
  185. .caobox_item {
  186. padding: 20rpx 0;
  187. box-sizing: border-box;
  188. flex-basis: 25%;
  189. }
  190. }
  191. .realtime {
  192. width: 95%;
  193. margin: 0rpx auto;
  194. .realtime_title {
  195. font-size: 32rpx;
  196. display: flex;
  197. justify-content: space-between;
  198. font-weight: 700;
  199. .span {
  200. color: #6e6c76;
  201. font-size: 24rpx;
  202. display: flex;
  203. justify-content: space-between;
  204. margin-top: 12rpx;
  205. }
  206. }
  207. .realtime_text {
  208. margin-top: 20rpx;
  209. display: flex;
  210. justify-content: space-between;
  211. flex-wrap: wrap;
  212. .realtime_item {
  213. width: 48%;
  214. height: 100rpx;
  215. display: flex;
  216. box-shadow: 0 0 10rpx #bcb9ca;
  217. margin-top: 20rpx;
  218. padding: 20rpx 0;
  219. image {
  220. width: 60rpx;
  221. height: 60rpx;
  222. margin: 20rpx 20rpx 20rpx 40rpx;
  223. }
  224. .text {
  225. padding: 10rpx 0 10rpx 30rpx;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. .btn-box {
  232. text-align: center;
  233. padding: 20rpx 30rpx;
  234. }
  235. /deep/.u-calendar__action {
  236. display: flex;
  237. justify-content: space-around;
  238. .u-calendar__action__text {
  239. line-height: 25px;
  240. }
  241. }
  242. </style>