deviceManage.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="deviceRegistWrapper" ref="contentWrapper">
  3. <!-- 筛选框start -->
  4. <view>
  5. <view style="height:103px"></view>
  6. <view class="ding">
  7. <view class="cu-bar search bg-gray filter-section" style="with:50%;">
  8. <view class="search-form round bg-white">
  9. <select name="" id="" placeholder="">
  10. <option value="">请选择设备类型</option>
  11. <option value="">类型1</option>
  12. <option value="">类型2</option>
  13. </select>
  14. </view>
  15. <view class="search-form round bg-white">
  16. <input type="text" placeholder="选输入设备点位" confirm-type="search"></input>
  17. </view>
  18. </view>
  19. <view class="cu-bar search bg-gray filter-section">
  20. <view class="search-form round bg-white" style="margin-bottom:26rpx">
  21. <input class="" @focus="InputFocus" v-model="siteName" @blur="InputBlur" :adjust-position="false"
  22. type="text" placeholder="选择传输方式" confirm-type="search"></input>
  23. </view>
  24. <view class="action">
  25. <button class="cu-btn bg-blue round" @click="searchData()">查询</button>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 筛选框end -->
  31. <!-- 设备注册列表start -->
  32. <block class="">
  33. <view class="processList deviceRegistList" style="height: calc(100vh - 241px);">
  34. <view class="cu-list menu-avatar ">
  35. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  36. v-for="(item,index) in newDeviceManage" :key="index" :data-target="'move-box-' + index">
  37. <checkbox-group class="block" @change="CheckboxChange">
  38. <view class="cu-form-group margin-top">
  39. <checkbox class='blue' :class="checkbox[0].checked?'checked':''"
  40. :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  41. </view>
  42. </checkbox-group>
  43. <view class="cu-avatar round lg" style="background-image:url(../../static/device-icon.png)">
  44. </view>
  45. <view class="content" @longpress="showDetail(item)">
  46. <view class="pro-title">
  47. <view class="cut">{{item.title}}</view>
  48. </view>
  49. <view class="pro-des ">
  50. <view class="text-cut">
  51. {{item.des}}
  52. </view>
  53. </view>
  54. <view class="pro-date ">{{item.time}}</view>
  55. <view class="showDetail" v-if="item.isShow">
  56. <view>修改设备</view>
  57. <view>删除设备</view>
  58. </view>
  59. </view>
  60. <view class="nav-right num">
  61. <view class="text-grey">
  62. <span class="online" v-if="item.status==0">在线</span>
  63. <span class="offline" v-if="item.status==1">离线</span>
  64. <span class="error" v-if="item.status==2">故障</span>
  65. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </block>
  72. <!-- 设备注册列表end -->
  73. <view class="share grid col-3 ">
  74. <view class="checkAll">
  75. <checkbox-group class="block" @change="CheckboxChange" style="display:inline-block">
  76. <view class="cu-form-group margin-top">
  77. <checkbox class='blue' :class="checkbox[0].checked?'checked':''"
  78. :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  79. </view>
  80. </checkbox-group>全选
  81. </view>
  82. <view class="share-item text-center">
  83. <view><text class="icon iconfont margin-xs" style="color:#19A402">&#xe66d;</text></view>
  84. <view @tap="goDeviceAdd()">新增</view>
  85. </view>
  86. <view class="share-item text-center">
  87. <view><text class="icon iconfont margin-xs" style="color:#FF0303">&#xe66c;</text></view>
  88. <view>删除</view>
  89. </view>
  90. <view class="share-item text-center">
  91. <view><text class="icon iconfont margin-xs" style="color:#FF642E">&#xe66e;</text></view>
  92. <view>导出</view>
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import json from '../../data/json.js';
  99. export default {
  100. data() {
  101. return {
  102. checkbox: [{
  103. value: 'A',
  104. checked: false
  105. }],
  106. deviceManage: json.deviceManage,
  107. siteListRes: 0,
  108. siteName: '',
  109. type: '0',
  110. siteListData: [],
  111. modalName: null,
  112. listTouchStart: 0,
  113. listTouchDirection: null,
  114. CustomBar: this.CustomBar,
  115. };
  116. },
  117. onPullDownRefresh() {
  118. console.log('refresh');
  119. setTimeout(function() {
  120. uni.stopPullDownRefresh();
  121. }, 1000);
  122. },
  123. computed: {
  124. newDeviceManage() {
  125. return this.deviceManage.map(item => {
  126. this.$set(item, "isShow", false)
  127. return item
  128. })
  129. }
  130. },
  131. mounted() {
  132. document.addEventListener('click', (e) => {
  133. if (e.target.className != 'showDetail') {
  134. this.deviceManage.forEach(item => {
  135. item.isShow = false
  136. })
  137. }
  138. })
  139. },
  140. methods: {
  141. // 页面跳转
  142. goDeviceAdd() {
  143. alert(1)
  144. // uni.navigateTo({
  145. // url: '/pages/deviceDetail/deviceDetail',
  146. // });
  147. uni.navigateTo({
  148. url: '/pages/deviceManage/deviceAdd/deviceAdd',
  149. });
  150. },
  151. CheckboxChange(e) {
  152. var items = this.checkbox,
  153. values = e.detail.value;
  154. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  155. items[i].checked = false;
  156. for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
  157. if (items[i].value == values[j]) {
  158. items[i].checked = true;
  159. break
  160. }
  161. }
  162. }
  163. },
  164. // 隐藏显示
  165. showDetail(e) {
  166. // alert(1)
  167. // 存储点击那一项的状态
  168. const nowStatu = e.isShow;
  169. // 将每一项列表的isShow设置为false,让所有的列表都隐藏
  170. this.deviceManage.forEach(item => {
  171. item.isShow = false
  172. })
  173. // 用于再次点击该项的取反
  174. e.isShow = !nowStatu
  175. },
  176. InputFocus(e) {
  177. this.InputBottom = e.detail.height
  178. },
  179. InputBlur(e) {
  180. this.InputBottom = 0
  181. },
  182. }
  183. }
  184. </script>
  185. <style >
  186. .showDetail {
  187. position: absolute;
  188. background: #fff;
  189. box-shadow: 0 1px 6px 0 rgb(32 33 36 / 28%);
  190. border-radius: 10rpx;
  191. top: 50rpx;
  192. right: 47%;
  193. z-index: 3000000;
  194. font-size: 28rpx;
  195. }
  196. .showDetail view{
  197. padding: 0rpx 20rpx;
  198. }
  199. .showDetail view:first-child{
  200. border-bottom:1px solid #EDEDED;
  201. }
  202. </style>