search.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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;background-color: #FFFFFF;height: 80px;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备搜索"></uni-nav-bar>
  7. <view class="search_top_input">
  8. <input type="text" value="" placeholder="请输入设备ID或设备名称" v-model="imports" @input="searchinp" />
  9. <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
  10. </view>
  11. </view>
  12. <view class="prevents">
  13. <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
  14. <view class="" v-if="side_type == 5">
  15. <image
  16. :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'"
  17. mode="" class="prevents_item_img"></image>
  18. <view class="prevents_item_top">
  19. <p>设备名称:{{item.equip_name==""?"无":item.equip_name}}</p>
  20. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  21. </view>
  22. <view class="prevents_item_bot">
  23. <p>设备 ID:{{item.equip_id || item.device_id}}</p>
  24. <p>最新上报时间:{{item.uptime|timeFormat()}}</p>
  25. </view>
  26. </view>
  27. <view class="" v-if="side_type == 15">
  28. <image
  29. src="http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png"
  30. mode="" class="prevents_item_img"></image>
  31. <view class="prevents_item_top">
  32. <p>设备名称:{{item.device_name==""?"无":item.device_name}}</p>
  33. </view>
  34. <view class="prevents_item_bot">
  35. <p>设备 ID:{{item.device_id}}</p>
  36. <p>最新上报时间:{{item.uptime|timeFormat()}}</p>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. Debounce,
  47. Throttle
  48. } from "../../util/anitthro.js"
  49. export default {
  50. data() {
  51. return {
  52. imports: '',
  53. eqlistdata: [],
  54. page: 1,
  55. size: 10,
  56. value: '',
  57. side_type: 5
  58. }
  59. },
  60. methods: {
  61. async eqlist() { //设备列表
  62. const res = await this.$myRequest({
  63. url: '/api/api_gateway?method=weather.weather.qxz_page',
  64. data: {
  65. device_type_id: 2,
  66. page: this.page,
  67. size: this.size,
  68. device_id: this.imports
  69. }
  70. })
  71. // console.log(res)
  72. this.eqlistdata = this.eqlistdata.concat(res.ids)
  73. console.log(this.eqlistdata)
  74. },
  75. async tubulareqlist() { //设备列表 环境监测
  76. this.loadingtf = true
  77. const res = await this.$myRequest({
  78. url: '/api/api_gateway?method=weather.weather.nd_qxz_page',
  79. data: {
  80. page: this.page,
  81. page_size: 10,
  82. device_id: this.imports
  83. }
  84. })
  85. this.loadingtf = false
  86. this.eqlistdata = this.eqlistdata.concat(res.ids)
  87. console.log(res.ids)
  88. },
  89. clickLeft() {
  90. uni.navigateBack({
  91. delta: 1
  92. })
  93. },
  94. search() {
  95. this.eqlistdata = []
  96. if(this.side_type==5){
  97. this.eqlist()
  98. }else if(this.side_type == 15){
  99. this.tubulareqlist()
  100. }
  101. },
  102. searchinp() {
  103. Debounce(() => {
  104. this.search()
  105. }, 1000)()
  106. },
  107. eqdetails(data) {
  108. if(this.side_type == 5){
  109. uni.navigateTo({
  110. url: "./equipment?shebei=" + JSON.stringify(data)
  111. })
  112. }else if(this.side_type == 15){
  113. uni.navigateTo({
  114. url: "./gsequipment?shebei=" + JSON.stringify(data)
  115. })
  116. }
  117. }
  118. },
  119. onLoad(option) {
  120. this.side_type = option.type
  121. console.log(this.side_type)
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .search_top_input {
  127. width: 90%;
  128. height: 54rpx;
  129. background-color: #E4E4E4;
  130. border-radius: 27rpx;
  131. position: absolute;
  132. top: 100rpx;
  133. right: 5%;
  134. padding-top: 8rpx;
  135. box-sizing: border-box;
  136. input {
  137. width: 85%;
  138. // text-indent: 1rem;
  139. font-size: 26rpx;
  140. padding-left: 20px;
  141. box-sizing: border-box;
  142. }
  143. .icon {
  144. position: absolute;
  145. top: 8rpx;
  146. right: 26rpx;
  147. }
  148. }
  149. .prevents {
  150. width: 100%;
  151. position: absolute;
  152. top: 94px;
  153. .prevents_item {
  154. width: 95%;
  155. margin: 0 auto 30rpx;
  156. border-radius: 10rpx;
  157. box-shadow: 0 0 10rpx #bcb9ca;
  158. padding: 20rpx 40rpx 20rpx 80rpx;
  159. position: relative;
  160. box-sizing: border-box;
  161. .prevents_item_img {
  162. width: 30rpx;
  163. height: 50rpx;
  164. position: absolute;
  165. top: -4rpx;
  166. left: 30rpx;
  167. }
  168. .prevents_item_top {
  169. display: flex;
  170. justify-content: space-between;
  171. height: 60rpx;
  172. border-bottom: 2rpx solid #F4F4F4;
  173. line-height: 60rpx;
  174. font-size: 26rpx;
  175. .red {
  176. color: #ff0000;
  177. }
  178. .green {
  179. color: #7DBB91;
  180. }
  181. }
  182. .prevents_item_bot {
  183. margin-top: 20rpx;
  184. font-size: 26rpx;
  185. color: #BDBDBD;
  186. }
  187. }
  188. }
  189. </style>