123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <view class="car">
- <view class="cartop">
- <!-- <view class="topa flexc">
- <image :src="day" class="resetimg" @click="getReset"></image>
- <picker mode="date" @change='bindDateChangea'>
- <view class="chekt flexc">
- <view>{{cxrq|| "选择日期"}}</view>
- <image :src="up"></image>
- </view>
- </picker>
- </view>
- -->
- </view>
- <!-- 列表 -->
- <view class="carlists">
- <car-list :datainfo="list" :xglxlist="xglxList" :wtdt="wtdt" type='patrollist' @getDetail="getDetail" @getAddFn="getAddFn" @getDelFn="getDelFn"></car-list>
- </view>
- <block v-if="checkPermi(['wuYe:checkPointManage:add'])">
- <view style="height: 100rpx;"></view>
- <view class="rfbtn" @click="getAddFn">新增巡更点</view>
- </block>
- <loading></loading>
- </view>
- </template>
- <script>
- import config from '@/config'
- const baseUrl = config.baseUrl
- import carList from "@/service/components/car/list.vue"
- import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
- import {xgdglList,xgdglDel} from "@/api/work/service.js"
- import {getDictionaryFn} from "@/api/system/user.js"
- export default{
- components:{carList},
- data(){
- return{
- reset:require('@/car/static/car/reset.png'),
- up:require('@/car/static/car/up.png'),
- day:require('@/service/static/service/day.png'),
- cxrq:"",
- text:'',
- list:[{tit:'皖A IC520',type:1},{tit:'晋E KD783',type:2},],
- pageSize: 10,
- pageNum: 1,
- reachflag: true,
- wtdt:'',
- xglxList:[],
- }
- },
- onUnload() {
- uni.$off('refpatrolSet')
- },
- onLoad: function(){
- uni.$on('refpatrolSet',(res)=>{
- this.getrefreshData()
- })
- this.init()
- this.getDataFn()
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi, checkRole,
- init(){
- // 巡更类型
- getDictionaryFn('patrol_type').then(res=>{
- if(res.code==200){
- this.xglxList = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- getDetail(id){
- this.$tab.navigateTo("/service/pages/service/patrolset?id="+id)
- },
- getAddFn(){
- this.$tab.navigateTo("/service/pages/service/patrolset?")
- },
- getConfirm(){
- this.getrefreshData()
- },
- getReset(){
- this.cxrq='';
- this.text='';
- this.getrefreshData()
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getTabFn(val){
- this.tabval=val
- },
- bindDateChangea(e){
- var val=e.detail.value;
- this.cxrq=val;
- },
- getDelFn(id){
- var that=this;
- xgdglDel(id).then(res=>{
- if(res.code==200){
- this.$toast("删除成功")
- setTimeout(function(){
- that.getrefreshData()
- },1500)
- }
- })
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- }
- xgdglList(params).then(res=>{
- if(res.code==200){
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = ''
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- if (this.pageNum == 1) {
- this.list = res.rows;
- } else {
- this.list = this.list.concat(res.rows)
- }
- }else{
- this.$toast(res.msg)
- }
- })
-
- },
- }
- }
- </script>
- <style>
- page{background: #F3F3F0;}
- </style>
- <style lang="scss" scoped>
- .car{padding-top: 24rpx;}
- .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #F3F3F0;z-index: 2;
- .topa{padding: 30rpx 74rpx;
- .resetimg{width: 28rpx;height: 30rpx;margin-right: 30rpx;flex: 0 0 auto;}
- .chekt{min-width: 180rpx;
- view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
- image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
- }
- }
- }
- .carlists{padding: 0 18rpx;}
- </style>
|