index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="content">
  3. <Nav title="报表" :isBack="false" />
  4. <view class="section">
  5. <u-list finished-text="没有更多了" @scrolltolower="scrolltolower" height="85vh" :key="key">
  6. <view v-for="item in reportList" :key="item.id" @click="handelDetail(item.id)" class="item">
  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: 20
  29. },
  30. // 列表数据
  31. reportList: [],
  32. key: 0
  33. };
  34. },
  35. onShow() {
  36. this.queryParams.limit = 20
  37. this.getAllReport()
  38. this.key++
  39. },
  40. onPullDownRefresh() {
  41. this.queryParams.limit += 10
  42. this.getAllReport()
  43. },
  44. methods: {
  45. // 获取报表数据
  46. getAllReport() {
  47. uni.$http.get('/reportTable/getAllOkReportTable', this.queryParams).then(res => {
  48. const data = res.data
  49. if (data.code === 200) {
  50. this.reportList = data.data.reportTableList
  51. uni.stopPullDownRefresh()
  52. }
  53. })
  54. },
  55. // 前往详情页
  56. handelDetail(id) {
  57. uni.navigateTo({
  58. url: "/pages/reportForm/report-detail/index?id=" + id
  59. })
  60. },
  61. // 列表滚动到底部触发
  62. scrolltolower() {
  63. this.queryParams.limit += 10
  64. this.getAllReport()
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .content {
  71. padding: 0 25rpx 0rpx 25rpx;
  72. }
  73. .section {
  74. position: relative;
  75. }
  76. .empty {
  77. width: 400rpx;
  78. height: 400rpx;
  79. position: absolute;
  80. top: 50%;
  81. left: 50%;
  82. margin-top: -200rpx;
  83. margin-left: -200rpx;
  84. }
  85. </style>