|
|
|
|
@ -54,7 +54,7 @@ import {
|
|
|
|
|
import {
|
|
|
|
|
deviceCommandSamples,
|
|
|
|
|
bleCommandSamples,
|
|
|
|
|
} from "@/components/bluetoot/connection/test";
|
|
|
|
|
} from "@/components/bluetoot/connection/wl200";
|
|
|
|
|
|
|
|
|
|
import { minSecToS, s_to_ms, s_to_hms, sleep } from "@/utils/util";
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
|
|
|
|
|
@ -206,8 +206,8 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 上一次护理记录未生成,是否继续连接设备
|
|
|
|
|
isShowReReadRecordConnect: false,
|
|
|
|
|
|
|
|
|
|
// 按钮是否可运行
|
|
|
|
|
isFooterBtnDisabled: false,
|
|
|
|
|
// 按钮是否不可运行
|
|
|
|
|
isFooterBtnDisabled: true,
|
|
|
|
|
isFirstEntryMode: false, // 模式首次打开
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@ -375,7 +375,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.modeCurrentFun(res.data.data[0]);
|
|
|
|
|
});
|
|
|
|
|
}, 100);
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ ModeList: res.data.data });
|
|
|
|
|
}
|
|
|
|
|
@ -414,19 +414,15 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
/** 选中护理模式 */
|
|
|
|
|
modeCurrentFun = async (data, isNotCheck = false) => {
|
|
|
|
|
// 仅在未开始护理前,切换模式的时候提示模式弹窗
|
|
|
|
|
if (!this.state.isShowNurse) {
|
|
|
|
|
this.openStepTips();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 护理检查改变模式,是否提示切换护理模式
|
|
|
|
|
// isNotCheck为真时,不进行校验,直接切换
|
|
|
|
|
this.tempModeCurrent = data;
|
|
|
|
|
|
|
|
|
|
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
if (!isNotCheck) {
|
|
|
|
|
let isReturn = this.modeRuningChange();
|
|
|
|
|
if (isReturn) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { isShowNurse } = this.state;
|
|
|
|
|
|
|
|
|
|
let currentServiceData = {
|
|
|
|
|
startSource: "",
|
|
|
|
|
stopSource: "",
|
|
|
|
|
@ -445,6 +441,13 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
currentTime,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
if (!isNotCheck) {
|
|
|
|
|
let isReturn = this.modeRuningChange();
|
|
|
|
|
if (isReturn) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// 设置时间组合
|
|
|
|
|
if (data.serviceData.length > 0) {
|
|
|
|
|
@ -556,7 +559,14 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 如果检查通过,可运行,则执行下一步
|
|
|
|
|
if (!this.footerIsDisabled()) {
|
|
|
|
|
this.stepNext();
|
|
|
|
|
this.openStepTips(); // 仅在进入运行页的时候弹窗
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
// 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗
|
|
|
|
|
let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3;
|
|
|
|
|
this.showCountdownFun(downNum, () => {});
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 如果检查失败,则报错
|
|
|
|
|
@ -568,19 +578,21 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
* @description isCabinMode是否舱体模式。 0.检测面罩与舱体是否仍在连接中,需要分离 1.检测是否连接失败,需要重新连接
|
|
|
|
|
*/
|
|
|
|
|
onEmitErrorTips = async () => {
|
|
|
|
|
let { ActiveModeItem } = this.state;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
let { ActiveModeItem } = this.state;
|
|
|
|
|
|
|
|
|
|
// 按钮不可点击时,提示报错
|
|
|
|
|
let isDisabled = this.footerIsDisabled();
|
|
|
|
|
if (isDisabled) {
|
|
|
|
|
if (ActiveModeItem.isCabinMode === 0) {
|
|
|
|
|
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
} else {
|
|
|
|
|
this.showTips(
|
|
|
|
|
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
);
|
|
|
|
|
// 按钮不可点击时,提示报错
|
|
|
|
|
let isDisabled = this.footerIsDisabled();
|
|
|
|
|
if (isDisabled) {
|
|
|
|
|
if (ActiveModeItem.isCabinMode === 0) {
|
|
|
|
|
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
|
|
|
|
|
} else {
|
|
|
|
|
this.showTips(
|
|
|
|
|
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 绘制能量图
|
|
|
|
|
@ -697,6 +709,9 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.onEmitErrorTips();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.footerIsDisabled();
|
|
|
|
|
}, 100);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
console.log("监听到到设备连接状态改变 this.footerIsDisabled()");
|
|
|
|
|
@ -715,6 +730,9 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
isStandStatus: isStandDevice,
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.footerIsDisabled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 连上面罩后, 获取仪器记录, 与缓存信息对比
|
|
|
|
|
if (!this.hadGotInstrumentHistoryData) {
|
|
|
|
|
@ -894,18 +912,18 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 延迟500毫秒获取附属设备状态
|
|
|
|
|
* 延迟600毫秒获取附属设备状态
|
|
|
|
|
*/
|
|
|
|
|
const querySubDeviceArrayBuffer = deviceToolKitInstance.toBleCommand({
|
|
|
|
|
...bleCommandSamples.querySubDevice,
|
|
|
|
|
queryType: "WL200",
|
|
|
|
|
} as any);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log("发送查询指令");
|
|
|
|
|
console.log("发送查询附属设备指令 querySubDeviceArrayBuffer");
|
|
|
|
|
sendCommand({
|
|
|
|
|
value: querySubDeviceArrayBuffer,
|
|
|
|
|
});
|
|
|
|
|
}, 500);
|
|
|
|
|
}, 600);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 延迟500毫秒获取设备电量
|
|
|
|
|
@ -914,7 +932,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
bleCommandSamples.queryDeviceStatus as any
|
|
|
|
|
);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log("发送查询设备指令");
|
|
|
|
|
console.log("发送查询设备电量指令");
|
|
|
|
|
sendCommand({
|
|
|
|
|
value: queryDeviceArrayBuffer,
|
|
|
|
|
});
|
|
|
|
|
@ -1821,7 +1839,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
isConnectShow: false,
|
|
|
|
|
});
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
this.onNursingTap("switch");
|
|
|
|
|
};
|
|
|
|
|
connectionClose = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
@ -1894,22 +1912,17 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 如果舱体状态和模式类型不相等,则禁用
|
|
|
|
|
let isFooterBtnDisabled = false;
|
|
|
|
|
|
|
|
|
|
if (isStandStatus) {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
if (!isCanClick) {
|
|
|
|
|
isFooterBtnDisabled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("isCanClick", isCanClick);
|
|
|
|
|
console.log("isFooterBtnDisabled", isFooterBtnDisabled);
|
|
|
|
|
// 仅在值变化时更新state
|
|
|
|
|
if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: isFooterBtnDisabled,
|
|
|
|
|
});
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
|
|
|
|
|
};
|
|
|
|
|
@ -1967,6 +1980,8 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
<View catchMove>
|
|
|
|
|
<PopupInstrumentUploadTips
|
|
|
|
|
isShow={isFirstTipShow}
|
|
|
|
|
zIndex={10020}
|
|
|
|
|
myClassName="level-up"
|
|
|
|
|
title="打卡介绍"
|
|
|
|
|
data={nurseInfo}
|
|
|
|
|
close={this.onTipShowClose}
|
|
|
|
|
|