search.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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">
  12. <image :src="item.device_status==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.device_id}}</p>
  15. <p :class="item.device_status==1?'green':'red'" v-text="item.device_status==1?'在线':'离线'"></p>
  16. </view>
  17. <view class="prevents_item_bot">
  18. 最新上报时间:{{item.status_time|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=forecast.worm_lamp.lamp_list',
  62. data: {
  63. device_type_id: 2,
  64. page:this.page,
  65. size:this.size,
  66. device_id:this.imports
  67. }
  68. })
  69. this.eqlistdata=this.eqlistdata.concat(res.data)
  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. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. .search_top_input{
  96. width: 80%;
  97. height: 54rpx;
  98. background-color: #E4E4E4;
  99. border-radius: 27rpx;
  100. position: absolute;
  101. top: 18rpx;
  102. right: 18rpx;
  103. padding-top: 8rpx;
  104. input{
  105. width: 85%;
  106. text-indent: 1rem;
  107. font-size: 26rpx;
  108. }
  109. .icon{
  110. position: absolute;
  111. top: 8rpx;
  112. right: 26rpx;
  113. }
  114. }
  115. .prevents{
  116. width: 100%;
  117. position: absolute;
  118. top: 54px;
  119. .prevents_item{
  120. width: 95%;
  121. margin: 0 auto 30rpx;
  122. border-radius: 10rpx;
  123. box-shadow: 0 0 10rpx #bcb9ca;
  124. padding: 20rpx 40rpx 20rpx 80rpx;
  125. position: relative;
  126. .prevents_item_img{
  127. width: 30rpx;
  128. height: 50rpx;
  129. position: absolute;
  130. top: -4rpx;
  131. left: 30rpx;
  132. }
  133. .prevents_item_top{
  134. display: flex;
  135. justify-content: space-between;
  136. height: 60rpx;
  137. border-bottom: 2rpx solid #F4F4F4;
  138. line-height: 60rpx;
  139. font-size: 26rpx;
  140. .red{
  141. color: #ff0000;
  142. }
  143. .green{
  144. color: #7DBB91;
  145. }
  146. }
  147. .prevents_item_bot{
  148. margin-top: 20rpx;
  149. font-size: 26rpx;
  150. color: #BDBDBD;
  151. }
  152. }
  153. }
  154. </style>