index.vue 1.5 KB

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