zhanghongrui 2 år sedan
förälder
incheckning
dc4d0c333e

+ 1 - 1
pages/details/details.js

@@ -118,7 +118,7 @@ Page({
     bindViewQiYeDelete(){
         wx.showModal({
           title: '提示',
-          content: '确认删除企业?',
+          content: '确认废弃该企业?',
           complete: (res) => {
             if (res.cancel) {
               

+ 29 - 21
pages/patrol_list/patrol_list.js

@@ -6,15 +6,15 @@ Page({
    */
   data: {
     host: app.globalData.host,
-    enterpriseId:null,
+    enterpriseId: null,
     mList: null,
-    keyword:'',
+    keyword: '',
   },
 
   onLoad(options) {
-    this.data.enterpriseId=options.enterpriseId
+    this.data.enterpriseId = options.enterpriseId
   },
-  onShow(){
+  onShow() {
     this.getPatrolPointList()
   },
 
@@ -24,16 +24,16 @@ Page({
     // obj.busEnterpriseName = ""
     // obj.pageSize = 10
     // obj.reasonable = true
-    obj.busEnterpriseId=this.data.enterpriseId
-    obj.searchValue=this.data.keyword
+    obj.busEnterpriseId = this.data.enterpriseId
+    obj.searchValue = this.data.keyword
     // obj.searchFrom='app'
     http.send_get("/system/AppPatrolstationController/getPatrolstationList", obj, this.getPatrolPointListSuccess)
   },
   getPatrolPointListSuccess(res) {
-    if(res.code==200){
-       this.setData({
+    if (res.code == 200) {
+      this.setData({
         mList: res.data
-       })
+      })
     }
   },
 
@@ -42,13 +42,13 @@ Page({
   // 搜索结果跳页
   bindViewSearchEnd() {
     // wx.navigateTo({
-      // url: '../xunchawu/xunchawu'
+    // url: '../xunchawu/xunchawu'
     // })
     this.getPatrolPointList();
   },
 
-  bindViewInputSearch(e){
-    this.data.keyword= e.detail.value
+  bindViewInputSearch(e) {
+    this.data.keyword = e.detail.value
   },
   // bindViewSearchEnd(e){
   //   let isrisk = e.currentTarget.dataset.isrisk
@@ -64,19 +64,27 @@ Page({
   //       url: '../xunjianmore/xunjianmore?buslogid='+buslogid
   //     })
   //   }
-   
+
   // },
-  bindViewAddPatrol(){
+  bindViewAddPatrol() {
     wx.navigateTo({
-      url: '../new_patrol_point/new_patrol_point?enterpriseId='+this.data.enterpriseId
+      url: '../new_patrol_point/new_patrol_point?enterpriseId=' + this.data.enterpriseId
     })
   },
-  bindViewToDetails(e){
+  bindViewToDetails(e) {
     let id = e.currentTarget.dataset.id
-    
-    wx.navigateTo({
-      url: '../xungengdetails/xungengdetails?id='+ id,
-    })
+    let delFlag = e.currentTarget.dataset.delflag
+    if (delFlag != null && delFlag != '') {
+      wx.showToast({
+        title: '该巡更点已废弃',
+        icon: 'none'
+      })
+    } else {
+
+      wx.navigateTo({
+        url: '../xungengdetails/xungengdetails?id=' + id,
+      })
+    }
   }
- 
+
 })

+ 2 - 1
pages/patrol_list/patrol_list.wxml

@@ -15,11 +15,12 @@
     <!-- <i class="iconfont icon-wushuju zwsj"></i>
   <text class="zwsj_text">暂无数据</text> -->
     <view class="list_li flex-c"  wx:for="{{mList}}" wx:key="index"
-    bindtap="bindViewToDetails" data-id="{{item.busPatrolstationCode}}">
+    bindtap="bindViewToDetails" data-id="{{item.busPatrolstationCode}}" data-delflag="{{item.delFlag}}">
       <view class="list_li_1">
         <!-- <i class="list_icon iconfont icon-queding" wx:if="{{item.isRisk != 1}}"></i> -->
         <!-- <i class="list_icon iconfont icon-yingjipingtai" wx:if="{{item.isRisk == 1}}"></i> -->
         <text>[{{item.busEnterpriseName}}]{{item.busPatrolstationName}}</text>
+        <text class="txt_ri" wx:if="{{item.delFlag!=null&&item.delFlag!=''}}">{{item.delFlag}}</text>
         <i class="iconfont icon-xiangyou list_right"></i>
       </view>
       <view class="list_li_2">

+ 6 - 0
pages/patrol_list/patrol_list.wxss

@@ -55,4 +55,10 @@ position: relative;
   line-height: 60rpx;
   padding-bottom: 10rpx;
 }
+.txt_ri{
+  color: rgb(223, 0, 0)!important;
+  font-size: 24rpx;
+  position: absolute;
+  right: 90rpx;
+}
   

+ 8 - 0
pages/qiye/qiye.js

@@ -44,9 +44,17 @@ Page({
   // 企业详细页
   bindViewDetails(e) {
     let busEnterpriseId = e.currentTarget.dataset.enterpriseid
+    let delFlag = e.currentTarget.dataset.delflag
+    if(delFlag==1){
+      wx.showToast({
+        title: '该企业已废弃',
+        icon:'none'
+      })
+    }else{
     wx.navigateTo({
       url: '../details/details?busEnterpriseId=' + busEnterpriseId
     })
+  }
   },
   //企业表单详细
   bindViewQiYeMore() {

+ 2 - 1
pages/qiye/qiye.wxml

@@ -30,10 +30,11 @@
   </view>
   <!-- 列表 -->
   <view class="list_vi">
-    <view class="list_li" bindtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-enterpriseid="{{item.busEnterpriseId}}">
+    <view class="list_li" bindtap="bindViewDetails" wx:for="{{enterpriseList}}" wx:key="index" data-enterpriseid="{{item.busEnterpriseId}}"  data-delflag="{{item.delFlag}}">
       <i class="list_icon iconfont icon-queding" wx:if="{{item.riskCount == 0}}"></i>
       <i class="list_icon iconfont icon-yingjipingtai" wx:if="{{item.riskCount > 0}}"></i>
       <text>{{item.businessName}}</text>
+      <text class="txt_ri" wx:if="{{item.delFlag==1}}">废弃</text>
       <i class="iconfont icon-xiangyou list_right"></i>
     </view>
 

+ 6 - 0
pages/qiye/qiye.wxss

@@ -36,4 +36,10 @@
 
 .icon-jiahao {
   font-size: 60rpx;
+}
+.txt_ri{
+  color: rgb(223, 0, 0)!important;
+  font-size: 24rpx;
+  position: absolute;
+  right: 90rpx;
 }

+ 177 - 41
pages/xunchajilu/xunchajilu.js

@@ -2,68 +2,204 @@ import http from '../../base/httputil'
 const app = getApp()
 Page({
 
-  onLoad(e){
+  onLoad(e) {
     let busEnterpriseId = e.busEnterpriseId
     this.data.busEnterpriseId = busEnterpriseId
     this.setData({
-      businessName : e.businessName
+      businessName: e.businessName
     })
     this.getXunchaCount();
     this.getXunchaList();
   },
 
-  getXunchaCount(){
+  getXunchaCount() {
     let obj = new Object();
-    obj.busEnterpriseId = this.data.busEnterpriseId 
-    http.post("/system/AppXunchaController/getXunchaCount",obj,this.getXunchaCountSuccess)
+    obj.busEnterpriseId = this.data.busEnterpriseId
+
+    http.post("/system/AppXunchaController/getXunchaCount", obj, this.getXunchaCountSuccess)
   },
-  getXunchaCountSuccess(res){
- 
-    if(res.code==200){
-    this.setData({
-      todayXunchaCount:res.data.xunchaCount.todayXunchaCount,
-      todayRiskCount : res.data.xunchaCount.todayRiskCount
-    })
-  }
+  getXunchaCountSuccess(res) {
+
+    if (res.code == 200) {
+      this.setData({
+        todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
+        todayRiskCount: res.data.xunchaCount.todayRiskCount
+      })
+    }
   },
-  getXunchaList(){
+  getXunchaList() {
     let obj = new Object();
-    obj.busEnterpriseId = this.data.busEnterpriseId 
-    http.send_get("/system/AppXunchaController/getXunchaList",obj,this.getXunchaListSuccess)
+    obj.busEnterpriseId = this.data.busEnterpriseId
+    obj.pageNum = this.data.pageNum
+    obj.pageSize = 10
+    obj.reasonable = false
+    http.send_get("/system/AppXunchaController/getXunchaList", obj, this.getXunchaListSuccess)
   },
-  getXunchaListSuccess(res){
+  getXunchaListSuccess(res) {
   
-    this.setData({
-      xunchaList :  res.data.rows
+    // this.setData({
+    //   xunchaList :  res.data.rows
+    // })
+
+    if (res.code == 200) {
+      // 显示加载图标
+      wx.showLoading({
+        title: '玩命加载中',
+      })
+
+      var that = this
+
+      if (res.data.rows.length == 0) {
+        wx.showToast({
+          title: '暂无更多数据',
+          icon: "none"
+        })
+        that.setData({
+          hidden: true,
+          loadingData: false
+        });
+
+      }
+      if (this.data.isRefresh) {
+        this.setData({
+          xunchaList: res.data.rows,
+          total: res.data.total
+        })
+
+
+
+        // 隐藏导航栏加载框
+        setTimeout(function () {
+          that.setData({
+            loadingData: false
+          });
+          wx.hideNavigationBarLoading();
+          // 停止下拉动作
+          wx.stopPullDownRefresh();
+          wx.hideLoading()
+
+        }, 1000)
+
+      } else {
+        this.setData({
+          xunchaList: this.data.xunchaList.concat(res.data.rows)
+
+        })
+        // 隐藏加载框
+
+        setTimeout(function () {
+          that.setData({
+            hidden: true,
+            loadingData: false
+          });
+
+          wx.hideLoading();
+        }, 1000)
+
+      }
+    } else {
+      wx.showToast({
+        title: res.msg,
+        icon: 'none'
+      })
+    }
+  },
+  onPullDownRefresh: function () {
+    // 显示顶部刷新图标
+    wx.showNavigationBarLoading();
+    var that = this;
+    var loadingData = this.data.loadingData
+    if (loadingData) {
+      return;
+    }
+    that.setData({
+      pageNum: 1,
+      isRefresh: true
     })
+    this.getXunchaList()
   },
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    let that = this
+    var loadingData = that.data.loadingData
+   
+    var hidden = that.data.hidden
+    // 页数+1
+    that.setData({
+      pageNum: that.data.pageNum + 1,
+      isRefresh: false
+    })
+    if (hidden) {
+      that.setData({
+        hidden: false
+      });
+      console.info(that.data.hidden);
+    }
+
+    if (loadingData) {
+      return;
+    }
+    that.setData({
+      loadingData: true
+    });
+
+    
+    //console.log("@@@@"+Math.ceil(this.data.total/10))
+   // if(Math.ceil(that.data.total/10)>=that.data.pageNum){
+      that.getXunchaList();
+  
+    // }else{
+     
+    //   setTimeout(function () {
+    //     that.setData({
+    //       hidden: true,
+    //     });
+
+    //   }, 2000)
+    // }
 
+   
+  },
   /**
    * 页面的初始数据
    */
   data: {
     host: app.globalData.host,
-    busEnterpriseId : null,
-    businessName : null,
-    todayXunchaCount : 0,
-    todayRiskCount : 0,
-    xunchaList : null
+    busEnterpriseId: null,
+    businessName: null,
+    todayXunchaCount: 0,
+    todayRiskCount: 0,
+    xunchaList: null,
+
+    /**
+     * 控制上拉到底部时是否出现 "数据加载中..."
+     */
+    hidden: true,
+    /**
+     * 数据是否正在加载中,避免数据多次加载
+     */
+    loadingData: false,
+    isRefresh: true,
+    total: 0,
+    pageNum: 1 // 页码
+  },
+  // 巡检详细
+  toBindXunjinaMore(e) {
+    let isrisk = e.currentTarget.dataset.isrisk
+    let buslogid = e.currentTarget.dataset.buslogid
+    if (isrisk == 0) {
+      wx.showToast({
+        title: '没有发现安全隐患,请放心!!',
+        icon: "none"
+      })
+    } else {
+
+      wx.navigateTo({
+        url: '../xunjianmore/xunjianmore?buslogid=' + buslogid
+      })
+    }
+
   },
- // 巡检详细
- toBindXunjinaMore(e){
-  let isrisk = e.currentTarget.dataset.isrisk
-  let buslogid = e.currentTarget.dataset.buslogid
-  if(isrisk == 0){
-    wx.showToast({
-      title: '没有发现安全隐患,请放心!!',
-      icon: "none" 
-    })
-  }else{
-   
-    wx.navigateTo({
-      url: '../xunjianmore/xunjianmore?buslogid='+buslogid
-    })
-  }
- 
-},
 })

+ 4 - 1
pages/xunchajilu/xunchajilu.json

@@ -2,5 +2,8 @@
   "usingComponents": {},
   "navigationBarBackgroundColor": "#f94b0e",
   "navigationBarTextStyle": "white",
-  "navigationBarTitleText": "巡查记录"
+  "navigationBarTitleText": "巡查记录",
+  "enablePullDownRefresh": true,
+  "onPullDownRefresh": true,
+  "onReachBottom": true
 }

+ 12 - 2
pages/xungengdetails/xungengdetails.js

@@ -47,7 +47,7 @@ Page({
     http.post("/system/AppPatrolstationController/getPatrolstationDetail", obj, this.getDetailsSuccess)
   },
   getDetailsSuccess(res) {
-    
+   
     wx.hideLoading()
     if (res.data.length == 0) {
 
@@ -62,6 +62,16 @@ Page({
 
     } else {
 
+      if(res.data[0].delFlag!=null&&res.data[0].delFlag!=''){
+        wx.showToast({
+          title: '该巡更点已废弃',
+          icon: 'none'
+        })
+  
+        setTimeout(() => {
+          wx.navigateBack()
+        }, 2000);
+      }
       this.setData({
         businessName: res.data[0].busEnterpriseName,
         orgCode: res.data[0].busPatrolstationCode,
@@ -120,7 +130,7 @@ Page({
     let that = this
     wx.showModal({
       title: "提示",
-      content: "确定要弃编号为" + this.data.orgCode + "的巡更点吗?",
+      content: "确定要弃编号为" + this.data.orgCode + "的巡更点吗?",
       success: function (sm) {
         if (sm.confirm) {
           let obj = new Object()