equipmentdetails.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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.is_online==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" v-if="newdatesTF">
  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 class="realtime_tishi" v-else>
  49. 暂无数据
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. eqinfo: {},
  60. olddata: {},
  61. olddatas: [],
  62. newdatesTF:false,
  63. work:""
  64. }
  65. },
  66. methods: {
  67. modification() {
  68. this.olddatas = [{
  69. icon: '../../static/image/cb/icon02.png',
  70. txt: '设备开关',
  71. value: Number(this.olddata.ds) == 1 ? '开机' : "关机",
  72. },
  73. {
  74. icon: '../../static/image/cb/icon05.png',
  75. txt: '工作状态',
  76. value:this.work
  77. },
  78. {
  79. icon: '../../static/image/prevention/44.png',
  80. txt: '电击次数',
  81. value: this.olddata.ct
  82. },
  83. {
  84. icon: '../../static/image/prevention/33.png',
  85. txt: '定时时长',
  86. value: Math.abs(this.olddata.et - this.olddata.st)
  87. }, {
  88. icon: '../../static/image/cb/icon08.png',
  89. txt: '环境温度(℃)',
  90. value: this.olddata.at
  91. }, {
  92. icon: '../../static/image/cb/icon07.png',
  93. txt: '环境湿度(%)',
  94. value: this.olddata.ah
  95. }, {
  96. icon: '../../static/image/cb/icon16.png',
  97. txt: '信号强度',
  98. value: this.olddata.csq
  99. }, {
  100. icon: '../../static/image/prevention/100.png',
  101. txt: '清虫间隔(min)',
  102. value: this.olddata.clt_t
  103. }, {
  104. icon: '../../static/image/prevention/101.png',
  105. txt: '雨控状态',
  106. value: Number(this.olddata.rps) == 1 ? "雨控" : '正常'
  107. }, {
  108. icon: '../../static/image/prevention/102.png',
  109. txt: '温控状态',
  110. value: Number(this.olddata.tps) == 1 ? "温控" : '正常'
  111. },
  112. {
  113. icon: '../../static/image/prevention/105.png',
  114. txt: '充电电压',
  115. value: this.olddata.cv
  116. },
  117. {
  118. icon: '../../static/image/prevention/106.png',
  119. txt: '电压状态',
  120. value: Number(this.olddata.batStatus) == 1 ? "欠压" : '正常'
  121. },
  122. {
  123. icon: '../../static/image/prevention/107.png',
  124. txt: '纬度',
  125. value: this.olddata.lat
  126. },
  127. {
  128. icon: '../../static/image/prevention/108.png',
  129. txt: '经度',
  130. value: this.olddata.lng
  131. }
  132. ]
  133. },
  134. async history() { //设备列表
  135. const res = await this.$myRequest({
  136. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  137. data: {
  138. device_type_id: 2,
  139. device_id: this.eqinfo.item.imei
  140. }
  141. })
  142. if(res.data.length !=0){
  143. this.olddata = res.data[0].d_h_t
  144. this.newdatesTF =true
  145. if(Number(this.olddata.ws) == 0){
  146. this.work = "待机"
  147. }else if(Number(this.olddata.ws) == 1){
  148. this.work = "工作"
  149. }else{
  150. this.work = "充电"
  151. }
  152. }else{
  153. this.newdatesTF =false
  154. }
  155. this.modification()
  156. },
  157. clickLeft() {
  158. uni.navigateBack({
  159. delta: 1
  160. })
  161. },
  162. sim() {
  163. // sim卡详情
  164. uni.navigateTo({
  165. url:"./sim?id="+this.eqinfo.item.d_id
  166. })
  167. },
  168. control() { //设备控制
  169. uni.navigateTo({
  170. url: "./control?id=" + this.eqinfo.item.d_id
  171. })
  172. },
  173. charts() { //历史数据
  174. uni.navigateTo({
  175. url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
  176. })
  177. }
  178. },
  179. onLoad(option) {
  180. this.$forceUpdate()
  181. this.eqinfo.item = JSON.parse(option.shebei)
  182. console.log(JSON.parse(option.shebei))
  183. this.history()
  184. }
  185. }
  186. </script>
  187. <style lang="scss">
  188. .info {
  189. width: 100%;
  190. position: absolute;
  191. top: 44px;
  192. .info_item {
  193. width: 90%;
  194. margin: 0 auto;
  195. height: 260rpx;
  196. padding: 26rpx 50rpx;
  197. position: relative;
  198. box-sizing: border-box;
  199. .bgi {
  200. width: 100%;
  201. height: 260rpx;
  202. position: absolute;
  203. top: 0;
  204. left: 0;
  205. z-index: -1;
  206. }
  207. p {
  208. font-size: 24rpx;
  209. color: #FFFFFF;
  210. margin-bottom: 10rpx;
  211. }
  212. }
  213. }
  214. .control {
  215. width: 90%;
  216. position: absolute;
  217. top: 372rpx;
  218. left: 5%;
  219. display: flex;
  220. justify-content: space-between;
  221. text-align: center;
  222. padding: 0 30rpx;
  223. box-sizing: border-box;
  224. .control_item {
  225. width: 120rpx;
  226. height: 120rpx;
  227. image {
  228. width: 70rpx;
  229. height: 70rpx;
  230. }
  231. p {
  232. font-size: 24rpx;
  233. }
  234. }
  235. }
  236. .realtime {
  237. width: 100%;
  238. position: absolute;
  239. top: 500rpx;
  240. .realtime_title {
  241. font-weight: 700;
  242. width: 90%;
  243. margin: 0 auto;
  244. }
  245. .realtime_tishi{
  246. width: 90%;
  247. margin: 0 auto;
  248. text-align: center;
  249. font-size: 32rpx;
  250. padding-top: 40rpx;
  251. }
  252. .realtime_text {
  253. width: 90%;
  254. margin: 0 auto;
  255. .realtime_text_item {
  256. width: 100%;
  257. display: flex;
  258. justify-content: space-between;
  259. flex-wrap: wrap;
  260. margin-bottom: 50rpx;
  261. .realtime_text_item_info {
  262. width: 48%;
  263. box-shadow: 0 0 10rpx #bcb9ca;
  264. margin-top: 20rpx;
  265. display: flex;
  266. padding: 20rpx 20rpx;
  267. box-sizing: border-box;
  268. .item_info_img {
  269. width: 30%;
  270. text-align: center;
  271. margin-right: 30rpx;
  272. image {
  273. width: 64rpx;
  274. height: 64rpx;
  275. margin-top: 10rpx;
  276. }
  277. }
  278. .item_info_text {
  279. font-size: 24rpx;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. </style>