equipmentdetails.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <view style="position: fixed;z-index: 100;width: 100%;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
  7. </view>
  8. <view class="info">
  9. <view class="info_item">
  10. <image :src="eqinfo.item.device_status==1?'../../static/image/cb/onBg.png':'../../static/image/cb/offBg.png'" mode=""
  11. class="bgi"></image>
  12. <p style="font-size: 32rpx;">设备 ID:{{eqinfo.item.imei}}</p>
  13. <p>设备名称:{{eqinfo.item.device_name}}</p>
  14. <p>设备型号:{{eqinfo.item.dtype}}</p>
  15. <p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
  16. <p>设备地址:{{eqinfo.item.address}}</p>
  17. </view>
  18. </view>
  19. <view class="control">
  20. <view class="control_item" @click="control">
  21. <image src="../../static/image/prevention/8.png" mode=""></image>
  22. <p>设备控制</p>
  23. </view>
  24. <view class="control_item" @click="charts">
  25. <image src="../../static/image/prevention/9.png" mode=""></image>
  26. <p>历史数据</p>
  27. </view>
  28. <view class="control_item" @click="sim">
  29. <image src="../../static/image/prevention/10.png" mode=""></image>
  30. <p>SIM卡详情</p>
  31. </view>
  32. </view>
  33. <view class="realtime">
  34. <p class="realtime_title">实时数据</p>
  35. <view class="realtime_text">
  36. <view class="realtime_text_item">
  37. <view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
  38. <view class="item_info_img">
  39. <image :src="item.icon" mode=""></image>
  40. </view>
  41. <view class="item_info_text">
  42. <p>{{item.txt}}</p>
  43. <p style="margin-top: 20rpx;">{{item.value}}</p>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. eqinfo: {},
  57. olddata: {},
  58. olddatas: [],
  59. }
  60. },
  61. methods: {
  62. modification() {
  63. this.olddatas = [{
  64. icon: '../../static/image/cb/icon02.png',
  65. txt: '设备开关',
  66. value: this.olddata.ds == 1 ? '在线' : '离线',
  67. },
  68. {
  69. icon: '../../static/image/cb/icon05.png',
  70. txt: '工作状态',
  71. value: this.olddata.ws == 1 ? "工作" : "待机"
  72. },
  73. {
  74. icon: '../../static/image/prevention/44.png',
  75. txt: '电击次数',
  76. value: this.olddata.ct
  77. },
  78. {
  79. icon: '../../static/image/prevention/33.png',
  80. txt: '定时时长',
  81. value: Math.abs(this.olddata.et - this.olddata.st)
  82. }, {
  83. icon: '../../static/image/cb/icon08.png',
  84. txt: '环境温度(℃)',
  85. value: this.olddata.at
  86. }, {
  87. icon: '../../static/image/cb/icon07.png',
  88. txt: '环境湿度(%)',
  89. value: this.olddata.ah
  90. }, {
  91. icon: '../../static/image/cb/icon16.png',
  92. txt: '信号强度',
  93. value: this.olddata.csq
  94. }, {
  95. icon: '../../static/image/prevention/100.png',
  96. txt: '清虫间隔(min)',
  97. value: this.olddata.clt_t
  98. }, {
  99. icon: '../../static/image/prevention/101.png',
  100. txt: '雨控状态',
  101. value: this.olddata.rps == 1 ? "雨控" : '正常'
  102. }, {
  103. icon: '../../static/image/prevention/102.png',
  104. txt: '温控状态',
  105. value: this.olddata.tps == 1 ? "温控" : '正常'
  106. },
  107. {
  108. icon: '../../static/image/prevention/105.png',
  109. txt: '充电电压',
  110. value: this.olddata.cv / 100
  111. },
  112. {
  113. icon: '../../static/image/prevention/106.png',
  114. txt: '电压状态',
  115. value: this.olddata.batStatus == 1 ? "欠压" : '正常'
  116. },
  117. {
  118. icon: '../../static/image/prevention/107.png',
  119. txt: '纬度',
  120. value: this.olddata.lat
  121. },
  122. {
  123. icon: '../../static/image/prevention/108.png',
  124. txt: '经度',
  125. value: this.olddata.lng
  126. }
  127. ]
  128. },
  129. async history() { //设备列表
  130. const res = await this.$myRequest({
  131. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  132. data: {
  133. device_type_id: 2,
  134. device_id: this.eqinfo.item.imei
  135. }
  136. })
  137. this.olddata = res.data[0].d_h_t
  138. console.log(this.olddata)
  139. this.modification()
  140. },
  141. clickLeft() {
  142. uni.navigateBack({
  143. delta: 1
  144. })
  145. },
  146. sim() {
  147. // sim卡详情
  148. uni.navigateTo({
  149. url:"./sim?id="+this.eqinfo.item.d_id
  150. })
  151. // uni.showToast({
  152. // title: '此功能暂未开放',
  153. // duration: 2000,
  154. // icon: "none"
  155. // });
  156. },
  157. control() { //设备控制
  158. uni.navigateTo({
  159. url: "./control?id=" + this.eqinfo.item.d_id
  160. })
  161. },
  162. charts() { //历史数据
  163. uni.navigateTo({
  164. url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
  165. })
  166. }
  167. },
  168. onLoad(option) {
  169. this.$forceUpdate()
  170. this.eqinfo.item = JSON.parse(option.shebei)
  171. console.log(JSON.parse(option.shebei))
  172. this.history()
  173. }
  174. }
  175. </script>
  176. <style lang="scss">
  177. .info {
  178. width: 100%;
  179. position: absolute;
  180. top: 44px;
  181. .info_item {
  182. width: 90%;
  183. margin: 0 auto;
  184. height: 260rpx;
  185. padding: 26rpx 50rpx;
  186. position: relative;
  187. box-sizing: border-box;
  188. .bgi {
  189. width: 100%;
  190. height: 260rpx;
  191. position: absolute;
  192. top: 0;
  193. left: 0;
  194. z-index: -1;
  195. }
  196. p {
  197. font-size: 24rpx;
  198. color: #FFFFFF;
  199. margin-bottom: 10rpx;
  200. }
  201. }
  202. }
  203. .control {
  204. width: 90%;
  205. position: absolute;
  206. top: 372rpx;
  207. left: 5%;
  208. display: flex;
  209. justify-content: space-between;
  210. text-align: center;
  211. padding: 0 30rpx;
  212. box-sizing: border-box;
  213. .control_item {
  214. width: 120rpx;
  215. height: 120rpx;
  216. image {
  217. width: 70rpx;
  218. height: 70rpx;
  219. }
  220. p {
  221. font-size: 24rpx;
  222. }
  223. }
  224. }
  225. .realtime {
  226. width: 100%;
  227. position: absolute;
  228. top: 500rpx;
  229. .realtime_title {
  230. font-weight: 700;
  231. width: 90%;
  232. margin: 0 auto;
  233. }
  234. .realtime_text {
  235. width: 90%;
  236. margin: 0 auto;
  237. .realtime_text_item {
  238. width: 100%;
  239. display: flex;
  240. justify-content: space-between;
  241. flex-wrap: wrap;
  242. margin-bottom: 50rpx;
  243. .realtime_text_item_info {
  244. width: 48%;
  245. box-shadow: 0 0 10rpx #bcb9ca;
  246. margin-top: 20rpx;
  247. display: flex;
  248. padding: 20rpx 20rpx;
  249. box-sizing: border-box;
  250. .item_info_img {
  251. width: 30%;
  252. text-align: center;
  253. margin-right: 30rpx;
  254. image {
  255. width: 64rpx;
  256. height: 64rpx;
  257. margin-top: 10rpx;
  258. }
  259. }
  260. .item_info_text {
  261. font-size: 24rpx;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. </style>