equipmentdetails.vue 6.2 KB

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