初始化

This commit is contained in:
2025-12-11 09:50:02 +08:00
commit c25e282398
127 changed files with 63158 additions and 0 deletions

View File

@@ -0,0 +1,286 @@
// pages/basics/MakingRounds/MakingRounds.js
const app = getApp()
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} 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) {
const { room, hotel, status } = e.currentTarget.dataset;
if (status !== 1) return; // 不为1时不跳转
wx.navigateTo({
url: `/pages/basics/MakingRounds/process/process?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({
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,101 @@
.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

@@ -0,0 +1,182 @@
// pages/basics/MakingRounds/process/process.js
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} // 最后一条你自行改状态
],
deviceListindex:0,
inputValue:"",
toView:"",
scrollHeight: 0 ,
modalName: "",
note:"",
noteok:"",
errorsNumber:0,
HotelId:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (!options.RoomNumber || !options.HotelName ||!options.HotelId) {
app.toast(2, "无酒店信息~")
return;
}
console.log(options.RoomNumber)
this.setData ({
RoomNumber:options.RoomNumber,
HotelName:options.HotelName,
HotelId:options.HotelId
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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() {
},
showModal(e) {
this.setData({
modalName: e.currentTarget.dataset.target,
deviceListindex:e.currentTarget.dataset.id-1
})
},
DialogModal1(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
deviceList[deviceListindex].equipmentstatus=e.currentTarget.dataset.id
this.setData({
modalName: null,
deviceList:deviceList
})
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
})
console.log(this.data.deviceList)
},
inputSearchForHotels(e){
this.setData({
note: e.detail.value
})
console.log(this.data.note)
},
checkWardRoundRecords(e){
wx.navigateTo({
url: `/pages/basics/MakingRoundsAbnormal/MakingRoundsAbnormal?HotelId=${this.data.HotelId}&RoomNumber=${this.data.RoomNumber}`
});
},
saveTheText(e){
let deviceList = this.data.deviceList
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
})
},
})

View File

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

View File

@@ -0,0 +1,84 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">({{HotelName}})_{{RoomNumber}}</view>
</cu-custom>
<view class="flex solid-bottom justify-between ">
<view class=" padding-xs margin-sm radius">
<text class="text-black">异常数量:</text>
<text class="text-red">1</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>
<!-- 设备状态表格 -->
<view class="th">
<text class="th-item">设备名称</text>
<text class="th-item">状态</text>
<text class="th-item">设备检测</text>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;">
<view class="device-table">
<block wx:for="{{deviceList}}" wx:key="id">
<view class="tr">
<!-- 名称 -->
<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>
<!-- 按钮 -->
<view class="td btn-group">
<button class="btn green" data-id="{{item.id}}" data-st="正常" data-target="DialogModal1" bindtap="showModal">设备检测</button>
</view>
</view>
</block>
</view>
</scroll-view>
<view class="cu-modal {{modalName=='DialogModal1'?'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 " disabled="true" 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-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>
</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>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,18 @@
/* 新增scroll-view样式 */
.scroll-container {
height: calc(100vh - 240rpx); /* 精确计算上方固定内容的高度 */
}
.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; }
.tr{ display: flex; align-items: center; padding: 15rpx 0; border-bottom: 1rpx solid #f0f0f0; }
.td{ flex: 1; 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; }
.off{ background: #e54d42; }
.btn-group{ display: flex; justify-content: space-around; }
.btn{ width: 160rpx; height: 50rpx; line-height: 50rpx; font-size: 32rpx; color: #fff; padding: 0; border: none; border-radius: 8rpx; }
.green{ background: #07c160; }
.red{ background: #e54d42; }