siteListAlarming.vue 4.9 KB

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