search.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;top: 44px; z-index: 100;height: 160rpx;background-color: #FFFFFF;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" style="margin-top: 36rpx;"></uni-nav-bar>
  6. <view class="">
  7. <view class="search_top_input">
  8. <input type="text" v-model="value" placeholder="请选择设备类型" disabled @click="show = true" />
  9. <u-icon name="arrow-down-fill" size="20" class="icon" @click="show = true"></u-icon>
  10. <u-action-sheet :list="options1" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  11. </view>
  12. <view class="search_bot_input">
  13. <input type="text" value="" placeholder="请输入设备ID" v-model="imports" />
  14. <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="list">
  19. <view class="list_item" v-for="(item,index) in eqlistdata" :key="index">
  20. <view class="list_item_top">
  21. <p class="p1">
  22. <image :src="images[current].path" mode=""></image>
  23. {{item.device_name}}
  24. </p>
  25. <p :class="[item.device_status?'p2':'p_out']">{{item.device_status?"在线":"离线"}}</p>
  26. </view>
  27. <view class="list_item_text">
  28. <p>设备ID:{{item.device_id}}</p>
  29. <p>适配用户:无</p>
  30. <p>添加设备时间:{{item.status_time|timeFormat()}}</p>
  31. </view>
  32. <view class="list_item_btn">
  33. 修改名称
  34. </view>
  35. </view>
  36. <view class="none" v-if="eqlistdatatf">
  37. 暂无数据
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. options1: [{
  47. text: '杀虫灯',
  48. },
  49. {
  50. text: '测报灯',
  51. },
  52. {
  53. text: '智能性诱',
  54. },
  55. {
  56. text: '环境检测',
  57. },
  58. {
  59. text: '监控设备',
  60. },
  61. {
  62. text: '孢子仪',
  63. },
  64. ],
  65. imports: '',
  66. eqlistdata: [],
  67. current: 0,
  68. images: [{
  69. path: "../../static/image/fourMoodBase/scd.png",
  70. id: 2
  71. },
  72. {
  73. path: "../../static/image/fourMoodBase/cbd.png",
  74. id: 3
  75. }, {
  76. path: "../../static/image/fourMoodBase/xycb.png",
  77. id: 4
  78. }, {
  79. path: "../../static/image/fourMoodBase/qxz.png",
  80. id: 5
  81. }, {
  82. path: "../../static/image/fourMoodBase/jk.png",
  83. id: 6
  84. }, {
  85. path: "../../static/image/fourMoodBase/bzy.png",
  86. id: 7
  87. }
  88. ],
  89. eqlistdatatf: false, //暂无数据
  90. show: false, //选择框
  91. value: '', //选择框值
  92. indexs: 2 //设备id
  93. }
  94. },
  95. methods: {
  96. async eqlist() { //设备列表
  97. const res = await this.$myRequest({
  98. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  99. data: {
  100. device_type_id: this.indexs,
  101. device_id: this.imports
  102. }
  103. })
  104. this.eqlistdata = res.data
  105. if (this.eqlistdata.length == 0) {
  106. this.eqlistdatatf = true
  107. } else {
  108. this.eqlistdatatf = false
  109. }
  110. },
  111. clickLeft() { //返回
  112. uni.switchTab({
  113. url: "./index"
  114. })
  115. },
  116. search() { //搜索
  117. this.eqlist()
  118. },
  119. actionSheetCallback(index) { //选择框
  120. this.value = this.options1[index].text;
  121. this.indexs = index + 2
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .search_top_input {
  128. width: 80%;
  129. height: 54rpx;
  130. background-color: #E4E4E4;
  131. border-radius: 27rpx;
  132. position: absolute;
  133. top: 18rpx;
  134. right: 18rpx;
  135. padding-top: 8rpx;
  136. box-sizing: border-box;
  137. input {
  138. width: 85%;
  139. text-indent: 1rem;
  140. font-size: 26rpx;
  141. }
  142. .icon {
  143. position: absolute;
  144. top: 18rpx;
  145. right: 32rpx;
  146. }
  147. }
  148. .search_bot_input {
  149. width: 80%;
  150. height: 54rpx;
  151. background-color: #E4E4E4;
  152. border-radius: 27rpx;
  153. position: absolute;
  154. top: 44px;
  155. right: 18rpx;
  156. padding-top: 8rpx;
  157. box-sizing: border-box;
  158. input {
  159. width: 85%;
  160. text-indent: 1rem;
  161. font-size: 26rpx;
  162. }
  163. .icon {
  164. position: absolute;
  165. top: 8rpx;
  166. right: 26rpx;
  167. }
  168. }
  169. .list {
  170. width: 100%;
  171. background-color: #FDFDFD;
  172. position: absolute;
  173. top: 260rpx;
  174. .list_item {
  175. width: 95%;
  176. margin: 20rpx auto;
  177. padding: 10rpx 20rpx;
  178. position: relative;
  179. background-color: #FFFFFF;
  180. box-sizing: border-box;
  181. box-shadow: 0 0 10rpx #bcb9ca;
  182. .list_item_top {
  183. display: flex;
  184. justify-content: space-between;
  185. .p1 {
  186. height: 60rpx;
  187. line-height: 60rpx;
  188. font-size: 28rpx;
  189. image {
  190. width: 40rpx;
  191. height: 40rpx;
  192. vertical-align: text-top;
  193. margin-right: 20rpx;
  194. }
  195. }
  196. .p2 {
  197. height: 60rpx;
  198. line-height: 60rpx;
  199. font-size: 28rpx;
  200. color: #42b983;
  201. }
  202. .p_out {
  203. height: 60rpx;
  204. line-height: 60rpx;
  205. font-size: 28rpx;
  206. color: red;
  207. }
  208. }
  209. .list_item_text {
  210. margin-top: 20rpx;
  211. p {
  212. font-size: 24rpx;
  213. color: #636363;
  214. margin-top: 10rpx;
  215. }
  216. p:first-child {
  217. font-size: 28rpx;
  218. font-weight: 700;
  219. }
  220. }
  221. .list_item_btn {
  222. width: 126rpx;
  223. color: #42b983;
  224. height: 40rpx;
  225. text-align: center;
  226. border: 1rpx solid #42b983;
  227. border-radius: 25rpx;
  228. font-size: 24rpx;
  229. line-height: 35rpx;
  230. position: absolute;
  231. top: 136rpx;
  232. right: 20rpx;
  233. }
  234. }
  235. .none {
  236. width: 100%;
  237. height: 100rpx;
  238. line-height: 100rpx;
  239. font-size: 32rpx;
  240. text-align: center;
  241. }
  242. }
  243. </style>