Administrator 2 vuotta sitten
vanhempi
commit
665dcd2077

+ 8 - 3
pages/index/index.js

@@ -39,14 +39,14 @@ Page({
 
     //功能数据-孙一石
     //记录首页点击-登录后继续跳转
-    dofun: null
+    dofun: null,
+    xunjianImgCount : 0
 
   },
 
   onLoad() {
-
   },
-
+ 
   // 待办跳转
   bindViewDaiBan() {
     wx.navigateTo({
@@ -172,6 +172,9 @@ Page({
     http.send_post("/system/AppIndexController/getIndexPageData", null, this.initIndexPageSuccess)
   },
   initIndexPageSuccess(res) {
+    this.setData({
+      xunjianImgCount : res.data.xunjianImgCount
+    })
     http.hideLoading()
   },
 
@@ -201,6 +204,8 @@ Page({
     wx.login({
       success(res) {
         var code = res.code
+
+
         var data = {
           wxCode: code,
           wxNickName: info.nickName,

+ 1 - 1
pages/index/index.wxml

@@ -35,7 +35,7 @@
   <image src="../images/line1.png"/>
 </view>
     <p bindtap="init_userInfo" data-fun="bindViewXunjianimg">安全隐患</p>
-    <h1 bindtap="init_userInfo" data-fun="bindViewXunjianimg">000,000</h1>
+    <h1 bindtap="init_userInfo" data-fun="bindViewXunjianimg">{{xunjianImgCount}}</h1>
     <span bindtap="init_userInfo" data-fun="bindViewXunjianimg">- 急事办 -</span>
 
     <view class="xszn top_banner_btn" open-type="contact" style="width:unset" bindtap="bindViewNewComer">

+ 25 - 9
pages/xunjian/xunjian.js

@@ -55,7 +55,7 @@ Page({
             let picutre = {
               "pic_key": uuid,
               "pic_value": tempFilePath,
-              "pic_base64":wx.getFileSystemManager().readFileSync(tempFilePath,'base64')
+              "pic_base64": wx.getFileSystemManager().readFileSync(tempFilePath, 'base64')
             }
             if (from == "before") {
               that.data.xunjianItems[jibie][1][index].picturesBefore.push(picutre)
@@ -336,15 +336,15 @@ Page({
   },
   submitXujianSuccess(res) {
     if (res.code == 200) {
-      if(res.data.haveXQZG == true){
+      if (res.data.haveXQZG == true) {
         //有限期整改的东西,去通知书页面
         wx.navigateTo({
-          url: '../xqzggzs2/xqzggzs2?logId='+res.data.logId+"&busEnterpriseId="+this.data.busEnterpriseId,
+          url: '../xqzggzs2/xqzggzs2?logId=' + res.data.logId + "&busEnterpriseId=" + this.data.busEnterpriseId,
         })
-      }else{
+      } else {
         // 直接返回详情页
         wx.navigateTo({
-          url: '../details/details?busEnterpriseId='+this.data.busEnterpriseId,
+          url: '../details/details?busEnterpriseId=' + this.data.busEnterpriseId,
         })
       }
     } else {
@@ -363,10 +363,26 @@ Page({
     })
   },
 
-  bindViewXunJiancz(){
-    wx.navigateTo({
-      url: '../xunjiancz/xunjiancz?busEnterpriseId='+this.data.busEnterpriseId,
-    })
+  bindViewXunJiancz() {
+
+    let obj = new Object()
+    obj.busEnterpriseId = this.data.busEnterpriseId
+    http.post('/system/AppXunjianController/getBusInspectionIsRiskByEnterpriseCount',
+      obj, this.getBusInspectionIsRiskByEnterpriseCountSuccess)
+  },
+
+  getBusInspectionIsRiskByEnterpriseCountSuccess(res) {
+    console.log(res)
+    if (res.code == 200) {
+      wx.navigateTo({
+        url: '../xunjiancz/xunjiancz?busEnterpriseId=' + this.data.busEnterpriseId,
+      })
+    } else {
+      wx.showToast({
+        title: res.msg,
+        icon: "none"
+      })
+    }
   },
 
 

+ 100 - 23
pages/xunjiancz/xunjiancz.js

@@ -11,6 +11,9 @@ Page({
     items_first: null,
     items_second: null,
     items_third: null,
+
+    chooseItems: null,
+    totalItems: 0,
     //
     isFolded: true,
     hui: "block",
@@ -130,7 +133,7 @@ Page({
 
 
   onLoad(e) {
-    console.log(e.busEnterpriseId)
+    this.data.chooseItems = new Map()
     this.data.busEnterpriseId = e.busEnterpriseId
     this.getXunjianczData()
   },
@@ -208,7 +211,6 @@ Page({
     http.post("/system/AppXunjianController/getItems", obj, this.getSecondItemsSuccess)
   },
   getSecondItemsSuccess(res) {
-    console.log(res)
     this.setData({
       items_second: res.data
     })
@@ -237,15 +239,89 @@ Page({
     http.post("/system/AppXunjianController/getItemsLast", obj, this.getThirdItemsSuccess)
   },
   getThirdItemsSuccess(res) {
+    let that = this
+    res.data.forEach(element => {
+      if (that.data.chooseItems[element.busItemsId] == true) {
+        element.checked = true
+      }
+    });
     this.setData({
       items_third: res.data
     })
   },
 
-  checkThirdItem(e){
-    console.log(e)
+  checkThirdItem(e) {
+    let busItemId = e.currentTarget.dataset.busitemsid
+    if (this.data.chooseItems[busItemId] == undefined || this.data.chooseItems[busItemId] == null) {
+      this.data.chooseItems[busItemId] = true
+    } else {
+      this.data.chooseItems[busItemId] = null
+    }
+    //计数
+    console.log(this.data.chooseItems)
+    let count = 0;
+    for (let item in this.data.chooseItems) {
+      if (this.data.chooseItems[item] == true) {
+        count++;
+      }
+    }
+    this.setData({
+      totalItems: count
+    })
   },
+  saveXunjianItems() {
+    let obj = new Object()
+    obj.busEnterpriseId = this.data.busEnterpriseId
+    obj.chooseItems = this.data.chooseItems;
+    http.send_post("/system/AppXunjianController/saveXunjianItems", obj, this.saveXunjianItemsSuccess)
+  },
+  saveXunjianItemsSuccess(res) {
+    console.log(res)
+    if (res.data.code == 200) {
+      wx.navigateTo({
+        url: '../xunjiancz/xunjiancz?busEnterpriseId=' + this.data.busEnterpriseId,
+      })
+    }
+  },
+
+  deleteItem(e) {
+    let that = this
+    let info = e.currentTarget.dataset.busiteminfo
+    wx.showModal({
+      title: "提示",
+      content: "确定要删除[" + info + "]?",
+      success: function (sm) {
+        if(sm.confirm){
+          let obj = new Object()
+          obj.busItemsId = e.currentTarget.dataset.busitemid
+          obj.busEnterpriseId = that.data.busEnterpriseId
+          obj.jibie = e.currentTarget.dataset.jibie
+          http.post("/system/AppXunjianController/deleteXunjianItem", obj, that.deleteItemSuccess)
+        }
+      }
+    })
 
+   
+  },
+  deleteItemSuccess(res) {
+    let that = this
+    if(res.code ==200){
+      this.data.xunjianItems[res.data.jibie][1].forEach(function (it,idx) {
+        console.log(it.listid,"======",res.data.busItemsId)
+        if(it.listid == res.data.busItemsId){
+          that.data.xunjianItems[res.data.jibie][1].splice(idx,1)
+          that.setData({
+            xunjianItems : that.data.xunjianItems
+          })
+        }
+      })
+    }
+  },
+  bindViewXunJian(){
+    wx.navigateTo({
+      url: '../xunjian/xunjian?busEnterpriseId='+this.data.busEnterpriseId,
+    })
+  },
 
   change_color_3(e) {
 
@@ -262,25 +338,26 @@ Page({
   },
 
   checkboxChange(e) {
-    let index = this.data.eIndex
-    let index2 = this.data.eIndex2
-    console.log('checkbox发生change事件,携带value值为:', e.detail.value)
-    const items = this.data.listdatachoose[index].children[index2].children
-    console.log(items)
-    const values = e.detail.value
-    for (let i = 0, lenI = items.length; i < lenI; ++i) {
-      items[i].choose = false
-      for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
-        if (items[i].value === values[j]) {
-          items[i].choose = true
-          break
-        }
-      }
-      console.log(items[i].choose, 'sladjfklsadjflkasdjflkdjslk')
-    }
-    this.setData({
-      items
-    })
+    console.log(e)
+    // let index = this.data.eIndex
+    // let index2 = this.data.eIndex2
+    // console.log('checkbox发生change事件,携带value值为:', e.detail.value)
+    // const items = this.data.listdatachoose[index].children[index2].children
+    // console.log(items)
+    // const values = e.detail.value
+    // for (let i = 0, lenI = items.length; i < lenI; ++i) {
+    //   items[i].choose = false
+    //   for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+    //     if (items[i].value === values[j]) {
+    //       items[i].choose = true
+    //       break
+    //     }
+    //   }
+    //   console.log(items[i].choose, 'sladjfklsadjflkasdjflkdjslk')
+    // }
+    // this.setData({
+    //   items
+    // })
   },
   //收起弹层
   updown() {

+ 18 - 11
pages/xunjiancz/xunjiancz.wxml

@@ -1,6 +1,6 @@
 <!--pages/xunjiancz/xunjiancz.wxml-->
 <wxs src="../../base/subutil.wxs" module="tools" />
-<view class="container" >
+<view class="container">
   <view wx:for="{{xunjianItems}}" wx:for-item="value">
     <view class="xj_nav">
       <text class="nav_text1">{{value[0][0]}}</text>
@@ -10,7 +10,9 @@
     <view class="txt_vi">
       <view class="txt" wx:for="{{value[1]}}" wx:key="{{item.listid}}">
         <text class="{{hui}}">{{item.info}}</text>
-        <view class="iconfont icon-pinleishanchu"></view>
+        <view bindtap="deleteItem" data-busitemid="{{item.listid}}" 
+        data-busiteminfo="{{item.info}}" data-jibie="{{item.jibie}}"
+        class="iconfont icon-pinleishanchu"></view>
       </view>
     </view>
   </view>
@@ -34,7 +36,7 @@
           <hr class="{{1 == currentIndex ? 'lineBox' : 'notLineBox'}} " />
         </view>
         <view class='titleBox' bindtap='titleClick' data-idx='2'>
-          <text class="{{2 == currentIndex ? 'fontColorBox1' : ''}}" style="padding: 5rpx 15rpx; background:#f94b0e ;color: white; border-radius: 15rpx;">{{tools.sub(threeL)}}</text>
+          <text class="{{2 == currentIndex ? 'fontColorBox1' : ''}}" style="padding: 5rpx 15rpx; background:#f94b0e ;color: white; border-radius: 15rpx;">{{totalItems}}</text>
           <hr class="{{2 == currentIndex ? 'lineBox' : 'notLineBox'}} " />
         </view>
       </view>
@@ -52,15 +54,20 @@
         </swiper-item>
         <swiper-item class='swiperTtemBox' data-swiper="3">
           <view class="tab_vi">
-            <checkbox-group bindchange="checkboxChange">
-              <label style="display: flex; padding:30rpx; border-bottom: 1rpx solid white;" wx:for="{{items_third}}" wx:key="{{item.value}}">
+           
+              <label style="display: flex; padding:30rpx; border-bottom: 1rpx solid white;" 
+              wx:for="{{items_third}}" wx:key="{{item.value}}"
+              bindtap="checkThirdItem"  
+              data-busitemsid="{{item.busItemsId}}" value="{{item.busItemsId}}"
+              >
                 <view class="weui-cell__hd">
-                  <checkbox  bindtap="checkThirdItem" data-busitemsid="{{item.busItemsId}}"
-                  value="{{item.busItemsName}}" checked="{{item.checked}}" />
+                  <checkbox
+                  checked="{{item.checked}}">
+                  </checkbox>
                 </view>
-                <view cclass="{{myclick3==item.busItemsId?selt:noselt}}">{{item.busItemsName}}</view>
+                <view class="{{myclick3==item.busItemsId?selt:noselt}}">{{item.busItemsName}}</view>
               </label>
-            </checkbox-group>
+            
             <view class="weui-cells weui-cells_after-title">
 
             </view>
@@ -70,6 +77,6 @@
 
     </view>
   </view>
-  <view class="float_btn iconfont" bindtap="bindViewXunJiancz">确定</view>
-  <view class="float_btn iconfont icon-gongju-" style="bottom: 280rpx;" bindtap="bindViewXunJiancz"></view>
+  <view class="float_btn iconfont" bindtap="saveXunjianItems">确定</view>
+  <view class="float_btn iconfont icon-gongju-" style="bottom: 280rpx;" bindtap="bindViewXunJian"></view>
 </view>