This commit is contained in:
SelfRidicule 2024-03-11 16:32:35 +08:00
parent 896fc7959c
commit 749740100d
8 changed files with 170 additions and 105 deletions

View File

@ -18,4 +18,13 @@ export function openDoorRq(data) {
method: "post",
data
});
}
// 开门记录
export function getOpenDoorRecordRq(data) {
return request({
url: `/api/equipment/getOpenDoorRecord?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
method: "post",
data
});
}

View File

@ -2,9 +2,15 @@ const app = getApp()
import Notify from '@vant/weapp/notify/notify';
import {
selfFormatTimeYMD,
selfFormatTimeHM
} from "../../../utils/util.js"
import {
getEquipmentByUserIdRq,
openDoorRq
openDoorRq,
getOpenDoorRecordRq
} from "../../../api/meeting/equipment.js"
Page({
@ -17,6 +23,7 @@ Page({
activeNames: [0],
userDetail: {},
equipmentDataList: [],
openRecordList: [],
},
/**
@ -35,6 +42,8 @@ Page({
})
// 获取设备数据
_this.getEquipmentData();
// 获取-开门记录数据
_this.getOpenRecordData()
},
// 获取设备数据
@ -60,6 +69,27 @@ Page({
})
},
// 获取-开门记录数据
getOpenRecordData() {
let _this = this;
getOpenDoorRecordRq({
userId: _this.data.userDetail.id,
pageNum: 1,
pageSize: 10
}).then(res => {
console.log('getOpenRecordData', res);
let openRecordList = res.data.records
openRecordList = openRecordList.map(item => {
item.createTimeYMD = selfFormatTimeYMD(item.createTime)
item.createTimeHM = selfFormatTimeHM(item.createTime)
return item;
})
_this.setData({
openRecordList
})
})
},
// 开门
openDoor(e) {
console.log('openDoor', e);
@ -68,7 +98,7 @@ Page({
let deviceId = e.currentTarget.dataset.deviceid
let roomId = e.currentTarget.dataset.roomid
let status = e.currentTarget.dataset.status
if (!status == '在线') {
if (status != '在线') {
Notify({
type: 'danger',
message: '设备不在线!'

View File

@ -7,7 +7,7 @@
<!-- 门禁控制列表 -->
<view class="controlView">
<view class="controlItem" wx:for="{{equipmentDataList}}">
<view class="controlItem" wx:for="{{equipmentDataList}}" wx:key="*this">
<view class="msg">
<view class="title">{{item.equipmentName}}</view>
<view class="status {{item.statusClass}}">{{item.equipmentStatus}}</view>
@ -24,12 +24,12 @@
<!-- 开门记录 -->
<view class="recordView">
<view class="recordItem" wx:for="{{5}}">
<view class="recordItem" wx:for="{{openRecordList}}" wx:key="*this">
<view class="timeView">
<view class="timeYMD">2024-02-06</view>
<view class="timeHm">13:00</view>
<view class="timeYMD">{{item.createTimeYMD}}</view>
<view class="timeHm">{{item.createTimeHM}}</view>
</view>
<view class="msg">西大门开启</view>
<view class="msg">{{item.deviceName}}</view>
</view>
</view>

View File

@ -81,12 +81,12 @@
}
.itemTitleView .more {
font-size: 26rpx;
font-size: 28rpx;
color: #4b89ef;
}
.recordView {
padding: 60rpx 24rpx 140rpx;
padding: 20rpx 24rpx;
background: white;
}

View File

@ -1,66 +1,125 @@
// pages/meeting/accessControl/accessControlRecord.js
const app = getApp()
import {
selfFormatTimeYMD,
selfFormatTimeHM
} from "../../../../utils/util.js"
import {
getOpenDoorRecordRq
} from "../../../../api/meeting/equipment.js"
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
userDetail: {},
openRecordList: [],
pageNum: 1,
pageSize: 25,
isDataAll: false,
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
let userDetail = wx.getStorageSync('user')
_this.setData({
userDetail,
...options,
})
// 获取-开门记录数据
_this.getOpenRecordData()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
// 获取-开门记录数据
getOpenRecordData() {
let _this = this;
if (_this.data.isDataAll) {
return
}
getOpenDoorRecordRq({
userId: _this.data.userDetail.id,
pageNum: _this.data.pageNum,
pageSize: _this.data.pageSize
}).then(res => {
console.log('getOpenRecordData', res);
let queryList = res.data.records
if (queryList && queryList.length > 0) {
queryList = queryList.map(item => {
item.createTimeYMD = selfFormatTimeYMD(item.createTime)
item.createTimeHM = selfFormatTimeHM(item.createTime)
return item;
})
let openRecordList = _this.data.openRecordList.concat(queryList);
_this.setData({
openRecordList,
pageNum: _this.data.pageNum + 1,
})
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
} else {
_this.setData({
isDataAll: true
})
}
})
},
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
console.log('onReachBottom 页面上拉触底');
let _this = this;
// 获取-开门记录数据
_this.getOpenRecordData();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
}
})

View File

@ -1,4 +1,7 @@
{
"usingComponents": {},
"navigationBarTitleText": "开门记录"
"usingComponents": {
"van-divider": "@vant/weapp/divider/index"
},
"navigationBarTitleText": "开门记录",
"onReachBottomDistance": 100
}

View File

@ -1,19 +1,13 @@
<view class="container">
<!-- 标题 -->
<!-- <view class="itemTitleView">
<view class="line"></view>
<view class="title">开门记录</view>
<view class="line"></view>
</view> -->
<view class="containerView public">
<!-- 开门记录 -->
<view class="recordView">
<view class="recordItem" wx:for="{{25}}">
<view class="recordItem" wx:for="{{openRecordList}}" wx:key="*this">
<view class="timeView">
<view class="timeYMD">2024-02-06</view>
<view class="timeHm">13:00</view>
<view class="timeYMD">{{item.createTimeYMD}}</view>
<view class="timeHm">{{item.createTimeHM}}</view>
</view>
<view class="msg">西大门开启</view>
<view class="msg">{{item.deviceName}}</view>
</view>
</view>
<van-divider wx:if="{{isDataAll}}" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider>
</view>

View File

@ -1,40 +1,10 @@
.container{
width: 100vw;
height: 100vh;
background: #ffffff;
overflow-y: auto;
}
.itemTitleView {
display: flex;
justify-content: center;
align-items: center;
margin-top: 30rpx;
}
.itemTitleView .title {
margin: 0 30rpx;
font-size: 32rpx;
font-weight: bold;
color: #141414;
}
.itemTitleView .line{
flex: 1;
height: 1rpx;
background: gray;
opacity: 0.12;
}
.itemTitleView .more {
font-size: 26rpx;
color: #4b89ef;
.containerView.public {
height: auto;
}
.recordView {
padding: 60rpx 24rpx 140rpx;
background: white;
padding: 60rpx 24rpx 10rpx;
/* background: white; */
}
.recordView .recordItem {
@ -45,7 +15,7 @@
background: #ffffff;
}
.recordView .recordItem:nth-child(2n){
.recordView .recordItem:nth-child(2n) {
background: #f9fafc;
}
@ -82,4 +52,4 @@
font-size: 26rpx;
word-break: break-all;
line-height: 1;
}
}