index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.getAllReport()
  36. },
  37. onPullDownRefresh() {
  38. this.getAllReport()
  39. },
  40. methods: {
  41. // 获取报表数据
  42. getAllReport() {
  43. uni.$http.get('/reportTable/getAllOkReportTable', this.queryParams).then(res => {
  44. const data = res.data
  45. if (data.code === 200) {
  46. this.reportList = data.data.reportTableList
  47. uni.stopPullDownRefresh()
  48. }
  49. })
  50. },
  51. // 前往详情页
  52. handelDetail(id) {
  53. uni.navigateTo({
  54. url: "/pages/reportForm/report-detail/index?id=" + id
  55. })
  56. },
  57. // 列表滚动到底部触发
  58. scrolltolower() {
  59. this.queryParams.limit += 10
  60. this.getAllReport()
  61. },
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .content {
  67. padding: 0 25rpx 0rpx 25rpx;
  68. }
  69. .section {
  70. position: relative;
  71. }
  72. .empty {
  73. height: 80vh;
  74. position: relative;
  75. .empty-icon {
  76. width: 400rpx;
  77. height: 400rpx;
  78. position: absolute;
  79. top: 30%;
  80. left: 50%;
  81. margin-top: -200rpx;
  82. margin-left: -200rpx
  83. }
  84. }
  85. </style>