search.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. <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'"
  15. mode="" class="prevents_item_img"></image>
  16. <view class="prevents_item_top">
  17. <p>设备名称:{{item.equip_name==""?"无":item.equip_name}}</p>
  18. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  19. </view>
  20. <view class="prevents_item_bot">
  21. <p>设备 ID:{{item.equip_id}}</p>
  22. <p>最新上报时间:{{item.uptime|timeFormat()}}</p>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. Debounce,
  32. Throttle
  33. } from "../../util/anitthro.js"
  34. export default {
  35. data() {
  36. return {
  37. imports: '',
  38. eqlistdata: [],
  39. page: 1,
  40. size: 10,
  41. show: false,
  42. value: '',
  43. options1: [{
  44. text: "杀虫灯",
  45. id: 2
  46. },
  47. {
  48. text: "虫情测报",
  49. id: 3
  50. },
  51. {
  52. text: "孢子仪",
  53. id: 7
  54. },
  55. {
  56. text: "性诱设备",
  57. id: 4
  58. },
  59. ]
  60. }
  61. },
  62. methods: {
  63. async eqlist() { //设备列表
  64. const res = await this.$myRequest({
  65. url: '/api/api_gateway?method=weather.weather.qxz_page',
  66. data: {
  67. device_type_id: 2,
  68. page: this.page,
  69. size: this.size,
  70. device_id: this.imports
  71. }
  72. })
  73. // console.log(res)
  74. this.eqlistdata = this.eqlistdata.concat(res.ids)
  75. console.log(this.eqlistdata)
  76. },
  77. clickLeft() {
  78. uni.navigateBack({
  79. delta: 1
  80. })
  81. },
  82. search() {
  83. this.eqlistdata = []
  84. this.eqlist()
  85. },
  86. searchinp() {
  87. Debounce(() => {
  88. this.eqlistdata = []
  89. this.eqlist()
  90. }, 1000)()
  91. },
  92. actionSheetCallback(index) { //选择框
  93. this.value = this.options1[index].text;
  94. // this.id = this.options1[index].id
  95. },
  96. eqdetails(data) {
  97. uni.navigateTo({
  98. url: "./equipment?shebei=" + JSON.stringify(data)
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .search_top_input {
  106. width: 90%;
  107. height: 54rpx;
  108. background-color: #E4E4E4;
  109. border-radius: 27rpx;
  110. position: absolute;
  111. top: 100rpx;
  112. right: 5%;
  113. padding-top: 8rpx;
  114. box-sizing: border-box;
  115. input {
  116. width: 85%;
  117. // text-indent: 1rem;
  118. font-size: 26rpx;
  119. padding-left: 20px;
  120. box-sizing: border-box;
  121. }
  122. .icon {
  123. position: absolute;
  124. top: 8rpx;
  125. right: 26rpx;
  126. }
  127. }
  128. .prevents {
  129. width: 100%;
  130. position: absolute;
  131. top: 84px;
  132. .prevents_item {
  133. width: 95%;
  134. margin: 0 auto 30rpx;
  135. border-radius: 10rpx;
  136. box-shadow: 0 0 10rpx #bcb9ca;
  137. padding: 20rpx 40rpx 20rpx 80rpx;
  138. position: relative;
  139. box-sizing: border-box;
  140. .prevents_item_img {
  141. width: 30rpx;
  142. height: 50rpx;
  143. position: absolute;
  144. top: -4rpx;
  145. left: 30rpx;
  146. }
  147. .prevents_item_top {
  148. display: flex;
  149. justify-content: space-between;
  150. height: 60rpx;
  151. border-bottom: 2rpx solid #F4F4F4;
  152. line-height: 60rpx;
  153. font-size: 26rpx;
  154. .red {
  155. color: #ff0000;
  156. }
  157. .green {
  158. color: #7DBB91;
  159. }
  160. }
  161. .prevents_item_bot {
  162. margin-top: 20rpx;
  163. font-size: 26rpx;
  164. color: #BDBDBD;
  165. }
  166. }
  167. }
  168. </style>