vlist.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="car">
  3. <!-- 列表 -->
  4. <view class="carlists">
  5. <box-list :datainfo="list" :fkztList="fkztList" :wtdt="wtdt" type='visitor' @getDetail="getDetail" @getDelFn="getDelFn"></box-list>
  6. </view>
  7. <loading></loading>
  8. </view>
  9. </template>
  10. <script>
  11. import config from '@/config'
  12. const baseUrl = config.baseUrl
  13. import boxList from "@/work/components/box/list.vue"
  14. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  15. import {reservList,reservDel} from "@/api/work/people.js"
  16. import {getDictionaryFn} from "@/api/system/user.js"
  17. export default{
  18. components:{boxList},
  19. data(){
  20. return{
  21. // reset:require('@/work/static/car/reset.png'),
  22. // search:require('@/work/static/car/search.png'),
  23. // up:require('@/work/static/car/up.png'),
  24. cxrq:"",
  25. text:'',
  26. list:[{tit:'皖A IC520',type:1},{tit:'晋E KD783',type:2},],
  27. pageSize: 10,
  28. pageNum: 1,
  29. reachflag: true,
  30. wtdt:'',
  31. fkztList:[],
  32. }
  33. },
  34. onLoad: function() {
  35. this.init()
  36. this.getDataFn()
  37. },
  38. // 上拉触底加载更多触发事件
  39. onReachBottom() {
  40. if (this.reachflag) {
  41. this.pageNum++
  42. this.getDataFn()
  43. }
  44. },
  45. methods:{
  46. checkPermi, checkRole,
  47. getDetail(id){
  48. this.$tab.navigateTo("/work/pages/visitor/vdetail?id="+id)
  49. },
  50. init(){
  51. // 访客状态
  52. getDictionaryFn('yuyetype').then(res=>{
  53. if(res.code==200){
  54. this.fkztList = res.data.map(v => {
  55. return {
  56. dictLabel: v.dictLabel,
  57. dictValue: v.dictValue
  58. }
  59. })
  60. }
  61. })
  62. },
  63. getConfirm(){
  64. this.getrefreshData()
  65. },
  66. getReset(){
  67. this.cxrq='';
  68. this.text='';
  69. this.getrefreshData()
  70. },
  71. getrefreshData(){
  72. this.pageNum=1;
  73. this.list=[];
  74. this.reachflag=true;
  75. this.getDataFn()
  76. },
  77. getTabFn(val){
  78. this.tabval=val
  79. },
  80. bindDateChangea(e){
  81. var val=e.detail.value;
  82. this.cxrq=val;
  83. },
  84. getDelFn(data){
  85. var that=this;
  86. reservDel(data).then(res=>{
  87. if(res.code==200){
  88. this.$toast("删除成功");
  89. setTimeout(function(){
  90. that.getrefreshData()
  91. },1500)
  92. }
  93. })
  94. },
  95. getDataFn(){
  96. var params={
  97. pageSize:this.pageSize,
  98. pageNum: this.pageNum,
  99. }
  100. reservList(params).then(res=>{
  101. if(res.code==200){
  102. if (res.rows.length < this.pageSize) {
  103. this.reachflag = false
  104. this.wtdt = '到底了~';
  105. } else {
  106. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  107. if (num < res.total) {
  108. this.reachflag = true
  109. this.wtdt = ''
  110. } else {
  111. this.reachflag = false
  112. this.wtdt = '到底了~';
  113. }
  114. }
  115. var newArr=JSON.parse(JSON.stringify(res.rows))
  116. newArr.forEach(ite=>{
  117. ite.right=0;
  118. })
  119. if (this.pageNum == 1) {
  120. this.list = newArr;
  121. } else {
  122. this.list = this.list.concat(newArr)
  123. }
  124. }else{
  125. this.$toast(res.msg)
  126. }
  127. })
  128. },
  129. }
  130. }
  131. </script>
  132. <style>
  133. page{background: #F3F3F0;}
  134. </style>
  135. <style lang="scss" scoped>
  136. .car{padding: 24rpx 0 10rpx;}
  137. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  138. .topa{padding: 20rpx ;
  139. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  140. .chekt{min-width: 180rpx;
  141. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  142. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  143. }
  144. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  145. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  146. input{flex: 1;font-size: 26rpx;color: #272727;}
  147. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  148. font-size: 26rpx;
  149. color: #FFFFFF;}
  150. }
  151. }
  152. .tabtop{padding-bottom: 40rpx;padding-top: 26rpx;
  153. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  154. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  155. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  156. }
  157. }
  158. }
  159. }
  160. .carlists{padding: 0 18rpx;}
  161. </style>