فهرست منبع

修改告知书逻辑

menc 2 سال پیش
والد
کامیت
6a9341a448

+ 39 - 1
base/httputil.js

@@ -96,7 +96,13 @@ function loginSuccess(res) {
 function send_post(url, data, successfun) {
 
   console.log("令牌:", app.globalToken)
-  
+  if (app.globalToken == null) {
+    wx.showToast({
+      title: '尚未登录,登录后即可使用',
+      icon: 'none'
+    })
+    return
+  }
   wx.request({
     url: BASE_Server + url, //仅为示例,并非真实的接口地址 
     method: "POST",
@@ -122,6 +128,14 @@ function send_post(url, data, successfun) {
 }
 
 function post(url, data, successfun) {
+  console.log("令牌:", app.globalToken)
+  if (app.globalToken == null) {
+    wx.showToast({
+      title: '尚未登录,登录后即可使用',
+      icon: 'none'
+    })
+    return
+  }
   wx.request({
     url: BASE_Server + url, //仅为示例,并非真实的接口地址
     method: "POST",
@@ -142,6 +156,29 @@ function post(url, data, successfun) {
 }
 
 
+function post_token(url, data, successfun) {
+  console.log("令牌:", app.globalToken)
+  wx.request({
+    url: BASE_Server + url, //仅为示例,并非真实的接口地址 
+    method: "POST",
+    header: {
+      'content-type': 'application/json',
+      'Authorization': 'Bearer ' + app.globalToken
+    },
+    data: data,
+    success(res) {
+      console.log("TAG","返回数据:"+res.data)
+      authToken(res.data)
+      successfun(res.data)
+    },
+    fail(res){
+      wx.showToast({
+        title: "网络请求失败",
+      })
+    }
+
+  })
+}
 function get(url, data, successfun) {
   wx.request({
     url: BASE_Server + url, //仅为示例,并非真实的接口地址
@@ -244,6 +281,7 @@ module.exports = {
   send_photo: send_photo,
   send: send,
   post: post,
+  post_token: post_token,
   // wxpost: wxpost,
   get: get,
   send_get:send_get,

+ 21 - 0
base/utils.js

@@ -0,0 +1,21 @@
+   // util.js 
+   const formatTime = date => {
+    const year = date.getFullYear()
+    const month = date.getMonth() + 1
+    const day = date.getDate()
+    const hour = date.getHours()
+    const minute = date.getMinutes()
+    const second = date.getSeconds()
+    return year+"年"+month+"月"+day+"日"
+  //返回年月日,时分秒
+  //  return [year, month, day].map(formatNumber)//.join(\'/\') + \' \' + [hour, minute].map(formatNumber).join(\':\')   
+ }
+ 
+//  const formatNumber = n => {
+//    n = n.toString()
+//    return n[1] ? n : \'0\' + n
+//  }
+ 
+ module.exports = {
+   formatTime: formatTime
+ }

+ 4 - 7
pages/denglu/denglu.js

@@ -49,14 +49,11 @@ Page({
     let that=this;
     console.log("要提交给服务器的用户名和密码是",this.data.wxCode+"_"+this.data.userName+"_"+this.data.password);
     var data = {
-      // wxCode: this.data.wxCode,
-      // wxNickName: this.data.userName,
-      // wxAvatarUrl: info.avatarUrl
       userName:this.data.userName,
       password:this.data.password,
       openid:this.data.openid,
     }
-    http.send_post("/system/minapp/AppLoginController/bindWxUser", data, that.bindSuccess)
+    http.post_token("/system/minapp/AppLoginController/bindWxUser", data, that.bindSuccess)
   },
   
   bindSuccess(res) {
@@ -76,7 +73,6 @@ Page({
       console.log("登陆成功的令牌:",app.globalToken)
       wx.setStorageSync('userName', that.data.userName)
       wx.setStorageSync('password', that.data.password)
-      wx.setStorageSync('access_token', app.globalToken)
       app.isLoginSuccess=true;
       this.setData({
         isBindSuccess : true
@@ -100,13 +96,14 @@ Page({
     var data = {
       wxCode: that.data.wxCode,
     }  
-    http.send_post("/system/minapp/AppLoginController/getSessionKeyOropenid", data, this.openIdSuccess)
+    http.post_token("/system/minapp/AppLoginController/getSessionKeyOropenid", data, this.openIdSuccess)
   },
   openIdSuccess(res){
     let that = this
     if (res!=null&&res.openid!=null) {
       that.data.openid = res.openid
-      wx.setStorageSync('openid', res.openid)
+      console.log("openid",res.openid)
+      // wx.setStorageSync('openid', res.openid)
     }
   },
  

+ 1 - 3
pages/index/index.js

@@ -58,9 +58,7 @@ Page({
   },
 
   onShow() {
-    let token = wx.getStorageSync('access_token')
-    if (token == '' || token == null) {
-      app.globalToken = null
+    if (app.globalToken == null) {
       wx.showToast({
         title: '尚未登录,登录后即可使用',
         icon: 'none'

+ 26 - 7
pages/qianming/qianming.js

@@ -10,8 +10,9 @@ Page({
    */
   data: {
     host: app.globalData.host,
-    logId : null,
-    busEnterpriseId : null,
+    index:null,
+    qianming:null,
+    qianming1:null
   },
   // 画布的触摸移动开始手势响应
   start: function (event) {
@@ -51,8 +52,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.data.logId = options.logId
-    this.data.busEnterpriseId = options.busEnterpriseId
+    this.data.index=options.index
     that = this
     //获得Canvas的上下文
     content = wx.createCanvasContext('firstCanvas')
@@ -107,9 +107,28 @@ Page({
         //上传图片
         that.uploadSignPic(path)
         console.log(path)
-        wx.navigateTo({
-          url: '../xqzggzs2/xqzggzs2?logId='+that.data.logId+"&qianming="+path+"&busEnterpriseId="+that.data.busEnterpriseId,
-        })
+        let page = getCurrentPages();
+        let prevPage = page[page.length - 2];
+        if(that.data.index==0){
+          prevPage.setData({
+            index :0,
+            qianming:path,
+          });
+           wx.navigateBack()
+        }else if(that.data.index==1){
+          prevPage.setData({
+            index :1,
+            qianming1:path,
+          });
+          wx.navigateBack()
+        }else if(that.data.index==2){
+          prevPage.setData({
+            index :2,
+            qianming:path,
+          });
+          wx.navigateBack()
+        }
+       
       }
     })
   },

+ 29 - 4
pages/xqzggzs/xqzggzs.js

@@ -1,4 +1,5 @@
 // pages/xqzggzs/xqzggzs.js
+import util from '../../base/utils'
 const app = getApp()
 Page({
 
@@ -6,14 +7,25 @@ Page({
    * 页面的初始数据
    */
   data: {
-    host: app.globalData.host
+    host: app.globalData.host,
+    index:null,
+    isFirst:true,
+    qianming:null,
+    time:null,
+  },
+  bindViewQianMing(){
+    wx.navigateTo({
+      url: '../qianming/qianming?index=2',
+    })
   },
-
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    var time= util.formatTime(new Date())
+    this.setData({
+      time:time
+    })
   },
 
   /**
@@ -27,7 +39,20 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    if(!this.data.isFirst){
+      let pages = getCurrentPages();
+      let currPage = pages[pages.length-1];
+      this.data.index=currPage.data.index;
+      if(this.data.index==2){
+        this.data.qianming=currPage.data.qianming;
+        if (this.data.qianming != undefined && this.data.qianming != null) {
+          this.setData({
+            qianming: this.data.qianming
+          })
+        }
+      }
+    }
+    this.data.isFirst=false
   },
 
   /**

+ 18 - 13
pages/xqzggzs/xqzggzs.wxml

@@ -1,18 +1,23 @@
 <!--pages/xqzggzs/xqzggzs.wxml-->
 <view class="container">
-  <view class="zg_bh"><text>编号:</text><input type="number" style="width: 400rpx;"/></view>
+  <view class="zg_bh"><text>编号:</text><input type="number" style="width: 400rpx;" /></view>
   <text class="con_tit mar_top">复查意见告知书</text>
-  <view class="flex_row text_ind mar_top2">本机关于 <input type="text" style="width: 250rpx;" />,对你单位做出了隐患限期整改告知书(编号:<input type="number"  style="width: 250rpx;"/>),经对你单位整改情况进行复查,提出如下意见:</view>
-    <textarea ></textarea>
-    <view class="flex_row text_ind">现告知你单位对上述问题于 <input type="text" style="width: 100rpx;" />前整改完毕,达到有关法律法规规章和标准规定的要求。由此造成应当采取措施,确保安全生产。</view>
-    <view class="flex_row text_ind">逾期未整改或在整改过程中存在安全生产违法行为的,我单位将提报相关执法部门进行依法查处。</view>
-<view class="flex_row text_ind">如果对本告知内容有异议,可向<input type="text" style="width: 150rpx;"/>咨询或说明情况,也可通过12350安全生产举报电话进行反映。在没有新书面告知前,本告知要求不停止执行,法律另有规定的除外。</view>
+  <view class="flex_row text_ind mar_top2">本机关于 <input type="text" style="width: 250rpx;" />,对你单位做出了隐患限期整改告知书(编号:<input type="number" style="width: 250rpx;" />),经对你单位整改情况进行复查,提出如下意见:</view>
+  <textarea></textarea>
+  <view class="flex_row text_ind">现告知你单位对上述问题于 <input type="text" style="width: 100rpx;" />前整改完毕,达到有关法律法规规章和标准规定的要求。由此造成应当采取措施,确保安全生产。</view>
+  <view class="flex_row text_ind">逾期未整改或在整改过程中存在安全生产违法行为的,我单位将提报相关执法部门进行依法查处。</view>
+  <view class="flex_row text_ind">如果对本告知内容有异议,可向<input type="text" style="width: 150rpx;" />咨询或说明情况,也可通过12350安全生产举报电话进行反映。在没有新书面告知前,本告知要求不停止执行,法律另有规定的除外。</view>
 
-<view class="flex_row mar_top">被复查单位负责人(签名):<input type="text" style="width: 220rpx;"/></view>
-<view class="flex_row mar_top2">检查人员:<input type="text" style="width: 190rpx;"/><text>编号:</text><input type="text" style="width: 190rpx;"/></view>
-<view class="flex_row mar_top2"><text style="opacity: 0;">检查人员:</text><input type="text" style="width: 190rpx;"/>编号:<input type="text" style="width: 190rpx;"/></view>
-<view class="flex_row mar_top2" style="text-align: right;"><input type="text" style="width: 370rpx;"/>部门(印章)</view>
-<view class="flex_row mar_top2" style="text-align: right;"><input type="number" style="width: 100rpx;"/>年<input type="number" style="width: 100rpx;"/>月<input type="number" style="width: 100rpx;"/>日</view>
+  <view class="flex_row mar_top txt_vi">
+    <text bindtap="bindViewQianMing">被复查单位负责人(签名):</text>
+    <image wx:if="{{qianming != undefined && qianming != null}}" src="{{qianming}}" class="qm_img"></image>
+  </view>
+  <view class="flex_row mar_top2">检查人员:<input type="text" style="width: 190rpx;" /><text>编号:</text><input type="text" style="width: 190rpx;" /></view>
+  <view class="flex_row mar_top2"><text style="opacity: 0;">检查人员:</text><input type="text" style="width: 190rpx;" />编号:<input type="text" style="width: 190rpx;" /></view>
+  <view class="flex_row mar_top2" style="text-align: right;"><input type="text" style="width: 370rpx;" />部门(印章)</view>
+  <!-- <view class="flex_row mar_top2" style="text-align: right;"><input type="number" style="width: 100rpx;" />年<input type="number" style="width: 100rpx;" />月<input type="number" style="width: 100rpx;" />日</view> -->
+  <view class="flex_row mar_top2" style="text-align: right;"><text type="text" style="width: 340rpx;" />{{time}}</view>
 
-<button type="primary">提交</button>
-</view>
+  <button type="primary">提交</button>
+  <view style="height: 10rpx;"></view>
+</view>

+ 7 - 0
pages/xqzggzs/xqzggzs.wxss

@@ -49,4 +49,11 @@ textarea{
 button{
   width: 70%!important;
   margin: 50rpx auto;
+}
+.qm_img{
+  width: 200rpx;
+  height: 160rpx;
+}
+.txt_vi{
+  display: flex;
 }

+ 87 - 12
pages/xqzggzs2/xqzggzs2.js

@@ -1,4 +1,5 @@
 import http from '../../base/httputil'
+import util from '../../base/utils'
 const app = getApp()
 Page({
 
@@ -10,9 +11,29 @@ Page({
     logId: null,
     pageData: null,
     qianming: null,
-    busEnterpriseId : null
+    qianming1: null,
+    busEnterpriseId : null,
+    time:null,
+    index:null,
+    isFirst:true,
+    company:null,
+    number:null,
+    number1:null,
+    submitdata:[],
+    // {itemId:"",
+    // itemContent:""}
+  },
+  bindViewInputCompany(e){
+    this.data.company = e.detail.value;
+  },
+  
+  bindViewInputNumber(e){
+    this.data.number = e.detail.value;
+  },
+  
+  bindViewInputNumber1(e){
+    this.data.number1 = e.detail.value;
   },
-
   getXqzggzs2() {
     var obj = new Object()
     obj.logId = this.data.logId
@@ -32,12 +53,11 @@ Page({
     console.log(options)
     this.data.logId = options.logId
     this.data.busEnterpriseId = options.busEnterpriseId
-    if (options.qianming != undefined && options.qianming != null) {
-      this.setData({
-        qianming: options.qianming
-      })
-    }
     this.getXqzggzs2()
+    var time= util.formatTime(new Date())
+    this.setData({
+      time:time
+    })
   },
 
   /**
@@ -51,7 +71,28 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    if(!this.data.isFirst){
+      let pages = getCurrentPages();
+      let currPage = pages[pages.length-1];
+      this.data.index=currPage.data.index;
+      if(this.data.index==0){
+        this.data.qianming=currPage.data.qianming;
+        if (this.data.qianming != undefined && this.data.qianming != null) {
+          this.setData({
+            qianming: this.data.qianming
+          })
+        }
+      }else if(this.data.index==1){
+        this.data.qianming1=currPage.data.qianming1;
+        if (this.data.qianming1 != undefined && this.data.qianming1 != null) {
+          this.setData({
+            qianming1: this.data.qianming1
+          })
+        }
+      }
+    }
+    this.data.isFirst=false
+  
   },
 
   /**
@@ -92,17 +133,51 @@ Page({
 
   bindQianming() {
     wx.navigateTo({
-      url: '../qianming/qianming?logId=' + this.data.logId+"&busEnterpriseId="+this.data.busEnterpriseId,
+      url: '../qianming/qianming?index=0',
+    })
+  },
+
+  bindQianming1() {
+    wx.navigateTo({
+      url: '../qianming/qianming?index=1',
     })
   },
   submitXqzggzs2(){
-    http.post("/system/AppXunjianController/submitXqzggzs2",null,this.submitXqzggzs2Success)
+    if(this.data.pageData!=null&&this.data.pageData.riskInspections!=null){
+      let array=this.data.pageData.riskInspections;
+      let listdata;
+      debugger
+        for(var i=0;i<array.length;i++){
+          this.setData({
+            [`submitdata[${i}].itemId `]: array[i].busItemsId,
+            [`submitdata[${i}].itemContent `]: array[i].busItemsName,
+          })
+        } 
+        console.log("TAG",this.data.submitdata)
+    }
+    // http.post("/system/AppXunjianController/submitXqzggzs2",null,this.submitXqzggzs2Success)
+    var data={
+      logId:this.data.logId,
+      enterpriseId:this.data.busEnterpriseId,
+      enterpriseName:"",
+      lastTime:this.data.pageData.latTime,
+      askCom:this.data.company,
+      checker1Sign:this.data.pageData.nickName,
+      checker1Code:this.data.number,
+      checker2Sign:this.data.qianming,
+      checker2Code:this.data.number1,
+      becheckerSign:this.data.qianming1,
+      checkTime:this.data.time,
+      tzs_items:this.data.submitdata,
+    }
+    http.send_post("/system/AppXunjianController/saveZGTZS",data,this.submitXqzggzs2Success)
   },
   submitXqzggzs2Success(e){
     if(e.code == 200){
-      wx.navigateTo({
-        url: '../details/details?busEnterpriseId='+this.data.busEnterpriseId,
+      wx.showToast({
+        title: '操作成功',
       })
+      wx.navigateBack()
     }
   }
 

+ 14 - 8
pages/xqzggzs2/xqzggzs2.wxml

@@ -8,16 +8,22 @@
   </view>
   <view class="flex_row text_ind">现告知你单位对上述问题于<b> {{pageData.latTime}}</b>,前整改完毕,达到有关法律法规规章和标准规定的要求。由此造成事故的,依法追究有关人员的责任。整改期间,你单位应当采取措施,确保安全生产。</view>
   <view class="flex_row text_ind">逾期未整改或在整改过程中存在安全生产违法行为的,我单位将提报相关执法部门进行依法查处。</view>
-  <view class="flex_row text_ind">如果对本告知内容有异议,可向<input type="text" style="width: 150rpx;" />咨询或说明情况,也可通过12350安全生产举报电话进行反映。在没有新书面告知前,本告知要求不停止执行,法律另有规定的除外。</view>
-
-
-  <view class="flex_row mar_top">检查人员:<text style="margin-right: 30rpx;">{{pageData.nickName}}</text><text style="margin-left:30rpx;">编号:</text><input type="text" style="width: 190rpx;" /></view>
-
-  <view class="flex_row mar_top2 txt_vi" bindtap="bindQianming"><text>被复查单位负责人(签名):</text>
+  <view class="flex_row text_ind">如果对本告知内容有异议,可向<input type="text" style="width: 150rpx;" bindinput="bindViewInputCompany" />咨询或说明情况,也可通过12350安全生产举报电话进行反映。在没有新书面告知前,本告知要求不停止执行,法律另有规定的除外。</view>
+  <view class="flex_row mar_top">检查人员:<text style="margin-right: 30rpx;">{{pageData.nickName}}</text></view>
+  <view class="flex_row mar_top">检查人员编号:<input type="text" style="width: 400rpx;" maxlength="15" bindinput="bindViewInputNumber" /></view>
+  <view class="flex_row mar_top2 txt_vi" bindtap="bindQianming"><text>监督人员(签名):</text>
     <image wx:if="{{qianming != undefined && qianming != null}}" src="{{qianming}}" class="qm_img"></image>
   </view>
-  <view class="flex_row mar_top2" style="text-align: right;"><input type="text" style="width: 340rpx;" />部门:{{pageData.deptName}}(印章)</view>
-  <view class="flex_row mar_top2" style="text-align: right;"><input type="number" style="width: 100rpx;" />年<input type="number" style="width: 100rpx;" />月<input type="number" style="width: 100rpx;" />日</view>
+  <view class="flex_row mar_top">监督人员编号<input type="text" style="width: 400rpx;" maxlength="15" bindinput="bindViewInputNumber1" /></view>
+  <view class="flex_row mar_top2 txt_vi" bindtap="bindQianming1"><text>被复查单位负责人(签名):</text>
+    <image wx:if="{{qianming1 != undefined && qianming1 != null}}" src="{{qianming1}}" class="qm_img"></image>
+  </view>
+  <view class="flex_row mar_top2" style="text-align: right;"><text type="text" style="width: 340rpx;" />部门:{{pageData.deptName}}(印章)</view>
+  <view class="flex_row mar_top2" style="text-align: right;"><text type="text" style="width: 340rpx;" />{{time}}</view>
+
+  <!-- <view class="flex_row mar_top2" style="text-align: right;"><text type="number" style="width: 100rpx;" />{{year}}年<text type="number" style="width: 100rpx;"/>{{month}}月<text type="number" style="width: 100rpx;"/>{{day}}日</view> -->
 
   <button type="primary" bindtap="submitXqzggzs2">提交</button>
+  <view style="height: 10rpx;"></view>
+
 </view>

+ 1 - 1
pages/xunjian/xunjian.js

@@ -350,7 +350,7 @@ Page({
     if (res.code == 200) {
       if (res.data.haveXQZG == true) {
         //有限期整改的东西,去通知书页面
-        wx.navigateBack({
+        wx.redirectTo({
           url: '../xqzggzs2/xqzggzs2?logId=' + res.data.logId + "&busEnterpriseId=" + this.data.busEnterpriseId,
         })
       } else {

+ 1 - 1
pages/xunjiancz/xunjiancz.js

@@ -279,7 +279,7 @@ Page({
   },
   saveXunjianItemsSuccess(res) {
     console.log(res)
-    if (res.data.code == 200) {
+    if (res.code == 200) {
       // wx.navigateTo({
         // url: '../xunjiancz/xunjiancz?busEnterpriseId=' + this.data.busEnterpriseId,
       // })

+ 3 - 3
pages/xunjianmore/xunjianmore.js

@@ -49,8 +49,8 @@ Page({
   },
   // 跳转整改进度
   bindViewXqZgGzS(){
-    // wx.navigateTo({
-    //   url: '../xqzggzs/xqzggzs',
-    // })
+    wx.navigateTo({
+      url: '../xqzggzs/xqzggzs',
+    })
   },
 })

+ 1 - 1
project.private.config.json

@@ -1,7 +1,7 @@
 {
   "projectname": "sooka_edyj_minapp",
   "setting": {
-    "compileHotReLoad": false,
+    "compileHotReLoad": true,
     "urlCheck": false
   },
   "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",