equipment.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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.equip_id}}</p>
  13. <p>设备名称:{{eqinfo.item.equip_name?eqinfo.item.equip_name:"无"}}</p>
  14. <p>最近上报时间:{{eqinfo.item.uptime|timeFormat()}}</p>
  15. <p>地址:{{city==""?"--":city}}</p>
  16. </view>
  17. </view>
  18. <view class="control">
  19. <view class="control_item" @click="control">
  20. <image src="../../static/image/prevention/8.png" mode=""></image>
  21. <p>设备控制</p>
  22. </view>
  23. <view class="control_item" @click="information">
  24. <image src="../../static/image/environment/9.png" mode=""></image>
  25. <p>24小时数据</p>
  26. </view>
  27. <view class="control_item" @click="charts">
  28. <image src="../../static/image/environment/10.png" mode=""></image>
  29. <p>历史数据</p>
  30. </view>
  31. </view>
  32. <view class="realtime">
  33. <p class="realtime_title">实时数据</p>
  34. <view class="realtime_text">
  35. <view class="realtime_text_item">
  36. <view class="realtime_text_item_info" v-for="(item,index) in olddata.conf" :key="index" v-if="item">
  37. <view class="item_info_img" :style="{'background-color':olddatas[Math.floor(Math.random()*(5-0+1))]}">
  38. <image :src="'../../static/image/environment/icon_'+olddata.dat[index][1]+'.png'" mode=""></image>
  39. </view>
  40. <view class="item_info_text">
  41. <p>{{item}}</p>
  42. <p style="margin-top: 20rpx;">{{parseFloat(olddata.dat[index][0]) == -99.99 ?'N/A':parseFloat(olddata.dat[index])}}</p>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. eqinfo: {},
  56. olddata: {},
  57. olddatas: ["#fba825", "#53d67c", "#008cf2", "#fb504d", "#d87ffc", "#4ec5f0"],
  58. city: ""
  59. }
  60. },
  61. methods: {
  62. clickLeft() {
  63. uni.navigateBack({
  64. delta: 1
  65. })
  66. },
  67. async history() { //设备列表
  68. const res = await this.$myRequest({
  69. url: '/api/api_gateway?method=weather.weather.qxz_status',
  70. data: {
  71. device_id: this.eqinfo.item.equip_id
  72. }
  73. })
  74. this.olddata = res
  75. for (var key in this.olddata.conf) {
  76. if (this.olddata.conf[key].indexOf("#") != -1) {
  77. this.olddata.conf[key] = this.olddata.conf[key].replace("#", "(") + ")"
  78. }
  79. this.olddata.dat[key] = this.olddata.dat[key].split("#")
  80. }
  81. console.log(this.olddata)
  82. },
  83. control() { //设备控制
  84. uni.navigateTo({
  85. url: "./contros?id=" + this.eqinfo.item.d_id
  86. })
  87. },
  88. information() { //24小时数据
  89. uni.navigateTo({
  90. url: "./onedaythedata?id=" + this.eqinfo.item.equip_id
  91. })
  92. },
  93. charts() { //历史数据
  94. uni.navigateTo({
  95. url: "./history?device_id=" + this.eqinfo.item.equip_id
  96. })
  97. },
  98. reverseGeocode(Object,callback){
  99. }
  100. },
  101. onLoad(option) {
  102. this.$forceUpdate()
  103. this.eqinfo.item = JSON.parse(option.shebei)
  104. console.log(this.eqinfo)
  105. this.history()
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .info {
  111. width: 100%;
  112. position: absolute;
  113. top: 44px;
  114. .info_item {
  115. width: 90%;
  116. margin: 0 auto;
  117. height: 260rpx;
  118. padding: 26rpx 50rpx;
  119. position: relative;
  120. box-sizing: border-box;
  121. .bgi {
  122. width: 100%;
  123. height: 260rpx;
  124. position: absolute;
  125. top: 0;
  126. left: 0;
  127. z-index: -1;
  128. }
  129. p {
  130. font-size: 24rpx;
  131. color: #FFFFFF;
  132. margin-bottom: 10rpx;
  133. }
  134. }
  135. }
  136. .control {
  137. width: 90%;
  138. position: absolute;
  139. top: 372rpx;
  140. left: 5%;
  141. display: flex;
  142. justify-content: space-between;
  143. text-align: center;
  144. padding: 0 30rpx;
  145. box-sizing: border-box;
  146. .control_item {
  147. width: 128rpx;
  148. height: 120rpx;
  149. image {
  150. width: 70rpx;
  151. height: 70rpx;
  152. }
  153. p {
  154. font-size: 24rpx;
  155. }
  156. }
  157. }
  158. .realtime {
  159. width: 100%;
  160. position: absolute;
  161. top: 500rpx;
  162. .realtime_title {
  163. font-weight: 700;
  164. width: 90%;
  165. margin: 0 auto;
  166. }
  167. .realtime_text {
  168. width: 90%;
  169. margin: 0 auto;
  170. .realtime_text_item {
  171. width: 100%;
  172. display: flex;
  173. justify-content: space-between;
  174. flex-wrap: wrap;
  175. margin-bottom: 50rpx;
  176. .realtime_text_item_info {
  177. width: 48%;
  178. box-shadow: 0 0 10rpx #bcb9ca;
  179. margin-top: 20rpx;
  180. display: flex;
  181. padding: 20rpx 0rpx 20rpx 20rpx;
  182. box-sizing: border-box;
  183. .item_info_img {
  184. width: 90rpx;
  185. text-align: center;
  186. margin-right: 28rpx;
  187. border-radius: 50%;
  188. height: 90rpx;
  189. image {
  190. width: 64rpx;
  191. height: 64rpx;
  192. margin-top: 15rpx
  193. }
  194. }
  195. .item_info_text {
  196. font-size: 24rpx;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. </style>