detail.vue 6.9 KB

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