search.vue 3.4 KB

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