detail.vue 6.0 KB

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