p-i-s-search.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view :style="{height:statusBarHeight + 'px'}">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="navbar">
  8. <view class="left" @click="click_left()">
  9. <uni-icons type="arrowleft" color="#fff" size="18"></uni-icons>
  10. </view>
  11. <view class="right">
  12. <view class="input_box">
  13. <view class="input_icon"></view>
  14. <input type="text" value="" v-model="search_text" placeholder="搜索" />
  15. </view>
  16. </view>
  17. <view class="search_btn" @click="search()">
  18. <text>搜索</text>
  19. </view>
  20. </view>
  21. </view>
  22. <!-- 占位符 -->
  23. <view :style="{height: statusBarHeight + 'px'}"></view>
  24. <view style="height: 93rpx;"></view>
  25. <view class="inner_box">
  26. <view class="inner_title">
  27. <view class="name name_1">序号</view>
  28. <view class="name name_2">安装地点</view>
  29. <view class="name name_3">数值/状态</view>
  30. </view>
  31. <view class="list_item">
  32. <view class="item" :class="item.status" v-for="item in searchList" :key="item.id">
  33. <view class="text text_1">{{item.id}}</view>
  34. <view class="text text_2">{{item.position}}</view>
  35. <view class="text text_3">{{item.value}}{{item.unit}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. statusBarHeight: 20,
  46. // 查询关键词
  47. search_text:'',
  48. //查询结果列表
  49. searchList:[]
  50. };
  51. },
  52. created() {
  53. // 获取手机系统信息
  54. const info = uni.getSystemInfoSync()
  55. // 设置状态栏高度
  56. this.statusBarHeight = info.statusBarHeight
  57. },
  58. methods: {
  59. click_left() {
  60. uni.navigateBack();
  61. },
  62. async search(){
  63. // console.log(this.search_text)
  64. const res = await this.$myRequest({
  65. method:"POST",
  66. url: '/safety/search',
  67. header: {
  68. 'Content-Type': 'application/json',
  69. },
  70. data:{
  71. name:this.search_text
  72. }
  73. })
  74. console.log(res.data.data)
  75. this.searchList = res.data.data
  76. },
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .content {
  82. position: fixed;
  83. top: 0;
  84. left: 0;
  85. background-color: #009FE8;
  86. }
  87. .navbar {
  88. width: 750rpx;
  89. box-sizing: border-box;
  90. padding-left: 31rpx;
  91. padding-right: 26rpx;
  92. padding-top: 14rpx;
  93. padding-bottom: 14rpx;
  94. display: flex;
  95. justify-content: space-between;
  96. .left {
  97. width: 42rpx;
  98. line-height: 65rpx;
  99. }
  100. .right {
  101. margin-left: 30rpx;
  102. width: 620rpx;
  103. height: 65rpx;
  104. background-color: #fff;
  105. border-radius: 33rpx;
  106. .input_box {
  107. display: flex;
  108. .input_icon {
  109. margin-left: 43rpx;
  110. margin-top: 16rpx;
  111. width: 34rpx;
  112. height: 34rpx;
  113. background-image: url(icon/search_black.png);
  114. background-size: cover;
  115. background-repeat: no-repeat;
  116. }
  117. input{
  118. margin-left: 19rpx;
  119. height: 65rpx;
  120. font-size: 24rpx;
  121. font-family: PingFangSC-Regular, PingFang SC;
  122. font-weight: 400;
  123. color: #232627;
  124. }
  125. }
  126. }
  127. .search_btn{
  128. margin-left: 30rpx;
  129. margin-top: 2rpx;
  130. width: 108rpx;
  131. height: 60rpx;
  132. line-height: 60rpx;
  133. text-align: center;
  134. background: #FFFFFF;
  135. border-radius: 33rpx;
  136. font-size: 24rpx;
  137. font-family: PingFangSC-Regular, PingFang SC;
  138. font-weight: 400;
  139. color: #232627;
  140. }
  141. }
  142. .inner_box{
  143. .inner_title{
  144. padding: 0 24rpx;
  145. height: 94rpx;
  146. background: #F3F6FA;
  147. display: flex;
  148. justify-content: space-between;
  149. align-items: center;
  150. .name{
  151. font-size: 27rpx;
  152. font-family: PingFangSC-Regular, PingFang SC;
  153. font-weight: 400;
  154. color: #232627;
  155. text-align: center;
  156. }
  157. .name_1{
  158. width: 125rpx;
  159. }
  160. .name_2{
  161. margin: 0 15rpx;
  162. width: 420rpx;
  163. }
  164. .name_3{
  165. width: 125rpx;
  166. }
  167. }
  168. .list_item{
  169. .item{
  170. padding: 0 24rpx;
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. border-bottom: 1px solid #f3f3f3;
  175. .text{
  176. font-size: 25rpx;
  177. font-family: PingFangSC-Regular, PingFang SC;
  178. font-weight: 400;
  179. line-height: 94rpx;
  180. text-align: center;
  181. }
  182. .text_1{
  183. width: 125rpx;
  184. }
  185. .text_2{
  186. margin: 0 15rpx;
  187. width: 420rpx;
  188. }
  189. .text_3{
  190. width: 125rpx;
  191. }
  192. }
  193. .normal{
  194. color: #27AE60;
  195. }
  196. .alarm{
  197. color: #E74C3C;
  198. }
  199. .sign{
  200. color: #2C3E50;
  201. }
  202. .fault{
  203. color: #2873FF;
  204. }
  205. }
  206. }
  207. </style>