Browse Source

修改bug

jiagsf 2 weeks ago
parent
commit
d53ed5082d
4 changed files with 112 additions and 19 deletions
  1. 1 1
      pages/interviewee/index.acss
  2. 15 9
      pages/interviewee/index.axml
  3. 94 7
      pages/interviewee/index.js
  4. 2 2
      utils/api/api.js

+ 1 - 1
pages/interviewee/index.acss

@@ -583,7 +583,7 @@
   
 }
 
-.main .interviewee-content .interviewee-content-rightHistory .content .content_box .content_box_right .title .title-info .title-info-cancelSel{
+.main .interviewee-content .interviewee-content-rightHistory .content .content_box .content_box_info .title .title-info .title-info-cancelSel{
   width: calc(24vmax / 12.80);
   height: calc(24vmax / 12.80);
   background-color: #146576;

+ 15 - 9
pages/interviewee/index.axml

@@ -124,16 +124,21 @@
                 a:for="{{ historyList }}"
                 a:for-index="index"
               >
-                <view class="content_box {{ item.info1.isSel ? 'content_boxSel' : '' }}" onTap="selInfo" data-index={{ index }}>
+                <view class="content_box {{ (item.info1.isSel || item.info2.isSel) ? 'content_boxSel' : '' }}" onTap="selInfo" data-index={{ index }}>
                   <view class="content_box_left content_box_info">
                     <view class="title">
                       访客信息
-                      <image 
-                        a:if="{{ item.info1.isSel }}"
-                        class="selected-icon"
-                        mode="scaleToFill" 
-                        src="https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/interviewee/selected.png" 
-                      />
+
+                      <view class="title-info" a:if="{{ item.info2.isSel || item.info1.isSel }}">
+                        <image catchTouchMove
+                          catchTap="selInfo1" data-index="{{ index }}"
+                          a:if="{{ item.info1.isSel }}"
+                          class="selected-icon"
+                          mode="scaleToFill" 
+                          src="https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/interviewee/selected.png" 
+                        />
+                        <view a:else catchTap="selInfo1" data-index="{{ index }}" catchTouchMove class="title-info-cancelSel"> </view>
+                      </view>
                     </view>
                     <view class="info">
                       <view class="info_box">
@@ -178,10 +183,11 @@
                       </view>
                     </view>
                   </view>
+                  
                   <view class="content_box_right content_box_info">
                     <view class="title">
                       受访人信息
-                      <view class="title-info" a:if="{{ item.info1.isSel }}">
+                      <view class="title-info" a:if="{{ item.info2.isSel || item.info1.isSel }}">
                         <image catchTouchMove
                           catchTap="selInfo2" data-index="{{ index }}"
                           a:if="{{ item.info2.isSel }}"
@@ -189,7 +195,7 @@
                           mode="scaleToFill" 
                           src="https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/interviewee/selected.png" 
                         />
-                        <view a:else class="title-info-cancelSel"> </view>
+                        <view a:else catchTap="selInfo2" data-index="{{ index }}" catchTouchMove class="title-info-cancelSel"> </view>
                       </view>
                     </view>
                     <view class="info">

+ 94 - 7
pages/interviewee/index.js

@@ -31,6 +31,14 @@ Page({
       peopleNum: 1,
       causeMatterName: '',
     },
+    // 保存用户填写的最后信息
+    formInfo: {
+      visitorPhone: '',
+      visitorUnit: '',
+      carnum: '',
+      peopleNum: 1,
+      causeMatterName: '',
+    },
     // 事由
     causeMatterList: [
       /*{
@@ -172,7 +180,7 @@ Page({
     historyPagNum: 1, //当前页数
     historyPageSize: 0, //总页数
     isHistory: true,
-    historyList: []
+    historyList: [],
   },
   onLoad() {
     my.hideBackHome();
@@ -200,6 +208,7 @@ Page({
       'remainingInfo.visitorUnit': app.data.userInfo.visitorUnit || '',
       carnum: app.data.userInfo.carnum || '',
       'remainingInfo.causeMatterName': visitReasonList.length > 0 ? visitReasonList[0] : '',
+      'formInfo.causeMatterName': visitReasonList.length > 0 ? visitReasonList[0] : '',
     })
     console.log(visitReasonList)
     // ⾃然⼈⻛险评分查询
@@ -231,11 +240,11 @@ Page({
     try {
       let params = {
         data : {
-          certNo: "362330199801077198",
-          sn: "118D002000500012",
-
           // "certNo": this.data.remainingInfo.visitorIdCard,
           // sn: app.globalData.sn,
+
+          "certNo": "362330199801077198",
+          sn: "118D002000500012",
         },
         pageNum: historyPagNum ? historyPagNum : 1,
         pageSize: 2
@@ -334,6 +343,7 @@ Page({
       item.info2.isSel = false
       if (index == idx) {
         this.setData({
+          carnum: item.info1.carnum,
           remainingInfo: {
             ...this.data.remainingInfo,
             ...item.info1
@@ -356,10 +366,57 @@ Page({
       }
       return item; // 其他项保持不变
     });
+    this.setData({ 
+      historyList: items,
+    }); // 更新数据状态
+  },
+  // 选择访客 单独控制
+  selInfo1: function (e){
+    let visitReasonList = (app.globalData.snDisposition.visitReason || '业务拜访/会议邀请/施工单位/其他事项').split('/')
+    const idx = e.currentTarget.dataset.index; // 获取被点击项的下标
+    const items = this.data.historyList.map((item,index) => {
+      if (index == idx) {
+        if(!item.info1.isSel){
+          this.setData({
+            carnum: item.info1.carnum,
+            remainingInfo:{
+              ...this.data.remainingInfo,
+              ...item.info1
+            }
+          })
+        }else{
+          this.defaultFormInfo()
+        }
+        return {
+          ...item,
+          info1:{
+            ...item.info1,
+            isSel: !item.info1.isSel // 切换选中状态
+          }
+         }; 
+      }
+      return item; // 其他项保持不变
+    });
     this.setData({ 
       historyList: items 
     }); // 更新数据状态
   },
+  defaultFormInfo(){
+    console.log(this.data.formInfo)
+    this.setData({
+      carnum: this.data.formInfo.carnum || '',
+      remainingInfo:{
+        ...this.data.formInfo
+        // 'visitorPhone': app.data.userInfo.phone || app.data.inputPhone,
+        // 'visitorName': app.data.userInfo.xm,
+        // 'visitorIdCard': app.data.userInfo.sfzh,
+        // 'avatar': app.data.userInfo.avatar,
+        // 'idCardPhoto': app.data.userInfo.idCardPhoto,
+        // 'visitorUnit': app.data.userInfo.visitorUnit || '',
+        // 'causeMatterName': visitReasonList.length > 0 ? visitReasonList[0] : '',
+      }
+    })
+  },
   // 选择受访人 单独控制
   selInfo2: function (e){
     const idx = e.currentTarget.dataset.index; // 获取被点击项的下标
@@ -384,14 +441,12 @@ Page({
           }
          }; 
       }
-      // console.log(item)
       return item; // 其他项保持不变
     });
     this.setData({ 
       historyList: items 
     }); // 更新数据状态
   },
-
   backEnter(){
     this.setData({
       isHistory: !this.data.isHistory,
@@ -434,7 +489,6 @@ Page({
         return
       }
       let decrypted = JSON.parse(decryptedData.decrypted)
-      // console.log(222, decrypted);
       if (!decrypted.result) {
         app.globalData.riskResult = 1
       } else if (decrypted.resultInfo.personFxpfjx && decrypted.resultInfo.personFxpfjx[4] == 1) {
@@ -498,9 +552,41 @@ Page({
     let type = e.target.dataset.type
     let val = e.detail.value
     let key = `remainingInfo.${type}`
+    let formKey = `formInfo.${type}`
     this.setData({
       [key]: val,
+      [formKey]: val
     })
+
+    console.log(this.data.historyList)
+    if(this.data.historyList.length>0){
+      this.data.historyList.forEach(item=>{
+        item.info1.isSel = false
+      })
+
+      this.setData({
+        historyList: this.data.historyList
+      })
+
+      // let array = this.data.historyList.map(item=>{
+      //   console.log(item)
+      //   if(item.info1.isSel){
+      //     return {
+      //       ...item,
+      //       info1:{
+      //         ...item.info1,
+      //         isSel: !item.info1.isSel
+      //       }
+      //     }
+      //   }else{
+          
+      //   }
+      // })
+  
+      // this.setData({
+      //   historyList: array
+      // })
+    }
   },
 
   // 事由
@@ -522,6 +608,7 @@ Page({
     let item = e.currentTarget.dataset.item
     this.setData({
       'remainingInfo.causeMatterName': item,
+      'formInfo.causeMatterName': item,
       isShowCauseMatter: false
     })
   },

+ 2 - 2
utils/api/api.js

@@ -156,8 +156,8 @@ const getVisitDeviceUser = (data) => {
 // 可配置 公共接口 
 const publicInterface = (prop, defaultProp, data, method, errorTip) => {
   const app = getApp()
-  const url = app.globalData.snDisposition[url] ? app.globalData.snDisposition[url] : path + defaultProp
-  console.log(url)
+  const url = app.globalData.snDisposition[prop] ? app.globalData.snDisposition[prop] : path + defaultProp
+  console.log(999, url )
   return request({
     url:  url,
     data: data,