重构第一版 智控助手小程序

This commit is contained in:
2025-12-30 15:21:19 +08:00
parent c25e282398
commit 3852e6ac20
32 changed files with 3584 additions and 123 deletions

1
app.js
View File

@@ -44,6 +44,7 @@ App({
HotelId:-1,
CreateTime:null,
HotelCode:null,
CreatDate:null,
},
toast:function(type,title,success,time){
if(type==1){

View File

@@ -10,7 +10,11 @@
"pages/basics/MakingRounds/process/process",
"pages/basics/MakingRoundsAbnormal/MakingRoundsAbnormal",
"pages/basics/HostUpgrade/HostUpgrade",
"pages/basics/HostUpgrade/EquipmentCaontrol/EquipmentCaontrol"
"pages/basics/HostUpgrade/EquipmentCaontrol/EquipmentCaontrol",
"pages/test/test",
"pages/basics/FacialDeviceBinding/FacialDeviceBinding",
"pages/basics/progress/progress",
"pages/basics/progress/RoomTypeControlLog/RoomTypeControlLog"
],
"window": {
"backgroundTextStyle": "light",

View File

@@ -1398,6 +1398,14 @@ button.icon.lg {
justify-content: space-between;
align-items: center
}
.cu-list.menu>.cu-itemzn {
position: relative;
padding: 0 10rpx;
min-height: 100rpx;
background-color: var(--white);
justify-content: space-between;
align-items: center
}
.cu-list.menu>.cu-item:last-child:after {
border: none

View File

@@ -191,6 +191,16 @@ export async function GetRoomTypeNode(params){
url: BoonliveUrl + 'GetDeviceInfo',
data: params || {}
})
}
//获取房型下的设备
export async function GetRoomAddressStatus(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "",
url: BoonliveUrl + 'GetRoomAddressStatus',
data: params || {}
})
}
export async function WebChatUpgrade(params){
@@ -257,4 +267,58 @@ export async function SetRCUCurtain(params){
data: params || {}
})
}
SetRCUCurtain
//查询设备列表
export async function QueryDeviceList(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'QueryDeviceList',
data: params || {}
})
}
//设置RCU服务
export async function SetRCUService(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'SetRCUService',
data: params || {}
})
}
//写入房间设备访问日志
export async function WriteRoomVisitLog(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "上传查房记录中",
url: BoonliveUrl + 'WriteRoomVisitLog',
data: params || {}
})
}
//查询房间设备访问日志
export async function QueryRoomVisitLog(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "查询设备访问日志中",
url: BoonliveUrl + 'QueryRoomVisitLog',
data: params || {}
})
}
//修改房间设备访问日志
export async function UpdateRoomVisitLog(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "更新故障记录中",
url: BoonliveUrl + 'UpdateRoomVisitLog',
data: params || {}
})
}

View File

@@ -2,29 +2,34 @@
let show = 0;
export default async function reqeust(params) {
show++;
return new Promise((resolve, reject) => {
// 判断是否需要显示loading弹窗
const needLoading = params.title !== undefined && params.title !== null && params.title !== '';
if (needLoading) {
wx.showLoading({
title: params.title,
mask:true
})
wx.request({
mask: true
});
}
return new Promise((resolve, reject) => {
wx.request({
header: {
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
},
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
},
url: params.url,
method: params.method || 'post',
data: params.data || {},
success: res => {
resolve(res.data)
resolve(res.data)
},
fail: err => {
reject(err)
},
complete:()=>{
show--;
if(show==0){
wx.hideLoading()
if (needLoading && show === 0) {
wx.hideLoading();
}
}
})

View File

@@ -26,12 +26,6 @@ Page({
color: 'purple',
icon: 'font'
},
{
title: '主机绑定 ',
name: 'HostBinding',
color: 'mauve',
icon: 'icon'
},
{
title: '人脸机绑定',
name: 'FacialDeviceBinding',

View File

@@ -0,0 +1,629 @@
// pages/FacialDeviceBinding/FacialDeviceBinding.js
// 人脸设备绑定页面逻辑
const app = getApp()
// 导入请求中心
import {
GetHostsInfo,
GetFaceSN,
GetFaceCode,
CheckFaceSNAutho,
CheckFaceSN,
OpenDoorTest
} from '../../../lib/RequestingCenter';
Page({
data: {
autho:null,
RoomIndex: 0, // 当前选中房间索引
Hotelinfo: null, // 酒店信息
HostsData: null, // 原始设备数据
HostsDataFilters: [], // 过滤后的设备数据
onlineFaceDevices: 0, // 在线人脸设备数量
inputValue: "", // 搜索输入值
scrollHeight: 0, // 滚动区域高度
toView: '', // 滚动位置
modal: '', // 弹窗状态
selHosts: null, // 当前选中的房间
faceSNCode: '', // 人脸设备SN输入
bdHosts: [], // 已绑定的主机列表
Help: false, // 帮助状态
islogs: false, // 操作记录状态
showinfo: 0, // 显示信息类型
faceAddress: '', // 人脸设备地址
input: 0, // 输入类型
ISLoopDebugging: 0, // 回路调试状态
message: [], // 弹窗信息
},
/**
* 页面的初始数据
*/
onLoad:async function(options) {
if (!options.HotelId || app.globalData.autho == null) {
app.toast(2, "无酒店信息~")
return;
}
this.setData({
autho: app.globalData.autho ,
HotelId:options.HotelId
})
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
// 计算滚动区域高度
this.calcScrollHeight();
// 获取人脸设备数据
this.GetHostsInfo();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 页面显示时重新获取数据
this.GetHostsInfo();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.GetHostsInfo();
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
// 返回上一页
back: function () {
wx.navigateBack({
delta: 1
});
},
// 计算滚动区域高度
calcScrollHeight: function () {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
// 获取人脸设备数据
GetHostsInfo: function () {
const that = this;
// 显示加载提示
wx.showLoading({
title: '加载中...',
});
// 调用获取主机信息接口
GetHostsInfo({
HotelID: that.data.HotelId
}).then(res => {
// 隐藏加载提示
wx.hideLoading();
if (res.Status == 200) {
// 处理数据
const HostsData = res.Data;
const HostsDataFilters = HostsData;
// 统计在线人脸设备数量
let onlineFaceDevices = 0;
for (let i = 0; i < HostsDataFilters.length; i++) {
if (HostsDataFilters[i].FaceStatus) {
onlineFaceDevices++;
}
}
// 更新数据
that.setData({
HostsData: HostsData,
HostsDataFilters: HostsDataFilters,
onlineFaceDevices: onlineFaceDevices,
RoomIndex: 0
});
// 获取位置信息
that.GetLOC();
} else {
wx.showToast({
title: '获取数据失败',
icon: 'none'
});
}
}).catch(err => {
wx.hideLoading();
wx.showToast({
title: '网络异常',
icon: 'none'
});
console.error('获取主机信息失败:', err);
});
},
// 获取位置信息
GetLOC: function () {
const that = this;
// 调用微信获取位置接口
wx.getFuzzyLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude;
const longitude = res.longitude;
const address = `${latitude},${longitude}`;
that.setData({
faceAddress: address
});
},
fail(err) {
console.error('获取位置信息失败:', err);
// 位置信息获取失败不影响主流程
}
});
},
// 搜索输入
inputSearchForHotels: function (e) {
this.setData({
inputValue: e.detail.value
});
},
// 搜索房间
SearchForHotels: function () {
const that = this;
const inputValue = that.data.inputValue;
const HostsData = that.data.HostsData;
if (inputValue === '') {
// 搜索条件为空,显示所有数据
that.setData({
HostsDataFilters: HostsData
});
return;
}
// 根据房号搜索
const filters = HostsData.filter(item => {
return item.RoomNumber.indexOf(inputValue) !== -1;
});
that.setData({
HostsDataFilters: filters
});
},
// 刷新房间数据
RefreshTheRoom: function () {
this.GetHostsInfo();
},
// 跳转到人脸设备详情或直接扫码绑定
goFaceDetail: function (e) {
const index = e.currentTarget.id.split('-')[1];
const HostsDataFilters = this.data.HostsDataFilters;
const selHosts = HostsDataFilters[index];
selHosts.index = index;
this.setData({
RoomIndex: index,
selHosts: selHosts
});
// 判断条件:离线且未绑定
if (!selHosts.FaceStatus && (!selHosts.FaceSN || selHosts.FaceSN === '')) {
// 直接调用摄像头扫码绑定
this.GetFaceCode();
} else {
// 设置消息数据
this.setData({
message: [selHosts.FaceSN, selHosts.RoomNumber],
// 显示设备详情
modal: -1
});
}
},
// 关闭弹窗
GetHide: function () {
this.setData({
modal: ''
});
},
// 反馈错误
ErrorInfo: function () {
wx.showToast({
title: '反馈功能开发中',
icon: 'none'
});
},
// 人脸设备解绑
JbSn: function (params) {
let jbjd = null;
let faceSN = null;
let that = this;
let index = -1;
// 检查是否从SN已绑定弹窗点击解绑按钮
if (typeof params.currentTarget.dataset['index'] != 'undefined') {
faceSN = this.data.faceSNCode;
index = params.currentTarget.dataset['index'];
// 解绑的房间
jbjd = this.data.bdHosts[index];
} else {
jbjd = this.data.selHosts;
faceSN = this.data.selHosts.FaceSN;
}
wx.showModal({
title: '解绑确认',
content: `确定要解除${jbjd.RoomNumber}房间的人脸设备绑定吗?`,
success(res) {
if (res.confirm) {
// 调用解绑接口
GetFaceSN({
faceSN: faceSN,
roomID: jbjd.Id,
roomNumber: jbjd.RoomNumber,
faceAddress: that.data.faceAddress,
HotelID: jbjd.HotelID,
isjb: true
}).then(res => {
if (res.Status == 200) {
wx.showToast({
title: '解绑成功',
icon: 'success'
});
// 如果是从SN已绑定弹窗解绑需要更新bdHosts数据
if (index > -1) {
let databdHosts = that.data.bdHosts;
databdHosts.splice(index, 1);
that.setData({
bdHosts: databdHosts
});
// 如果bdHosts为空继续执行绑定
if (databdHosts.length <= 0) {
that.GetFaceSNend();
}
}
// 重新获取数据
that.GetHostsInfo();
// 关闭弹窗
that.GetHide();
} else {
wx.showToast({
title: '解绑失败',
icon: 'none'
});
}
}).catch(err => {
wx.showToast({
title: '网络异常',
icon: 'none'
});
console.error('解绑失败:', err);
});
}
}
});
},
// 扫码绑定人脸设备
GetFaceCode: function () {
const that = this;
// 检查权限
if (!that.CheckFaceSNAutho()) {
wx.showToast({
title: '您没有权限绑定人脸设备',
icon: 'none'
});
return;
}
// 调用微信扫码接口
wx.scanCode({
success: (res) => {
const code = res.result;
that.setData({
faceSNCode: code
});
debugger
that.GetFaceSNOK();
},
fail: (err) => {
console.error('扫码失败:', err);
wx.showToast({
title: '扫码失败',
icon: 'none'
});
}
});
},
// 手动输入人脸设备SN
ShowInputsn: function () {
// 检查权限
if (!this.CheckFaceSNAutho()) {
wx.showToast({
title: '您没有权限绑定人脸设备',
icon: 'none'
});
return;
}
this.setData({
modal: 'showBindConfirm'
});
},
GetFaceSNOK:function(){
let that = this;
if (!this.CheckFaceMAC(that.data.faceSNCode)) {
this.setData({
modal: 520
})
return;
};
if (that.data.selHosts.FaceSN == that.data.faceSNCode) {
app.toast(2, "条码一致,无需更改~")
return;
}
this.CheckFaceMACWL()
},
CheckFaceMACWL(){
let that = this;
CheckFaceSN({faceSN:this.data.faceSNCode}).then(
res => {
if (res.Status == 200) {
if(res.Data<=0){
that.setData({
modal:-521,
})
}else{
let remove = [];
let bdHosts = res.Data;
try {
//记录已经分配酒店但是未分配房间 且酒店是当前酒店 那就判断为没有绑定
that.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
for (let index = 0; index < bdHosts.length; index++) {
if (elements.HotelId == bdHosts[index].HotelID) {
if(bdHosts[index].HotelID == that.data.Hotelinfo.HotelId && bdHosts[index].Id==0){
remove.push(index);
}
elements.Auth.forEach (Auth=>{
if(Auth.AuthorityId == 21 && Auth.AuthotypeId == 3){
//有权限
bdHosts[index].qx = 0;
}
})
}
}
})
});
} catch (error) {
console.log(error)
}
remove.forEach (x=>{
bdHosts.splice(x, 1);
})
let modalval = -200;
if(bdHosts.length<=0){
modalval = -521;
}
that.setData({
modal:modalval,
bdHosts:bdHosts
})
// app.toast(2, "已经被绑定")
}
}else{
app.toast(2, "网络繁忙")
}
},
err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
CheckFaceMAC:function(vlues){
return true;
console.log(vlues.length != 16)
return vlues.length == 16;
},
// 完成人脸设备绑定
GetFaceSNend: function () {
const that = this;
const selHosts = that.data.selHosts;
const faceSNCode = that.data.faceSNCode;
// 显示加载提示
wx.showLoading({
title: '绑定中...',
});
// 调用绑定接口
GetFaceSN({
faceSN: faceSNCode,
roomID: selHosts.Id,
roomNumber: selHosts.RoomNumber,
faceAddress: that.data.faceAddress,
HotelID: selHosts.HotelID,
isjb: false
}).then(res => {
// 隐藏加载提示
wx.hideLoading();
if (res.Status == 200) {
wx.showToast({
title: '绑定成功',
icon: 'success'
});
// 重新获取数据
that.GetHostsInfo();
// 关闭弹窗
that.GetHide();
} else if (res.Status == 400) {
// 设备已被绑定
that.setData({
bdHosts: res.Data,
code: faceSNCode,
modal: -200
});
} else {
wx.showToast({
title: '绑定失败',
icon: 'none'
});
}
}).catch(err => {
// 隐藏加载提示
wx.hideLoading();
wx.showToast({
title: '网络异常',
icon: 'none'
});
console.error('绑定失败:', err);
});
},
// 检查人脸设备绑定权限
CheckFaceSNAutho: function () {
let res = false;
this.data.Hotelinfo.Auth.forEach(x => {
if (x.AuthorityId == 21 && x.AuthotypeId == 3) {
res = true;
}
});
return res;
},
// 设置操作
testinfo: function (e) {
var jbjd = this.data.selHosts;
wx.navigateTo({
url: '/pages/test/test?Hotelinfo=' + e.currentTarget.id + '&RoomID=' + jbjd.Id + '&faceadd=' + this.data.faceAddress
});
},
// 开门操作
OpenDoor: function (e) {
const sn = e.currentTarget.id.split('_');
OpenDoorTest({faceSN:sn[2],isjb:true}).then(
res=>{
if (res.Status == 200) {
wx.showToast({
title: res.Message,
icon: 'none'
})
}else{
wx.showToast({
title: res.Message,
icon: 'none'
})
}
},rej=>{
wx.showToast({
title: "网络繁忙",
icon: 'none'
})
}
);
},
// 切换显示信息
GetshowinfoClick: function (e) {
const index = e.currentTarget.dataset.index;
this.setData({
showinfo: index
});
},
// 切换显示信息(刷新)
GetshowinfoClick1: function () {
this.GetHostsInfo();
},
})

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "人脸设备绑定",
"usingComponents": {
"cu-custom": "/colorui/components/cu-custom"
}
}

View File

@@ -0,0 +1,144 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<view class=" solids bg-white" style="height:70px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl" style=" height:45% ;width: 100%;">
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房号:{{HostsDataFilters[RoomIndex].RoomNumber}}</text>
</view>
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">人脸设备在线:</text>
<text class="text-blue">{{onlineFaceDevices}}/</text>
<text class="text-black">{{HostsDataFilters.length}} </text>
</view>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids" style="width: 60%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;" placeholder="请输入房号搜索房间"/>
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="SearchForHotels">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">刷新</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;" >
<view class='nav-list1 bg-white' style="margin-top: 20rpx;">
<view bindtap="goFaceDetail" data-room="{{item.RoomNumber}}" data-hotel="{{Hotelinfo.HotelName}}"
data-status="{{item.FaceStatus}}" data-faceSN="{{item.FaceSN}}" hover-class="navigator-hover" class="nav-li4 bg-{{item.FaceStatus===true? 'cyan':'gray'}}" wx:for="{{HostsDataFilters}}" id="msg-{{index}}" wx:key="index">
<view style="font-size: 28rpx;justify-content:start" >{{item.RoomNumber}}</view>
<view style="font-size: 18rpx;justify-content:start;color:{{item.FaceSN && !item.FaceStatus ? 'red' : 'gray'}}" >{{item.FaceSN || '未绑定'}}</view>
</view>
</view>
</scroll-view>
<!-- 房间已经绑定人脸机弹窗提示 -->
<view class="cu-modal {{modal==-1?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{selHosts.RoomNumber}}已经绑定人脸机</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{message[1]}}</view>
<view class="basis-sm text-right">人脸机SN</view><view class="basis-lg text-left">{{message[0]}}</view>
<view class=" text-left flex-sub text-sm text-gray">房间已经绑定人脸机,点击继续将执行扫描绑定;点击取消,将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<!-- <view class="action margin-0 flex-sub " data-type="0" bindtap="ErrorInfo">反馈错误</view>text-red -->
<view id="{{Hotelinfo.HotelName}}_{{message[1]}}_{{message[0]}}_{{Hotelinfo.Code}}_{{Hotelinfo.HotelId}}" class="action margin-0 flex-sub text-green solid-left" style="font-weight: 600;" bindtap="testinfo" >设置</view>
<view id="{{Hotelinfo.HotelName}}_{{message[1]}}_{{message[0]}}_{{Hotelinfo.Code}}" class="action margin-0 flex-sub text-green solid-left" style="font-weight: 600;" bindtap="OpenDoor" >开门</view>
<!-- <view class="action margin-0 flex-sub {{selHosts.FaceSN!=''?'show':''}} text-red solid-left" bindtap="JbSn" >解绑</view> -->
<!-- <view class="action margin-0 flex-sub solid-left" bindtap="GetHide" >取消</view> -->
<!-- <view class="action margin-0 flex-sub text-green solid-left" bindtap="{{FaceSNinput == 0?'GetFaceCode':'ShowInputsn'}}" >继续</view> -->
</view>
</view>
</view>
<!-- 绑定确认弹窗 -->
<view class="cu-modal {{modal=='-521'?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">绑定人脸设备</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">人脸设备SN</view>
<view class="basis-lg text-left">
<textarea placeholder="请输入人脸设备SN" model:value="{{faceSNCode}}" name="input" style="width: 100%; height: 100rpx; border: 1rpx solid #ccc; border-radius: 4rpx; padding: 10rpx;" placeholder-style="color: #999;"></textarea>
</view>
<view class=" text-left flex-sub text-sm text-gray">确定为该房间绑定人脸设备SN点击继续将执行绑定操作点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" bindtap="GetFaceSNend" >继续</view>
</view>
</view>
</view>
<!-- SN已经被绑定弹窗提示 -->
<view class="cu-modal {{modal==-200?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{code}}已经被绑定
</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-xs flex flex-wrap justify-center " >
<view class="basis-xl text-sm" wx:for="{{bdHosts}}" >
<text class=" text-right ">酒店:</text><text class="text-left text-red">{{item.HotelName}}</text>
<text class="padding-left-xs text-right " >房间:</text><text class="text-left text-red">{{item.RoomNumber}}</text>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx == 0}}" data-index="{{index}}" type="" bindtap="JbSn" >解绑</button>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx != 0}}" disabled >解绑</button>
</view>
<view class="basis-xl">SN<text class="text-left">{{faceSNCode}}</text></view>
<view class="basis-xl text-left text-sm text-gray">SN已经被其他房间绑定点击解绑将取消原有绑定执行新的绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view wx:if="{{bdHosts.length<=0}}" class="action margin-0 flex-sub solid-left" data-type="false" bindtap="GetFaceSNend" >继续</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,364 @@
/* pages/FacialDeviceBinding/FacialDeviceBinding.wxss */
/* 人脸设备绑定页面样式 */
/* 滚动区域样式 */
#scroll {
height: 100%;
}
/* 房间列表样式 */
.nav-list1 {
display: flex;
flex-wrap: wrap;
padding: 0 10rpx;
}
/* 房间项样式 */
.nav-li4 {
width: 31.33%;
margin: 1%;
padding: 15rpx;
border-radius: 8rpx;
text-align: center;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
transition: all 0.3s;
}
.nav-li4:active {
transform: scale(0.95);
}
/* 在线状态样式 */
.bg-green {
background-color: #4CD964;
color: white;
}
/* 青色在线状态样式 */
.bg-cyan {
background-color: #00BCD4;
color: white;
}
/* 离线状态样式 */
.bg-gray {
background-color: #E5E5EA;
color: #8E8E93;
}
/* 搜索框样式 */
.cu-btn1 {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 5rpx;
font-size: 26rpx;
height: 64rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
/* 按钮样式 */
.margin-left {
margin-left: 10rpx;
}
/* 顶部操作栏样式 */
.cu-bar1 {
display: flex;
align-items: center;
justify-content: space-between;
}
/* 弹性换行样式 */
.flex-wrap {
display: flex;
}
/* 固体样式 */
.solids {
display: block;
}
/* 顶部信息栏样式 */
.text-xl {
font-size: 36rpx;
font-weight: bold;
}
.text-blue {
color: #007AFF;
}
.text-black {
color: #000000;
}
/* 弹窗样式 */
.cu-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.3s;
}
.cu-modal.show {
opacity: 1;
}
.cu-dialog {
background: white;
border-radius: 10rpx;
width: 80%;
max-width: 500rpx;
overflow: hidden;
transform: scale(0.8);
transition: transform 0.3s;
}
.cu-modal.show .cu-dialog {
transform: scale(1);
}
.cu-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx;
border-bottom: 1px solid #E5E5EA;
}
.cu-bar .content {
font-size: 36rpx;
font-weight: bold;
}
.cu-bar.bg-gradual-blue .action {
color: white;
}
.cu-bar.bg-gradual-blue .action text {
color: white;
}
.cu-bar .action {
color: #007AFF;
font-size: 32rpx;
}
/* 内容区样式 */
.padding-lg {
padding: 30rpx;
}
.flex {
display: flex;
}
.flex-wrap {
flex-wrap: wrap;
}
.basis-sm {
width: 30%;
text-align: right;
padding-right: 20rpx;
}
.basis-lg {
width: 70%;
text-align: left;
}
.text-red {
color: #FF3B30;
}
.text-green {
color: #4CD964;
}
/* 输入框样式 */
input {
border: 1px solid #E5E5EA;
border-radius: 5rpx;
padding: 15rpx;
width: 100%;
font-size: 32rpx;
box-sizing: border-box;
}
/* 底部按钮栏样式 */
.cu-bar.bg-white {
border-top: 1px solid #E5E5EA;
border-bottom: none;
}
.cu-bar .action {
padding: 10rpx 20rpx;
}
.solid-left {
border-left: 1px solid #E5E5EA;
}
/* 酒店信息样式 */
.text-df {
font-size: 28rpx;
}
/* 设备信息样式 */
.text-sm {
font-size: 24rpx;
}
/* 分隔线样式 */
.ControlLine {
height: 2rpx;
background-color: #E5E5EA;
margin: 20rpx 0;
}
/* 轻量级文本样式 */
.light {
opacity: 0.7;
}
/* 禁用状态样式 */
button:disabled {
opacity: 0.5;
}
/* 加载提示样式 */
.loading {
display: flex;
justify-content: center;
align-items: center;
padding: 50rpx;
}
.loading text {
margin-left: 10rpx;
font-size: 32rpx;
color: #8E8E93;
}
/* 空数据提示样式 */
.empty {
text-align: center;
padding: 100rpx;
color: #8E8E93;
font-size: 32rpx;
}
/* 帮助区域样式 */
.cu-card {
margin: 20rpx;
background: white;
border-radius: 10rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.cu-item {
padding: 30rpx;
}
.title {
font-size: 36rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.content {
font-size: 32rpx;
line-height: 1.6;
}
.desc {
margin-bottom: 20rpx;
}
.text-content {
font-size: 30rpx;
line-height: 1.8;
}
/* 酒店信息样式 */
.hotel-info {
padding: 20rpx;
background: white;
border-bottom: 1px solid #E5E5EA;
}
.hotel-name {
font-size: 36rpx;
font-weight: bold;
color: #000000;
}
.hotel-code {
font-size: 30rpx;
color: #8E8E93;
margin-top: 10rpx;
}
/* 状态统计样式 */
.status-stats {
display: flex;
justify-content: space-around;
padding: 20rpx;
background: white;
border-bottom: 1px solid #E5E5EA;
}
.stat-item {
text-align: center;
}
.stat-label {
font-size: 30rpx;
color: #8E8E93;
}
.stat-value {
font-size: 40rpx;
font-weight: bold;
color: #007AFF;
}
/* 操作按钮样式 */
.operation-buttons {
display: flex;
justify-content: space-around;
padding: 20rpx;
background: white;
border-bottom: 1px solid #E5E5EA;
}
.operation-button {
flex: 1;
margin: 0 10rpx;
padding: 20rpx;
background: #007AFF;
color: white;
border-radius: 50rpx;
text-align: center;
font-size: 32rpx;
}
.operation-button:active {
opacity: 0.8;
}

View File

@@ -89,7 +89,6 @@
<view class="bg-white " wx:for="{{roomtypeInfoNodeinfo}}" wx:for-item="row" wx:for-index="rowIndex">
<view class=" bg-white " wx:if="{{row[0]===1}}" >
<!-- <view style="text-align: left;font-weight: bold">设置设备开关状态:</view> -->
<view class="Ncu-bar bg-white flex-sub" wx:for="{{row[1].length/4 }}" wx:for-index="colIndex" >

View File

@@ -16,6 +16,7 @@ import {
SetRCULight,
SetRCUAir,
SetRCUCurtain,
GetRoomAddressStatus
} from '../../../lib/RequestingCenter.js'
Page({
@@ -80,6 +81,7 @@ Page({
}
}
app.globalData.CreatDate =res.Data[0].CreateTime
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
@@ -103,9 +105,6 @@ Page({
app.toast(2, "网络繁忙")
});
},
/**
@@ -194,11 +193,19 @@ Page({
})
},
goProcess(e) {
let indexstr = e.currentTarget.id.replace("msg-","")
let index= Number(indexstr)
const { room, hotel, status } = e.currentTarget.dataset;
this.setData({
RoomIndex:index
} )
//debugger
let HostsDataFilters= this.data.HostsDataFilters
console.log(HostsDataFilters[index].RoomNumber)
let RoomTypeID=HostsDataFilters[index].RoomTypeID
if (status !== 1) return; // 不为1时不跳转
wx.navigateTo({
url: `/pages/basics/MakingRounds/process/process?RoomNumber=${room}&HotelName=${hotel}&HotelId=${this.data.Hotelinfo.HotelId }`
url: `/pages/basics/MakingRounds/process/process?RoomNumber=${room}&RoomTypeID=${RoomTypeID}&HotelName=${hotel}&HotelId=${this.data.Hotelinfo.HotelId }`
});
},
RefreshTheRoom:async function(e){
@@ -209,14 +216,17 @@ Page({
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
RoomIndex:RoomIndex,
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,

View File

@@ -1,4 +1,10 @@
// pages/basics/MakingRounds/process/process.js
const app = getApp()
import {
GetRoomAddressStatus,
QueryDeviceList,
WriteRoomVisitLog,
SetRCUService
} from '../../../../lib/RequestingCenter.js'
Page({
/**
@@ -7,23 +13,7 @@ Page({
data: {
RoomNumber:"",
HotelName:"",
deviceList:[
{id:1, name:'取电面板通讯', status:'在线',note:'在线',isnote:"0"},
{id:2, name:'温控面板通讯', status:'在线',note:'在线',isnote:0},
{id:3, name:'红外转发通讯', status:'离线',note:'在线',isnote:0},
{id:4, name:'485窗帘电机通讯',status:'在线',note:'在线',isnote:0},
{id:5, name:'门口传感器测试', status:'显示',note:'在线',isnote:0},
{id:6, name:'卫生间传感器测试',status:'显示',note:'在线',isnote:0},
{id:7, name:'淋浴间传感器测试',status:'不显示',note:'在线',isnote:0},
{id:8, name:'床尾传感器测试', status:'不显示',note:'在线',isnote:0},
{id:9, name:'镜前传感器测试', status:'不显示',note:'在线',isnote:0},
{id:10,name:'休闲区传感器测试',status:'不显示',note:'在线',isnote:0},
{id:11,name:'客厅传感器测试', status:'不显示',note:'在线',isnote:0},
{id:12,name:'厅卫传感器测试', status:'不显示',note:'在线',isnote:0},
{id:13,name:'浴缸传感器测试', status:'不显示',note:'在线',isnote:0},
{id:14,name:'门磁测试', status:'不显示',note:'在线',isnote:0},
{id:15,name:'干接点窗帘测试', status:'正常',note:'在线',isnote:0} // 最后一条你自行改状态
],
deviceList:[],
deviceListindex:0,
inputValue:"",
toView:"",
@@ -32,15 +22,22 @@ Page({
note:"",
noteok:"",
errorsNumber:0,
HotelId:""
HotelId:"",
RoomTypeID:"",
showErrorReasonInput: false, // 控制异常原因输入框显示/隐藏
errorReason: "", // 异常原因内容
},
// 定时器ID
timer5s: null,
timer1min: null,
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
onLoad:async function(options) {
if (!options.RoomNumber || !options.HotelName ||!options.HotelId) {
if (!options.RoomNumber || !options.HotelName ||!options.HotelId ||!options.RoomTypeID) {
app.toast(2, "无酒店信息~")
return;
}
@@ -48,15 +45,95 @@ Page({
this.setData ({
RoomNumber:options.RoomNumber,
HotelName:options.HotelName,
HotelId:options.HotelId
HotelId:options.HotelId,
RoomTypeID:options.RoomTypeID
})
console.log(app.globalData.HotelCode)
// let HotelId =parseInt(app.globalData.HotelCode);
// await GetRoomAddressStatus({
// Code: HotelId,
// RoomNum:options.RoomNumber
// }).then(res => {
// if (res.Status == 200) {
// } else {
// app.toast(2, res.Message || "网络繁忙")
// }
// }, err => {
// console.log(err)
// app.toast(2, "网络繁忙")
// }).catch(err => {
// console.log(err)
// app.toast(2, "网络繁忙")
// });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
onReady:async function() {
//debugger
this.calcScrollHeight();
// 页面加载完毕时调用QueryDeviceList获取设备列表
await this.getDeviceList();
},
/**
* 获取设备列表
*/
getDeviceList:async function() {
try {
const res = await QueryDeviceList({
HotelID: app.globalData.HotelCode,
RoomTypeID: this.data.RoomTypeID
});
if (res.Status == 1) {
console.log('设备列表获取成功:', res.Data);
// 更新设备列表数据
let deviceList = [];
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
// 检查是否已存在相同名称的设备
const isExist = deviceList.some(item => item.name === element.DevName);
if (!isExist) {
deviceList.push({
id: deviceList.length + 1,
name: element.DevName,
status: "在线",
note: element.Process,
isnote: 0,
Addrlist: [element.DevAddr]
});
} else {
// 如果设备已存在将新地址添加到Addrlist中
const existingDevice = deviceList.find(item => item.name === element.DevName);
if (existingDevice) {
// 检查Addrlist中是否已存在该地址避免重复添加
if (!existingDevice.Addrlist.includes(element.DevAddr)) {
existingDevice.Addrlist.push(element.DevAddr);
}
}
}
}
this.setData({
deviceList: deviceList
});
} else {
console.log('设备列表获取失败:', res.Message);
app.toast(2, res.Message || "获取设备列表失败");
}
} catch (error) {
console.log('获取设备列表出错:', error);
app.toast(2, "获取设备列表失败");
}
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
@@ -66,7 +143,7 @@ Page({
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.select('#NmyScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
@@ -85,21 +162,172 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
// 启动定时器
this.startTimers();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
// 停止定时器
this.stopTimers();
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
// 停止定时器
this.stopTimers();
},
/**
* 启动定时器
*/
startTimers() {
// 先调用一次SetRCUService
this.callSetRCUService();
// 再调用一次GetRoomAddressStatus
this.callGetRoomAddressStatus();
// 设置5秒定时器查询设备离在线状态
this.timer5s = setInterval(() => {
this.callGetRoomAddressStatus();
}, 5000);
// 设置1分钟定时器启动设备巡检
this.timer1min = setInterval(() => {
this.callSetRCUService();
}, 60000);
},
/**
* 停止定时器
*/
stopTimers() {
if (this.timer5s) {
clearInterval(this.timer5s);
this.timer5s = null;
}
if (this.timer1min) {
clearInterval(this.timer1min);
this.timer1min = null;
}
},
/**
* 调用SetRCUService接口
*/
async callSetRCUService() {
// 解析.NET风格的日期格式 "/Date(1473004800000)/"
let dotNetDate = app.globalData.CreatDate
let timestamp, pageCreateTime
try {
timestamp = parseInt(dotNetDate.match(/\d+/)[0])
pageCreateTime = new Date(timestamp)
} catch (error) {
console.error('日期解析错误:', error)
// 如果解析失败,使用当前日期作为备选
pageCreateTime = new Date()
}
let year = pageCreateTime.getFullYear()
let month = (pageCreateTime.getMonth() + 1).toString().padStart(2, '0')
let day = pageCreateTime.getDate().toString().padStart(2, '0')
let CreateTime = `${year}-${month}-${day}`
try {
const params = {
code: app.globalData.HotelCode,
creatDate:CreateTime,
roomNumber: this.data.RoomNumber,
modalAddress:"004000029",
status: "1"
};
const res = await SetRCUService(params);
console.log('SetRCUService调用成功:', res);
} catch (error) {
console.error('SetRCUService调用失败:', error);
}
},
/**
* 调用GetRoomAddressStatus接口
*/
async callGetRoomAddressStatus() {
//debugger
try {
const params = {
Code: parseInt(app.globalData.HotelCode),
RoomNum: this.data.RoomNumber
};
const res = await GetRoomAddressStatus(params);
//console.log('GetRoomAddressStatus调用成功:', res);
// 更新设备状态
if (res.Status === 1 && res.Data) {
this.updateDeviceStatus(res.Data);
}
} catch (error) {
console.error('GetRoomAddressStatus调用失败:', error);
}
},
/**
* 更新设备状态
*/
updateDeviceStatus(data) {
let deviceList = this.data.deviceList;
// 检测data和deviceList是否有数据若无数据则退出函数
if (!data || !deviceList || deviceList.length === 0) return;
// 先将所有设备标记为在线
deviceList = deviceList.map(device => ({
...device,
status: '在线'
}));
// 遍历设备异常数据集合data
for (const exceptionAddr in data) {
if (data.hasOwnProperty(exceptionAddr)) {
// 取异常地址的前6个字符
const exceptionAddrPrefix = exceptionAddr.toString().substring(0, 6);
// 遍历设备列表
for (let index = 0; index < deviceList.length; index++) {
const device = deviceList[index];
let isMatched = false;
// 遍历设备的地址集合
for (let addrIndex = 0; addrIndex < device.Addrlist.length; addrIndex++) {
const deviceAddr = device.Addrlist[addrIndex];
// 取设备地址的前6个字符
const deviceAddrPrefix = deviceAddr.toString().substring(0, 6);
// 比较地址前缀
if (deviceAddrPrefix === exceptionAddrPrefix) {
// 地址匹配,将设备标记为离线
deviceList[index].status = '离线';
isMatched = true;
break; // 退出当前设备的地址循环
}
}
if (isMatched) {
continue; // 匹配成功,遍历下一个设备
}
}
}
}
// 更新设备列表
this.setData({
deviceList: deviceList
});
console.log('设备状态更新完成:', deviceList);
},
/**
@@ -131,29 +359,52 @@ Page({
DialogModal1(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
deviceList[deviceListindex].equipmentstatus=e.currentTarget.dataset.id
const status = e.currentTarget.dataset.id
this.setData({
modalName: null,
deviceList:deviceList
})
// 如果选择异常,显示异常原因弹窗
if (status === 'hideModal_0') {
// 先设置设备状态为异常
deviceList[deviceListindex].equipmentstatus = status
// 重新计算异常数量
const errorsNumber = deviceList.filter(device => device.equipmentstatus === 'hideModal_0').length;
this.setData({
errorReason: deviceList[deviceListindex].errorReason || "", // 显示已有的异常原因
modalName: "DialogModal4",
deviceList: deviceList,
errorsNumber: errorsNumber
})
} else {
// 选择正常,直接保存状态并关闭弹窗
deviceList[deviceListindex].equipmentstatus = status
// 清除异常原因
deviceList[deviceListindex].errorReason = undefined
// 重新计算异常数量
const errorsNumber = deviceList.filter(device => device.equipmentstatus === 'hideModal_0').length;
this.setData({
modalName: null,
deviceList: deviceList,
errorsNumber: errorsNumber
})
}
console.log(this.data.deviceList)
},
DialogModal2(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
if (e.currentTarget.dataset.id==="hideModal_1") {
deviceList[deviceListindex].isnote=1
}else{
deviceList[deviceListindex].isnote=0
}
this.setData({
deviceList:deviceList
modalName: "DialogModal3"
})
console.log(this.data.deviceList)
},
DialogModal3(e){
this.setData({
modalName:""
})
},
inputSearchForHotels(e){
this.setData({
note: e.detail.value
@@ -171,12 +422,106 @@ Page({
let deviceListindex=this.data.deviceListindex
let note=this.data.note
let noteok=e.currentTarget.dataset.id
deviceList[deviceListindex].isnote= 0
if (noteok==="ok") {
deviceList[deviceListindex].note= note
}
this.setData({
deviceList:deviceList
deviceList:deviceList,
modalName: "DialogModal1"
})
},
// 处理异常原因输入
inputErrorReason(e){
this.setData({
errorReason: e.detail.value
})
},
// 确认异常原因弹窗
confirmErrorReasonModal(){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
// 保存异常原因到设备节点
deviceList[deviceListindex].errorReason = this.data.errorReason
this.setData({
deviceList: deviceList,
modalName: null, // 退出所有弹窗
errorReason: ""
})
console.log("异常原因已保存:", deviceList[deviceListindex])
},
// 取消异常原因弹窗
cancelErrorReasonModal(){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
// 如果还没有保存过异常原因,将设备状态改回未检测
if (!deviceList[deviceListindex].errorReason) {
deviceList[deviceListindex].equipmentstatus = undefined
// 重新计算异常数量
const errorsNumber = deviceList.filter(device => device.equipmentstatus === 'hideModal_0').length;
this.setData({
deviceList: deviceList,
errorsNumber: errorsNumber
})
}
this.setData({
modalName: "DialogModal1", // 返回之前的弹窗
errorReason: ""
})
},
/**
* 上传查房状态
*/
async uploadWardRoundStatus() {
const deviceList = this.data.deviceList
// 检查所有设备是否已设置equipmentstatus状态
const allSet = deviceList.every(device => device.equipmentstatus !== undefined && device.equipmentstatus !== null)
if (!allSet) {
app.toast(2, "请先完成所有设备的状态检测")
return
}
try {
// 构造请求参数
const params = {
HotelID: this.data.HotelId,
RoomNumber: this.data.RoomNumber,
EquipmentList: deviceList.map(device => ({
EquipmentStatus: device.equipmentstatus === 'hideModal_1' ? '正常' : device.equipmentstatus === 'hideModal_0' ? '故障' : '',
FaultDescription: device.errorReason || '',
DevName: device.name,
EquipmentStatusType: device.equipmentstatus === 'hideModal_1' ? '1' : device.equipmentstatus === 'hideModal_0' ? '2' : '',
EquipmentOnlineStatus: device.status === '在线' ? '1' : '2'
}))
}
// 调用接口上传数据
const res = await WriteRoomVisitLog(params)
// 处理返回结果
if (res.Status === 1) {
app.toast(1, res.Message || "上传成功")
console.log("上传成功", res)
} else {
app.toast(2, res.Message || "上传失败")
console.log("上传失败", res)
}
} catch (error) {
app.toast(2, "上传失败,请检查网络连接")
console.error("上传出错", error)
}
},
/**
* 刷新设备列表
*/
refreshDeviceList() {
// 调用getDeviceList函数刷新设备列表
this.getDeviceList()
},
})

View File

@@ -4,24 +4,24 @@
<view slot="content">({{HotelName}})_{{RoomNumber}}</view>
</cu-custom>
<view class="flex solid-bottom justify-between ">
<view class=" padding-xs margin-sm radius">
<view class=" padding-5 margin-5 radius">
<text class="text-black">异常数量:</text>
<text class="text-red">1</text>
<text class="text-red">{{errorsNumber}}</text>
<text class="text-black">/{{deviceList.length}}</text>
</view>
<view class="bg-grey padding-xs margin-sm radius" hover-class="navigator-hover" bindtap="checkWardRoundRecords" >查看查房记录</view>
<view class="bg-grey padding-xs margin-sm radius" hover-class="navigator-hover">上传查房状态</view>
<view class="bg-grey padding-5 margin-5 radius" hover-class="navigator-hover" bindtap="checkWardRoundRecords" >查看查房记录</view>
<view class="bg-grey padding-5 margin-5 radius" hover-class="navigator-hover" bindtap="uploadWardRoundStatus">上传查房状态</view>
<view class="bg-grey padding-5 margin-5 radius" hover-class="navigator-hover" bindtap="refreshDeviceList">刷新设备</view>
</view>
<!-- 设备状态表格 -->
<!-- 设备状态表格 -->
<view class="th">
<text class="th-item">设备名称</text>
<text class="th-item">状态</text>
<text class="th-item">设备检测</text>
<text class="th-item td ">状态</text>
<text class="th-item td2">设备检测</text>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;">
<scroll-view scroll-y scroll-into-view="{{toView}}" id="NmyScroll" style="height:{{scrollHeight}}rpx;">
<view class="device-table">
<block wx:for="{{deviceList}}" wx:key="id">
<view class="tr">
@@ -29,14 +29,12 @@
<text class="th-item {{item.equipmentstatus==='hideModal_1'? 'bg-green':item.equipmentstatus==='hideModal_0'? 'bg-red':'textbcolor'}} ">{{item.name}}</text>
<!-- 状态 -->
<view class="td status">
<text class="status-text {{item.status==='在线'||item.status==='显示'?'on':'off'}}">
{{item.status}}
</text>
<view class="td status" style="margin-left: 10rpx;" >
<text class="status-text {{item.status==='在线'||item.status==='显示'?'on':'off'}}">{{item.status}}</text>
</view>
<!-- 按钮 -->
<view class="td btn-group">
<view class="td2 btn-group">
<button class="btn green" data-id="{{item.id}}" data-st="正常" data-target="DialogModal1" bindtap="showModal">设备检测</button>
</view>
@@ -59,25 +57,51 @@
</view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-gray text-xl text-blue" data-id="hideModal_1" bindtap="DialogModal2">修改检测流程</button>
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="hideModal_0" bindtap="DialogModal1">异常</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="hideModal_1" bindtap="DialogModal1">正常</button>
<button class="cu-btn bg-gray text-xl text-blue" data-id="hideModal_1" bindtap="DialogModal2" disabled="{{modalName=='DialogModal3'}}" >修改检测流程</button>
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="hideModal_0" bindtap="DialogModal1" disabled="{{modalName=='DialogModal3'}}" >异常</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="hideModal_1" bindtap="DialogModal1" disabled="{{modalName=='DialogModal3'}}" >正常</button>
</view>
</view>
</view>
</view>
<view wx:if="{{deviceList[deviceListindex].isnote === 1 }}" >
<view class=" text-left" > 检测流程:</view>
<textarea auto-height maxlength="-1" class="solids " focus="true" bindinput="inputSearchForHotels" confirm-type="return" style="width: 100%;font-size: 32rpx;text-align: left;white-space: pre-wrap; word-break: break-all; line-height: 1.5;" value=" {{deviceList[deviceListindex].note}}"/>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="cancel" bindtap="saveTheText">取消</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="ok" bindtap="saveTheText">保存</button>
<!-- 修改检测流程弹窗 -->
<view class="cu-modal {{modalName=='DialogModal3'?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">修改检测流程 - {{deviceList[deviceListindex].name}}</view>
</view>
<view >
<view class=" text-left" > 检测流程:</view>
<textarea auto-height maxlength="-1" class="solids " focus="true" bindinput="inputSearchForHotels" confirm-type="return" style="width: 95%;font-size: 32rpx;text-align: left;white-space: pre-wrap; word-break: break-all; line-height: 1.5;" value=" {{deviceList[deviceListindex].note}}"/>
</view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="cancel" bindtap="saveTheText">取消</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="ok" bindtap="saveTheText">保存</button>
</view>
</view>
</view>
</view>
<!-- 异常原因输入弹窗 -->
<view class="cu-modal {{modalName=='DialogModal4'?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">异常原因 - {{deviceList[deviceListindex].name}}</view>
</view>
<view >
<view class=" text-left" > 请输入异常原因:</view>
<textarea auto-height maxlength="-1" class="solids " focus="true" bindinput="inputErrorReason" confirm-type="return" style="width: 95%;font-size: 32rpx;text-align: left;white-space: pre-wrap; word-break: break-all; line-height: 1.5;" value=" {{errorReason}}"/>
</view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-red text-xl text-black margin-left" bindtap="cancelErrorReasonModal">取消</button>
<button class="cu-btn bg-green text-xl text-black margin-left" bindtap="confirmErrorReasonModal">确定</button>
</view>
</view>
</view>
</view>

View File

@@ -5,9 +5,10 @@
.textbcolor{ background-color: #f0f0f0;}
.device-table{ margin: 20rpx; font-size: 28rpx; }
.th{ display: flex; border-bottom: 2rpx solid #e0e0e0; padding: 15rpx 0; }
.th-item{ flex: 1; text-align: center; font-weight: bold; }
.th-item{ flex: 6; text-align: center; font-weight: bold; }
.tr{ display: flex; align-items: center; padding: 15rpx 0; border-bottom: 1rpx solid #f0f0f0; }
.td{ flex: 1; text-align: center; }
.td2{ flex: 3; text-align: center; }
.name{ text-align: left; padding-left: 10rpx; }
.status-text{ padding: 4rpx 12rpx; border-radius: 6rpx; color: #fff; font-size: 24rpx; }
.on{ background: #07c160; }

View File

@@ -15,7 +15,11 @@ import {
SetRCULight,
SetRCUAir,
SetRCUCurtain,
QueryRoomVisitLog,
WriteRoomVisitLog,
UpdateRoomVisitLog
} from '../../../lib/RequestingCenter.js'
var util = require('../../../utils/util.js')
Page({
/**
@@ -30,6 +34,14 @@ Page({
toView:"",
RoomNumber:"",
HotelId:"",
// 时间范围查询相关
seltime:4, // 时间范围4-全部1-今日2-本周3-本月5-指定时间
starttime:"", // 起始时间
endtime:"", // 结束时间
// 设备访问日志数据
visitLogList: [],
// 选中的记录ID用于控制故障原因的显示
selectedId: null,
},
/**
@@ -78,14 +90,171 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
async onShow() {
await this.getRoomVisitLog();
},
// 获取房间设备访问日志
async getRoomVisitLog() {
// 检查是否有HotelId
if (!this.data.HotelId) {
console.error("缺少HotelId参数");
app.toast(2, "缺少酒店信息");
// 确保visitLogList始终是数组
this.setData({
visitLogList: [],
HostsDataFilters: []
});
return;
}
let params = {
HotelID: this.data.HotelId,
RoomNumber: this.data.RoomNumber, // 初始加载时不按房号筛选,获取所有异常记录
StartTime: this.data.starttime,
EndTime: this.data.endtime
};
console.log("请求参数:", params);
try {
let logs = []
const res = await QueryRoomVisitLog(params);
if (res && res.Status === 1) {
console.log(res.Data)
// 初始化 logs 数组
let logs = [];
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index]; // element 是一个数组
// 查找每个字段对应的值
const findValue = (key) => {
const item = element.find(obj => obj.Key === key);
return item ? item.Value : null;
};
logs[index] = {
Id: findValue("ID"),
HotelID: findValue("HotelID"),
RoomNumber: findValue("RoomNumber"),
EquipmentStatus: findValue("EquipmentStatus"),
FaultDescription: findValue("FaultDescription"),
UpdateDate: findValue("UpdateDate"),
DevName: findValue("DevName"),
EquipmentStatusType: findValue("EquipmentStatusType"),
EquipmentOnlineStatus: findValue("EquipmentOnlineStatus"),
EquipmentOnlineStatusShow:0
};
}
// 如果有搜索房号,将符合条件的记录放到头部
if (this.data.RoomNumber) {
logs= this.sortHotelsByFuzzyMatch(logs,this.data.RoomNumber)
}
this.setData({
visitLogList: logs, // 明确设置为数组
HostsDataFilters: logs // 更新异常记录数量显示
});
// 打印最终数据长度
console.log("最终显示数据数量:", logs.length);
} else {
console.error("API请求失败:", res);
app.toast(2, res.Message || "查询失败");
// 清空数据列表,明确设置为数组
this.setData({
visitLogList: [],
HostsDataFilters: []
});
}
} catch (err) {
console.error("查询设备访问日志失败:", err);
app.toast(2, "查询失败,请重试");
// 清空数据列表,明确设置为数组
this.setData({
visitLogList: [],
HostsDataFilters: []
});
}
},
sortHotelsByFuzzyMatch:function(hotels, keyword) {
// 1. 参数验证
if (!Array.isArray(hotels)) {
console.warn('第一个参数必须是数组');
return [];
}
if (typeof keyword !== 'string') {
console.warn('第二个参数必须是字符串');
return hotels.slice();
}
// 2. 处理空数组或空关键字的情况
const trimmedKeyword = keyword.trim();
if (hotels.length === 0 || trimmedKeyword === '') {
return hotels
}
const lowerKeyword = trimmedKeyword.toLowerCase();
// 3. 分离匹配和不匹配的酒店
const matchedHotels = [];
const unmatchedHotels = [];
hotels.forEach(hotel => {
// 检查是否为有效酒店对象
if (!hotel || typeof hotel !== 'object' || !hotel.RoomNumber) {
unmatchedHotels.push(hotel);
return;
}
const hotelName = String(hotel.RoomNumber).toLowerCase();
const isMatch = hotelName.includes(lowerKeyword);
if (isMatch) {
matchedHotels.push(hotel);
} else {
unmatchedHotels.push(hotel);
}
});
// 4. 合并数组并返回
return [...matchedHotels, ...unmatchedHotels];
},
/**
@@ -115,11 +284,222 @@ Page({
onReachBottom() {
},
// 房号输入
inputSearchForHotels(e){
this.setData({
RoomNumber: e.detail.value
})
},
// 搜索按钮点击
searchRoomLog() {
const { visitLogList, RoomNumber } = this.data;
if (!RoomNumber) {
// 如果搜索框为空,直接返回
return;
}
// 在现有数据上进行房号匹配
const filteredLogs = visitLogList.filter(log => log.RoomNumber && log.RoomNumber.includes(RoomNumber));
const otherLogs = visitLogList.filter(log => !log.RoomNumber || !log.RoomNumber.includes(RoomNumber));
// 将符合条件的数据放到头部
this.setData({
visitLogList: [...filteredLogs, ...otherLogs]
});
},
// 时间范围选择
seltime: function(e) {
let sel = Number(e.target.dataset.val);
let starttime = "";
let endtime = "";
const now = new Date();
switch (sel) {
case 1: // 今日
starttime = now.toISOString().split('T')[0];
endtime = now.toISOString().split('T')[0];
break;
case 2: // 本周
let time = this.getThisWeekData();
starttime = time.start_day;
endtime = time.end_day;
break;
case 3: // 本月
starttime = util.getCurrentMonthFirst(new Date());
endtime = util.getCurrentMonthLast(new Date());
break;
case 4: // 全部
starttime = "";
endtime = "";
break;
}
this.setData({
seltime: sel,
starttime: starttime,
endtime: endtime
});
},
// 自定义时间选择
bindTimeChange: function(e) {
if (e.target.dataset.type == 1) {
this.setData({
seltime: 5,
starttime: e.detail.value
});
} else {
this.setData({
seltime: 5,
endtime: e.detail.value
});
}
},
// 时间范围查询
async searchByTime() {
await this.getRoomVisitLog();
},
// 全部记录查询
async RefreshTheRoom() {
this.setData({
seltime: 4,
starttime: "",
endtime: "",
RoomNumber: "" // 清空搜索框内容
});
await this.getRoomVisitLog();
},
// 获取本周的起止日期
getThisWeekData: function() {
var thisweek = {};
var date = new Date();
// 本周一的日期
date.setDate(date.getDate() - date.getDay() + 1);
thisweek.start_day = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
// 本周日的日期
date.setDate(date.getDate() + 6);
thisweek.end_day = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
return thisweek;
},
// 切换故障原因显示状态
toggleFaultReason(e) {
const id = e.currentTarget.dataset.id;
const { selectedId } = this.data;
// 如果点击的是当前显示的项,则隐藏;否则显示点击的项
this.setData({
selectedId: selectedId === id ? null : id
});
},
// 确认维修完成
async confirmRepair(e) {
const id = e.currentTarget.dataset.id;
console.log("确认维修完成设备ID:", id);
// 找到对应的设备记录
const deviceIndex = this.data.visitLogList.findIndex(item => item.Id === id);
if (deviceIndex === -1) {
console.error("未找到对应的设备记录");
return;
}
const device = this.data.visitLogList[deviceIndex];
// 获取当前时间
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
try {
// 1. 先调用UpdateRoomVisitLog接口将原来的故障记录设置为维修完成
const updateParams = {
id: id,
faultDescription: "维修完成",
equipmentStatusType: "1"
};
const updateRes = await UpdateRoomVisitLog(updateParams);
if (updateRes.Status !== 1) {
wx.showToast({
title: updateRes.Message || "更新故障记录失败",
icon: 'none',
duration: 2000
});
console.log("更新故障记录失败", updateRes);
return;
}
// 2. 调用WriteRoomVisitLog接口写入一条新的正常记录
const writeParams = {
HotelID: this.data.HotelId,
RoomNumber: device.RoomNumber,
EquipmentList: [{
EquipmentStatus: "正常",
FaultDescription: "已维修完成",
DevName: device.DevName,
EquipmentStatusType: "3",
EquipmentOnlineStatus: "1",
UpdateDate: currentTime
}]
};
const writeRes = await WriteRoomVisitLog(writeParams);
// 处理返回结果
if (writeRes.Status === 1) {
wx.showToast({
title: '维修完成',
icon: 'success',
duration: 2000
});
// 从visitLogList中移除对应的故障记录
const updatedVisitLogList = [...this.data.visitLogList];
updatedVisitLogList.splice(deviceIndex, 1);
// 更新页面数据
this.setData({
visitLogList: updatedVisitLogList,
HostsDataFilters: updatedVisitLogList
});
// 如果当前选中的是被移除的记录,清空选中状态
if (this.data.selectedId === id) {
this.setData({
selectedId: null
});
}
} else {
wx.showToast({
title: writeRes.Message || "写入正常记录失败",
icon: 'none',
duration: 2000
});
console.log("写入正常记录失败", writeRes);
}
} catch (error) {
wx.showToast({
title: "维修完成失败,请检查网络连接",
icon: 'none',
duration: 2000
});
console.error("维修完成出错", error);
}
},
/**
* 用户点击右上角分享
*/

View File

@@ -23,31 +23,82 @@
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="inputSearchForHotels">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">维修记录</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="searchRoomLog">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">刷新记录</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" >
<view class="cu-list menu margin-top-xs margin-bottom-sm shadow-lg" >
<view class="cu-itemz " wx:for="{{20}}" wx:key="index">
<view class="flex" style="width: 80%">
<view class="flex text-black"style="width: 50%">
<!-- 时间筛选 - 已隐藏,默认选择全部 -->
<view class="bg-white " style="width: 100%;border-bottom: 1px solid #f0f0f0;" wx:if="{{false}}">
<view class="flex padding-top-xs flex-wrap">
<view class="text-df font-bold margin-right-sm">时间范围:</view>
<view bindtap="seltime" data-val="4" class="padding-right-sm padding-left-sm {{seltime==4?'bg-green':''}} margin-right-xs text-df border-radius">全部</view>
<view bindtap="seltime" data-val="1" class="padding-right-sm padding-left-sm {{seltime==1?'bg-green':''}} margin-right-xs text-df border-radius">今日</view>
<view bindtap="seltime" data-val="2" class="padding-right-sm padding-left-sm {{seltime==2?'bg-green':''}} margin-right-xs text-df border-radius">本周</view>
<view bindtap="seltime" data-val="3" class="padding-right-sm padding-left-sm {{seltime==3?'bg-green':''}} margin-right-xs text-df border-radius">本月</view>
</view>
<view class="flex">
<view class="flex padding-top-xs padding-bottom-xs align-center flex-wrap" style="width: 80%;">
<view class="margin-right-sm text-df">时间:</view>
<picker mode="date" class="text-df padding-right-sm padding-left-sm border border-gray border-radius margin-right-sm" data-type="1" bindchange="bindTimeChange">
<view class="picker text-green">
{{starttime==""?"请选择":starttime}}
</view>
</picker>
<view class=" text-df">至:</view>
<picker start="{{starttime}}" mode="date" class="text-df padding-right-sm padding-left-sm border border-gray border-radius margin-right-sm" bindchange="bindTimeChange" data-type="2">
<view class="picker text-green">
{{endtime==""?"请选择":endtime}}
</view>
</picker>
</view>
<view style="width: 20%;">
<button class="cu-btn1 line-green border-radius" style="width: 150rpx; margin:0;" bindtap="searchByTime">查询</button>
</view>
</view>
</view>
<scroll-view id="myScroll" scroll-y scroll-into-view="{{toView}}" style="height:{{scrollHeight}}rpx;" >
<view class="margin-5" style=" border-bottom: 1px solid #f0f0f0;" wx:for="{{visitLogList}}" wx:key="index">
<view class="Listindem ">
<!-- 房间号与时间日期 -->
<view class="flex" style="width: 80%" bindtap="toggleFaultReason" data-id="{{item.Id}}">
<view class=" text-black"style="width: 50%; ">
<view style="height: 45%;width: 100%;">
<view >{{item.UpdateDate}}</view>
</view>
<view class="flex" style="width: 100%;height: 55%;">
<view>房号:</view>
<view class="nav-name">{{"床卫生间传"}}</view>
<view >{{item.RoomNumber}}</view>
</view>
</view>
<view class=" nav-name " style="width: 50%;left: 30rpx;">
<view >床卫生间传感器测试</view>
</view>
<!-- 设备名称 -->
</view>
<view class="nav-nameTop" style="width: 50%;left: 30rpx;font-weight:bold; " >
<view >{{item.DevName}}</view>
</view>
</view>
<view class="flex"style="width: 18%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;white-space: pre-line;" bindtap="RefreshTheRoom">确认维\n修完成</button>
<view class="flex" style="width: 18%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;white-space: pre-line;" bindtap="confirmRepair" data-id="{{item.Id}}">确认维
修完成</button>
</view>
</view>
<!-- //故障原因: -->
<view class="flex line-gray" style="background-color: var(--white)" wx:if="{{selectedId == item.Id}}">
<view style="width: 20%;">故障原因:</view>
<view style="color: red;width: 80%;">{{item.FaultDescription}}</view>
</view>
</view>
</view>
</scroll-view>

View File

@@ -99,3 +99,12 @@
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.Listindem{
position: relative;
display: flex;
padding: 0 10rpx;
min-height: 100rpx;
background-color: var(--white);
justify-content: space-between;
align-items: center
}

View File

@@ -0,0 +1,135 @@
// pages/basics/progress/RoomTypeControlLog/RoomTypeControlLog.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
Hotelinfo: null,
HotelId: null,
RoomNumber: null,
sectionsList: [
{
id: 1,
name: '刷卡记录',
icon: 'card',
color: '#4CAF50',
count: 0
},
{
id: 2,
name: '回路状态记录',
icon: 'circuit',
color: '#2196F3',
count: 0
},
{
id: 3,
name: '回路异常记录',
icon: 'warning',
color: '#FF9800',
count: 0
},
{
id: 4,
name: '外设异常记录',
icon: 'device',
color: '#F44336',
count: 0
},
{
id: 5,
name: '语音上报记录',
icon: 'voice',
color: '#9C27B0',
count: 0
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('RoomTypeControlLog onLoad options:', options);
if (options.HotelId && options.RoomNumber && options.HotelName) {
this.setData({
HotelId: options.HotelId,
RoomNumber: options.RoomNumber,
Hotelinfo: {
HotelName: options.HotelName,
Code: ''
}
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
/**
* 返回上一页
*/
back() {
wx.navigateBack({
delta: 1
});
},
/**
* 点击板块列表项
*/
tap板块列表项(e) {
const { id, name } = e.currentTarget.dataset;
console.log('点击了板块:', name, 'ID:', id);
// 这里可以添加点击事件的处理逻辑,比如跳转到对应记录的详细页面
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,34 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<!-- 房间信息 -->
<view class="bg-white padding-sm margin-top-xs" style="border-bottom: 1px solid #f0f0f0;">
<view class="flex justify-between align-center">
<view class="text-df font-bold">房间号:{{RoomNumber}}</view>
<view class="text-sm text-gray">房间控制日志</view>
</view>
</view>
<!-- 板块列表 -->
<view class="margin-top-xs" >
<view class="nav-list1 bg-white" style="margin-top: 0;">
<view
bindtap="tap板块列表项"
data-id="{{item.id}}"
data-name="{{item.name}}"
hover-class="navigator-hover"
class="nav-li4"
style="background-color: {{item.color}}; margin: 10rpx; width: calc(50% - 20rpx);"
wx:for="{{sectionsList}}"
wx:key="id">
<view class="flex flex-column align-center" style="width: 100%; height: 100%;">
<view class="text-white" style="font-size: 32rpx; margin-bottom: 10rpx;">{{item.name}}</view>
<view class="text-white" style="font-size: 24rpx; opacity: 0.8;">共 {{item.count}} 条记录</view>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1 @@
/* pages/basics/progress/RoomTypeControlLog/RoomTypeControlLog.wxss */

View File

@@ -0,0 +1,293 @@
// pages/basics/progress/progress.js
const app = getApp()
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
GetRoomAddressStatus
} from '../../../lib/RequestingCenter.js'
Page({
/**
* 页面的初始数据
*/
data: {
RoomIndex:0,
//权限信息
autho: null,
//酒店信息
Hotelinfo: null,
HostsData:null,
HostsDataFilters:[],
isback:null,
HotelId:null,
statusdata:null,
onlineNumber:0,
inputValue:"",
toView:"",
scrollHeight: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:async function(options) {
if (!options.HotelId || app.globalData.autho == null) {
app.toast(2, "无酒店信息~")
return;
}
this.setData({
autho: app.globalData.autho
})
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
HotelId: options.HotelId,
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
inputSearchForHotels(e){
this.setData({
inputValue: e.detail.value
})
},
SearchForHotels(e){
//debugger
let myarry =this.data.HostsDataFilters
let inputValue =this.data.inputValue.trim()
const CNaelement =this.sortHotelsByFuzzyMatch(myarry,inputValue)
this.setData({
HostsDataFilters:CNaelement
})
},
goProcess(e) {
let indexstr = e.currentTarget.id.replace("msg-","")
let index= Number(indexstr)
const { room, hotel, status } = e.currentTarget.dataset;
this.setData({
RoomIndex:index
} )
let HostsDataFilters= this.data.HostsDataFilters
console.log(HostsDataFilters[index].RoomNumber)
// 取消状态检查,无论状态如何都允许跳转
wx.navigateTo({
url: `/pages/basics/progress/RoomTypeControlLog/RoomTypeControlLog?RoomNumber=${room}&HotelName=${hotel}&HotelId=${this.data.Hotelinfo.HotelId }`
});
},
RefreshTheRoom:async function(e){
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
RoomIndex:0,
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
sortHotelsByFuzzyMatch:function(hotels, keyword) {
// 1. 参数验证
if (!Array.isArray(hotels)) {
console.warn('第一个参数必须是数组');
return [];
}
if (typeof keyword !== 'string') {
console.warn('第二个参数必须是字符串');
return hotels.slice();
}
// 2. 处理空数组或空关键字的情况
const trimmedKeyword = keyword.trim();
if (hotels.length === 0 || trimmedKeyword === '') {
return hotels.slice();
}
const lowerKeyword = trimmedKeyword.toLowerCase();
// 3. 分离匹配和不匹配的酒店
const matchedHotels = [];
const unmatchedHotels = [];
hotels.forEach(hotel => {
// 检查是否为有效酒店对象
if (!hotel || typeof hotel !== 'object' || !hotel.RoomNumber) {
unmatchedHotels.push(hotel);
return;
}
const hotelName = String(hotel.RoomNumber).toLowerCase();
const isMatch = hotelName.includes(lowerKeyword);
if (isMatch) {
matchedHotels.push(hotel);
} else {
unmatchedHotels.push(hotel);
}
});
// 4. 合并数组并返回
return [...matchedHotels, ...unmatchedHotels];
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,46 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<view class=" solids bg-white" style="height:70px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl" style=" height:45% ;width: 100%;">
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房号:{{HostsDataFilters[RoomIndex].RoomNumber}}</text>
</view>
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房间在线:</text>
<text class="text-blue">{{onlineNumber}}/</text>
<text class="text-black">{{HostsDataFilters.length}} </text>
</view>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids" style="width: 60%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;"/>
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="SearchForHotels">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">刷新</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;" >
<view class='nav-list1 bg-white' style="margin-top: 20rpx;">
<view bindtap="goProcess" data-room="{{item.RoomNumber}}" data-hotel="{{Hotelinfo.HotelName}}"
data-status="{{item.Status}}" hover-class="navigator-hover" class="nav-li4 bg-{{item.Status===1? 'cyan':'gray'}}" wx:for="{{HostsDataFilters}}" id="msg-{{index}}" wx:key>
<view style="font-size: 32rpx;justify-content:start" >{{item.RoomNumber}}</view>
<view style="font-size: 20rpx;justify-content:start" >{{item.MAC}}</view>
</view>
</view>
</scroll-view>

View File

@@ -0,0 +1,102 @@
/* pages/basics/progress/progress.wxss */
.aside{
width:8rem;
border-right: 1px solid #ddd;
font-size: .85rem;
}
.type-nav{
width:8rem;
position: relative;
padding:.7rem .3rem;
text-align: center;
border-bottom: 1px solid #ddd;
z-index: 10;
}
.flex-wrap{
display: flex;
}
.type-nav.selected{
margin-right: -1px;
padding-left:0,-1px;
color: #333;
background-color: #fff;
}
/* .content{
background-color: #fff;
} */
.dish{
margin-left: 1rem;
padding: 1rem;
border-bottom: 1px solid #ddd;
}
.dish .title{
display: block;
font-size: 1rem;
}
.dish p{
color: orange;
font-size: .75rem;
}
.dish .add-btn{
width: 8rem;
text-align: right;
}
.cu-bar1 {
display: flex;
align-items: center;
justify-content: space-between;
}
.cart{
display: block;
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 1rem;
background: #ddd;
}
.container {
height: 50%;
box-sizing: border-box;
background-color: #f4f4f4;
}
.cu1-btn {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 5rpx 5rpx;
font-size: 26rpx;
height: 70rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.cu-btn1 {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 5rpx;
font-size: 26rpx;
height: 64rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}

View File

@@ -50,14 +50,16 @@ Page({
//确定选择酒店
ShowSelHotel: async function (e) {
let HotelCode
let id = e.currentTarget.dataset['id'];
if(id==-1){
id = this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId;
HotelCode= this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].Code;
}
if(this.data.hotelIndex>=0){
app.globalData.HotelId=id
app.globalData.HotelCode=HotelCode
wx.navigateTo({
@@ -212,8 +214,14 @@ Page({
selectGroupIndex: _xiaoxi_selectGroupIndex,
hotelIndex: _xiaoxi_hotelIndex
})
//非选择 读取上次进行跳转
if(!this.data.issel && this.data.hotelIndex>-1){
let HotelCode= this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].Code;
let HotelId=this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId
app.globalData.HotelId=HotelId
app.globalData.HotelCode=HotelCode
wx.navigateTo({
url: '/pages/NewHome/NewHome?HotelId='+this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId
})
@@ -221,6 +229,10 @@ Page({
// console.log(this.data.autho.length==1 && this.data.autho[0].Hotels.length==1 && option.issel!=0)
//非选择 如果只有一个酒店就直接进行跳转
if(this.data.autho.length==1 && this.data.autho[0].Hotels.length==1 && !this.data.issel){
let HotelCode= this.data.autho[0].Hotels[0].Code;
let HotelId=this.data.autho[0].Hotels[0].HotelId
app.globalData.HotelId=HotelId
app.globalData.HotelCode=HotelCode
wx.navigateTo({
url: '/pages/NewHome/NewHome?HotelId='+this.data.autho[0].Hotels[0].HotelId
})

647
pages/test/test.js Normal file
View File

@@ -0,0 +1,647 @@
const app = getApp()
//导入测试请求发方法
import {
OpenDoorTest,
RestartTheDevice,
GeteDeviceInfomation,
DeletePeopleFromDeviceByGroup,
GetThePeopleListOfDevice,
openRommCheckin,
roomCheckOut,GetFaceSN
} from '../../lib/RequestingCenter.js'
// pages/test/test.js
Page({
/**
* 页面的初始数据
*/
data: {
imgList:[],
cout:1,
isbut:false,
isbuts:false,
count:1,
//测试信息
sn:"",
hid:"",
HotelId:"",
HotelName:"",
Roomid:"",
openUserName:"李四",
openUserID:"123456789456123456",
openUserSex:"1",
outUserName:"",
outUserID:"",
imgurl:"",
openUserTel:"15915641569",
RoomNO:"",
faceadd:""
},
isCard(e) {
if(this.data.isCardds==this.data.isCard){
this.setData({
isCard: e.detail.value,
isCardds:!e.detail.value
})
}else{
this.setData({
isCard: e.detail.value,
isCardds:""
})
}
// this.setData({
// isCard: e.detail.value
// })
},
isCardds(e){
if(this.data.isCardds==this.data.isCard){
this.setData({
isCard: !e.detail.value,
isCardds:e.detail.value
})
}else{
this.setData({
isCard: "",
isCardds:e.detail.value
})
}
},
//开房测试
OpenRoom:function(params){
this.setData({
islogs: false,
openrom: !this.data.openrom
})
//调用打开摄像头代码
// wx.chooseMedia({
// count: 1, // 可以选择的图片数量
// sizeType: ['compressed'], // 可以指定是原图还是压缩图
// sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机
// success: function (res) {
// // 将拍照后的照片保存在本地文件夹中
// var tempFilePaths = res.tempFiles[0].tempFilePath
// console.log(res.tempFiles[0].tempFilePath)
// wx.uploadFile({
// url: 'http://localhost:56306/ImgServer/Update',//开发者放服务地址
// filePath: tempFilePaths,
// name: 'file',
// success: function (res) {
// var data = res.data;
// console.log(data);
// },
// fail: function (res) {
// console.log(res);
// }
// })
// }
// })
//授权获取用户摄像头权限
},
ViewImage(e) {
wx.previewImage({
urls: this.data.imgList,
current: e.currentTarget.dataset.url
});
},
ChooseImage() {
console.log(111111111111)
var that =this;
wx.chooseImage({
count: 1, //默认9
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有,'compressed'
sourceType: ['camera'], //从相册选择camera,album
camera: 'front',
success: (res) => {
console.log(res.tempFilePaths)
if (that.data.imgList.length != 0) {
that.setData({
imgList: that.data.imgList.concat(res.tempFilePaths)
})
} else {
that.setData({
imgList: res.tempFilePaths
})
}
console.log(that.data.imgList)
// https://auth.blv-oa.com/Wx/Update
// http://auth.blv-oa.com/Wx/Update
wx.uploadFile({
url: 'https://auth.blv-oa.com/Wx/Update',//开发者放服务地址
filePath: that.data.imgList[0],
name: 'file',
success: function (res) {
var data = res.data;
console.log(res)
data=JSON.parse(data)
console.log(data.data.src)
that.setData({
imgurl:data.data.src
})
},
fail: function (res) {
console.log(res);
}
})
},
fail:(res)=>{
console.log(res)
}
});
// wx.authorize({
// scope: 'scope.camera',
// success: function () {
// console.log("授权成功");
// // wx.chooseMedia({
// // count: 1,
// // mediaType: ['image'],
// // sourceType: ['album'],
// // maxDuration: 30,
// // camera: 'front',
// // success(res) {
// // console.log(res.tempFiles)
// // // console.log(res.tempFiles[0].tempFilePath)
// // // console.log(res.tempFiles[0].size)
// // if (that.data.imgList.length != 0) {
// // that.setData({
// // imgList: that.data.imgList.concat(res.tempFiles[0].tempFilePath)
// // })
// // } else {
// // that.setData({
// // imgList: res.tempFiles[0].tempFilePath
// // })
// // }
// // console.log(that.data.imgList)
// // // wx.uploadFile({
// // // url: 'https://auth.blv-oa.com/Wx/Update',//开发者放服务地址
// // // filePath: that.data.imgList[0],
// // // name: 'file',
// // // success: function (res) {
// // // var data = res.data;
// // // console.log(res)
// // // data=JSON.parse(data)
// // // console.log(data.data.src)
// // // that.setData({
// // // imgurl:data.data.src
// // // })
// // // },
// // // fail: function (res) {
// // // console.log(res);
// // // }
// // // })
// // }
// // })
// },
// fail: function (err) {
// console.log(err);
// }
// })
},
DelImg(e) {
wx.showModal({
title: '',
content: '确定要删除这张照片吗?',
cancelText: '再看看',
confirmText: '再见',
success: res => {
if (res.confirm) {
this.data.imgList.splice(e.currentTarget.dataset.index, 1);
this.setData({
imgList: this.data.imgList
})
}
}
})
},
radioChang:function(e){
console.log("radio发生change事件携带value值为", e.detail.value)
this.setData({
openUserSex:e.detail.value
})
},
/// <summary>
/// pms开房测试
/// </summary>
/// <param name="idNumber"></param>
/// <param name="name"></param>
/// <param name="sex"></param>
/// <param name="picture"></param>
/// <param name="phone"></param>
/// <param name="hotel"></param>
/// <param name="room">房间编号</param>
/// <param name="checkin">开房时间</param>
/// <param name="shi">开房时间长度</param>
/// <returns></returns>
//开房按钮
Checkin:function(){
console.log("姓名:"+this.data.openUserName+"证件类型:"+this.data.openUserID+"性别:"+this.data.openUserSex+"照片路径:"+this.data.imgurl)
var that=this;
console.log("房间id:"+that.data.Roomid+"人脸机编号:"+that.data.sn+"酒店编号:"+that.data.hid)
openRommCheckin({
idNumber:that.data.openUserID,
name:that.data.openUserName,
sex:that.data.openUserSex,
picture:that.data.imgurl,
phone:that.data.openUserTel,
room:that.data.Roomid,
faceSN:that.data.sn,
hotelCode:that.data.hid,
}).then(
res => {
console.log(res)
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
},
//解绑
JbSn:function(params) {
var that=this;
wx.showModal({
title: '提示',
content: '确定要解绑吗?',
success (res) {
if (res.confirm) {
GetFaceSN({
faceSN:that.data.sn,
roomID:that.data.RoomNO,
roomNumber:that.data.Roomid,
faceAddress:that.data.address,
HotelID:that.data.hid,
isjb:true
}).then(
res => {
if (res.Status == 200) {
switch (res.Data) {
case 0:
app.toast(1, "解绑成功~");
wx.navigateTo({
url: '/pages/Hosts/Hosts?HotelId='+that.data.hid
})
break;
case 1:
app.toast(2, "SN已经绑定酒店~")
break;
case 2:
app.toast(2, "SN绑定酒店失败~")
break;
case 3:
app.toast(2, "SN注册绑定酒店失败~")
break;
case 4:
app.toast(2, "未知错误~")
break;
case 5:
app.toast(2, "数据不符合~")
break;
case 6:
app.toast(2, "解绑失败~")
break;
default:
app.toast(2, "其他错误~")
break;
}
/// 0 成功
/// 1 已经注册已经绑定酒店
/// 2 已经注册更新失败
/// 3 未注册为分配酒店 添加注册 添加酒店是啊比
/// 4 未能预计的结果--
/// 5 数据不符合
/// 6 解绑失败
console.log(0)
}
else{
app.toast(2, "网络繁忙")
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
// if (confirm("你确定要继续吗?")) {
// } else {
// // 用户点击了取消
// }
},
//退房测试
checkOut:function(params){
var that=this;
wx.showModal({
title: '提示',
content: '确定退房吗?',
success (res) {
if (res.confirm) {
roomCheckOut({
room:that.data.Roomid,
faceSN:that.data.sn,
hotelCode:that.data.hid,
}).then(
res => {
if (res.Status == 200){
app.toast(2,"退房命令下发成功")
}
else{
app.toast(2, "退房命令下发成功")
}
},
err => {
app.toast(2, "退房命令下发失败")
}
).catch(err => {
app.toast(2, "退房命令下发失败")
});
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
// 帮助
HelpClick: function (params) {
this.setData({
islogs: false,
Help: !this.data.Help,
openrom: false
})
},
//功能测试
// featurutist:function(){
// },
//测试
// featurutistlist:function(e){
// },
//开门测试
OpenDoor:function(){
var that=this;
OpenDoorTest({faceSN:that.data.sn,isjb:true}).then(
res => {
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
},
//版本号码查询
Getversionnumber:function(){
console.log(2);
var that=this;
GeteDeviceInfomation({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
res => {
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
},
//人数查询
Getpeopleobjained:function(){
console.log(3)
var that=this;
GetThePeopleListOfDevice({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
res => {
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
},
//删除所有人
Deletepeople:function(){
console.log(4)
var that=this;
wx.showModal({
title: '提示',
content: '确定删除设备中用户组为1的所有人信息吗',
success (res) {
if (res.confirm) {
DeletePeopleFromDeviceByGroup({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
res => {
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
//设备重新启动
RestartDevice:function(){
console.log(5)
var that=this;
wx.showModal({
title: '提示',
content: '确定让设备重新启动吗?',
success (res) {
if (res.confirm) {
RestartTheDevice({faceSN:that.data.sn,isjb:true}).then(
res => {
if (res.Status == 200) {
app.toast(2, res.Message)
}
else{
app.toast(2, res.Message)
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options)
var splitArray = options.Hotelinfo.split("_");
console.log(splitArray)
var that=this;
that.setData({
sn:splitArray[2],
HotelId:splitArray[3],
Roomid:splitArray[1],
HotelName:splitArray[0],
hid:splitArray[4],
RoomNO:options.RoomID,
faceadd:options.faceadd
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
pages/test/test.json Normal file
View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

143
pages/test/test.wxml Normal file
View File

@@ -0,0 +1,143 @@
<cu-custom bgColor="bg-gradual-blue" isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{HotelId}}-{{HotelName}}</view>
</cu-custom>
<view class="cu-card">
<view class="cu-item">
<view style="float: left; width: 70%;">
<view style="text-align: left;">编号:{{HotelId}}</view>
<view> 酒店:{{HotelName}} </view>
<view> 房间:{{Roomid}} </view>
<view> SN{{sn}} </view>
</view>
<view style="float: left; width: 30%;">
<view class="text-green" style="text-align: right;" bindtap="HelpClick">{{Help?'关闭':'帮助'}}</view>
<view style="text-align: center;" >
<button class="text-red cu-btn " bindtap="JbSn" >解绑</button>
</view>
</view>
</view>
</view>
<!-- 操作区域 -->
<view class="cu-list menu" wx:if="{{!Help && !islogs}}" >
<view class="cu-bar bg-white solid-bottom">
<view class='action'>
<text class='cuIcon-titles text-orange '></text> 开房测试
</view>
<view class='action'>
<switch class='sm' checked='{{isCard}}' bindchange='isCard'></switch>
</view>
</view>
<view class="cu-card case {{isCard?'no-card':''}}" wx:if="{{isCard}}">
<view class="cu-item shadow">
<view class="padding-xs">
<button class="cu-btn round margin-top margin-left bg-red lg" bindtap="checkOut">退房</button>
<form>
<view class="cu-form-group margin-top">
<view class="title">姓 名:</view>
<input placeholder="请输入姓名" model:value="{{openUserName}}"></input>
</view>
<view class="cu-form-group">
<view class="title">证件号:</view>
<input placeholder="请输入证件号" model:value="{{openUserID}}"></input>
</view>
<view class="cu-form-group">
<view class="title">电话号码:</view>
<input placeholder="请输入电话号码" model:value="{{openUserTel}}"></input>
</view>
<radio-group class="cu-form-group" bindchange="radioChang" data-id="{{openUserSex}}">
<view class="title">性 别:</view>
<view>
<radio class="red margin-left-lg" value="0"></radio>男
<radio class="red margin-left-lg" value="1"></radio>女
</view>
</radio-group>
<view class="cu-bar bg-white margin-top">
<view class="action">
图片上传
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" wx:for="{{imgList}}" wx:key="{{index}}" bindtap="ViewImage" data-url="{{imgList[index]}}">
<image src='{{imgList[index]}}' mode='aspectFill'></image>
<view class="cu-tag bg-red" catchtap="DelImg" data-index="{{index}}">
<text class="cuIcon-close"></text>
</view>
</view>
<view class="solids" bindtap="ChooseImage" wx:if="{{imgList.length<1}}">
<text class="cuIcon-cameraadd"></text>
</view>
</view>
</view>
<view class="padding flex flex-direction" bindtap="Checkin">
<button class="cu-btn bg-grey lg" >开房</button>
</view>
</form>
</view>
</view>
</view>
<view class="cu-bar bg-white solid-bottom {{isCard?'margin-top':''}}">
<view class='action'>
<text class='cuIcon-titles text-orange '></text> 功能测试
</view>
<view class='action'>
<switch class='sm' checked='{{isCardds}}' bindchange='isCardds'></switch>
</view>
</view>
<view class="cu-card dynamic {{isCardds?'no-card':''}}" wx:if="{{isCardds}}">
<view class="cu-item shadow">
<button style="margin:5px ;" class="cu-btn round margin-xl bg-green" bindtap="OpenDoor" >开门</button>
<button class="cu-btn round margin-xl" bindtap="Getversionnumber">版本号</button>
<button style="margin:5px ;" class="cu-btn bg-red margin-xl round" bindtap="Deletepeople">删除</button>
<button class="cu-btn bg-red margin-xl round" bindtap="RestartDevice">重启</button>
</view>
</view>
</view>
<!-- 帮助区域 -->
<view wx:if="{{Help}}" class="padding-xs">
<view class="cu-card article">
<view class="cu-item shadow " style="margin:0;padding-bottom:0;">
<view class="title" style="line-height:initial;"><view class="text-cut">页面说明</view></view>
<view class="content">
<view class="desc">
<view class="text-content text-df">
<!-- 指示块,仅针对本次进入页面有效,不代表历史操作记录,刷新或者重新进入页面都会执行重置操作。 -->
此处的说明信息只在本页面使用。其他页面不可以使用本页面说明,
</view>
</view>
</view>
</view>
</view>
<view class="cu-card article">
<view class="cu-item shadow " style="margin:0;padding-bottom:0;">
<view class="title" style="line-height:initial;"><view class="text-cut">功能测试区域所有按钮含义</view></view>
<view class="content">
<view class="desc">
<view class="text-content text-df" style="height: auto;">
<view class="text-df text-green">开门</view>
点击开门按钮是下发开门命令给设备,如果成功会听见继电器闭合声音或弹框开门成功。否则弹出开门失败或没有听见继电器闭合声音。
<view class="text-df text-green">版本号</view>
点击版本号是下发获取设备信息命令给设备,如果成功会弹出设备的版本号。否则弹出无法获取设备的版本信息。
<!-- <view class="text-df text-green">人数</view>
点击人数是下发获取入住人员数量命令给设备如果成功会弹出入住人员数量否则弹出入住人数是0。 -->
<view class="text-df text-green">删除</view>
点击删除是下发删除所有入住人员命令给设备,如果成功弹出删除成功,否则弹出删除失败。
<view class="text-df text-green">重启</view>
点击删除是下发重启命令给设备,如果成功下发成功设备将重新启动,否则弹出下发失败,设备不会重新启动。
<view class="text-df text-green">开房</view>
开房所有信息默认值性别默认是姓名默认李四电话默认15915641569证件号码默认123456789456123456直接点击图片上传上传照片后点击开房即可发送信息给人脸机。注意图片上传成功会显示在页面上
<view class="text-df text-green">退房</view>
直接点击退房,会直接下发退房命令给人脸机。
</view>
</view>
</view>
</view>
</view>
</view>

1
pages/test/test.wxss Normal file
View File

@@ -0,0 +1 @@
/* pages/test/test.wxss */

View File

@@ -71,5 +71,5 @@
"include": []
},
"appid": "wx2278e1d160883eb0",
"libVersion": "2.29.2"
"libVersion": "3.11.1"
}