7
0

2 Commits 07cb1a030b ... 97f28bd6bb

Autor SHA1 Mensagem Data
  小郭 97f28bd6bb Merge refs/remotes/origin/V2.0 into refs/heads/V2.0 há 4 meses atrás
  小郭 dadb4cf17a 工单修改 há 4 meses atrás

+ 1 - 1
app.js

@@ -3,7 +3,7 @@ let wechat = require('./utils/wechat.js');
 let log = require('./utils/log.js');
 App({
   globalData: {
-    // postHeadAgreement: 'http://127.0.0.1:10301',
+    //postHeadAgreement: 'http://127.0.0.1:10301',
     // 测试
     postHeadAgreement: 'https://jqcs.pjnes.com/cloud/chargapi',
     // postHeadAgreement: 'http://192.168.105.171:10301',

+ 12 - 2
pages/outmoney/outmoney.js

@@ -7,6 +7,7 @@ Page({
    */
   data: {
     outMoney: null,
+    inputValue:'',
     checkPass: false,
     msg:null,
     userInfo: {},
@@ -51,11 +52,20 @@ Page({
     remarkArrayIndex: null
   },
   outMoney(e) {
-    console.log(e);
+    //console.log(e);
     let outMoney = e.detail.value;
+    // 如果输入的长度超过2个字符,则截取前2个字符
+    if (outMoney.length > 4) {
+      outMoney = outMoney.slice(0, 4);
+    }
+    this.setData({
+      inputValue:outMoney
+    });
     this.setData({
-      outMoney
+      outMoney:this.data.inputValue
     });
+    console.log(this.data.outMoney);
+    console.log("45456");
     if (this.data.userInfo.repaidbalance && outMoney && outMoney >= 0.3 && outMoney <= this.data.userInfo.repaidbalance) {
       if (this.data.remarkArrayIndex){
         this.setData({

+ 1 - 1
pages/outmoney/outmoney.wxml

@@ -1,7 +1,7 @@
 <!--pages/outmoney/outmoney.wxml-->
 <view class='money_input'>
   <text>提现金额(元)</text>
-  <input placeholder-class="section_phcolor" bindinput='outMoney' focus="true" type='digit' placeholder="请输入提现金额,不低于0.3元" />
+  <input placeholder-class="section_phcolor" bindinput='outMoney' value="{{inputValue}}" focus="true" type='digit' placeholder="请输入提现金额,不低于0.3元" />
 </view>
 <view class="outmoney"><text>可用余额{{userInfo.repaidbalance}}元</text></view>
 <view class='money_input'>

+ 4 - 2
pages/worksheetinfo/accendant.js

@@ -8,7 +8,7 @@ Page({
     items: []
   },
   checkboxChange(e) {
-    //console.log('checkbox发生change事件,携带value值为:', e.detail.value);
+    console.log('checkbox发生change事件,携带value值为:', e.detail.value);
     let accendants = [];
     e.detail.value.forEach((item,index) => {
       this.data.items.forEach((item1,index1)=>{
@@ -20,6 +20,7 @@ Page({
     let pages = getCurrentPages();
     let prevPage = pages[pages.length - 2]; //上一个页面
     let worksheetinfo = prevPage.data.worksheetinfo;
+    prevPage.accendantids = []
     worksheetinfo.accendant = accendants.join(",");
     prevPage.setData({
       accendantids: e.detail.value,
@@ -32,8 +33,9 @@ Page({
    */
   onLoad: function (options) {
     let { chargstationid, accendant} = options;
+    let userInfo = wx.getStorageSync('userInfo');
+    //let accendants = `${userInfo.userName},${accendant}`.split(",");
     let accendants = accendant.split(",");
-    //console.log(chargstationid);
     let that = this;
     wx.request({
       url: getApp().globalData.postHeadAgreement +'/restapi/wechat/getuserstation',

+ 52 - 10
pages/worksheetinfo/addworksheetinfo.js

@@ -8,6 +8,7 @@ Page({
   data: {
     images: [],
     signs: [],
+    submitting:false,
     worksheetinfo: {},
     chargstations: [],
     chargstationsindex: 0,
@@ -98,8 +99,8 @@ Page({
       placeholder: '请选择时间', 
       startDateTime: '2020-01-01 00:00',
       endDateTime: '2040-01-01 00:00',
-      // pText: Util.formatTimePicker(new Date()) //'2022-04-30 00:00'
-      pText: '0000-00-00 00:00' //'2022-04-30 00:00'
+      pText: Util.formatTimePicker(new Date()) //'2022-04-30 00:00'
+      //pText: '0000-00-00 00:00' //'2022-04-30 00:00'
     },
     finishdate: null,
     finishtime: '00:00',
@@ -199,6 +200,7 @@ Page({
     })
   },
   bindMainLocationInput(e) {
+    console.log(e);
     let mainLocation = e.detail.value;
     let worksheetinfo = this.data.worksheetinfo;
     worksheetinfo.mainLocation = mainLocation;
@@ -206,6 +208,12 @@ Page({
       worksheetinfo
     });
   },
+  bindAccendantInput(e){
+    let accendant = e.detail.value;
+    this.setData({
+      "worksheetinfo.accendant":accendant
+    });
+  },
   bindContentInput(e) {
     let content = e.detail.value;
     // let worksheetinfo = this.data.worksheetinfo;
@@ -219,6 +227,13 @@ Page({
     worksheetinfo.operatorName = this.data.userNames.length>0?this.data.userNames[0]:"";
     worksheetinfo.pams = this.data.accendantids;
     console.info(this.data.accendantids)
+    console.log("783756349857235");
+
+     // 如果正在提交,则不执行重复操作
+     if (this.data.submitting) {
+      return;
+    }
+     
     // worksheetinfo.accendant = null;
     // if (this.data.exceptdate ) {
     // // if (this.data.exceptdate && this.data.excepttime) {
@@ -249,7 +264,15 @@ Page({
       });
       return;
     }
-    if(worksheetinfo.pams.length == 0){
+    // if(worksheetinfo.pams.length == 0){
+    //   wx.showModal({
+    //     showCancel: false,
+    //     content: '运维人员不能为空,请填写!',
+    //     confirmColor:'#00AADD',
+    //   });
+    //   return;
+    // }
+      if(worksheetinfo.accendant == '' || worksheetinfo.accendant == undefined){
       wx.showModal({
         showCancel: false,
         content: '运维人员不能为空,请填写!',
@@ -268,7 +291,7 @@ Page({
     let signs = this.data.signs;
     console.log(signs.length == 0);
 
-
+    let that = this
     var signString = [];
     if (signs.length == 0) {
       //2021-1-1撤销校验
@@ -305,6 +328,12 @@ Page({
     var uploadSignOverFlag = setInterval(function() {
       if (signString.length == signs.length) {
         clearInterval(uploadSignOverFlag);
+        // 设置提交状态为 true 
+        that.setData({
+           submitting: true
+        });
+    console.log("1111");
+    console.log(that.data.submitting);
         if (images.length == 0) {
           if (worksheetinfo.pciture) {
             console.log(worksheetinfo.pciture);
@@ -312,7 +341,9 @@ Page({
             //worksheetinfo.pciture = ((worksheetinfo.pciture.split(",")).concat(signString)).join(",");
             console.log(worksheetinfo.pciture);
           }
-
+          wx.showLoading({
+            title: '提交中...',
+          })
           wx.request({
             url: getApp().globalData.postHeadAgreement + '/restapi/wechat/saveWorkSheet',
             data: worksheetinfo,
@@ -327,6 +358,11 @@ Page({
                 });
               } else {
                 wx.navigateBack();
+                wx.hideLoading()
+                 //提交完成重置按钮
+                that.setData({
+                  submitting: false
+                });
               }
             }
           });
@@ -355,6 +391,7 @@ Page({
                         //worksheetinfo.pciture = ((worksheetinfo.pciture.split(",")).concat(signString)).join(",");
                         worksheetinfo.pciture = (pciString.concat(imgString).concat(signString)).join(",");
                         //var images = this.data.images.concat(res.tempFilePaths);
+                        wx.showLoading({title: "提交中...."})
                         wx.request({
                           url: getApp().globalData.postHeadAgreement + '/restapi/wechat/saveWorkSheet',
                           data: worksheetinfo,
@@ -369,6 +406,11 @@ Page({
                               });
                             } else {
                               wx.navigateBack();
+                              wx.hideLoading()
+                              //提交完成重置按钮
+                              that.setData({
+                                submitting: false
+                              });
                             }
                           }
                         });
@@ -384,7 +426,6 @@ Page({
           });
         }
       }
-
     }, 100);
 
 
@@ -557,7 +598,6 @@ Page({
     let userInfo = wx.getStorageSync('userInfo');
     let isLogin = wx.getStorageSync('isLogin');
     let that = this;
-    //console.log(12345);
 
 
     if (userInfo && isLogin) {
@@ -581,18 +621,20 @@ Page({
             chargStationName = item.chargStationName
             // chargStationId = item.id
           });
+
           let worksheetinfo = that.data.worksheetinfo;
           worksheetinfo.chargStationId = chargStationId;
+          worksheetinfo.accendant = userInfo.userName
+          that.data.accendantids.push(userInfo.userId);//解决初始页面未给pams赋值
           that.setData({
             // chargStationName:that.data.chargStationNameNullValue,
-            worksheetinfo 
+            worksheetinfo,
           });
         }
       });
 
-
-
     }
+
     // wx.request({
     //   url: getApp().globalData.postHeadAgreement + '/restapi/wechat/getuserworksheet',
     //   data: worksheetinfo.id,

+ 2 - 2
pages/worksheetinfo/addworksheetinfo.wxml

@@ -49,7 +49,7 @@
   </view>
   <view class="context">
     <text>维修人员</text>
-    <input bindtap='bindAccendantChange' class='input' type='text' value='{{worksheetinfo.accendant}}'></input>
+    <input bindtap='bindAccendantChange' bindinput="bindAccendantInput" class='input' type='text' value='{{worksheetinfo.accendant}}'></input>
   </view>
   <view class="context">
     <text>工作内容</text>
@@ -125,4 +125,4 @@
 </scroll-view>
 <view  class="School_Input"  style="{{school_id?'':'color:#808080'}};{{schoolValidate?'border:1rpx solid #BD3731':''}}" bindtap="showSchoolPicker">{{school_name}}
         </view>
-<button bindtap='bindWorkSheetSubmit' class='submitbutton'>提交</button>
+<button bindtap='bindWorkSheetSubmit' class='submitbutton' disabled="{{submitting}}">提交</button>

+ 52 - 24
pages/worksheetinfo/findstation.js

@@ -58,36 +58,62 @@ Page({
     let {
       keywords
     } = e.currentTarget.dataset;
-
-    let pages = getCurrentPages();
     //console.log(pages);
     //console.log(e);
     // console.log(keywords);
     if (keywords) {
-      let pages = getCurrentPages();
-      let prevPage = pages[pages.length - 2]; //上一个页面
-      let worksheetinfo = prevPage.data.worksheetinfo;
-      let chargStationName = keywords.chargStationName
-      worksheetinfo.chargStationId =  keywords.id;
-      worksheetinfo.mainLocation =  keywords.address;
-      worksheetinfo.accendant =  '';
-      worksheetinfo.pams =  [];
-      prevPage.setData({
-        chargStationName,
-        chargStationNameClearFlag:false,
-        worksheetinfo,
-        accendantids:[],
-        
+      //------------新增code 解决异步请求数据回显问题----------------------------
+      let api = getApp().globalData.postHeadAgreement
+      let path = 'restapi/wechat/getuserstation'
+      let params = keywords.id
+      console.log(params);
+      //调用微信封装的Promise  携带的参数根据需求写为json{} 还是Long类型
+      wechat.request(api,path,params)
+      .then(response=>{
+        let userInfo = wx.getStorageSync('userInfo');
+        console.log("用户");
+        console.log(userInfo);
+        let pages = getCurrentPages();
+        let prevPage = pages[pages.length - 2]; //上一个页面
+        let worksheetinfo = prevPage.data.worksheetinfo;
+        let chargStationName = keywords.chargStationName
+        worksheetinfo.chargStationId =  keywords.id;
+        worksheetinfo.mainLocation =  keywords.address;
+        worksheetinfo.accendant = '';
+
+        //处理数据
+        let {
+           data: items
+        } = response;
+              items.forEach((item, index) => {
+                if (item.userName.includes(userInfo.userName)){
+                  worksheetinfo.accendant =userInfo.userName
+                }
+              });
+              worksheetinfo.pams =  [];
+              prevPage.setData({
+                chargStationName,
+                chargStationNameClearFlag:false,
+                worksheetinfo,
+                accendantids:[userInfo.userId],
+              });
+              console.log("异步慢");
+              console.log(prevPage.data.worksheetinfo);
+              wx.navigateBack({
+                delta: 1
+              });
+      })
+      .catch(error=>{
+        console.log("请求失败");
+        wx.navigateBack({//返回上一个页面
+          delta: 1
+        });
       });
     }
     //let url = `/pages/index/index`;
     //wx.navigateBack({
     //  url
     // });
-
-    wx.navigateBack({
-      delta: 1
-    });
   },
   bindSearch(e) {
     let {
@@ -98,7 +124,10 @@ Page({
       keywords,
       pagenum:1,
       chargList: []
-    })  
+    })
+
+    console.log(this.data);
+    console.log("7898");
     this.getNextPage();
 
   },
@@ -109,8 +138,8 @@ Page({
   getNextPage(){
     let userInfo = wx.getStorageSync('userInfo');
     let isLogin = wx.getStorageSync('isLogin');
-
-    if(this.data.chargList.length == this.data.total){
+    //必须排除返回结果值为空的情况,负责一直搜索为空
+    if(this.data.chargList.length == this.data.total && this.data.chargList.length != 0){
       this.setData({
         finishedLoadTap:this.data.finishedLoadTap+1
       })
@@ -138,7 +167,6 @@ Page({
     })
 
   let that = this;
-
   if (userInfo && isLogin) {
 
 

+ 10 - 0
pages/worksheetinfo/worksheetinfo.js

@@ -227,6 +227,8 @@ Page({
     worksheetinfo.operatorName = this.data.userNames.length>0?this.data.userNames[0]:"";
     worksheetinfo.pams = this.data.accendantids;
     worksheetinfo.accendant = null;
+    console.log(this.data.workstatusindex);
+    console.log("工单状态");
     // if (this.data.exceptdate && this.data.excepttime) {
     //   worksheetinfo.exceptTime = this.data.exceptdate + " " + this.data.excepttime + ":00";
     // }
@@ -269,6 +271,14 @@ Page({
       });
       return;
     }
+    if( this.data.finishparams.pText=='0000-00-00 00:00'&& this.data.workstatusindex == 6){
+      wx.showModal({
+        showCancel: false,
+        content: '请填写实际完成时间!',
+        confirmColor:'#00AADD',
+      });
+      return;
+    }
     let signs = this.data.signs;
     console.log(signs.length == 0);
     var signString = [];

+ 1 - 1
project.private.config.json

@@ -4,5 +4,5 @@
   "setting": {
     "compileHotReLoad": true
   },
-  "libVersion": "3.2.4"
+  "libVersion": "3.3.5"
 }

+ 3 - 2
utils/wechat.js

@@ -58,8 +58,9 @@ class Wechat {
     return new Promise((resolve, reject) => {
       let opts = {
         url: `${api}/${path}`,
-        data: Object.assign({}, params),
-        header: { 'Content-Type': 'json' },
+        data: params,
+        method: 'POST',
+        header: { 'Content-Type': 'application/json' },
         success: resolve,
         fail: reject
       }