初始化
This commit is contained in:
182
pages/basics/MakingRounds/process/process.js
Normal file
182
pages/basics/MakingRounds/process/process.js
Normal 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 的 top(px)
|
||||
wx.createSelectorQuery()
|
||||
.in(this)
|
||||
.select('#myScroll')
|
||||
.boundingClientRect(rect => {
|
||||
if (rect) {
|
||||
const topPx = rect.top; // px
|
||||
const bottomPx = 10 / 2; // 10rpx → 5px(2倍屏)
|
||||
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
|
||||
})
|
||||
},
|
||||
})
|
||||
3
pages/basics/MakingRounds/process/process.json
Normal file
3
pages/basics/MakingRounds/process/process.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
84
pages/basics/MakingRounds/process/process.wxml
Normal file
84
pages/basics/MakingRounds/process/process.wxml
Normal 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>
|
||||
|
||||
|
||||
18
pages/basics/MakingRounds/process/process.wxss
Normal file
18
pages/basics/MakingRounds/process/process.wxss
Normal 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; }
|
||||
Reference in New Issue
Block a user