|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import Taro from "@tarojs/taro";
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
import classnames from "classnames";
|
|
|
|
|
import { debounce } from "lodash";
|
|
|
|
|
// eslint-disable-next-line import/no-named-as-default
|
|
|
|
|
import React, {
|
|
|
|
|
Component,
|
|
|
|
|
@ -457,9 +458,12 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
// 如果是正在运行中切换,则直接准备运行
|
|
|
|
|
if (isShowNurse) {
|
|
|
|
|
this.onStartNurse();
|
|
|
|
|
if (!this.footerIsDisabled()) {
|
|
|
|
|
this.stepNext(); // 如果切换模式,则不执行开始逻辑
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
this.onNursingTap("switch");
|
|
|
|
|
}, 800);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
@ -608,7 +612,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 1.如果没有持久化不再提示,每次进入都会弹窗提示
|
|
|
|
|
if (!isFirstEntryModeNot) {
|
|
|
|
|
// 2.必须要有数据才弹窗
|
|
|
|
|
if (this.state.ActiveModeItem.openSourceData) {
|
|
|
|
|
if (this.state.ActiveModeItem.openSourceData.length > 0) {
|
|
|
|
|
this.setState({ isShowStepTips: true });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -777,13 +781,14 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
// 判断设备主动上报的关机事件
|
|
|
|
|
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
|
|
|
|
|
this.rmWL200NursingHistory(this.WL200NursingHistory, true);
|
|
|
|
|
// 判断护理时间,如果不足,则提示不足
|
|
|
|
|
if (!this.isCheckNurseTime()) {
|
|
|
|
|
this.setState({ isNotEnoughTime: true });
|
|
|
|
|
} else {
|
|
|
|
|
this.endNurseFun();
|
|
|
|
|
// 判断id是否一致, 一致的话则生成护理报表, 并提示
|
|
|
|
|
if (jsonStatus.id == this.WL200NursingHistory.id) {
|
|
|
|
|
debounce(
|
|
|
|
|
this.checkInstrumentRecord.bind(this, jsonStatus),
|
|
|
|
|
500
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -917,6 +922,17 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**监听关机事件*/
|
|
|
|
|
onEndDevice = () => {
|
|
|
|
|
this.rmWL200NursingHistory(this.WL200NursingHistory, true);
|
|
|
|
|
// 判断护理时间,如果不足,则提示不足
|
|
|
|
|
if (!this.isCheckNurseTime()) {
|
|
|
|
|
this.setState({ isNotEnoughTime: true });
|
|
|
|
|
} else {
|
|
|
|
|
this.endNurseFun();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 同步设备运行信息:运行时间 */
|
|
|
|
|
updateDeviceSyncData = (newData, jsonStatus) => {
|
|
|
|
|
DeviceSyncData = {
|
|
|
|
|
@ -1260,9 +1276,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点击开始护理
|
|
|
|
|
* @name 点击开始护理
|
|
|
|
|
* @params type 传值 switch 则用于区分是否切换模式的启动
|
|
|
|
|
*/
|
|
|
|
|
onNursingTap() {
|
|
|
|
|
onNursingTap(type = "") {
|
|
|
|
|
// 如果已禁止运行,则停止执行后续逻辑
|
|
|
|
|
if (this.state.isFooterBtnDisabled) return;
|
|
|
|
|
// 防止多次点击
|
|
|
|
|
@ -1321,9 +1338,11 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let downNum = CountDownTime[ActiveModeItem.modeType] || 3;
|
|
|
|
|
console.log("downNum", downNum);
|
|
|
|
|
this.showCountdownFun(downNum, () => {}); // 倒计时弹窗
|
|
|
|
|
// 仅在切换模式的时候,弹窗倒计时.
|
|
|
|
|
if (type === "switch") {
|
|
|
|
|
let downNum = CountDownTime[ActiveModeItem.modeType] || 3;
|
|
|
|
|
this.showCountdownFun(downNum, () => {}); // 倒计时弹窗
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始执行护理
|
|
|
|
|
this.workStatus = MODE_WORKING_ENUM.WORKING; // 不管当前什么状态,直接设为工作状态
|
|
|
|
|
@ -1398,6 +1417,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
*
|
|
|
|
|
* */
|
|
|
|
|
checkInstrumentRecord = async (jsonStatus: any) => {
|
|
|
|
|
console.log("检查护理记录");
|
|
|
|
|
let { currentDevice, ActiveModeItem, ModeList } = this.state;
|
|
|
|
|
if (jsonStatus) {
|
|
|
|
|
}
|
|
|
|
|
@ -1437,7 +1457,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let sceneTime = minSecToS(ActiveModeItem.modeTimeStr);
|
|
|
|
|
// 4.判断设备状态-未运行/已完成/待机
|
|
|
|
|
if (
|
|
|
|
|
workStatus == MODE_WORKING_ENUM.STANDBY ||
|
|
|
|
|
@ -1458,8 +1477,8 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
|
|
|
|
|
|
|
|
|
|
if (totalSeconds < nursingTime) {
|
|
|
|
|
console.log("护理时间不足,弹出提示");
|
|
|
|
|
// todo
|
|
|
|
|
// 护理时间不足
|
|
|
|
|
this.setState({ isNotEnoughTime: true });
|
|
|
|
|
this.rmWL200NursingHistory(WL200NursingHistory);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -1561,8 +1580,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
|
|
|
|
|
if (nowWL200NursingHistory.id == WL200NursingHistory.id) {
|
|
|
|
|
Taro.removeStorageSync("WL200NursingHistory");
|
|
|
|
|
this.WL200NursingHistory.id = "";
|
|
|
|
|
} else if (hard) {
|
|
|
|
|
Taro.removeStorageSync("WL200NursingHistory");
|
|
|
|
|
this.WL200NursingHistory.id = "";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1810,18 +1831,25 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 手动护理模式切换:提示是否保存护理
|
|
|
|
|
/**仅关闭*/
|
|
|
|
|
closeTipsSave = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowTipsSave: false,
|
|
|
|
|
});
|
|
|
|
|
this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
|
|
|
|
|
};
|
|
|
|
|
/**关闭+切换*/
|
|
|
|
|
cancelTipsSave = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowTipsSave: false,
|
|
|
|
|
});
|
|
|
|
|
this.modeCurrentFun(this.tempModeCurrent, true); // 不提交护理记录,也不进行校验
|
|
|
|
|
};
|
|
|
|
|
/**关闭+提交+切换*/
|
|
|
|
|
confirmTipsSave = async () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowTipsSave: false,
|
|
|
|
|
});
|
|
|
|
|
// isShowTipsSave
|
|
|
|
|
this.PostNursingLogClock(null, false);
|
|
|
|
|
this.PostNursingLogClock(null, false); // 先提交护理记录
|
|
|
|
|
this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1876,9 +1904,13 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
// 仅在值变化时更新state
|
|
|
|
|
if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -2030,6 +2062,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
confirmButtonText="确认"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeTipsSave}
|
|
|
|
|
cancel={this.cancelTipsSave}
|
|
|
|
|
confirm={this.confirmTipsSave}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
@ -2066,6 +2099,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
<Video
|
|
|
|
|
className="video-or-image"
|
|
|
|
|
src={ActiveModeItem.modeVideo}
|
|
|
|
|
loop
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|