search.vue 5.1 KB

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