controlReport.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="site-wrapper">
  3. <view style="height: calc(100vh - 200rpx)">
  4. <!-- 筛选框start -->
  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="" type="text" placeholder="请输入标题" v-model="supervision_title" />
  9. </view>
  10. <view class="action">
  11. <button class="cu-btn bg-blue round" @click="loadData">查询</button>
  12. </view>
  13. </view>
  14. <!-- 筛选框end -->
  15. <view class="cu-list menu-avatar">
  16. <view
  17. class="cu-item"
  18. :class="modalName == 'move-box-' + index ? 'move-cur' : ''"
  19. v-for="(item, index) in controlReport"
  20. :key="index"
  21. :data-target="'move-box-' + index"
  22. @tap="goDetail(item.id)"
  23. >
  24. <view class="cu-avatar round lg" style="background-image: url(../../../static/controlReportIcon.png)"></view>
  25. <view class="content">
  26. <view class="pro-title">
  27. <view class="cut inOneLine">{{ item.supervision_title }}</view>
  28. </view>
  29. <view class="pro-date inOneLine">{{ item.site_name }}</view>
  30. <view class="pro-date inOneLine">{{ item.create_time }}</view>
  31. </view>
  32. <view class="nav-right num">
  33. <view class="text-grey">
  34. <text class="icon iconfont margin-right-sm margin-left-lg">&#xe629;</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view v-if="!controlReport.length && siteListRes == 1" class="text-center margin-top"> 暂无数据</view>
  40. <view v-show="isLoadMore && this.currentPage > 1" style="padding-bottom: 60px">
  41. <uni-load-more :status="loadStatus"></uni-load-more>
  42. </view>
  43. </view>
  44. <!-- 新增按钮start -->
  45. <view style="width: 100%; position: fixed; bottom: 0px; right: 0px; height: 64px; background: #fff">
  46. <view class="plus">
  47. <image src="../../../static/plus.png" style="width: 100rpx; height: 100rpx" @tap="goAddPage()"></image>
  48. </view>
  49. </view>
  50. <!-- 新增按钮end -->
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. controlReport: [],
  58. modalName: null,
  59. siteListRes: 0,
  60. currentPage: 1,
  61. size: 11,
  62. loadStatus: "loading", //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  63. isLoadMore: false, //是否加载中
  64. supervision_title: "",
  65. };
  66. },
  67. onReachBottom() {
  68. //上拉触底函数
  69. if (!this.isLoadMore) {
  70. //此处判断,上锁,防止重复请求
  71. this.isLoadMore = true;
  72. this.currentPage += 1;
  73. this.loadData();
  74. }
  75. },
  76. onLoad: function (option) {
  77. this.loadData();
  78. },
  79. methods: {
  80. // 页面跳转
  81. goAddPage(item) {
  82. uni.redirectTo({
  83. url: "/pages/eleControl/controlReport/controlReportAdd/controlReportAdd",
  84. });
  85. },
  86. goDetail(id) {
  87. uni.navigateTo({
  88. url: "/pages/eleControl/controlReport/controlReportDetail/controlReportDetail?id=" + id,
  89. });
  90. },
  91. loadData() {
  92. this.getDataList({
  93. currentPage: this.currentPage,
  94. size: this.size,
  95. supervision_title: this.supervision_title,
  96. });
  97. },
  98. //数据请求
  99. async getDataList(params = {}) {
  100. const res = await this.$myRequest({
  101. url: "MonitoringReporting/getMonitoringReportingList",
  102. showLoading: true,
  103. data: params,
  104. });
  105. this.siteListRes = 1;
  106. if (res.data.total) {
  107. // this.controlReport = res.data.data
  108. this.controlReport = res.data.data;
  109. if (res.data.data.length < this.size) {
  110. //判断接口返回数据量小于请求数据量,则表示此为最后一页
  111. this.isLoadMore = true;
  112. this.loadStatus = "nomore";
  113. } else {
  114. this.isLoadMore = false;
  115. }
  116. } else {
  117. this.isLoadMore = true;
  118. this.loadStatus = "nomore";
  119. }
  120. },
  121. },
  122. };
  123. </script>
  124. <style lang="scss">
  125. .cu-item {
  126. height: 160rpx !important;
  127. }
  128. </style>