search.vue 3.1 KB

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