controlReport.vue 3.4 KB

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