search.vue 3.7 KB

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