This commit is contained in:
SelfRidicule 2024-03-10 17:21:44 +08:00
parent 7ec0fbb629
commit c1da11dc1d
6 changed files with 340 additions and 57 deletions

View File

@ -27,3 +27,39 @@ export function visitorPersonRq(data) {
data, data,
}); });
} }
// 访客-预约记录
export function selectVisitorRecordByIntervieweeIdRq(data) {
return request({
url: `/api/visitor/selectVisitorRecordByIntervieweeId?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
method: "post",
data,
});
}
// 访客-审核记录
export function selectVisitorRecordByUserIdRq(data) {
return request({
url: `/api/visitor/selectVisitorRecordByUserId?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
method: "post",
data,
});
}
// 访客-预约审核
export function updateVisitorPersonStatusRq(data) {
return request({
url: '/api/visitor/updateVisitorPersonStatus',
method: "post",
data,
});
}
// 获取访客记录的详情
export function selectVisitorRecordByIdRq(id) {
return request({
url: '/api/visitor/selectVisitorRecordById/' + id,
method: "get",
});
}

View File

@ -7,7 +7,8 @@ import {
} from "../../../../utils/util.js" } from "../../../../utils/util.js"
import { import {
visitorPersonRq visitorPersonRq,
selectVisitorRecordByIdRq
} from "../../../../api/meeting/visitorIinvitation.js" } from "../../../../api/meeting/visitorIinvitation.js"
@ -18,6 +19,9 @@ Page({
*/ */
data: { data: {
IMG_NAME: app.IMG_NAME, IMG_NAME: app.IMG_NAME,
id: null,
title: null,
type: null,
userDetail: {}, userDetail: {},
idcardTypeShow: false, idcardTypeShow: false,
idcardTypeList: [{ idcardTypeList: [{
@ -57,9 +61,12 @@ Page({
let userDetail = wx.getStorageSync('user') let userDetail = wx.getStorageSync('user')
// //
let detail = _this.data.detail; let detail = _this.data.detail;
// 添加 默认设置访客信息
if (options.type == 'add') {
detail.intervieweeId = userDetail.id // 访客id detail.intervieweeId = userDetail.id // 访客id
detail.name = userDetail.username // 访客姓名 detail.name = userDetail.username // 访客姓名
detail.phone = userDetail.mobile // 访客手机号 detail.phone = userDetail.mobile // 访客手机号
}
_this.setData({ _this.setData({
...options, ...options,
userDetail, userDetail,
@ -69,6 +76,29 @@ Page({
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: options.title title: options.title
}) })
// 有id查询详情
if (options.id) {
// 获取详情
_this.getDetail()
}
},
// 获取详情
getDetail() {
let _this = this;
selectVisitorRecordByIdRq(_this.data.id).then(res => {
console.log('selectVisitorRecordByIdRq', res);
let detail = res.data;
_this.setData({
detail,
fileList: [{
relativeUrl: detail.photo,
url: app.IMG_NAME + detail.photo,
name: detail.photo,
deletable: false,
}]
})
})
}, },
// 跳转-索引栏(单位、人员) // 跳转-索引栏(单位、人员)
@ -207,7 +237,7 @@ Page({
let fileList = _this.data.fileList; let fileList = _this.data.fileList;
fileList.push({ fileList.push({
relativeUrl: fileData.fileName, relativeUrl: fileData.fileName,
url: app.DOMAIN_NAME + fileData.fileName, url: app.IMG_NAME + fileData.fileName,
name: fileData.fileName, name: fileData.fileName,
deletable: true, deletable: true,
}) })

View File

@ -1,9 +1,35 @@
import Notify from '@vant/weapp/notify/notify';
import {
selectVisitorRecordByIntervieweeIdRq,
selectVisitorRecordByUserIdRq,
updateVisitorPersonStatusRq
} from "../../../../api/meeting/visitorIinvitation.js"
import {
selfFormatTimeYMDHM
} from "../../../../utils/util.js"
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
tabTitle: '预约记录',
userDetail: {},
changeData: false,
// 预约
reservationPageNum: 1,
reservationPageSize: 10,
reservationDataList: [],
reservationIsAll: false,
// 审核
verifyPageNum: 1,
verifyPageSize: 10,
verifyDataList: [],
verifyIsAll: false,
//
dialogShow: false, dialogShow: false,
dialogId: null, dialogId: null,
dialogContent: null, dialogContent: null,
@ -13,21 +39,122 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let _this = this;
let userDetail = wx.getStorageSync('user')
_this.setData({
...options,
userDetail,
})
// 获取-预约记录 数据
_this.getReservationData();
// 获取-预约审核 数据
_this.getVerifyData();
},
// 获取数据
getDataList() {
let _this = this;
let tabTitle = _this.data.tabTitle
if (tabTitle == '预约记录') {
_this.getReservationData()
} else if (tabTitle == '预约审核') {
_this.getVerifyData()
} else {
wx.showToast({
title: `tab 切换错误(${tabTitle})`,
icon: 'none',
});
return;
}
},
// 获取-预约记录 数据
getReservationData() {
let _this = this;
// 是否全部加载完成
if (_this.data.reservationIsAll) {
return;
}
selectVisitorRecordByIntervieweeIdRq({
pageNum: _this.data.reservationPageNum,
pageSize: _this.data.reservationPageSize,
intervieweeId: _this.data.userDetail.id
}).then(res => {
console.log('getReservationData', res);
let queryDataList = res.data.records;
if (queryDataList && queryDataList.length > 0) {
let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList))
_this.setData({
reservationDataList,
reservationPageNum: _this.data.reservationPageNum + 1
})
} else {
_this.setData({
reservationIsAll: true
})
}
})
},
// 获取-预约审核 数据
getVerifyData() {
let _this = this;
// 是否全部加载完成
if (_this.data.verifyIsAll) {
return;
}
selectVisitorRecordByUserIdRq({
pageNum: _this.data.verifyPageNum,
pageSize: _this.data.verifyPageSize,
userId: _this.data.userDetail.id
}).then(res => {
console.log('getVerifyData', res);
let queryDataList = res.data.records;
if (queryDataList && queryDataList.length > 0) {
let verifyDataList = _this.data.verifyDataList.concat(_this.formartData(queryDataList))
_this.setData({
verifyDataList,
verifyPageNum: _this.data.verifyPageNum + 1
})
} else {
_this.setData({
verifyIsAll: true
})
}
})
},
// 格式化数据
formartData(list) {
return list.map(item => {
let color = "#3794FF"
let verifyShow = false;
if (item.status == 0) { // 待审核
color = "#3794FF"
verifyShow = true;
} else if (item.status == 1) { // 审核通过
color = "#62c855"
} else if (item.status == 2) { // 审核驳回
color = "red"
}
item.fontColor = color;
item.verifyShow = verifyShow;
item.visitTimeFormat = selfFormatTimeYMDHM(item.visitTime);
return item;
})
}, },
// tab 切换 // tab 切换
tabClickSwitch(event) { tabClickSwitch(event) {
wx.showToast({ this.setData({
title: `切换到标签 ${event.detail.title}`, tabTitle: event.detail.title,
icon: 'none', })
});
}, },
// 显示-弹出框 // 显示-弹出框
showDialog(e) { showDialog(e) {
console.log('showDialog', e); console.log('showDialog', e);
let _this = this let _this = this
_this.setData({ _this.setData({
dialogShow: true, dialogShow: true,
@ -36,19 +163,51 @@ Page({
}) })
}, },
// 弹出框-通过 // 弹出框-审核
dialogSuccess() { dialogVerify(e) {
console.log('dialogSuccess', e);
let status = e.currentTarget.dataset.status;
let _this = this let _this = this
// 驳回 需要输入描述信息
if (status == 2 && !_this.data.dialogContent) {
Notify({
type: 'danger',
message: '请输入描述信息!'
});
return
}
updateVisitorPersonStatusRq({
id: _this.data.dialogId,
status,
rejectContent: _this.data.dialogContent,
}).then(res => {
console.log('updateVisitorPersonStatusRq', res);
if (res.code != 0) {
Notify({
type: 'danger',
message: res.msg
});
}
_this.setData({ _this.setData({
// 预约
reservationPageNum: 1,
reservationPageSize: 10,
reservationDataList: [],
reservationIsAll: false,
// 审核
verifyPageNum: 1,
verifyPageSize: 10,
verifyDataList: [],
verifyIsAll: false,
//
dialogShow: false, dialogShow: false,
dialogId: null,
dialogContent: null
}) })
}, // 获取-预约记录 数据
_this.getReservationData();
// 弹出框-驳回 // 获取-预约审核 数据
dialogReject() { _this.getVerifyData();
let _this = this
_this.setData({
dialogShow: false,
}) })
}, },
@ -61,13 +220,24 @@ Page({
}) })
}, },
// 跳转-预约 goDetail(e) {
goReservation() { console.log('goDetail', e);
let id = e.currentTarget.dataset.id
let type = e.currentTarget.dataset.type
let urlParam = "?type=" + type;
if (type == 'add') {
urlParam = urlParam + "&title=预约"
} else if (type == 'verify') {
urlParam = urlParam + "&title=审核" + "&id=" + id
} else if (type == 'detail') {
urlParam = urlParam + "&title=详情" + "&id=" + id
}
wx.navigateTo({ wx.navigateTo({
url: '/pages/meeting/visitorIinvitation/detail/detail?title=预约', url: '/pages/meeting/visitorIinvitation/detail/detail' + urlParam,
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
@ -79,7 +249,26 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
let _this = this;
if (_this.data.changeData) {
_this.setData({
dataChange: false,
// 预约
reservationPageNum: 1,
reservationPageSize: 10,
reservationDataList: [],
reservationIsAll: false,
// 审核
verifyPageNum: 1,
verifyPageSize: 10,
verifyDataList: [],
verifyIsAll: false,
})
// 获取-预约记录 数据
_this.getReservationData();
// 获取-预约审核 数据
_this.getVerifyData();
}
}, },
/** /**
@ -108,6 +297,9 @@ Page({
*/ */
onReachBottom() { onReachBottom() {
console.log('onReachBottom'); console.log('onReachBottom');
let _this = this;
// 获取数据
_this.getDataList()
}, },
/** /**
@ -116,15 +308,4 @@ Page({
onShareAppMessage() { onShareAppMessage() {
}, },
onChange(event) {
wx.showToast({
title: `切换到标签 ${event.detail.name}`,
icon: 'none',
});
},
toCheckFn() {
wx.reLaunch({
url: '/pages/meeting/visitorIinvitation/visitorIinvitation',
})
}
}) })

View File

@ -7,6 +7,7 @@
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",
"van-button": "@vant/weapp/button/index", "van-button": "@vant/weapp/button/index",
"van-dialog": "@vant/weapp/dialog/index", "van-dialog": "@vant/weapp/dialog/index",
"van-field": "@vant/weapp/field/index" "van-field": "@vant/weapp/field/index",
"van-notify": "@vant/weapp/notify/index"
} }
} }

View File

@ -1,41 +1,62 @@
<view class="containerView public"> <view class="containerView public">
<van-tabs bind:click="tabClickSwitch" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray"> <van-tabs bind:click="tabClickSwitch" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray">
<van-tab title="预约记录"> <van-tab title="预约记录">
<view class="itemView" wx:for="{{6}}"> <view class="itemView" wx:for="{{reservationDataList}}" wx:for-item="item" wx:key="*this" bind:tap="goDetail" data-id="{{item.id}}" data-type="detail">
<view class="topView"> <view class="topView">
<view class="name">访客:张三</view> <view class="name">被访人:{{item.userName}}</view>
<view class="status">待审核</view> <view class="status" style="color: {{item.fontColor}};">{{item.statusName}}</view>
</view> </view>
<view class="contentView"> <view class="contentView">
<view class="dataView"> <view class="dataView">
<van-icon name="manager" color="#cccccc" size="40rpx" /> <van-icon name="manager" color="#cccccc" size="40rpx" />
<view class="msg">访问事由: 参观会议参观会议参观会议参观会议参观会议参观会议参观会议参观会议参观会议参观会议参观会议</view> <view class="msg">访问事由: {{item.visitContent}}</view>
</view> </view>
<view class="dataView"> <view class="dataView">
<van-icon name="clock-o" color="#cccccc" size="40rpx" /> <van-icon name="clock-o" color="#cccccc" size="40rpx" />
<view class="msg">2024-02-02 14:00</view> <view class="msg">{{item.visitTimeFormat}}</view>
</view> </view>
<view class="btnView"> <view class="btnView">
<view class="btn">查看详情</view> <view class="btn">查看详情</view>
<view class="btn" data-id="{{item}}" bind:tap="showDialog">审核</view>
</view> </view>
</view> </view>
</view> </view>
</van-tab> </van-tab>
<van-tab title="预约审核" disabled="{{false}}"> <van-tab title="预约审核" disabled="{{false}}">
<view class="itemView" wx:for="{{verifyDataList}}" wx:for-item="item" wx:key="*this" bind:tap="goDetail" data-id="{{item.id}}" data-type="verify">
<view class="topView">
<view class="name">访客:{{item.name}}</view>
<view class="status" style="color: {{item.fontColor}};">{{item.statusName}}</view>
</view>
<view class="contentView">
<view class="dataView">
<van-icon name="manager" color="#cccccc" size="40rpx" />
<view class="msg">访问事由: {{item.visitContent}}</view>
</view>
<view class="dataView">
<van-icon name="clock-o" color="#cccccc" size="40rpx" />
<view class="msg">{{item.visitTimeFormat}}</view>
</view>
<view class="btnView">
<view class="btn">查看详情</view>
<view class="btn" wx:if="{{item.verifyShow}}" data-id="{{item.id}}" catch:tap="showDialog">审核</view>
</view>
</view>
</view>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<view class="submitBtn" bind:tap="goReservation">立即预约</view> <view class="submitBtn" data-type="add" bind:tap="goDetail">立即预约</view>
</view>
<!-- 审核弹出框 --> <!-- 审核弹出框 -->
<van-dialog use-slot title="审核" show="{{ dialogShow }}" show-confirm-button="{{false}}" show-cancel-button="{{false}}" close-on-click-overlay> <van-dialog use-slot title="审核" show="{{ dialogShow }}" show-confirm-button="{{false}}" show-cancel-button="{{false}}" close-on-click-overlay>
<van-field input-class="textarea" bind:input="dialogInput" value="{{ dialogContent }}" type="textarea" placeholder="请输入描述信息" /> <van-field input-class="textarea" bind:input="dialogInput" value="{{ dialogContent }}" type="textarea" placeholder="请输入描述信息" />
<view class="dialogBtnView"> <view class="dialogBtnView">
<view class="rejectBtn" bind:tap="dialogReject">驳回</view> <view class="rejectBtn" data-status="2" bind:tap="dialogVerify">驳回</view>
<view class="successBtn" bind:tap="dialogSuccess">通过</view> <view class="successBtn" data-status="1" bind:tap="dialogVerify">通过</view>
</view> </view>
</van-dialog> </van-dialog>
</view> <!-- 消息提示 -->
<van-notify id="van-notify" />

View File

@ -99,6 +99,19 @@ function selfFormatTimeYMDHMS(time) {
} }
//返回 2017-12-12 12:30
function selfFormatTimeYMDHM(time) {
let date = new Date(time);
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
}
//返回 2017-12-12 12 //返回 2017-12-12 12
function selfFormatTimeYMDH(time) { function selfFormatTimeYMDH(time) {
let date = new Date(time); let date = new Date(time);
@ -202,6 +215,7 @@ module.exports = {
formatTime2: formatTime2, formatTime2: formatTime2,
selfFormatTimeReturnSecond59, selfFormatTimeReturnSecond59,
selfFormatTimeYMDHMS, selfFormatTimeYMDHMS,
selfFormatTimeYMDHM,
selfFormatTimeYMD, selfFormatTimeYMD,
selfFormatTimeHM, selfFormatTimeHM,
selfFormatTimeYMDH, selfFormatTimeYMDH,