search.vue 3.6 KB

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