equipmentdetails.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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
  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. icon: '../../static/image/prevention/104.png',
  108. txt: '灯管状态',
  109. value: this.olddata.lamp == 1 ? "亮" : '灭'
  110. },
  111. {
  112. icon: '../../static/image/prevention/105.png',
  113. txt: '充电电压',
  114. value: this.olddata.cv / 100
  115. },
  116. {
  117. icon: '../../static/image/prevention/106.png',
  118. txt: '电压状态',
  119. value: this.olddata.batStatus == 1 ? "欠压" : '正常'
  120. },
  121. {
  122. icon: '../../static/image/prevention/107.png',
  123. txt: '纬度',
  124. value: this.olddata.lat
  125. },
  126. {
  127. icon: '../../static/image/prevention/108.png',
  128. txt: '经度',
  129. value: this.olddata.lng
  130. }
  131. ]
  132. },
  133. async history() { //设备列表
  134. const res = await this.$myRequest({
  135. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  136. data: {
  137. device_type_id: 2,
  138. device_id: this.eqinfo.item.imei
  139. }
  140. })
  141. this.olddata = res.data[0].d_h_t
  142. console.log(this.olddata)
  143. this.modification()
  144. },
  145. clickLeft() {
  146. uni.navigateBack({
  147. delta: 1
  148. })
  149. },
  150. sim() { //sim卡详情
  151. // uni.navigateTo({
  152. // url:"./sim?id="+this.eqinfo.item.d_id
  153. // })
  154. uni.showToast({
  155. title: '此功能暂未开放',
  156. duration: 2000,
  157. icon: "none"
  158. });
  159. },
  160. control() { //设备控制
  161. uni.navigateTo({
  162. url: "./control?id=" + this.eqinfo.item.d_id
  163. })
  164. },
  165. charts() { //历史数据
  166. uni.navigateTo({
  167. url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
  168. })
  169. }
  170. },
  171. onLoad(option) {
  172. this.$forceUpdate()
  173. this.eqinfo.item = JSON.parse(option.shebei)
  174. console.log(JSON.parse(option.shebei))
  175. this.history()
  176. }
  177. }
  178. </script>
  179. <style lang="scss">
  180. .info {
  181. width: 100%;
  182. position: absolute;
  183. top: 44px;
  184. .info_item {
  185. width: 90%;
  186. margin: 0 auto;
  187. height: 260rpx;
  188. padding: 26rpx 50rpx;
  189. position: relative;
  190. box-sizing: border-box;
  191. .bgi {
  192. width: 100%;
  193. height: 260rpx;
  194. position: absolute;
  195. top: 0;
  196. left: 0;
  197. z-index: -1;
  198. }
  199. p {
  200. font-size: 24rpx;
  201. color: #FFFFFF;
  202. margin-bottom: 10rpx;
  203. }
  204. }
  205. }
  206. .control {
  207. width: 90%;
  208. position: absolute;
  209. top: 372rpx;
  210. left: 5%;
  211. display: flex;
  212. justify-content: space-between;
  213. text-align: center;
  214. padding: 0 30rpx;
  215. box-sizing: border-box;
  216. .control_item {
  217. width: 120rpx;
  218. height: 120rpx;
  219. image {
  220. width: 70rpx;
  221. height: 70rpx;
  222. }
  223. p {
  224. font-size: 24rpx;
  225. }
  226. }
  227. }
  228. .realtime {
  229. width: 100%;
  230. position: absolute;
  231. top: 500rpx;
  232. .realtime_title {
  233. font-weight: 700;
  234. width: 90%;
  235. margin: 0 auto;
  236. }
  237. .realtime_text {
  238. width: 90%;
  239. margin: 0 auto;
  240. .realtime_text_item {
  241. width: 100%;
  242. display: flex;
  243. justify-content: space-between;
  244. flex-wrap: wrap;
  245. margin-bottom: 50rpx;
  246. .realtime_text_item_info {
  247. width: 48%;
  248. box-shadow: 0 0 10rpx #bcb9ca;
  249. margin-top: 20rpx;
  250. display: flex;
  251. padding: 20rpx 20rpx;
  252. box-sizing: border-box;
  253. .item_info_img {
  254. width: 30%;
  255. text-align: center;
  256. margin-right: 30rpx;
  257. image {
  258. width: 64rpx;
  259. height: 64rpx;
  260. margin-top: 10rpx;
  261. }
  262. }
  263. .item_info_text {
  264. font-size: 24rpx;
  265. }
  266. }
  267. }
  268. }
  269. }
  270. </style>