index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 40px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回"
  7. size="16">
  8. <view class="bases_search">
  9. <view class="bases_search_text" @click="clickRight">
  10. <u-icon name="search" class="search" @click="search"></u-icon>
  11. <input type="text" v-model="data.search" placeholder="设备ID搜索" @input="searchinput" disabled/>
  12. </view>
  13. </view>
  14. </uni-nav-bar>
  15. </view>
  16. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/1.png'" mode="" class="image"></image>
  17. <view class="prevents">
  18. <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
  19. <image :src="item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/7.png'" mode=""
  20. class="prevents_item_img"></image>
  21. <view class="prevents_item_top">
  22. <p>设备名称:{{item.equip_name==""?"无":item.equip_name}}</p>
  23. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  24. </view>
  25. <view class="prevents_item_bot">
  26. <p>设备 ID:{{item.equip_id}}</p>
  27. <p>最新上报时间:{{item.uptime|timeFormat()}}</p>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="top">
  33. <view class="backtop" @click="top" v-if="isTop">
  34. <image src="../../static/images/1.png" mode="" class="img0"></image>
  35. </view>
  36. <view class="more">
  37. <view class="box" @click="online" v-show="filtrateTF">
  38. <p>在线</p>
  39. </view>
  40. <view class="box" @click="offline" v-show="filtrateTF">
  41. <p>离线</p>
  42. </view>
  43. <view class="box" @click="complete" v-show="filtrateTF">
  44. <p>全部</p>
  45. </view>
  46. <view @click="filtrate">
  47. <image src="../../static/images/b0bcdb0e3fe8690520f743aa8303bf2.png" mode="" class="img1"></image>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. page: 1,
  58. size: 10,
  59. eqlistdata: [],
  60. isTop:false,
  61. filtrateTF:false,
  62. device_status:""
  63. }
  64. },
  65. methods: {
  66. async eqlist() { //设备列表
  67. const res = await this.$myRequest({
  68. url: '/api/api_gateway?method=weather.weather.qxz_page',
  69. data: {
  70. page: this.page,
  71. device_status:this.device_status
  72. }
  73. })
  74. this.eqlistdata = this.eqlistdata.concat(res.ids)
  75. console.log(res.ids)
  76. },
  77. clickRight() {
  78. uni.navigateTo({
  79. url: "./search"
  80. })
  81. },
  82. clickLeft() {
  83. uni.switchTab({
  84. url: "../index/index"
  85. })
  86. },
  87. eqdetails(data) {
  88. uni.navigateTo({
  89. url: "./equipment?shebei=" + JSON.stringify(data)
  90. })
  91. },
  92. filtrate(){
  93. this.filtrateTF = !this.filtrateTF
  94. },
  95. top() {
  96. uni.pageScrollTo({
  97. scrollTop: 0,
  98. duration: 500
  99. })
  100. },
  101. online(){
  102. this.eqlistdata=[]
  103. this.page = 1
  104. this.device_status = 1
  105. this.eqlist()
  106. this.filtrateTF = !this.filtrateTF
  107. },
  108. offline(){
  109. this.eqlistdata=[]
  110. this.page = 1
  111. this.device_status = 0
  112. this.eqlist()
  113. this.filtrateTF = !this.filtrateTF
  114. },
  115. complete(){
  116. this.eqlistdata=[]
  117. this.page = 1
  118. this.device_status = ""
  119. this.eqlist()
  120. this.filtrateTF = !this.filtrateTF
  121. }
  122. },
  123. onLoad() {
  124. this.eqlist()
  125. },
  126. onReachBottom() {
  127. this.page++
  128. this.eqlist()
  129. },
  130. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  131. if (e.scrollTop > 200) { //距离大于200时显示
  132. this.isTop = true
  133. } else { //距离小于200时隐藏
  134. this.isTop = false
  135. }
  136. },
  137. }
  138. </script>
  139. <style lang="scss">
  140. /deep/.uni-icons {
  141. font-size: 40rpx !important;
  142. }
  143. .image {
  144. position: fixed;
  145. top: 80px;
  146. width: 100%;
  147. height: 160rpx;
  148. z-index: 555;
  149. }
  150. .bases_search {
  151. width: 60%;
  152. background-color: #FFFFFF;
  153. position: absolute;
  154. top: 10rpx;
  155. left: 50%;
  156. margin-left: -33%;
  157. .bases_search_text {
  158. width: 90%;
  159. margin: 0 auto;
  160. background-color: #F8F8F8;
  161. height: 60rpx;
  162. border-radius: 30rpx;
  163. display: flex;
  164. line-height: 60rpx;
  165. .search {
  166. padding: 0 20rpx;
  167. font-size: 34rpx;
  168. }
  169. input {
  170. width: 80%;
  171. margin-top: 10rpx;
  172. font-size: 28rpx;
  173. }
  174. }
  175. }
  176. .prevents {
  177. width: 100%;
  178. position: absolute;
  179. top: 140px;
  180. .prevents_item {
  181. width: 95%;
  182. margin: 0 auto 30rpx;
  183. border-radius: 10rpx;
  184. box-shadow: 0 0 10rpx #bcb9ca;
  185. padding: 20rpx 40rpx 20rpx 80rpx;
  186. box-sizing: border-box;
  187. position: relative;
  188. .prevents_item_img {
  189. width: 30rpx;
  190. height: 50rpx;
  191. position: absolute;
  192. top: -4rpx;
  193. left: 30rpx;
  194. }
  195. .prevents_item_top {
  196. display: flex;
  197. justify-content: space-between;
  198. height: 60rpx;
  199. border-bottom: 2rpx solid #F4F4F4;
  200. line-height: 60rpx;
  201. font-size: 26rpx;
  202. .red {
  203. color: #ff0000;
  204. }
  205. .green {
  206. color: #7DBB91;
  207. }
  208. }
  209. .prevents_item_bot {
  210. margin-top: 20rpx;
  211. font-size: 26rpx;
  212. color: #BDBDBD;
  213. }
  214. }
  215. }
  216. .top {
  217. position: fixed;
  218. right: 10px;
  219. bottom: 40px;
  220. z-index: 100;
  221. image {
  222. width: 100rpx;
  223. height: 100rpx;
  224. }
  225. .backtop{
  226. display: flex;
  227. justify-content: flex-end;
  228. margin-bottom: 10rpx;
  229. }
  230. .more{
  231. display: flex;
  232. }
  233. .box{
  234. width: 80rpx;
  235. height: 80rpx;
  236. background-color: rgba(161,161,161,0.45);
  237. border-radius: 50%;
  238. text-align: center;
  239. line-height: 80rpx;
  240. box-sizing: border-box;
  241. margin: 14rpx 10rpx 0 0;
  242. color: #fff;
  243. }
  244. }
  245. </style>