controlReport.vue 3.7 KB

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