equipmentdetails.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. {
  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() { //sim卡详情
  147. // uni.navigateTo({
  148. // url:"./sim?id="+this.eqinfo.item.d_id
  149. // })
  150. uni.showToast({
  151. title: '此功能暂未开放',
  152. duration: 2000,
  153. icon: "none"
  154. });
  155. },
  156. control() { //设备控制
  157. uni.navigateTo({
  158. url: "./control?id=" + this.eqinfo.item.d_id
  159. })
  160. },
  161. charts() { //历史数据
  162. uni.navigateTo({
  163. url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
  164. })
  165. }
  166. },
  167. onLoad(option) {
  168. this.$forceUpdate()
  169. this.eqinfo.item = JSON.parse(option.shebei)
  170. console.log(JSON.parse(option.shebei))
  171. this.history()
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. .info {
  177. width: 100%;
  178. position: absolute;
  179. top: 44px;
  180. .info_item {
  181. width: 90%;
  182. margin: 0 auto;
  183. height: 260rpx;
  184. padding: 26rpx 50rpx;
  185. position: relative;
  186. box-sizing: border-box;
  187. .bgi {
  188. width: 100%;
  189. height: 260rpx;
  190. position: absolute;
  191. top: 0;
  192. left: 0;
  193. z-index: -1;
  194. }
  195. p {
  196. font-size: 24rpx;
  197. color: #FFFFFF;
  198. margin-bottom: 10rpx;
  199. }
  200. }
  201. }
  202. .control {
  203. width: 90%;
  204. position: absolute;
  205. top: 372rpx;
  206. left: 5%;
  207. display: flex;
  208. justify-content: space-between;
  209. text-align: center;
  210. padding: 0 30rpx;
  211. box-sizing: border-box;
  212. .control_item {
  213. width: 120rpx;
  214. height: 120rpx;
  215. image {
  216. width: 70rpx;
  217. height: 70rpx;
  218. }
  219. p {
  220. font-size: 24rpx;
  221. }
  222. }
  223. }
  224. .realtime {
  225. width: 100%;
  226. position: absolute;
  227. top: 500rpx;
  228. .realtime_title {
  229. font-weight: 700;
  230. width: 90%;
  231. margin: 0 auto;
  232. }
  233. .realtime_text {
  234. width: 90%;
  235. margin: 0 auto;
  236. .realtime_text_item {
  237. width: 100%;
  238. display: flex;
  239. justify-content: space-between;
  240. flex-wrap: wrap;
  241. margin-bottom: 50rpx;
  242. .realtime_text_item_info {
  243. width: 48%;
  244. box-shadow: 0 0 10rpx #bcb9ca;
  245. margin-top: 20rpx;
  246. display: flex;
  247. padding: 20rpx 20rpx;
  248. box-sizing: border-box;
  249. .item_info_img {
  250. width: 30%;
  251. text-align: center;
  252. margin-right: 30rpx;
  253. image {
  254. width: 64rpx;
  255. height: 64rpx;
  256. margin-top: 10rpx;
  257. }
  258. }
  259. .item_info_text {
  260. font-size: 24rpx;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. </style>