search.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 64px;">
  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?'http://static.yfpyx.com/bigdata_app/image/prevention/6.png':'http://static.yfpyx.com/bigdata_app/image/prevention/7.png'"
  15. mode="" class="prevents_item_img"></image>
  16. <view class="prevents_item_top">
  17. <p>设备 ID:{{item.imei}}</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. 最新上报时间:{{item.addtime|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=forecast.worm_lamp.lamp_list',
  65. data: {
  66. device_type_id: 2,
  67. page: this.page,
  68. size: this.size,
  69. device_id: this.imports
  70. }
  71. })
  72. this.eqlistdata = this.eqlistdata.concat(res.data)
  73. console.log(this.eqlistdata)
  74. },
  75. clickLeft() {
  76. uni.navigateBack({
  77. delta: 1
  78. })
  79. },
  80. search() {
  81. this.eqlistdata = []
  82. this.eqlist()
  83. },
  84. searchinp() {
  85. Debounce(() => {
  86. this.eqlistdata = []
  87. this.eqlist()
  88. }, 1000)()
  89. },
  90. actionSheetCallback(index) { //选择框
  91. this.value = this.options1[index].text;
  92. // this.id = this.options1[index].id
  93. },
  94. eqdetails(data) {
  95. uni.navigateTo({
  96. url: "./equipmentdetails?shebei=" + JSON.stringify(data)
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .search_top_input {
  104. width: 80%;
  105. height: 54rpx;
  106. background-color: #E4E4E4;
  107. border-radius: 27rpx;
  108. position: absolute;
  109. top: 18rpx;
  110. right: 18rpx;
  111. padding-top: 8rpx;
  112. box-sizing: border-box;
  113. input {
  114. width: 85%;
  115. // text-indent: 1rem;
  116. font-size: 26rpx;
  117. padding-left: 20px;
  118. box-sizing: border-box;
  119. }
  120. .icon {
  121. position: absolute;
  122. top: 8rpx;
  123. right: 26rpx;
  124. }
  125. }
  126. .prevents {
  127. width: 100%;
  128. position: absolute;
  129. top: 54px;
  130. .prevents_item {
  131. width: 95%;
  132. margin: 0 auto 30rpx;
  133. border-radius: 10rpx;
  134. box-shadow: 0 0 10rpx #bcb9ca;
  135. padding: 20rpx 40rpx 20rpx 80rpx;
  136. position: relative;
  137. box-sizing: border-box;
  138. .prevents_item_img {
  139. width: 30rpx;
  140. height: 50rpx;
  141. position: absolute;
  142. top: -4rpx;
  143. left: 30rpx;
  144. }
  145. .prevents_item_top {
  146. display: flex;
  147. justify-content: space-between;
  148. height: 60rpx;
  149. border-bottom: 2rpx solid #F4F4F4;
  150. line-height: 60rpx;
  151. font-size: 26rpx;
  152. .red {
  153. color: #ff0000;
  154. }
  155. .green {
  156. color: #7DBB91;
  157. }
  158. }
  159. .prevents_item_bot {
  160. margin-top: 20rpx;
  161. font-size: 26rpx;
  162. color: #BDBDBD;
  163. }
  164. }
  165. }
  166. </style>