illegalParking.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="topa flexc">
  5. <image :src="reset" class="resetimg" @click="getReset"></image>
  6. <picker mode="date" @change='bindDateChangea'>
  7. <view class="chekt flexc">
  8. <view>{{wtrq|| "选择日期"}}</view>
  9. <image :src="up"></image>
  10. </view>
  11. </picker>
  12. <view class="search flexc">
  13. <image :src="search"></image>
  14. <!-- confirm-type="search" @confirm="getConfirm" -->
  15. <input placeholder="请输入车牌号进行搜索" v-model="text"/>
  16. <view class="btn" @click="getConfirm">搜索</view>
  17. </view>
  18. </view>
  19. <view class="tabtop flexc">
  20. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  21. </view>
  22. </view>
  23. <!-- 列表 -->
  24. <view class="carlists mt12">
  25. <car-list :datainfo="list" :carType="carType" :wtdt="wtdt" type='carpark' @getDetail="getDetail" @getDelFn='getDelFn'></car-list>
  26. </view>
  27. <block v-if="checkPermi(['wuYe:illegalParking:add'])">
  28. <view style="height: 100rpx;"></view>
  29. <view class="rfbtn" @click="getCheck">违停登记</view>
  30. </block>
  31. <loading></loading>
  32. </view>
  33. </template>
  34. <script>
  35. import config from '@/config'
  36. const baseUrl = config.baseUrl
  37. import carList from "@/car/components/car/list.vue"
  38. import {illegalParkingList,illegalParkingDel} from "@/api/work/car.js"
  39. import {getDictionaryFn} from "@/api/system/user.js"
  40. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  41. export default{
  42. components:{carList},
  43. data(){
  44. return{
  45. reset:require('@/car/static/car/reset.png'),
  46. up:require('@/car/static/car/up.png'),
  47. car:require('@/car/static/car/car.png'),
  48. cara:require('@/car/static/car/cara.png'),
  49. carb:require('@/car/static/car/carb.png'),
  50. search:require('@/car/static/car/search.png'),
  51. wtrq:"",
  52. text:'',
  53. list:[],
  54. pageSize: 10,
  55. pageNum: 1,
  56. reachflag: true,
  57. wtdt:'暂无数据',
  58. tabval:'-1',
  59. tablist:[{tit:'全部',val:'-1'}],
  60. carType:[],//车辆类型
  61. }
  62. },
  63. onUnload() {
  64. uni.$off('refCarPark')
  65. },
  66. onLoad: function() {
  67. uni.$on('refCarPark',(res)=>{
  68. this.getrefreshData()
  69. })
  70. this.init()
  71. this.getDataFn()
  72. },
  73. // 上拉触底加载更多触发事件
  74. onReachBottom() {
  75. if (this.reachflag) {
  76. this.pageNum++
  77. this.getDataFn()
  78. }
  79. },
  80. methods:{
  81. checkPermi, checkRole,
  82. init(){//car_type
  83. // 车辆类型
  84. getDictionaryFn('car_type').then(res=>{
  85. if(res.code==200){
  86. this.carType = res.data.map(v => {
  87. var obj={
  88. tit: v.dictLabel,
  89. val: v.dictValue
  90. }
  91. this.tablist.push(obj)
  92. return {
  93. dictLabel: v.dictLabel,
  94. dictValue: v.dictValue
  95. }
  96. })
  97. }
  98. })
  99. },
  100. getCheck(){
  101. this.$tab.navigateTo("/car/pages/illegalcheck")
  102. },
  103. getDetail(e){
  104. this.$tab.navigateTo("/car/pages/illegalrecord?id="+e)
  105. },
  106. getConfirm(){
  107. this.getrefreshData()
  108. },
  109. getReset(){
  110. this.wtrq='';
  111. this.text='';
  112. this.getrefreshData()
  113. },
  114. getrefreshData(){
  115. this.pageNum=1;
  116. this.list=[];
  117. this.reachflag=true;
  118. this.getDataFn()
  119. },
  120. getTabFn(val){
  121. this.tabval=val;
  122. this.getrefreshData()
  123. },
  124. bindDateChangea(e){
  125. var val=e.detail.value;
  126. this.wtrq=val;
  127. this.getrefreshData()
  128. },
  129. getDelFn(data){
  130. var that=this;
  131. illegalParkingDel(data).then(res=>{
  132. if(res.code==200){
  133. this.$toast("删除成功");
  134. setTimeout(function(){
  135. that.getrefreshData()
  136. },1500)
  137. }
  138. })
  139. },
  140. getDataFn(){
  141. var params={
  142. pageSize:this.pageSize,
  143. pageNum: this.pageNum,
  144. }
  145. if(this.tabval!='-1'){
  146. params.carType=this.tabval
  147. }
  148. if(this.text){
  149. params.plateNumber=this.text
  150. }
  151. if(this.wtrq){
  152. params['params[createTime]']=this.wtrq
  153. }
  154. illegalParkingList(params).then(res=>{
  155. if(res.code==200){
  156. if (res.rows.length < this.pageSize) {
  157. this.reachflag = false
  158. this.wtdt = '到底了~';
  159. } else {
  160. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  161. if (num < res.total) {
  162. this.reachflag = true
  163. this.wtdt = ''
  164. } else {
  165. this.reachflag = false
  166. this.wtdt = '到底了~';
  167. }
  168. }
  169. var newArr=JSON.parse(JSON.stringify(res.rows))
  170. newArr.forEach(ite=>{
  171. ite.right=0;
  172. })
  173. if (this.pageNum == 1) {
  174. this.list = newArr;
  175. } else {
  176. this.list = this.list.concat(newArr)
  177. }
  178. }else{
  179. this.$toast(res.msg)
  180. }
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style>
  187. page{background: #F3F3F0;}
  188. </style>
  189. <style lang="scss" scoped>
  190. .car{padding: 206rpx 0 10rpx;}
  191. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  192. .topa{padding: 20rpx ;
  193. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  194. .chekt{min-width: 180rpx;
  195. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  196. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  197. }
  198. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  199. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  200. input{flex: 1;font-size: 26rpx;color: #272727;}
  201. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  202. font-size: 26rpx;
  203. color: #FFFFFF;}
  204. }
  205. }
  206. .tabtop{padding-bottom: 46rpx;
  207. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;
  208. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  209. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  210. }
  211. }
  212. }
  213. .tablst{background: #F3F3F0;padding:30rpx 16rpx 30rpx 46rpx;overflow: auto;
  214. .tabs{height: 48rpx;background: #DADADA;border-radius: 24rpx;margin-right: 30rpx;font-weight: 500;display: flex;align-items: center;justify-content: center;padding: 0 24rpx;
  215. font-size: 26rpx;box-sizing: border-box;flex: 0 0 auto;color: #666666;
  216. &.act{border: 2rpx solid #0256FD;background: #FFFFFF;color: #0256FD;}
  217. }
  218. }
  219. }
  220. .carlists{padding: 0 18rpx;}
  221. </style>