|
|
|
|
@ -56,9 +56,10 @@ import {
|
|
|
|
|
bleCommandSamples,
|
|
|
|
|
} from "@/components/bluetoot/connection/wl200";
|
|
|
|
|
|
|
|
|
|
import { minSecToS, s_to_ms, s_to_hms, sleep } from "@/utils/util";
|
|
|
|
|
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
|
|
|
|
|
import commandMap from "@/utils/commandMap";
|
|
|
|
|
import { Popup } from "@antmjs/vantui";
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
|
|
|
|
|
|
|
|
|
|
@ -217,6 +218,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 不涉及渲染的页面变量
|
|
|
|
|
isRuning: any = false; // 设备是否运行中
|
|
|
|
|
jsonStatus: any = {}; // 同步设备返回数据,用于结束
|
|
|
|
|
workJsonStatus: any = {}; // 同步工作中的仪器
|
|
|
|
|
tempModeCurrent: any = {}; // 临时保存的当前模式
|
|
|
|
|
elapsedTime: any = 0; // 设备已运行时间
|
|
|
|
|
workStatus: any = ""; // 工作状态
|
|
|
|
|
@ -443,6 +445,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let currentTime = data.modeTimeStr;
|
|
|
|
|
let modeArray = ["all", "visor", "cabin", "yimeish"];
|
|
|
|
|
this.setState({
|
|
|
|
|
ActiveModeItem: data,
|
|
|
|
|
activeModeID: data.id,
|
|
|
|
|
@ -450,6 +453,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
currentServiceData,
|
|
|
|
|
ModeStepIndex: 0,
|
|
|
|
|
currentTime,
|
|
|
|
|
ModeType: modeArray[data.modeClass],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
@ -536,9 +540,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
this.setState({
|
|
|
|
|
ModeType: modeArray[SwitchActiveModeItem.modeClass],
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log("ModeType", this.state.ModeType);
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
stepNext = () => {
|
|
|
|
|
@ -800,7 +801,10 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.workJsonStatus = jsonStatus;
|
|
|
|
|
this.workStatus = jsonStatus.workStatus;
|
|
|
|
|
|
|
|
|
|
setTimeout(() => console.log("this.workStatus", this.workStatus));
|
|
|
|
|
this.setState({
|
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
|
// fr200Electricity: jsonStatus.battery,
|
|
|
|
|
@ -816,7 +820,6 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
500
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1440,21 +1443,39 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
checkInstrumentRecord = async (jsonStatus: any) => {
|
|
|
|
|
console.log("检查护理记录");
|
|
|
|
|
let { currentDevice, ActiveModeItem, ModeList } = this.state;
|
|
|
|
|
if (jsonStatus) {
|
|
|
|
|
}
|
|
|
|
|
// 1.判断是否存在工作状态:如果不存在,则等待两秒用于连接设备与赋值,再执行后面的代码
|
|
|
|
|
if (!this.workStatus) {
|
|
|
|
|
await sleep(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await sleep(2);
|
|
|
|
|
|
|
|
|
|
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
|
|
|
|
|
if (isSyncHistory) {
|
|
|
|
|
this.setState({ isShowHistoryMsg: false });
|
|
|
|
|
Taro.removeStorageSync("isSyncHistory");
|
|
|
|
|
}
|
|
|
|
|
console.log(
|
|
|
|
|
"this.workJsonStatus",
|
|
|
|
|
this.workJsonStatus,
|
|
|
|
|
this.workJsonStatus.workMode
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isFooterBtnDisabled: false,
|
|
|
|
|
});
|
|
|
|
|
if (this.workJsonStatus.workMode) {
|
|
|
|
|
console.log("this.workJsonStatus.workMode", this.workJsonStatus.workMode);
|
|
|
|
|
if (this.workJsonStatus.workMode.indexOf("Stand") > -1) {
|
|
|
|
|
console.log(
|
|
|
|
|
"this.workJsonStatus.workMode",
|
|
|
|
|
this.workJsonStatus.workMode
|
|
|
|
|
);
|
|
|
|
|
this.setState({
|
|
|
|
|
isStandStatus: true,
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => this.footerIsDisabled(), 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2.判断是否已存在缓存的护理记录:如果没有历史,则缓存
|
|
|
|
|
let workStatus = this.workStatus;
|
|
|
|
|
let workStatus = this.workJsonStatus.workStatus;
|
|
|
|
|
let WL200NursingHistory = this.WL200NursingHistory;
|
|
|
|
|
if (!this.WL200NursingHistory) {
|
|
|
|
|
console.log("小程序缓存没有数据, 忽略");
|
|
|
|
|
@ -1484,6 +1505,19 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("workStatus", workStatus);
|
|
|
|
|
console.log("jsonStatus", jsonStatus, this.workJsonStatus);
|
|
|
|
|
console.log("currentTime", WL200NursingHistory.currentTime);
|
|
|
|
|
console.log("isStandStatus", this.state.isStandStatus);
|
|
|
|
|
|
|
|
|
|
let historyElapsedTime =
|
|
|
|
|
minSecToS(recordModeItem.modeTimeStr) -
|
|
|
|
|
minSecToS(WL200NursingHistory.currentTime);
|
|
|
|
|
|
|
|
|
|
this.elapsedTime =
|
|
|
|
|
this.elapsedTime > historyElapsedTime
|
|
|
|
|
? this.elapsedTime
|
|
|
|
|
: historyElapsedTime;
|
|
|
|
|
// 4.判断设备状态-未运行/已完成/待机
|
|
|
|
|
if (
|
|
|
|
|
workStatus == MODE_WORKING_ENUM.STANDBY ||
|
|
|
|
|
@ -1494,12 +1528,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
if (jsonStatus.id == WL200NursingHistory.id) {
|
|
|
|
|
console.log("id一致, 设备没有运行/已完成/待机");
|
|
|
|
|
let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间
|
|
|
|
|
let neededTotalSeconds = jsonStatus.neededTotalSeconds; // 从仪器上获取的使用时间
|
|
|
|
|
console.log(
|
|
|
|
|
"从仪器上获取的使用时间 totalSeconds: %d neededTotalSeconds: %d",
|
|
|
|
|
totalSeconds,
|
|
|
|
|
neededTotalSeconds
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let nursingTimeStr = currentDevice?.nursingTimeStr;
|
|
|
|
|
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
|
|
|
|
|
|
|
|
|
|
@ -1523,6 +1552,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
modeName: ActiveModeItem.modeName,
|
|
|
|
|
nursingTime: timeValue,
|
|
|
|
|
};
|
|
|
|
|
this.handleWorkStatus(false, "end");
|
|
|
|
|
let res: any = await this.PostNursingLogClock(params);
|
|
|
|
|
console.log("res", res);
|
|
|
|
|
this.rmWL200NursingHistory(WL200NursingHistory);
|
|
|
|
|
@ -1535,15 +1565,23 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
modeName: ActiveModeItem.modeName,
|
|
|
|
|
nursingTime: "00:01:00",
|
|
|
|
|
};
|
|
|
|
|
this.handleWorkStatus(false, "end");
|
|
|
|
|
let res: any = await this.PostNursingLogClock(params);
|
|
|
|
|
console.log("res", res);
|
|
|
|
|
this.rmWL200NursingHistory(WL200NursingHistory);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 5.判断设备状态-运行中 正常逻辑,这里不做处理,如果用户操作,则按正常流程判断
|
|
|
|
|
console.log("同步异常,但设备运行中");
|
|
|
|
|
console.log("同步异常,但设备运行中");
|
|
|
|
|
console.log("同步异常,但设备运行中");
|
|
|
|
|
console.log("id一致, 设备运行中或暂停");
|
|
|
|
|
// 5.判断设备状态-运行中
|
|
|
|
|
// 同步时间
|
|
|
|
|
if (jsonStatus.id == WL200NursingHistory.id) {
|
|
|
|
|
if (WL200NursingHistory.currentTime) {
|
|
|
|
|
this.setState({
|
|
|
|
|
step: 2,
|
|
|
|
|
});
|
|
|
|
|
this.resetTimer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1554,11 +1592,27 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
// 是否同步历史记录
|
|
|
|
|
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
|
|
|
|
|
if (isSyncHistory) {
|
|
|
|
|
let ActiveModeItem = this.WL200NursingHistory.ActiveModeItem;
|
|
|
|
|
// 直接进入开始护理状态
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowNurse: true,
|
|
|
|
|
isShowHistoryMsg: true,
|
|
|
|
|
currentServiceData: this.WL200NursingHistory.currentServiceData,
|
|
|
|
|
tempModeCurrent: ActiveModeItem,
|
|
|
|
|
ActiveModeItem: ActiveModeItem,
|
|
|
|
|
activeModeID: ActiveModeItem.id,
|
|
|
|
|
ModeID: "mode_" + ActiveModeItem.id,
|
|
|
|
|
currentTime: this.WL200NursingHistory.currentTime,
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// 设置时间组合
|
|
|
|
|
if (ActiveModeItem.serviceData.length > 0) {
|
|
|
|
|
this.setServiceTimeData();
|
|
|
|
|
}
|
|
|
|
|
// 存在组合模式时,设置组合模式
|
|
|
|
|
if (ActiveModeItem.combineData.length > 0) {
|
|
|
|
|
this.setCustomMaskData();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1575,6 +1629,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
id: jsonStatus.id,
|
|
|
|
|
neededTotalSeconds: jsonStatus.neededTotalSeconds,
|
|
|
|
|
jsonStatus,
|
|
|
|
|
ActiveModeItem: this.state.ActiveModeItem,
|
|
|
|
|
};
|
|
|
|
|
this.WL200NursingHistory = JSON.parse(JSON.stringify(params));
|
|
|
|
|
Taro.setStorageSync("WL200NursingHistory", params);
|
|
|
|
|
@ -1977,6 +2032,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isStopNurse,
|
|
|
|
|
ModeList,
|
|
|
|
|
ModeType,
|
|
|
|
|
ModeStepIndex,
|
|
|
|
|
currentServiceData,
|
|
|
|
|
ActiveModeItem,
|
|
|
|
|
SwitchActiveModeItem,
|
|
|
|
|
@ -2003,6 +2059,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
isShowReReadRecordSave,
|
|
|
|
|
isFooterBtnDisabled,
|
|
|
|
|
isShowHistoryMsg,
|
|
|
|
|
stepIndex,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -2141,11 +2198,15 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
upgradeFun={() => {}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{isShowHistoryMsg && (
|
|
|
|
|
<View className="sync-history-msg">正在同步护理记录...</View>
|
|
|
|
|
)}
|
|
|
|
|
<Popup
|
|
|
|
|
show={isShowHistoryMsg}
|
|
|
|
|
className="custom-popup"
|
|
|
|
|
overlay={false}
|
|
|
|
|
>
|
|
|
|
|
<View className="sync-history-msg">正在同步护理记录...</View>
|
|
|
|
|
</Popup>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
<View>
|
|
|
|
|
<View className="iot-main">
|
|
|
|
|
@ -2220,6 +2281,7 @@ class IotCarePlan extends Component<any, any> {
|
|
|
|
|
<ModeContent
|
|
|
|
|
isShowNurse={isShowNurse}
|
|
|
|
|
ActiveModeItem={ActiveModeItem}
|
|
|
|
|
ModeStepIndex={ModeStepIndex}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|