|
@@ -14,6 +14,7 @@ import {
|
|
import {
|
|
import {
|
|
encryptAndSign
|
|
encryptAndSign
|
|
} from '../../utils/index/getSM4'
|
|
} from '../../utils/index/getSM4'
|
|
|
|
+import { match } from 'assert'
|
|
const app = getApp()
|
|
const app = getApp()
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
@@ -168,45 +169,10 @@ Page({
|
|
screenIntervalId: null, //定时器
|
|
screenIntervalId: null, //定时器
|
|
// 默认历史
|
|
// 默认历史
|
|
|
|
|
|
- historyPagNum: 0, //总页数
|
|
|
|
- historyPageSize: 0, //当前页数
|
|
|
|
- historyPagNum: 1,
|
|
|
|
|
|
+ historyPagNum: 1, //当前页数
|
|
|
|
+ historyPageSize: 0, //总页数
|
|
isHistory: true,
|
|
isHistory: true,
|
|
- historyList: [{
|
|
|
|
- id:1,
|
|
|
|
- info1:{
|
|
|
|
- visitorName: '访客1',
|
|
|
|
- visitorUnit: '单位1',
|
|
|
|
- isSel:false,
|
|
|
|
- },
|
|
|
|
- info2:{
|
|
|
|
- name: '受访人1',
|
|
|
|
- phone: '1111111111111',
|
|
|
|
- idNumber: '11111111111',
|
|
|
|
- company: '11111111111',
|
|
|
|
- unitName: '111111111',
|
|
|
|
- floor: '111111111111',
|
|
|
|
- room: '1111111111111',
|
|
|
|
- showTitle: '111111111',
|
|
|
|
- }
|
|
|
|
- },{
|
|
|
|
- id:2,
|
|
|
|
- info1:{
|
|
|
|
- visitorName: '访客1',
|
|
|
|
- visitorUnit: '单位2',
|
|
|
|
- isSel:false,
|
|
|
|
- },
|
|
|
|
- info2:{
|
|
|
|
- name: '受访人2',
|
|
|
|
- phone: '22222222222',
|
|
|
|
- idNumber: '2222222222',
|
|
|
|
- company: '222222222222',
|
|
|
|
- unitName: '2222222222222',
|
|
|
|
- floor: '222222222222222',
|
|
|
|
- room: '2222222222222',
|
|
|
|
- showTitle: '222222222222',
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
|
|
+ historyList: []
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
my.hideBackHome();
|
|
my.hideBackHome();
|
|
@@ -261,48 +227,78 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- async getHistory(){
|
|
|
|
|
|
+ async getHistory(historyPagNum){
|
|
try {
|
|
try {
|
|
- let data = {
|
|
|
|
|
|
+ let params = {
|
|
data : {
|
|
data : {
|
|
- "certNo": this.data.remainingInfo.visitorIdCard,
|
|
|
|
- sn: app.globalData.sn,
|
|
|
|
|
|
+ certNo: "362330199801077198",
|
|
|
|
+ sn: "118D002000500012",
|
|
|
|
+
|
|
|
|
+ // "certNo": this.data.remainingInfo.visitorIdCard,
|
|
|
|
+ // sn: app.globalData.sn,
|
|
},
|
|
},
|
|
- pageNum:this.data.historyPagNum,
|
|
|
|
|
|
+ pageNum: historyPagNum ? historyPagNum : 1,
|
|
pageSize: 2
|
|
pageSize: 2
|
|
}
|
|
}
|
|
- let res = await app.data.publicInterface('fkjHistoryRecordUrl','/history',data,'post','历史访问记录请求失败')
|
|
|
|
- let array = res.data.forEach((item,index)=>{
|
|
|
|
- item.info1 = {
|
|
|
|
- 'carno': item.carno,
|
|
|
|
- 'certName': item.certName,
|
|
|
|
- 'certPhone': item.certPhone,
|
|
|
|
- 'company': item.company,
|
|
|
|
- 'reason': item.reason,
|
|
|
|
- 'isSel': false
|
|
|
|
- }
|
|
|
|
- item.info2 = {
|
|
|
|
- "visiteeBm": item.visiteeBm,
|
|
|
|
- "visiteeCompany": item.visiteeCompany,
|
|
|
|
- "visiteeFloor": item.visiteeFloor,
|
|
|
|
- "visiteePhone": item.visiteePhone,
|
|
|
|
- "visiteeRoom": item.visiteeRoom,
|
|
|
|
- "visiteeXm": item.visiteeXm,
|
|
|
|
- 'isSel': false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- console.log()
|
|
|
|
- this.setData({
|
|
|
|
- isHistory: array
|
|
|
|
- // 'pagination.current': newCurrent,
|
|
|
|
- // 'pagination.pageNum': resData.pages,
|
|
|
|
- // 'pagination.total': resData.total,
|
|
|
|
- // tableList: resData.list,
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ let res = await app.data.publicInterface('fkjHistoryRecordUrl','/history',params,'post','历史访问记录请求失败')
|
|
|
|
+ if(res.data.total > 0 ){
|
|
|
|
+ let array = res.data.list.map((item,index)=>{
|
|
|
|
+ return{
|
|
|
|
+ info1:{
|
|
|
|
+ 'carnum': item.carno,
|
|
|
|
+ 'visitorName': item.certName,
|
|
|
|
+ 'visitorPhone': item.certPhone,
|
|
|
|
+ 'visitorUnit': item.company,
|
|
|
|
+ 'causeMatterName': item.reason,
|
|
|
|
+ 'isSel': false
|
|
|
|
+ },
|
|
|
|
+ info2:{
|
|
|
|
+ "unitName": item.visiteeBm,
|
|
|
|
+ "company": item.visiteeCompany,
|
|
|
|
+ "floor": item.visiteeFloor,
|
|
|
|
+ "phone": item.visiteePhone,
|
|
|
|
+ "room": item.visiteeRoom,
|
|
|
|
+ "name": item.visiteeXm,
|
|
|
|
+ 'isSel': false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.setData({
|
|
|
|
+ historyPagNum: historyPagNum ? historyPagNum : 1,
|
|
|
|
+ historyPageSize: res.data.pages,
|
|
|
|
+ historyList: array,
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.setData({
|
|
|
|
+ isHistory: false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log(error);
|
|
console.log(error);
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ // 上一页
|
|
|
|
+ historyPreviousFun() {
|
|
|
|
+ console.log(this.data)
|
|
|
|
+ const pageNum = this.data.historyPagNum - 1
|
|
|
|
+ if (pageNum <= 0) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ intervieweeForm:{}
|
|
|
|
+ })
|
|
|
|
+ this.getHistory(pageNum)
|
|
|
|
+ },
|
|
|
|
+ // 下一页
|
|
|
|
+ historyNextFun() {
|
|
|
|
+ const pageNum = this.data.historyPagNum + 1
|
|
|
|
+ if (pageNum > this.data.historyPageSize) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ intervieweeForm:{}
|
|
|
|
+ })
|
|
|
|
+ this.getHistory(pageNum)
|
|
},
|
|
},
|
|
async getTable(e) {
|
|
async getTable(e) {
|
|
try {
|
|
try {
|
|
@@ -332,11 +328,11 @@ Page({
|
|
},
|
|
},
|
|
// 选中受访人信息数据
|
|
// 选中受访人信息数据
|
|
selInfo: function (e) {
|
|
selInfo: function (e) {
|
|
- const id = e.currentTarget.id; // 获取被点击项的id
|
|
|
|
- const items = this.data.historyList.map(item => {
|
|
|
|
|
|
+ const idx = e.currentTarget.dataset.index; // 获取被点击项的下标
|
|
|
|
+ const items = this.data.historyList.map((item,index) => {
|
|
item.info1.isSel = false
|
|
item.info1.isSel = false
|
|
item.info2.isSel = false
|
|
item.info2.isSel = false
|
|
- if (item.id == id) {
|
|
|
|
|
|
+ if (index == idx) {
|
|
this.setData({
|
|
this.setData({
|
|
remainingInfo: {
|
|
remainingInfo: {
|
|
...this.data.remainingInfo,
|
|
...this.data.remainingInfo,
|
|
@@ -366,9 +362,9 @@ Page({
|
|
},
|
|
},
|
|
// 选择受访人 单独控制
|
|
// 选择受访人 单独控制
|
|
selInfo2: function (e){
|
|
selInfo2: function (e){
|
|
- const id = e.currentTarget.id; // 获取被点击项的id
|
|
|
|
- const items = this.data.historyList.map(item => {
|
|
|
|
- if (item.id == id) {
|
|
|
|
|
|
+ const idx = e.currentTarget.dataset.index; // 获取被点击项的下标
|
|
|
|
+ const items = this.data.historyList.map((item,index) => {
|
|
|
|
+ if (index == idx) {
|
|
if(!item.info2.isSel){
|
|
if(!item.info2.isSel){
|
|
this.setData({
|
|
this.setData({
|
|
intervieweeForm:{
|
|
intervieweeForm:{
|
|
@@ -388,6 +384,7 @@ Page({
|
|
}
|
|
}
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
+ // console.log(item)
|
|
return item; // 其他项保持不变
|
|
return item; // 其他项保持不变
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
@@ -527,7 +524,6 @@ Page({
|
|
'remainingInfo.causeMatterName': item,
|
|
'remainingInfo.causeMatterName': item,
|
|
isShowCauseMatter: false
|
|
isShowCauseMatter: false
|
|
})
|
|
})
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
|
|
// 是否显示搜索项
|
|
// 是否显示搜索项
|
|
@@ -691,24 +687,18 @@ Page({
|
|
// 确定
|
|
// 确定
|
|
async sure() {
|
|
async sure() {
|
|
if(this.data.isHistory){
|
|
if(this.data.isHistory){
|
|
- if(!this.data.intervieweeForm.name) this.backEnter()
|
|
|
|
- return
|
|
|
|
|
|
+ if(!this.data.intervieweeForm.name) {
|
|
|
|
+ this.backEnter()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- return
|
|
|
|
let {
|
|
let {
|
|
remainingInfo,
|
|
remainingInfo,
|
|
intervieweeForm,
|
|
intervieweeForm,
|
|
carnum
|
|
carnum
|
|
} = this.data
|
|
} = this.data
|
|
- console.log(
|
|
|
|
- 'remainingInfo',
|
|
|
|
- remainingInfo)
|
|
|
|
- console.log(
|
|
|
|
- 'intervieweeForm',
|
|
|
|
- intervieweeForm)
|
|
|
|
let form = Object.assign({}, remainingInfo, intervieweeForm);
|
|
let form = Object.assign({}, remainingInfo, intervieweeForm);
|
|
- console.log(form)
|
|
|
|
|
|
+ console.log('form --->', form)
|
|
form.carnum = carnum
|
|
form.carnum = carnum
|
|
form.visitingTime = getDate()
|
|
form.visitingTime = getDate()
|
|
app.data.visitoMsgData = form
|
|
app.data.visitoMsgData = form
|
|
@@ -743,7 +733,7 @@ Page({
|
|
time: form.visitingTime,
|
|
time: form.visitingTime,
|
|
}
|
|
}
|
|
console.log('data', data)*/
|
|
console.log('data', data)*/
|
|
- console.log(JSON.stringify(areaRes))
|
|
|
|
|
|
+ console.log('areaRes ----> ', JSON.stringify(areaRes))
|
|
let newPushData = {
|
|
let newPushData = {
|
|
"appType": "HHVisit",
|
|
"appType": "HHVisit",
|
|
"recordid": 0, // 没有
|
|
"recordid": 0, // 没有
|
|
@@ -785,7 +775,7 @@ Page({
|
|
"endTime": null, // 有效期结束时间
|
|
"endTime": null, // 有效期结束时间
|
|
"event": 1 // 事件类型: 1 登记 2 签离
|
|
"event": 1 // 事件类型: 1 登记 2 签离
|
|
}
|
|
}
|
|
- console.log(JSON.stringify(newPushData))
|
|
|
|
|
|
+ console.log('newPushData ----> ',JSON.stringify(newPushData))
|
|
let url = app.globalData.snDisposition.transitPushUrl
|
|
let url = app.globalData.snDisposition.transitPushUrl
|
|
try {
|
|
try {
|
|
// 进出记录推送
|
|
// 进出记录推送
|