patrolrecord.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="topa flexc">
  5. <image :src="day" class="resetimg" @click="getReset"></image>
  6. <picker mode="date" @change='bindDateChangea'>
  7. <view class="chekt flexc">
  8. <view>{{cxrq|| "选择日期"}}</view>
  9. <image :src="up"></image>
  10. </view>
  11. </picker>
  12. </view>
  13. </view>
  14. <!-- 列表 -->
  15. <view class="carlists">
  16. <car-list :datainfo="list" :topval="ttopval" :wtdt="wtdt" type='patrol' @getDetail="getDetail" @getAddFn="getAddFn"></car-list>
  17. </view>
  18. <loading></loading>
  19. </view>
  20. </template>
  21. <script>
  22. import config from '@/config'
  23. const baseUrl = config.baseUrl
  24. import carList from "@/work/components/car/list.vue"
  25. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  26. export default{
  27. components:{carList},
  28. data(){
  29. return{
  30. reset:require('@/work/static/car/reset.png'),
  31. up:require('@/work/static/car/up.png'),
  32. day:require('@/work/static/service/day.png'),
  33. cxrq:"",
  34. text:'',
  35. list:[{tit:'皖A IC520',type:1},{tit:'晋E KD783',type:2},],
  36. pageSize: 10,
  37. pageNum: 1,
  38. reachflag: true,
  39. wtdt:'',
  40. }
  41. },
  42. onLoad: function() {
  43. },
  44. // 上拉触底加载更多触发事件
  45. onReachBottom() {
  46. if (this.reachflag) {
  47. this.pageNum++
  48. this.getDataFn()
  49. }
  50. },
  51. methods:{
  52. checkPermi, checkRole,
  53. getDetail(){
  54. this.$tab.navigateTo("/work/pages/service/patroldetail")
  55. },
  56. getAddFn(){
  57. this.$tab.navigateTo("/work/pages/service/patroladd")
  58. },
  59. getTabtop(val){
  60. this.ttopval=val
  61. },
  62. getConfirm(){
  63. this.getrefreshData()
  64. },
  65. getReset(){
  66. this.cxrq='';
  67. this.text='';
  68. this.getrefreshData()
  69. },
  70. getrefreshData(){
  71. this.pageNum=1;
  72. this.list=[];
  73. this.reachflag=true;
  74. this.getDataFn()
  75. },
  76. getTabFn(val){
  77. this.tabval=val
  78. },
  79. bindDateChangea(e){
  80. var val=e.detail.value;
  81. this.cxrq=val;
  82. },
  83. getDataFn(){
  84. var params={
  85. pageSize:this.pageSize,
  86. pageNum: this.pageNum,
  87. }
  88. params.noticeType=this.tabidx
  89. getNoticeList(params).then(res=>{
  90. if(res.code==200){
  91. if (res.rows.length < this.pageSize) {
  92. this.reachflag = false
  93. this.wtdt = '到底了~';
  94. } else {
  95. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  96. if (num < res.total) {
  97. this.reachflag = true
  98. this.wtdt = ''
  99. } else {
  100. this.reachflag = false
  101. this.wtdt = '到底了~';
  102. }
  103. }
  104. if (this.pageNum == 1) {
  105. this.list = res.rows;
  106. } else {
  107. this.list = this.list.concat(res.rows)
  108. }
  109. }else{
  110. this.$toast(res.msg)
  111. }
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style>
  118. page{background: #F3F3F0;}
  119. </style>
  120. <style lang="scss" scoped>
  121. .car{padding-top: 106rpx;}
  122. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #F3F3F0;z-index: 2;
  123. .topa{padding: 30rpx 74rpx;
  124. .resetimg{width: 28rpx;height: 30rpx;margin-right: 30rpx;flex: 0 0 auto;}
  125. .chekt{min-width: 180rpx;
  126. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  127. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  128. }
  129. }
  130. }
  131. .carlists{padding: 0 18rpx;}
  132. </style>