|
|
|
|
@ -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,
|
|
|
|
|
@ -42,7 +43,7 @@ import ModeContent from "./components/ModeContent/index";
|
|
|
|
|
import Footer from "./components/Footer";
|
|
|
|
|
/* 本页组件 END */
|
|
|
|
|
|
|
|
|
|
import { go, getStorageSync, setStorageSync } from "@/utils/traoAPI";
|
|
|
|
|
import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI";
|
|
|
|
|
import { InstrumentInfo } from "@/utils/Interface";
|
|
|
|
|
import "./iotCarePlan.less";
|
|
|
|
|
|
|
|
|
|
@ -149,7 +150,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
showVideoPlayBtn: true, // 视频播放按钮
|
|
|
|
|
duration: 0, // 视频总时长
|
|
|
|
|
hadShowBreakTips: false, // 是否展示过支架断开提示
|
|
|
|
|
popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗
|
|
|
|
|
|
|
|
|
|
isConnectShow: false, // 是否弹出连蓝牙弹窗:在蓝牙断开时弹出
|
|
|
|
|
/** 连接设备 End */
|
|
|
|
|
@ -208,6 +208,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
// 按钮是否可运行
|
|
|
|
|
isFooterBtnDisabled: false,
|
|
|
|
|
isFirstEntryMode: false, // 模式首次打开
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -227,6 +228,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
Taro.setKeepScreenOn({
|
|
|
|
|
keepScreenOn: true,
|
|
|
|
|
});
|
|
|
|
|
this.getWL200NursingHistory();
|
|
|
|
|
this.initData();
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {}
|
|
|
|
|
@ -254,18 +256,16 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async initData() {
|
|
|
|
|
let objStr = getStorageSync("instrument_detail");
|
|
|
|
|
if (objStr) {
|
|
|
|
|
let info = JSON.parse(objStr);
|
|
|
|
|
|
|
|
|
|
let obj = getStorageSync("instrument_detail");
|
|
|
|
|
if (obj) {
|
|
|
|
|
this.setState({
|
|
|
|
|
currentDevice: info,
|
|
|
|
|
currentDevice: obj,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await this.GetModeList(info.id);
|
|
|
|
|
await this.GetModeList(obj.id);
|
|
|
|
|
|
|
|
|
|
// 如果不存在设备模式值,则判断为首次进入,弹窗提示
|
|
|
|
|
let isFirstTipShow = getStorageSync("first_instrument_" + info.id);
|
|
|
|
|
let isFirstTipShow = getStorageSync("first_instrument_" + obj.id);
|
|
|
|
|
if (!isFirstTipShow) {
|
|
|
|
|
this.firstNurseInfo();
|
|
|
|
|
}
|
|
|
|
|
@ -339,7 +339,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);
|
|
|
|
|
@ -417,8 +417,9 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 护理检查改变模式,是否提示切换护理模式
|
|
|
|
|
// isNotCheck为真时,不进行校验,直接切换
|
|
|
|
|
this.tempModeCurrent = data;
|
|
|
|
|
this.footerIsDisabled();
|
|
|
|
|
|
|
|
|
|
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
if (!isNotCheck) {
|
|
|
|
|
let isReturn = this.modeRuningChange();
|
|
|
|
|
if (isReturn) return;
|
|
|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
@ -518,43 +522,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);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -579,6 +556,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 如果检查通过,可运行,则执行下一步
|
|
|
|
|
if (!this.footerIsDisabled()) {
|
|
|
|
|
this.stepNext();
|
|
|
|
|
this.openStepTips(); // 仅在进入运行页的时候弹窗
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 如果检查失败,则报错
|
|
|
|
|
@ -590,8 +568,11 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
* @description isCabinMode是否舱体模式。 0.检测面罩与舱体是否仍在连接中,需要分离 1.检测是否连接失败,需要重新连接
|
|
|
|
|
*/
|
|
|
|
|
onEmitErrorTips = async () => {
|
|
|
|
|
let { isStandStatus, ActiveModeItem } = this.state;
|
|
|
|
|
if (isStandStatus) {
|
|
|
|
|
let { ActiveModeItem } = this.state;
|
|
|
|
|
|
|
|
|
|
// 按钮不可点击时,提示报错
|
|
|
|
|
let isDisabled = this.footerIsDisabled();
|
|
|
|
|
if (isDisabled) {
|
|
|
|
|
if (ActiveModeItem.isCabinMode === 0) {
|
|
|
|
|
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
} else {
|
|
|
|
|
@ -621,9 +602,24 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @name 每次进入设备运行页,打开首个模式的介绍弹窗
|
|
|
|
|
*/
|
|
|
|
|
openStepTips = () => {
|
|
|
|
|
let isFirstEntryModeNot = getStorageSync(
|
|
|
|
|
"isFirstEntryMode_" + this.state.currentDevice.id
|
|
|
|
|
);
|
|
|
|
|
// 1.如果没有持久化不再提示,每次进入都会弹窗提示
|
|
|
|
|
if (!isFirstEntryModeNot) {
|
|
|
|
|
// 2.必须要有数据才弹窗
|
|
|
|
|
if (this.state.ActiveModeItem.openSourceData.length > 0) {
|
|
|
|
|
this.setState({ isShowStepTips: true });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
closeStepTips = (data) => {
|
|
|
|
|
if (data.isLocal) {
|
|
|
|
|
setStorageSync("isFirstEntry_" + this.state.currentDevice.id, true); // 关闭首次进入弹窗
|
|
|
|
|
setStorageSync("isFirstEntryMode_" + this.state.currentDevice.id, true); // 关闭首次进入弹窗
|
|
|
|
|
}
|
|
|
|
|
this.setState({ isShowStepTips: false });
|
|
|
|
|
};
|
|
|
|
|
@ -650,12 +646,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 +692,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isStopNurse: true,
|
|
|
|
|
ActiveModeItem,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@ -780,6 +779,19 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 判断设备主动上报的关机事件
|
|
|
|
|
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
|
|
|
|
|
// 判断id是否一致, 一致的话则生成护理报表, 并提示
|
|
|
|
|
if (jsonStatus.id == this.WL200NursingHistory.id) {
|
|
|
|
|
debounce(
|
|
|
|
|
this.checkInstrumentRecord.bind(this, jsonStatus),
|
|
|
|
|
500
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.workStatus = jsonStatus.workStatus;
|
|
|
|
|
this.setState({
|
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
|
@ -910,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 = {
|
|
|
|
|
@ -931,7 +954,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 +1022,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 +1040,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 +1068,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (nowModeItem) {
|
|
|
|
|
opts.currentTime = nowModeItem.modeTimeStr;
|
|
|
|
|
opts.currentTime = nowCurrentTime;
|
|
|
|
|
}
|
|
|
|
|
// startSettingCountDown 用于标记打开了倒计时loading
|
|
|
|
|
if (!this.state.isShowCountdown) {
|
|
|
|
|
@ -1133,17 +1165,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
|
|
|
|
|
@ -1240,9 +1276,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点击开始护理
|
|
|
|
|
* @name 点击开始护理
|
|
|
|
|
* @params type 传值 switch 则用于区分是否切换模式的启动
|
|
|
|
|
*/
|
|
|
|
|
onNursingTap() {
|
|
|
|
|
onNursingTap(type = "") {
|
|
|
|
|
// 如果已禁止运行,则停止执行后续逻辑
|
|
|
|
|
if (this.state.isFooterBtnDisabled) return;
|
|
|
|
|
// 防止多次点击
|
|
|
|
|
@ -1301,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; // 不管当前什么状态,直接设为工作状态
|
|
|
|
|
@ -1378,6 +1417,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
*
|
|
|
|
|
* */
|
|
|
|
|
checkInstrumentRecord = async (jsonStatus: any) => {
|
|
|
|
|
console.log("检查护理记录");
|
|
|
|
|
let { currentDevice, ActiveModeItem, ModeList } = this.state;
|
|
|
|
|
if (jsonStatus) {
|
|
|
|
|
}
|
|
|
|
|
@ -1417,7 +1457,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let sceneTime = minSecToS(ActiveModeItem.modeTimeStr);
|
|
|
|
|
// 4.判断设备状态-未运行/已完成/待机
|
|
|
|
|
if (
|
|
|
|
|
workStatus == MODE_WORKING_ENUM.STANDBY ||
|
|
|
|
|
@ -1438,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;
|
|
|
|
|
}
|
|
|
|
|
@ -1480,6 +1519,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
console.log("同步异常,但设备运行中");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 获取小程序本地缓存的历史记录 */
|
|
|
|
|
getWL200NursingHistory() {
|
|
|
|
|
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
|
|
|
|
|
@ -1530,13 +1570,20 @@ 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) {
|
|
|
|
|
Taro.removeStorageSync("WL200NursingHistory");
|
|
|
|
|
this.WL200NursingHistory.id = "";
|
|
|
|
|
} else if (hard) {
|
|
|
|
|
Taro.removeStorageSync("WL200NursingHistory");
|
|
|
|
|
this.WL200NursingHistory.id = "";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1561,6 +1608,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,
|
|
|
|
|
@ -1756,7 +1804,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
isNotEnoughTime: false,
|
|
|
|
|
});
|
|
|
|
|
Taro.switchTab({
|
|
|
|
|
Taro.reLaunch({
|
|
|
|
|
url: "/pages/index/index",
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
@ -1773,26 +1821,35 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
isConnectShow: false,
|
|
|
|
|
});
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
};
|
|
|
|
|
connectionClose = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
isConnectShow: false,
|
|
|
|
|
});
|
|
|
|
|
Taro.reLaunch({ url: "/pages/index/index" });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 手动护理模式切换:提示是否保存护理
|
|
|
|
|
/**仅关闭*/
|
|
|
|
|
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); // 不进行校验
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1819,7 +1876,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({ isFirstTipShow: true });
|
|
|
|
|
};
|
|
|
|
|
onTipShowClose = async () => {
|
|
|
|
|
setStorageSync("first_instrument_" + this.state.currentDevice.id, "true");
|
|
|
|
|
setStorageSync("first_instrument_" + this.state.currentDevice.id, true);
|
|
|
|
|
this.setState({ isFirstTipShow: false });
|
|
|
|
|
};
|
|
|
|
|
/** 初次护理信息弹窗 END */
|
|
|
|
|
@ -1834,13 +1891,33 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
let isCanClick = isStandStatus
|
|
|
|
|
? this.tempModeCurrent?.isCabinMode === 1
|
|
|
|
|
: this.tempModeCurrent?.isCabinMode === 0;
|
|
|
|
|
let isFooterBtnDisabled = !(isStandStatus === isCanClick);
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
// 如果舱体状态和模式类型不相等,则禁用
|
|
|
|
|
let isFooterBtnDisabled = false;
|
|
|
|
|
|
|
|
|
|
if (isStandStatus) {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 仅在值变化时更新state
|
|
|
|
|
if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
customBack = () => {
|
|
|
|
|
Taro.reLaunch({ url: "/pages/index/index" });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let {
|
|
|
|
|
title,
|
|
|
|
|
@ -1875,11 +1952,17 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
nurseInfo,
|
|
|
|
|
isShowReReadRecordSave,
|
|
|
|
|
isFooterBtnDisabled,
|
|
|
|
|
isFirstEntryMode,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Block>
|
|
|
|
|
<Navbar titleSlot={title} isBack />
|
|
|
|
|
<Navbar
|
|
|
|
|
titleSlot={title}
|
|
|
|
|
isBack
|
|
|
|
|
isCustomBack
|
|
|
|
|
customBack={this.customBack}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<View catchMove>
|
|
|
|
|
<PopupInstrumentUploadTips
|
|
|
|
|
@ -1917,7 +2000,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isShowNurse={isShowNurse}
|
|
|
|
|
ModeList={ModeList}
|
|
|
|
|
ModeType={ModeType}
|
|
|
|
|
ActiveModeItem={SwitchActiveModeItem}
|
|
|
|
|
onEmit={this.switchModeCurrentFun}
|
|
|
|
|
onEmitShowAll={this.openModeSwitch}
|
|
|
|
|
/>
|
|
|
|
|
@ -1933,7 +2015,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
<PopupStepTips
|
|
|
|
|
isShow={isShowStepTips}
|
|
|
|
|
isLarge
|
|
|
|
|
isFirstEntry
|
|
|
|
|
isFirstEntry={isFirstEntryMode}
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
data={ActiveModeItem.openSourceData}
|
|
|
|
|
close={this.closeStepTips}
|
|
|
|
|
@ -1980,25 +2062,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
confirmButtonText="确认"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeTipsSave}
|
|
|
|
|
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}
|
|
|
|
|
cancel={this.cancelTipsSave}
|
|
|
|
|
confirm={this.confirmTipsSave}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
@ -2035,6 +2099,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
<Video
|
|
|
|
|
className="video-or-image"
|
|
|
|
|
src={ActiveModeItem.modeVideo}
|
|
|
|
|
loop
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
@ -2090,7 +2155,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
ModeType={ModeType}
|
|
|
|
|
ModeID={ModeID}
|
|
|
|
|
activeModeID={activeModeID}
|
|
|
|
|
ActiveModeItem={ActiveModeItem}
|
|
|
|
|
onEmit={this.modeCurrentFun}
|
|
|
|
|
onEmitShowAll={this.openModeSwitch}
|
|
|
|
|
/>
|
|
|
|
|
|