otherReportList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <u-navbar
  4. :title="title"
  5. title-color="#fff"
  6. :is-back="true"
  7. :custom-back="customBack"
  8. :border-bottom="false"
  9. back-icon-color="#CCE8FF"
  10. :background="{background: 'linear-gradient(99deg, #7A4398 0%, #5A5DB9 100%)' }">
  11. <view class="navbar-right" slot="right" @click="handleReport">
  12. <text>登记</text>
  13. </view>
  14. </u-navbar>
  15. <mescroll-uni ref="mescrollRef01" @init="mescrollInit" :top="config.platform=='h5'?100:180" :down="downOption" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
  16. <view class="report-list">
  17. <view class="report-list-item" :class="{'arrearage':item.vehicleNoStatus}" v-for="item in dataList" :key="item.id"
  18. @click="goDetails(item.id)">
  19. <view class="u-flex u-row-between u-m-b-20">
  20. <text>路段/停车场{{item.roadName}}</text>
  21. <text class="u-tips-color">{{$u.timeFormat(item.createTime, 'mm月dd日hh:MM')}}</text>
  22. </view>
  23. <view class="u-flex u-row-between">
  24. <text class="u-line-1">问题描述:{{item.exceprionDes}}</text>
  25. <u-icon name="arrow-right" color="#ddd" size="28"></u-icon>
  26. </view>
  27. </view>
  28. </view>
  29. </mescroll-uni>
  30. </view>
  31. </template>
  32. <script>
  33. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  34. export default{
  35. mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
  36. components:{
  37. },
  38. data(){
  39. return{
  40. title:"其他问题",
  41. downOption:{
  42. auto:false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  43. },
  44. upOption:{
  45. page: {
  46. size: 10 // 每页数据的数量
  47. },
  48. auto:true,
  49. // use:false,
  50. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  51. empty:{
  52. tip: '~ 暂无数据 ~', // 提示
  53. // btnText: '去看看'
  54. }
  55. },
  56. dataList:[],
  57. }
  58. },
  59. onLoad(page){
  60. console.log('page',page);
  61. },
  62. onShow(){
  63. },
  64. methods:{
  65. customBack(){
  66. this.$u.route({
  67. url: 'pages/index/index',
  68. type:'switchTab'
  69. })
  70. },
  71. openPage(path,id) {
  72. this.$u.route({
  73. url: path,
  74. params:{
  75. id:id
  76. }
  77. })
  78. },
  79. goDetails(id){
  80. this.$u.route({
  81. url: 'pages/report/otherReport/details',
  82. params:{
  83. id:id
  84. }
  85. })
  86. },
  87. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  88. upCallback(page) {
  89. // console.log('page',page);
  90. let params ={
  91. pageNum:page.num,
  92. pageSize:page.size
  93. };
  94. this.$u.api.selectOtherExcptionList(params).then(curPageData=>{
  95. // console.log('word',word);
  96. console.log('curPageData',curPageData);
  97. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  98. this.mescroll.endSuccess(curPageData.data.total);
  99. this.mescroll.endBySize(curPageData.data.rows.length, curPageData.data.total);
  100. //设置列表数据
  101. if(page.num == 1) this.dataList = []; //如果是第一页需手动制空列表
  102. this.dataList=this.dataList.concat(curPageData.data.rows); //追加新数据
  103. console.log('this.dataList',this.dataList);
  104. }).catch(()=>{
  105. console.log('catch');
  106. //联网失败, 结束加载
  107. this.mescroll.endErr();
  108. })
  109. },
  110. //点击空布局按钮的回调
  111. emptyClick(){
  112. uni.showToast({
  113. title:'点击了按钮,具体逻辑自行实现'
  114. })
  115. },
  116. refresh(){
  117. this.mescroll.resetUpScroll( );
  118. },
  119. handleReport(){
  120. console.log('handleReport');
  121. this.$u.route({
  122. url: 'pages/report/otherReport/report',
  123. // type:'redirect',
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style>
  130. page{background-color: #F3F3F3;}
  131. </style>
  132. <style lang="scss" scoped>
  133. @import '../report.scss'
  134. </style>