search.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. /deep/.uni-icons{
  127. font-size: 40rpx !important;
  128. }
  129. .search_top_input {
  130. width: 80%;
  131. height: 54rpx;
  132. background-color: #E4E4E4;
  133. border-radius: 27rpx;
  134. position: absolute;
  135. top: 18rpx;
  136. right: 18rpx;
  137. padding-top: 8rpx;
  138. input {
  139. width: 85%;
  140. text-indent: 1rem;
  141. font-size: 26rpx;
  142. }
  143. .icon {
  144. position: absolute;
  145. top: 18rpx;
  146. right: 32rpx;
  147. }
  148. }
  149. .search_bot_input {
  150. width: 80%;
  151. height: 54rpx;
  152. background-color: #E4E4E4;
  153. border-radius: 27rpx;
  154. position: absolute;
  155. top: 44px;
  156. right: 18rpx;
  157. padding-top: 8rpx;
  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: 160rpx;
  174. .list_item {
  175. width: 95%;
  176. margin: 20rpx auto;
  177. padding: 10rpx 20rpx;
  178. position: relative;
  179. background-color: #FFFFFF;
  180. .list_item_top {
  181. display: flex;
  182. justify-content: space-between;
  183. .p1 {
  184. height: 60rpx;
  185. line-height: 60rpx;
  186. font-size: 28rpx;
  187. image {
  188. width: 40rpx;
  189. height: 40rpx;
  190. vertical-align: text-top;
  191. margin-right: 20rpx;
  192. }
  193. }
  194. .p2 {
  195. height: 60rpx;
  196. line-height: 60rpx;
  197. font-size: 28rpx;
  198. color: #42b983;
  199. }
  200. .p_out {
  201. height: 60rpx;
  202. line-height: 60rpx;
  203. font-size: 28rpx;
  204. color: red;
  205. }
  206. }
  207. .list_item_text {
  208. margin-top: 20rpx;
  209. p {
  210. font-size: 24rpx;
  211. color: #636363;
  212. margin-top: 10rpx;
  213. }
  214. p:first-child {
  215. font-size: 28rpx;
  216. font-weight: 700;
  217. }
  218. }
  219. .list_item_btn {
  220. width: 126rpx;
  221. color: #42b983;
  222. height: 40rpx;
  223. text-align: center;
  224. border: 1rpx solid #42b983;
  225. border-radius: 25rpx;
  226. font-size: 24rpx;
  227. line-height: 35rpx;
  228. position: absolute;
  229. top: 136rpx;
  230. right: 20rpx;
  231. }
  232. }
  233. .none {
  234. width: 100%;
  235. height: 100rpx;
  236. line-height: 100rpx;
  237. font-size: 32rpx;
  238. text-align: center;
  239. }
  240. }
  241. </style>