deviceList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="device">
  3. <z-paging ref="paging" v-model="deviceList" @query="queryList">
  4. <view class="device-header" slot="top">
  5. <view class="device-header-left">
  6. <u--input
  7. v-model="deviceTypeValue"
  8. suffixIcon="arrow-down"
  9. :readonly="true"
  10. @focus="deviceTypeShow = true"
  11. fontSize="24rpx"
  12. ></u--input>
  13. <u-picker :show="deviceTypeShow" :columns="deviceTypeList" keyName="label" @confirm="deviceTypeConfirm"></u-picker>
  14. </view>
  15. <view class="device-header-right">
  16. <u--input
  17. v-model="roadValue"
  18. suffixIcon="arrow-down"
  19. :readonly="true"
  20. fontSize="24rpx"
  21. @focus="roadShow = true"
  22. ></u--input>
  23. <u-picker :show="roadShow" :columns="roadList" keyName="label" @confirm="roadConfirm"></u-picker>
  24. </view>
  25. </view>
  26. <view class="device-list">
  27. <view class="device-list-item" v-for="(item, index) in deviceList" :key="index">
  28. <view class="device-list-item-left">
  29. <view class="left-device">
  30. <view>{{ item.deviceType }}</view>
  31. <view>{{ item.road }}</view>
  32. </view>
  33. <view class="device-no">设备编号: {{ item.deviceNo }}</view>
  34. </view>
  35. <view class="device-list-item-right" :class="item.status === 0 ? 'success' : item.status === 1 ? 'error' : 'nomal'">{{ item.status | filterStatus }}</view>
  36. </view>
  37. </view>
  38. </z-paging>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. deviceTypeValue: '全部',
  46. roadValue: '全部',
  47. deviceList: [],
  48. deviceTypeShow: false,
  49. deviceTypeList: [[
  50. { label: '全部', value: 0 },
  51. { label: '车位锁', value: 1 },
  52. { label: '地磁', value: 2 },
  53. { label: '栏杆道闸', value: 3 }
  54. ]],
  55. roadShow: false,
  56. roadList: [[
  57. { label: '全部', value: 0 },
  58. { label: '顺时路', value: 1 },
  59. { label: '党固路', value: 2 },
  60. { label: '丰林路', value: 3 },
  61. { label: '教育路', value: 4 },
  62. { label: '物资路', value: 5 },
  63. { label: '桂花苑路段', value: 6 },
  64. { label: '可处路', value: 7 }
  65. ]]
  66. }
  67. },
  68. filters: {
  69. filterStatus(val) {
  70. let name
  71. switch (val){
  72. case 0:
  73. name = '运行中'
  74. break;
  75. case 1:
  76. name = '已离线'
  77. break;
  78. case 2:
  79. name = '异常'
  80. break;
  81. }
  82. return name
  83. }
  84. },
  85. methods: {
  86. queryList(pageNo, pageSize) {
  87. this.$refs.paging.complete([{
  88. deviceType: '车位锁',
  89. road: '可处路-KC001',
  90. deviceNo: '200602061258',
  91. status: 0
  92. }, {
  93. deviceType: '地磁',
  94. road: '可处路-KC002',
  95. deviceNo: '200602061259',
  96. status: 1
  97. }, {
  98. deviceType: '栏杆道闸',
  99. road: '可处路-KC003',
  100. deviceNo: '200602061269',
  101. status: 2
  102. }, {
  103. deviceType: '地磁',
  104. road: '可处路-KC005',
  105. deviceNo: '200602061259',
  106. status: 0
  107. }])
  108. },
  109. deviceTypeConfirm(e) {
  110. this.deviceTypeValue = e.value[0].label
  111. this.deviceTypeShow = false
  112. },
  113. roadConfirm(e) {
  114. this.roadValue = e.value[0].label
  115. this.roadShow = false
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .device {
  122. font-family: 'PingFangSC-regular';
  123. &-header {
  124. display: flex;
  125. justify-content: space-between;
  126. padding: 24rpx;
  127. &-left {
  128. width: 30%;
  129. }
  130. &-right {
  131. width: 30%;
  132. }
  133. }
  134. &-list {
  135. &-item {
  136. border-bottom: solid 1px #bbb;
  137. padding: 32rpx 24rpx;
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. .left-device {
  142. display: flex;
  143. view {
  144. font-size: 30rpx;
  145. margin-bottom: 16rpx;
  146. &:first-child {
  147. color: #000;
  148. font-weight: 600;
  149. margin-right: 44rpx;
  150. font-size: 30rpx;
  151. width: 130rpx;
  152. }
  153. }
  154. }
  155. .device-no {
  156. font-size: 28rpx;
  157. }
  158. &-right {
  159. font-size: 28rpx;
  160. }
  161. .success {
  162. color: #06C76E;
  163. }
  164. .error {
  165. color: #FF3939;
  166. }
  167. .nomal {
  168. color: #008CFF;
  169. }
  170. }
  171. }
  172. }
  173. </style>