index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="content">
  3. <Nav title="报表" :isBack="false" />
  4. <view class="section">
  5. <u-list finished-text="没有更多了" @scrolltolower="scrolltolower" height="85vh">
  6. <view v-for="item in reportList" :key="item.id" @click="handelDetail(item.id)">
  7. <u-list-item>
  8. <u-cell-group>
  9. <u-cell :title="item.reportTableName" :label="item.createTime" isLink></u-cell>
  10. </u-cell-group>
  11. </u-list-item>
  12. </view>
  13. </u-list>
  14. <view class="empty" v-if="!this.reportList.length">
  15. <u-empty text="暂无数据" class="empty-icon" mode="data" icon="../../static/data.png">
  16. </u-empty>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. // 查询参数
  26. queryParams: {
  27. page: 1,
  28. limit: 10
  29. },
  30. // 列表数据
  31. reportList: []
  32. };
  33. },
  34. onShow() {
  35. this.queryParams.limit=10
  36. this.getAllReport()
  37. },
  38. onPullDownRefresh() {
  39. this.queryParams.limit += 10
  40. this.getAllReport()
  41. },
  42. methods: {
  43. // 获取报表数据
  44. getAllReport() {
  45. uni.$http.get('/reportTable/getAllOkReportTable', this.queryParams).then(res => {
  46. const data = res.data
  47. if (data.code === 200) {
  48. this.reportList = data.data.reportTableList
  49. uni.stopPullDownRefresh()
  50. }
  51. })
  52. },
  53. // 前往详情页
  54. handelDetail(id) {
  55. uni.navigateTo({
  56. url: "/pages/reportForm/report-detail/index?id=" + id
  57. })
  58. },
  59. // 列表滚动到底部触发
  60. scrolltolower() {
  61. this.queryParams.limit += 10
  62. this.getAllReport()
  63. },
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .content {
  69. padding: 0 25rpx 0rpx 25rpx;
  70. }
  71. .section {
  72. position: relative;
  73. }
  74. .empty {
  75. width: 400rpx;
  76. height: 400rpx;
  77. position: absolute;
  78. top: 50%;
  79. left: 50%;
  80. margin-top: -200rpx;
  81. margin-left: -200rpx;
  82. }
  83. </style>