siteListAlarming.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <!-- <list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type"
  3. :bindSiteName="siteName" :bindDetailUrl="detailUrl" :bindSiteListRes="siteListRes">
  4. </list-test> -->
  5. <view class="site-wrapper" ref="contentWrapper">
  6. <view style="height:100rpx"></view>
  7. <!-- 筛选框start -->
  8. <view class="ding">
  9. <view class="cu-bar search bg-gray filter-section">
  10. <view class="search-form round bg-white">
  11. <text class="cuIcon-search"></text>
  12. <input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
  13. v-model="siteName"></input>
  14. </view>
  15. <view class="action">
  16. <button class="cu-btn bg-blue round" @click="searchData">查询</button>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 筛选框end -->
  21. <!-- 站点列表start -->
  22. <view class="site-items" style="margin-top:0;">
  23. <view class="cu-list menu-avatar">
  24. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteListData"
  25. :key="index" :data-target="'move-box-' + index">
  26. <view class="cu-avatar round lg" v-bind:style="{ 'background-image': 'url(' + linkIcon+ ')' }"></view>
  27. <view class="content" v-if="type==1" @tap="goNowUrl(item)" >
  28. <view class="text-grey site-tit ">
  29. <text style="width:93%" class="inTwoLine">{{item.siteName}}( 共{{item.siteAlarmCount}}个未处理告警 )</text>
  30. </view>
  31. </view>
  32. <view class="content" v-else @tap="goNowUrl" @longpress="showDetail(item)">
  33. <view class="text-grey site-tit">
  34. {{item.siteName}}
  35. <text>(共3个设备)</text>
  36. </view>
  37. <view class="showDetail" v-if="item.isShow" @tap.stop="goNowDetailUrl" >查看详情</view>
  38. </view>
  39. <view class="nav-right num">
  40. <view class="text-grey">
  41. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view v-if="!siteListData.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
  47. <view v-show="isLoadMore&&this.currentPage>1">
  48. <uni-load-more :status="loadStatus"></uni-load-more>
  49. </view>
  50. </view>
  51. <!-- 站点列表end -->
  52. </view>
  53. </template>
  54. <script>
  55. import json from '../../data/json.js';
  56. export default {
  57. data() {
  58. return {
  59. modalName: null,
  60. siteListRes: 0,
  61. type: 1,
  62. linkUrl: '/pages/alarmingList/alarmingList',
  63. linkIcon: '../../static/site-icon-alarm.png',
  64. siteListData: [],
  65. num: ' 共3个未处理告警',
  66. detailUrl: '/pages/siteDetail/siteDetail',
  67. siteName: '',
  68. currentPage: 1,
  69. size: 12,
  70. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  71. isLoadMore: false, //是否加载中
  72. };
  73. },
  74. onPullDownRefresh() {
  75. console.log('refresh');
  76. setTimeout(function() {
  77. uni.stopPullDownRefresh();
  78. }, 1000);
  79. },
  80. computed: {
  81. },
  82. mounted() {
  83. },
  84. onReachBottom() { //上拉触底函数
  85. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  86. this.isLoadMore = true
  87. this.currentPage += 1;
  88. this.loadData()
  89. }
  90. },
  91. onLoad() {
  92. this.loadData()
  93. },
  94. methods: {
  95. searchData(){
  96. this.currentPage=1,
  97. this.siteListData=[]
  98. this.siteListRes=0
  99. this.loadData()
  100. },
  101. loadData(){
  102. this.getDataList({
  103. "siteName":this.siteName,
  104. currentPage: this.currentPage,
  105. size: this.size,
  106. })
  107. },
  108. // 页面跳转
  109. goNowUrl(item) {
  110. uni.navigateTo({
  111. url: this.linkUrl+'?companyCode='+item.companyCode,
  112. success: res => {},
  113. fail: () => {},
  114. complete: () => {}
  115. });
  116. // if(item.siteAlarmCount){
  117. // }
  118. },
  119. InputFocus(e) {
  120. this.InputBottom = e.detail.height
  121. },
  122. InputBlur(e) {
  123. this.InputBottom = 0
  124. },
  125. async getDataList(params = {}) {
  126. const res = await this.$myRequest({
  127. url: 'IntegratedAlarm/getSiteList',
  128. showLoading: true,
  129. data: params
  130. })
  131. // console.log(res.data.data)
  132. // this.siteListData = res.data.data
  133. this.siteListRes = 1;
  134. if (res.data.total) {
  135. this.siteListData = this.siteListData.concat(res.data.data)
  136. if (res.data.data.length < this.size) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
  137. this.isLoadMore = true
  138. this.loadStatus = 'nomore'
  139. } else {
  140. this.isLoadMore = false
  141. }
  142. } else {
  143. this.isLoadMore = true
  144. this.loadStatus = 'nomore'
  145. }
  146. }
  147. }
  148. }
  149. </script>
  150. <style>
  151. </style>