siteList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="site-wrapper" ref="contentWrapper" >
  3. <!-- 筛选框start -->
  4. <view class="ding">
  5. <view class="cu-bar search bg-gray filter-section">
  6. <view class="search-form round bg-white">
  7. <text class="cuIcon-search"></text>
  8. <input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
  9. confirm-type="search"></input>
  10. </view>
  11. <view class="action">
  12. <button class="cu-btn bg-blue round">查询</button>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 筛选框end -->
  17. <!-- 站点列表start -->
  18. <view class="site-items">
  19. <view class="cu-list menu-avatar">
  20. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in newSiteListData"
  21. :key="index" :data-target="'move-box-' + index">
  22. <view class="cu-avatar round lg" v-if="type==1" style="background-image: url(../../static/site-icon-alarm.png);"></view>
  23. <view class="cu-avatar round lg" v-else style="background-image: url(../../static/site-icon.png);"></view>
  24. <view class="content" v-if="type==1" @tap="goAlarmingList">
  25. <view class="text-grey site-tit">
  26. {{item.siteName}}
  27. <text>(共3个未处理告警)</text>
  28. </view>
  29. </view>
  30. <view class="content" v-else @tap="goDeviceType" @longpress="showDetail(item)">
  31. <view class="text-grey site-tit">
  32. {{item.siteName}}
  33. <text>(共3个设备)</text>
  34. </view>
  35. <view class="showDetail" v-if="item.isShow" @tap.stop="goSiteDetail" >查看详情</view>
  36. </view>
  37. <view class="nav-right num">
  38. <view class="text-grey">
  39. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 站点列表end -->
  46. </view>
  47. </template>
  48. <script>
  49. import json from '../../data/json.js';
  50. export default {
  51. data() {
  52. return {
  53. type: '0',
  54. show:'false',
  55. siteListData: json.siteListData,
  56. modalName: null,
  57. listTouchStart: 0,
  58. listTouchDirection: null,
  59. CustomBar: this.CustomBar,
  60. };
  61. },
  62. onLoad: function(option) {
  63. console.log(option.type); //打印出上个页面传递的参数。
  64. this.type = option.type;
  65. if (option.type == 1) {
  66. uni.setNavigationBarTitle({
  67. title: '综合报警'
  68. });
  69. } else {
  70. uni.setNavigationBarTitle({
  71. title: '运行监测'
  72. });
  73. }
  74. },
  75. onPullDownRefresh() {
  76. console.log('refresh');
  77. setTimeout(function() {
  78. uni.stopPullDownRefresh();
  79. }, 1000);
  80. },
  81. computed: {
  82. newSiteListData() {
  83. return this.siteListData.map(item => {
  84. this.$set(item, "isShow", false)
  85. return item
  86. })
  87. }
  88. },
  89. methods: {
  90. // 隐藏显示
  91. showDetail(e) {
  92. // 存储点击那一项的状态
  93. const nowStatu = e.isShow;
  94. this.show=e.isShow;
  95. // 将每一项列表的isShow设置为false,让所有的列表都隐藏
  96. this.siteListData.forEach(item => {
  97. item.isShow = false
  98. })
  99. // 用于再次点击该项的取反
  100. e.isShow = !nowStatu
  101. },
  102. InputFocus(e) {
  103. this.InputBottom = e.detail.height
  104. },
  105. InputBlur(e) {
  106. this.InputBottom = 0
  107. },
  108. // 页面跳转
  109. goAlarmingList() {
  110. uni.navigateTo({
  111. url: '/pages/alarmingList/alarmingList',
  112. success: res => {},
  113. fail: () => {},
  114. complete: () => {}
  115. });
  116. },
  117. goDeviceType() {
  118. uni.navigateTo({
  119. url: '/pages/deviceType/deviceType',
  120. success: res => {},
  121. fail: () => {},
  122. complete: () => {}
  123. });
  124. },
  125. goSiteDetail() {
  126. uni.navigateTo({
  127. url: '/pages/siteDetail/siteDetail',
  128. success: res => {},
  129. fail: () => {},
  130. complete: () => {}
  131. });
  132. },
  133. }
  134. }
  135. </script>
  136. <style>
  137. .showDetail {
  138. position: absolute;
  139. background: #fff;
  140. box-shadow: 0 1px 6px 0 rgb(32 33 36 / 28%);
  141. padding: 0rpx 32rpx;
  142. border-radius: 10rpx;
  143. top: 42rpx;
  144. right: 0%;
  145. z-index: 3000000;
  146. font-size: 28rpx;
  147. }
  148. </style>