|
|
|
|
@ -227,6 +227,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
Taro.setKeepScreenOn({
|
|
|
|
|
keepScreenOn: true,
|
|
|
|
|
});
|
|
|
|
|
this.getWL200NursingHistory();
|
|
|
|
|
this.initData();
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {}
|
|
|
|
|
@ -339,7 +340,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
Taro.onBLEConnectionStateChange(this.listener);
|
|
|
|
|
await this.notifyBLECharacteristicValueChange();
|
|
|
|
|
|
|
|
|
|
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
|
|
|
|
|
// this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
|
|
|
|
|
}
|
|
|
|
|
listener = (res) => {
|
|
|
|
|
console.log("listener res", res);
|
|
|
|
|
@ -518,43 +519,16 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
// 弹窗确定切换护理模式
|
|
|
|
|
confirmModeSwitchBtn = () => {
|
|
|
|
|
let { SwitchActiveModeItem, ActiveModeItem, isStandStatus } = this.state;
|
|
|
|
|
let modeArray = ["all", "visor", "cabin", "yimeish"];
|
|
|
|
|
// 切换护理模式时,需判断舱体和面罩是否切换
|
|
|
|
|
// if (SwitchActiveModeItem.isCabinMode !== ActiveModeItem.isCabinMode) {
|
|
|
|
|
// if (SwitchActiveModeItem.isCabinMode === 1) {
|
|
|
|
|
// // 判断舱体是否连接成功
|
|
|
|
|
// if (!isStandStatus) {
|
|
|
|
|
// console.log(
|
|
|
|
|
// "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
// );
|
|
|
|
|
// this.showTips(
|
|
|
|
|
// "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
// );
|
|
|
|
|
// // this.openErrorTipsText(
|
|
|
|
|
// // "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
// // );
|
|
|
|
|
// // return;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// // 判断舱体是否断开连接
|
|
|
|
|
// if (isStandStatus) {
|
|
|
|
|
// console.log("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
// this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
// // this.openErrorTipsText(
|
|
|
|
|
// // "检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"
|
|
|
|
|
// // );
|
|
|
|
|
// // return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
let { SwitchActiveModeItem } = this.state;
|
|
|
|
|
this.cancelModeSwitchBtn();
|
|
|
|
|
this.modeCurrentFun(SwitchActiveModeItem);
|
|
|
|
|
|
|
|
|
|
let modeArray = ["all", "visor", "cabin", "yimeish"];
|
|
|
|
|
this.setState({
|
|
|
|
|
ModeType: modeArray[SwitchActiveModeItem.modeClass],
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.modeCurrentFun(SwitchActiveModeItem);
|
|
|
|
|
this.cancelModeSwitchBtn();
|
|
|
|
|
console.log("ModeType", this.state.ModeType);
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -590,15 +564,14 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
* @description isCabinMode是否舱体模式。 0.检测面罩与舱体是否仍在连接中,需要分离 1.检测是否连接失败,需要重新连接
|
|
|
|
|
*/
|
|
|
|
|
onEmitErrorTips = async () => {
|
|
|
|
|
let { isStandStatus, ActiveModeItem } = this.state;
|
|
|
|
|
if (isStandStatus) {
|
|
|
|
|
if (ActiveModeItem.isCabinMode === 0) {
|
|
|
|
|
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
} else {
|
|
|
|
|
this.showTips(
|
|
|
|
|
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
let { ActiveModeItem } = this.state;
|
|
|
|
|
|
|
|
|
|
if (ActiveModeItem.isCabinMode === 0) {
|
|
|
|
|
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
} else {
|
|
|
|
|
this.showTips(
|
|
|
|
|
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -650,12 +623,11 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
case "WL200":
|
|
|
|
|
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
|
|
|
|
|
} else {
|
|
|
|
|
// 清除时间倒计时定时器
|
|
|
|
|
this.setState({
|
|
|
|
|
facialMaskConnectStatus: 0, // 蓝牙断开
|
|
|
|
|
isFooterBtnDisabled: false, // 蓝牙断开所以不可点击
|
|
|
|
|
});
|
|
|
|
|
// 断开连接直接暂停
|
|
|
|
|
// 断开连接直接暂停:会自动暂停定时器
|
|
|
|
|
this.judgementWorkStatus(
|
|
|
|
|
MODE_WORKING_ENUM.PAUSE,
|
|
|
|
|
ActiveModeItem?.modeType
|
|
|
|
|
@ -697,6 +669,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isStopNurse: true,
|
|
|
|
|
ActiveModeItem,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@ -780,6 +756,18 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 判断设备主动上报的关机事件
|
|
|
|
|
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
|
|
|
|
|
this.rmWL200NursingHistory(this.WL200NursingHistory, true);
|
|
|
|
|
// 判断护理时间,如果不足,则提示不足
|
|
|
|
|
if (!this.isCheckNurseTime()) {
|
|
|
|
|
this.setState({ isNotEnoughTime: true });
|
|
|
|
|
} else {
|
|
|
|
|
this.endNurseFun();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.workStatus = jsonStatus.workStatus;
|
|
|
|
|
this.setState({
|
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
|
@ -931,7 +919,9 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
console.log("时间校准频率,默认5秒一次", TIME_CALIBRATION_FREQUENCY);
|
|
|
|
|
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
|
|
|
|
|
const currentScene = ActiveModeItem; // 获取当前的场景
|
|
|
|
|
let sceneTime = minSecToS(currentScene.modeTimeStr); // 场景时间
|
|
|
|
|
let sceneTime = ActiveModeItem?.breakTimeStr
|
|
|
|
|
? minSecToS(ActiveModeItem.breakTimeStr)
|
|
|
|
|
: minSecToS(currentScene.modeTimeStr); // 场景时间
|
|
|
|
|
|
|
|
|
|
console.log("场景时间 sceneTime", sceneTime);
|
|
|
|
|
console.log("当前显示时间 currentTime", currentTime);
|
|
|
|
|
@ -997,6 +987,13 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
opts.workStatus = nWorkStatus;
|
|
|
|
|
|
|
|
|
|
let nowCurrentTime = ActiveModeItem.modeTimeStr;
|
|
|
|
|
// 完成重连同步则删除重连时间字段
|
|
|
|
|
if (ActiveModeItem?.breakTimeStr) {
|
|
|
|
|
nowCurrentTime = ActiveModeItem?.breakTimeStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const statusF = {
|
|
|
|
|
sleep: () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
@ -1008,7 +1005,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isShowCountdown: false,
|
|
|
|
|
});
|
|
|
|
|
if (nowModeItem?.isCabinMode && step == 2) {
|
|
|
|
|
opts.currentTime = nowModeItem.modeTimeStr;
|
|
|
|
|
opts.currentTime = nowCurrentTime;
|
|
|
|
|
} else if (!nowModeItem?.isCabinMode && step == 2) {
|
|
|
|
|
// fix: 启动非支架模式倒计时时,连上支架,仪器的状态变为standby
|
|
|
|
|
opts.step = 1;
|
|
|
|
|
@ -1036,7 +1033,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (nowModeItem) {
|
|
|
|
|
opts.currentTime = nowModeItem.modeTimeStr;
|
|
|
|
|
opts.currentTime = nowCurrentTime;
|
|
|
|
|
}
|
|
|
|
|
// startSettingCountDown 用于标记打开了倒计时loading
|
|
|
|
|
if (!this.state.isShowCountdown) {
|
|
|
|
|
@ -1133,17 +1130,21 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
step == 2 &&
|
|
|
|
|
facialMaskConnectStatus == 1
|
|
|
|
|
) {
|
|
|
|
|
let totalSeconds = minSecToS(ActiveModeItem.modeTimeStr);
|
|
|
|
|
// 现在的倒计时剩余时间:同步时检查是否断开重连,如果是,则使用断开的剩余时长,进行倒计时计算
|
|
|
|
|
let currentSeconds = ActiveModeItem?.breakTimeStr
|
|
|
|
|
let totalSeconds = ActiveModeItem?.breakTimeStr
|
|
|
|
|
? minSecToS(ActiveModeItem.breakTimeStr)
|
|
|
|
|
: minSecToS(currentTime);
|
|
|
|
|
: minSecToS(ActiveModeItem.modeTimeStr);
|
|
|
|
|
// 现在的倒计时剩余时间:同步时检查是否断开重连,如果是,则使用断开的剩余时长,进行倒计时计算
|
|
|
|
|
let currentSeconds = minSecToS(currentTime);
|
|
|
|
|
let checkTime = totalSeconds - currentSeconds;
|
|
|
|
|
|
|
|
|
|
// 缓存经过的时间:用于接口提交
|
|
|
|
|
this.elapsedTime = checkTime;
|
|
|
|
|
// 完成重连同步则删除重连时间字段
|
|
|
|
|
// 如果存在中断时间,则要加上间隔的时间
|
|
|
|
|
if (ActiveModeItem?.breakTimeStr) {
|
|
|
|
|
delete ActiveModeItem?.breakTimeStr;
|
|
|
|
|
this.setState({ ActiveModeItem });
|
|
|
|
|
let intervalTime =
|
|
|
|
|
minSecToS(ActiveModeItem.modeTimeStr) -
|
|
|
|
|
minSecToS(ActiveModeItem.breakTimeStr);
|
|
|
|
|
this.elapsedTime += intervalTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断剩余时间是否大于1
|
|
|
|
|
@ -1480,6 +1481,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
console.log("同步异常,但设备运行中");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 获取小程序本地缓存的历史记录 */
|
|
|
|
|
getWL200NursingHistory() {
|
|
|
|
|
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
|
|
|
|
|
@ -1530,7 +1532,12 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
console.log("更新updateWL200NursingHistory");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
/** 删除WL200护理历史 */
|
|
|
|
|
/**
|
|
|
|
|
* @name 删除WL200护理历史
|
|
|
|
|
* @description 参数1 护理历史 参数2 强制删除
|
|
|
|
|
* 如果传入护理历史ID与现有ID相等,则删除。
|
|
|
|
|
* 如果参数二为真,则强制删除
|
|
|
|
|
*/
|
|
|
|
|
rmWL200NursingHistory = (WL200NursingHistory, hard = false) => {
|
|
|
|
|
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
|
|
|
|
|
if (nowWL200NursingHistory.id == WL200NursingHistory.id) {
|
|
|
|
|
@ -1561,6 +1568,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
console.log("PostNursingLogClock", res);
|
|
|
|
|
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
this.rmWL200NursingHistory(this.WL200NursingHistory); // 护理完成,删除记录
|
|
|
|
|
if (isJump) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowNursingSuccess: true,
|
|
|
|
|
@ -1773,11 +1781,13 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
isConnectShow: false,
|
|
|
|
|
});
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
};
|
|
|
|
|
connectionClose = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
isConnectShow: false,
|
|
|
|
|
});
|
|
|
|
|
Taro.switchTab({ url: "/pages/index/index" });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 手动护理模式切换:提示是否保存护理
|
|
|
|
|
@ -1834,7 +1844,22 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
let isCanClick = isStandStatus
|
|
|
|
|
? this.tempModeCurrent?.isCabinMode === 1
|
|
|
|
|
: this.tempModeCurrent?.isCabinMode === 0;
|
|
|
|
|
let isFooterBtnDisabled = !(isStandStatus === isCanClick);
|
|
|
|
|
// 如果舱体状态和模式类型不相等,则禁用
|
|
|
|
|
let isFooterBtnDisabled = false;
|
|
|
|
|
|
|
|
|
|
if (isStandStatus) {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("isStandStatus", isStandStatus);
|
|
|
|
|
console.log("isFooterBtnDisabled", isFooterBtnDisabled);
|
|
|
|
|
console.log("isCanClick", isCanClick);
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
@ -1917,7 +1942,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isShowNurse={isShowNurse}
|
|
|
|
|
ModeList={ModeList}
|
|
|
|
|
ModeType={ModeType}
|
|
|
|
|
ActiveModeItem={SwitchActiveModeItem}
|
|
|
|
|
onEmit={this.switchModeCurrentFun}
|
|
|
|
|
onEmitShowAll={this.openModeSwitch}
|
|
|
|
|
/>
|
|
|
|
|
@ -1983,25 +2007,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
confirm={this.confirmTipsSave}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupConfirm
|
|
|
|
|
isShow={isShowReReadRecordSave}
|
|
|
|
|
isClose
|
|
|
|
|
zIndex={10020}
|
|
|
|
|
myClassName="level-up"
|
|
|
|
|
title="提示"
|
|
|
|
|
content={
|
|
|
|
|
<Block>
|
|
|
|
|
<View>检测到您上一次护理的记录未生成,</View>
|
|
|
|
|
<View>是否重新读取</View>
|
|
|
|
|
</Block>
|
|
|
|
|
}
|
|
|
|
|
cancelButtonText="取消"
|
|
|
|
|
confirmButtonText="确认"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeTipsSave}
|
|
|
|
|
confirm={this.confirmTipsSave}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupStatus
|
|
|
|
|
isShow={isShowNursingSuccess}
|
|
|
|
|
isClose
|
|
|
|
|
@ -2090,7 +2095,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
ModeType={ModeType}
|
|
|
|
|
ModeID={ModeID}
|
|
|
|
|
activeModeID={activeModeID}
|
|
|
|
|
ActiveModeItem={ActiveModeItem}
|
|
|
|
|
onEmit={this.modeCurrentFun}
|
|
|
|
|
onEmitShowAll={this.openModeSwitch}
|
|
|
|
|
/>
|
|
|
|
|
|