拿到每秒数据

master
blak-kong 2 years ago
parent 66b9630072
commit 5677dc4dda

@ -64,6 +64,7 @@ import {
} from "@flossom-npm/iot-translater"; } from "@flossom-npm/iot-translater";
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
import { Popup } from "@antmjs/vantui"; import { Popup } from "@antmjs/vantui";
import { fr200BleCommand } from "@/components/bluetoot/connection/fr200";
const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200"); const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200");
let deviceToolKitInstance = deviceToolKitInstanceFR200; let deviceToolKitInstance = deviceToolKitInstanceFR200;
@ -121,7 +122,7 @@ class IotCarePlanFR200 extends Component<any, any> {
basicModeList: [], //模式列表 basicModeList: [], //模式列表
modelActiveIndex: 0, //模式下标 modelActiveIndex: 0, //模式下标
sliderProgress: 22, sliderProgress: 22,
DeviceConnectStatus: 1, // 面罩连接状态 0未连接 1已连接 DeviceConnectStatus: 1, // 设备连接状态 0未连接 1已连接
Electricity: 4, // WL200电量 Electricity: 4, // WL200电量
matrixElectricity: 4, // WE200发箍电量 matrixElectricity: 4, // WE200发箍电量
@ -140,7 +141,7 @@ class IotCarePlanFR200 extends Component<any, any> {
isStandStatus: false, // 当前模式是否舱体/支架模式 isStandStatus: false, // 当前模式是否舱体/支架模式
isShowStepTips: false, // 是否显示介绍步骤弹窗 isShowStepTips: false, // 是否显示介绍步骤弹窗
isConnectionBlutoot: true, // 是否已连接蓝牙 isConnectionBlutoot: true, // 是否已连接蓝牙
isShowNurse: false, // 是否开始并显示护理 isShowNurse: true, // 是否开始并显示护理 FR200默认已经开始准备护理
isStopNurse: false, // 是否暂停护理 isStopNurse: false, // 是否暂停护理
isEndNurse: false, // 是否结束护理 isEndNurse: false, // 是否结束护理
errorTips: "", // 错误提示 errorTips: "", // 错误提示
@ -189,8 +190,8 @@ class IotCarePlanFR200 extends Component<any, any> {
// 上一次护理记录未生成,是否继续连接设备 // 上一次护理记录未生成,是否继续连接设备
isShowReReadRecordConnect: false, isShowReReadRecordConnect: false,
// 按钮是否不可运行 // 按钮是否不可运行:FR200不可禁用
isFooterBtnDisabled: true, isFooterBtnDisabled: false,
// isFirstEntryMode: false, // 模式首次打开 // isFirstEntryMode: false, // 模式首次打开
isShowHistoryMsg: false, // 是否显示正在同步历史 isShowHistoryMsg: false, // 是否显示正在同步历史
@ -198,13 +199,13 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
// 不涉及渲染的页面变量 // 不涉及渲染的页面变量
isRuning: any = false; // 设备是否运行中 isRuning: any = true; // 设备默认运行中fr200贴脸就会自动开始工作
jsonStatus: any = {}; // 同步设备返回数据,用于结束 jsonStatus: any = {}; // 同步设备返回数据,用于结束
workJsonStatus: any = {}; // 同步工作中的仪器 workJsonStatus: any = {}; // 同步工作中的仪器
tempModeCurrent: any = {}; // 临时保存的当前模式 tempModeCurrent: any = {}; // 临时保存的当前模式
elapsedTime: any = 0; // 设备已运行时间 elapsedTime: any = 0; // 设备已运行时间
workStatus: any = ""; // 工作状态 workStatus: any = ""; // 工作状态
WL200NursingHistory: any = null; // 护理缓存历史 FR200NursingHistory: any = null; // 护理缓存历史
hadCheckReport = false; // 是否已检查仪器护理记录 hadCheckReport = false; // 是否已检查仪器护理记录
hadGotInstrumentHistoryData = false; // 是否已缓存仪器历史数据 hadGotInstrumentHistoryData = false; // 是否已缓存仪器历史数据
hadLoadedPage = false; // 判断是否首次进入页面 hadLoadedPage = false; // 判断是否首次进入页面
@ -235,8 +236,9 @@ class IotCarePlanFR200 extends Component<any, any> {
Taro.setKeepScreenOn({ Taro.setKeepScreenOn({
keepScreenOn: true, keepScreenOn: true,
}); });
// this.getWL200NursingHistory();
this.initData(); this.initData();
this.getInstrumentClockSummary();
this.getInstrumentClockDetail();
} }
componentDidMount() {} componentDidMount() {}
@ -250,7 +252,7 @@ class IotCarePlanFR200 extends Component<any, any> {
return; return;
} }
// this.getWL200NursingHistory(); this.getFR200NursingHistory();
// 重置初始值,每次进入页面重新检查面罩护理记录 // 重置初始值,每次进入页面重新检查面罩护理记录
this.hadCheckReport = false; this.hadCheckReport = false;
this.hadGotInstrumentHistoryData = false; this.hadGotInstrumentHistoryData = false;
@ -378,9 +380,9 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeList: res.data.data, ModeList: res.data.data,
}); });
// setTimeout(() => { setTimeout(() => {
// this.modeCurrentFun(res.data.data[0]); this.modeCurrentFun(res.data.data[0]);
// }, 100); }, 100);
} else { } else {
this.setState({ ModeList: [] }); this.setState({ ModeList: [] });
} }
@ -424,6 +426,7 @@ class IotCarePlanFR200 extends Component<any, any> {
this.tempModeCurrent = data; this.tempModeCurrent = data;
// 仅在未开始护理前,切换模式的时候提示模式弹窗 // 仅在未开始护理前,切换模式的时候提示模式弹窗
// FR200默认开始护理
if (!this.state.isShowNurse) { if (!this.state.isShowNurse) {
this.openStepTips(); this.openStepTips();
} }
@ -677,90 +680,138 @@ class IotCarePlanFR200 extends Component<any, any> {
break; break;
//设备状态同步 //设备状态同步
case "DeviceStatusSync": case "DeviceStatusSync":
this.setState({
Electricity: jsonStatus.battery,
});
switch (jsonStatus.workStatus) { switch (jsonStatus.workStatus) {
case "standby": case "standby":
//设备的待机状态 可能workMode字段为空 //设备的待机状态 可能workMode字段为空
console.log("设备状态同步 待机状态", jsonStatus); console.log("设备状态同步 待机状态", jsonStatus);
// this.judgementWorkStatus(
// MODE_WORKING_ENUM.STANDBY,
// jsonStatus.workMode
// );
break; break;
case "pause": case "pause":
//设备的暂停状态 //设备的暂停状态
console.log("设备状态同步 暂停状态", jsonStatus); console.log("设备状态同步 暂停状态", jsonStatus);
// this.judgementWorkStatus(
// MODE_WORKING_ENUM.PAUSE,
// jsonStatus.workMode
// );
break; break;
case "working": case "working":
//设备的运行中状态 //设备的运行中状态
console.log("设备状态同步 运行中状态", jsonStatus); console.log("设备状态同步 运行中状态", jsonStatus);
// this.judgementWorkStatus(
// MODE_WORKING_ENUM.WORKING,
// jsonStatus.workMode
// );
break; break;
default: default:
break; break;
} }
console.log(
"jsonStatus?.workMode === this.state.ActiveModeItem.modeType",
jsonStatus?.workMode === this.state.ActiveModeItem.modeType
);
console.log(
"this.state.DeviceConnectStatus",
this.state.DeviceConnectStatus
);
console.log("this.isRuning", this.isRuning);
if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
if (this.state.workMode !== jsonStatus?.workMode) {
this.setState({
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
});
}
// 判断设备是否在运行中(护理中)
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
if (this.isRuning) {
if (
this.state.DeviceConnectStatus === 1 &&
jsonStatus.workStatus !== MODE_WORKING_ENUM.END
) {
this.updateDeviceSyncData(
{
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
},
jsonStatus
);
}
}
}
break; break;
//设备对控制指令的响应 //设备对控制指令的响应
case "DeviceControl": case "DeviceControl":
console.log("设备控制响应", jsonStatus); console.log("设备控制响应", jsonStatus);
// if (jsonStatus.responseStatus == "OK") { if (jsonStatus.responseStatus == "OK") {
// console.log("发送控制指令成功"); console.log("发送控制指令成功");
// this.workJsonStatus = jsonStatus; this.workJsonStatus = jsonStatus;
// this.workStatus = jsonStatus.workStatus; this.workStatus = jsonStatus.workStatus;
// setTimeout(() => console.log("this.workStatus", this.workStatus)); setTimeout(() => console.log("this.workStatus", this.workStatus));
// this.setState({ this.setState({
// Electricity: jsonStatus.battery, Electricity: jsonStatus.battery,
// // fr200Electricity: jsonStatus.battery, matrixElectricity: jsonStatus.matrixBattery,
// matrixElectricity: jsonStatus.matrixBattery, });
// });
// 判断设备主动上报的关机事件
// // 判断设备主动上报的关机事件 if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
// if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) { // 判断id是否一致, 一致的话则生成护理报表, 并提示
// // 判断id是否一致, 一致的话则生成护理报表, 并提示 if (jsonStatus.id == this.FR200NursingHistory.id) {
// if (jsonStatus.id == this.WL200NursingHistory.id) { debounce(
// debounce( this.checkInstrumentRecord.bind(this, jsonStatus),
// this.checkInstrumentRecord.bind(this, jsonStatus), 500
// 500 );
// ); }
// } return;
// return; }
// }
if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
// if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) { this.setState({
// this.setState({ workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
// workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存 });
// });
// 判断是否在isRuning(护理中)
// // 判断是否在step == 2(护理中) // 仅当设备模式与小程序是否一致,才允许更改设备运行时间
// // 仅当设备模式与小程序是否一致,才允许更改设备运行时间 if (
// if ( this.state.DeviceConnectStatus === 1 &&
// this.state.facialMaskConnectStatus === 1 && this.isRuning == 2 &&
// this.state.step == 2 && jsonStatus.workStatus !== MODE_WORKING_ENUM.END
// jsonStatus.workStatus !== MODE_WORKING_ENUM.END ) {
// ) { this.updateDeviceSyncData(
// this.updateDeviceSyncData( {
// { totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
// totalWorkingMinutes: jsonStatus.totalWorkingMinutes, totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
// totalWorkingSeconds: jsonStatus.totalWorkingSeconds, },
// }, jsonStatus
// jsonStatus );
// ); }
// } }
// }
if (
// if ( jsonStatus.workMode === MODE_WORKING_ENUM.WORKING &&
// jsonStatus.workMode === MODE_WORKING_ENUM.WORKING && this.isRuning
// this.state.step == 2 ) {
// ) { const { ActiveModeItem } = this.state;
// const { ActiveModeItem } = this.state; const item = ActiveModeItem;
// const item = ActiveModeItem; if (jsonStatus.workMode !== item.modeType) {
// if (jsonStatus.workMode !== item.modeType) { clearTimeout(loadingTipsTimer);
// clearTimeout(loadingTipsTimer); this.setState({
// this.setState({ isShowCountdown: false,
// isShowCountdown: false, });
// }); }
// } }
// } }
// }
break; break;
//设备对信息查询指令的响应 // 设备对信息查询指令的响应
case "InfoQuery": case "InfoQuery":
console.log("设备对信息查询指令的响应 InfoQuery", jsonStatus);
switch (jsonStatus.infoQueryType) { switch (jsonStatus.infoQueryType) {
// 离线记录 // 离线记录
case "offlineClockInInfo": case "offlineClockInInfo":
@ -814,7 +865,7 @@ class IotCarePlanFR200 extends Component<any, any> {
/**监听关机事件*/ /**监听关机事件*/
onEndDevice = () => { onEndDevice = () => {
this.rmWL200NursingHistory(this.WL200NursingHistory, true); this.rmFR200NursingHistory(this.FR200NursingHistory, true);
// 判断护理时间,如果不足,则提示不足 // 判断护理时间,如果不足,则提示不足
if (!this.isCheckNurseTime()) { if (!this.isCheckNurseTime()) {
this.setState({ isNotEnoughTime: true }); this.setState({ isNotEnoughTime: true });
@ -874,7 +925,7 @@ class IotCarePlanFR200 extends Component<any, any> {
// 每次同步后,更新历史缓存 // 每次同步后,更新历史缓存
setTimeout(() => { setTimeout(() => {
this.updateWL200NursingHistory(); this.updateFR200NursingHistory(null, jsonStatus);
}, 100); }, 100);
}, },
}; };
@ -960,27 +1011,18 @@ class IotCarePlanFR200 extends Component<any, any> {
if (nowModeItem) { if (nowModeItem) {
opts.currentTime = nowCurrentTime; opts.currentTime = nowCurrentTime;
} }
// startSettingCountDown 用于标记打开了倒计时loading // 倒计时loading
if (!this.state.isShowCountdown) { // if (!this.state.isShowCountdown) {
this.setState({ // this.setState({
isShowCountdown: true, // isShowCountdown: true,
}); // });
this.setLoadingTips(CountDownTime[workMode] || 6); // this.setLoadingTips(CountDownTime[workMode] || 6);
} // }
}, },
working: () => { working: () => {
if (this.state.DeviceConnectStatus != 1) {
opts.workStatus = MODE_WORKING_ENUM.STANDBY;
this.isRuning = false;
} else if (this.isRuning === false) {
this.isRuning = false;
this.setState({
title: "正在护理",
isStopNurse: false,
});
}
this.setState({ this.setState({
title: "正在护理",
isStopNurse: false,
isShowCountdown: false, isShowCountdown: false,
hadShowBreakTips: false, hadShowBreakTips: false,
}); });
@ -1229,20 +1271,33 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
} }
/*** 护理记录 START ***/ /*** 护理记录 START ***/
/** 小程序查询护理记录 */ /** 小程序查询护理记录概要 */
getInstrumentHistoryData() { getInstrumentClockSummary() {
this.hadGotInstrumentHistoryData = true; this.hadGotInstrumentHistoryData = true;
console.log("发送指令currentMaskReportInfo 获取设备护理记录"); console.log("发送指令clockSummary 获取设备护理概要");
setTimeout(() => { setTimeout(() => {
const queryCurrentMaskReportInfoBuffer = const queryClockSummary = deviceToolKitInstance.toBleCommand({
deviceToolKitInstance.toBleCommand({ ...(fr200BleCommand.InfoQuery.clockSummary as any),
...(bleCommandSamples.queryCurrentMaskReportInfo as any), });
}); sendCommand({
value: queryClockSummary,
});
}, 1000);
}
/** 小程序查询最近一条护理详情 */
getInstrumentClockDetail() {
this.hadGotInstrumentHistoryData = true;
console.log("发送指令clockDetail 查询最近一条护理详情");
setTimeout(() => {
const queryClockSummary = deviceToolKitInstance.toBleCommand({
...(fr200BleCommand.InfoQuery.clockDetail as any),
});
sendCommand({ sendCommand({
value: queryCurrentMaskReportInfoBuffer, value: queryClockSummary,
}); });
}, 3000); }, 2000);
} }
/** /**
* @title * @title
* @description * @description
@ -1297,42 +1352,42 @@ class IotCarePlanFR200 extends Component<any, any> {
// 2.判断是否已存在缓存的护理记录:如果没有历史,则缓存 // 2.判断是否已存在缓存的护理记录:如果没有历史,则缓存
let workStatus = this.workJsonStatus.workStatus; let workStatus = this.workJsonStatus.workStatus;
let WL200NursingHistory = this.WL200NursingHistory; let FR200NursingHistory = this.FR200NursingHistory;
if (!this.WL200NursingHistory) { if (!this.FR200NursingHistory) {
console.log("小程序缓存没有数据, 忽略"); console.log("小程序缓存没有数据, 忽略");
if ( if (
workStatus == MODE_WORKING_ENUM.WORKING || workStatus == MODE_WORKING_ENUM.WORKING ||
workStatus == MODE_WORKING_ENUM.PAUSE workStatus == MODE_WORKING_ENUM.PAUSE
) { ) {
// 缓存没有数据, 要存缓存 // 缓存没有数据, 要存缓存
this.setWL200NursingHistory(jsonStatus); this.setFR200NursingHistory(jsonStatus);
} }
return; return;
} }
// 3.判断是否当天(如果不是当天,则删除记录) // 3.判断是否当天(如果不是当天,则删除记录)
if (!dayjs().isSame(WL200NursingHistory?.createDate, "day")) { if (!dayjs().isSame(FR200NursingHistory?.createDate, "day")) {
console.log("小程序缓存有数据,但是不是当天数据,忽略"); console.log("小程序缓存有数据,但是不是当天数据,忽略");
this.rmWL200NursingHistory(WL200NursingHistory); this.rmFR200NursingHistory(FR200NursingHistory);
return; return;
} }
// 仪器缓存模式,判断是否存在于现有模式中 // 仪器缓存模式,判断是否存在于现有模式中
let recordModeItem = ModeList.find((item) => { let recordModeItem = ModeList.find((item) => {
return item.id == WL200NursingHistory.currentServiceData.modeId; return item.id == FR200NursingHistory.currentServiceData.modeId;
}); });
if (!WL200NursingHistory || !recordModeItem) { if (!FR200NursingHistory || !recordModeItem) {
console.log("仪器有数据, 但是缓存没有数据, 忽略"); console.log("仪器有数据, 但是缓存没有数据, 忽略");
return; return;
} }
console.log("workStatus", workStatus); console.log("workStatus", workStatus);
console.log("jsonStatus", jsonStatus, this.workJsonStatus); console.log("jsonStatus", jsonStatus, this.workJsonStatus);
console.log("currentTime", WL200NursingHistory.currentTime); console.log("currentTime", FR200NursingHistory.currentTime);
let historyElapsedTime = let historyElapsedTime =
minSecToS(recordModeItem.modeTimeStr) - minSecToS(recordModeItem.modeTimeStr) -
minSecToS(WL200NursingHistory.currentTime); minSecToS(FR200NursingHistory.currentTime);
this.elapsedTime = this.elapsedTime =
this.elapsedTime > historyElapsedTime this.elapsedTime > historyElapsedTime
@ -1345,7 +1400,7 @@ class IotCarePlanFR200 extends Component<any, any> {
!workStatus !workStatus
) { ) {
// 判断id是否一致, 一致的话则生成护理报表 // 判断id是否一致, 一致的话则生成护理报表
if (jsonStatus.id == WL200NursingHistory.id) { if (jsonStatus.id == FR200NursingHistory.id) {
console.log("id一致, 设备没有运行/已完成/待机"); console.log("id一致, 设备没有运行/已完成/待机");
let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间 let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间
@ -1355,7 +1410,7 @@ class IotCarePlanFR200 extends Component<any, any> {
if (totalSeconds < nursingTime) { if (totalSeconds < nursingTime) {
// 护理时间不足 // 护理时间不足
this.setState({ isNotEnoughTime: true }); this.setState({ isNotEnoughTime: true });
this.rmWL200NursingHistory(WL200NursingHistory); this.rmFR200NursingHistory(FR200NursingHistory);
return; return;
} }
@ -1375,7 +1430,7 @@ class IotCarePlanFR200 extends Component<any, any> {
this.handleWorkStatus(false, "end"); this.handleWorkStatus(false, "end");
let res: any = await this.PostNursingLogClock(params); let res: any = await this.PostNursingLogClock(params);
console.log("res", res); console.log("res", res);
this.rmWL200NursingHistory(WL200NursingHistory); this.rmFR200NursingHistory(FR200NursingHistory);
} else { } else {
// ID不一致同步异常统一提交一分钟 // ID不一致同步异常统一提交一分钟
let params = { let params = {
@ -1388,14 +1443,14 @@ class IotCarePlanFR200 extends Component<any, any> {
this.handleWorkStatus(false, "end"); this.handleWorkStatus(false, "end");
let res: any = await this.PostNursingLogClock(params); let res: any = await this.PostNursingLogClock(params);
console.log("res", res); console.log("res", res);
this.rmWL200NursingHistory(WL200NursingHistory); this.rmFR200NursingHistory(FR200NursingHistory);
} }
} else { } else {
console.log("id一致, 设备运行中或暂停"); console.log("id一致, 设备运行中或暂停");
// 5.判断设备状态-运行中 // 5.判断设备状态-运行中
// 同步时间 // 同步时间
if (jsonStatus.id == WL200NursingHistory.id) { if (jsonStatus.id == FR200NursingHistory.id) {
if (WL200NursingHistory.currentTime) { if (FR200NursingHistory.currentTime) {
this.isRuning = true; this.isRuning = true;
this.resetTimer(); this.resetTimer();
} }
@ -1404,23 +1459,23 @@ class IotCarePlanFR200 extends Component<any, any> {
}; };
/** 获取小程序本地缓存的历史记录 */ /** 获取小程序本地缓存的历史记录 */
getWL200NursingHistory() { getFR200NursingHistory() {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
// 是否同步历史记录 // 是否同步历史记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory"); let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) { if (isSyncHistory) {
let ActiveModeItem = this.WL200NursingHistory.ActiveModeItem; let ActiveModeItem = this.FR200NursingHistory.ActiveModeItem;
// 直接进入开始护理状态 // 直接进入开始护理状态
this.setState({ this.setState({
isShowNurse: true, isShowNurse: true,
isShowHistoryMsg: true, isShowHistoryMsg: true,
currentServiceData: this.WL200NursingHistory.currentServiceData, currentServiceData: this.FR200NursingHistory.currentServiceData,
tempModeCurrent: ActiveModeItem, tempModeCurrent: ActiveModeItem,
ActiveModeItem: ActiveModeItem, ActiveModeItem: ActiveModeItem,
activeModeID: ActiveModeItem.id, activeModeID: ActiveModeItem.id,
ModeID: "mode_" + ActiveModeItem.id, ModeID: "mode_" + ActiveModeItem.id,
currentTime: this.WL200NursingHistory.currentTime, currentTime: this.FR200NursingHistory.currentTime,
}); });
setTimeout(() => { setTimeout(() => {
// 设置时间组合 // 设置时间组合
@ -1431,8 +1486,8 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
} }
/** 设置WL200护理历史 */ /** 设置WL200护理历史 */
setWL200NursingHistory = (jsonStatus: any) => { setFR200NursingHistory = (jsonStatus: any) => {
let { currentDevice, ActiveModeItem, ModeList } = this.state; let { currentDevice, ActiveModeItem } = this.state;
const params = { const params = {
createDate: dayjs().format("YYYY-MM-DD"), createDate: dayjs().format("YYYY-MM-DD"),
workMode: jsonStatus.workMode, workMode: jsonStatus.workMode,
@ -1445,16 +1500,16 @@ class IotCarePlanFR200 extends Component<any, any> {
jsonStatus, jsonStatus,
ActiveModeItem: this.state.ActiveModeItem, ActiveModeItem: this.state.ActiveModeItem,
}; };
this.WL200NursingHistory = JSON.parse(JSON.stringify(params)); this.FR200NursingHistory = JSON.parse(JSON.stringify(params));
Taro.setStorageSync("WL200NursingHistory", params); Taro.setStorageSync("FR200NursingHistory", params);
console.log("保存setWL200NursingHistory"); console.log("保存setFR200NursingHistory");
}; };
/** 更新WL200护理历史运行时间 */ /** 更新WL200护理历史运行时间 */
updateWL200NursingHistory = (data: any = null) => { updateFR200NursingHistory = (data: any = null, jsonStatus = null) => {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
if (this.WL200NursingHistory) { if (this.FR200NursingHistory) {
let params: any = this.WL200NursingHistory; let params: any = this.FR200NursingHistory;
// 设置当前时间 // 设置当前时间
params.currentTime = this.state.currentTime; params.currentTime = this.state.currentTime;
@ -1472,9 +1527,17 @@ class IotCarePlanFR200 extends Component<any, any> {
currentServiceData = this.state.ActiveModeItem.serviceData[0]; currentServiceData = this.state.ActiveModeItem.serviceData[0];
} }
params.currentServiceData = currentServiceData; params.currentServiceData = currentServiceData;
if (jsonStatus) {
// 缓存每秒数据
if (!params.dataArray) params.dataArray = [];
params.dataArray.push(jsonStatus);
}
} }
Taro.setStorageSync("WL200NursingHistory", params); Taro.setStorageSync("FR200NursingHistory", params);
console.log("更新updateWL200NursingHistory"); console.log("更新updateFR200NursingHistory");
} else {
this.setFR200NursingHistory(jsonStatus);
} }
}; };
/** /**
@ -1483,14 +1546,16 @@ class IotCarePlanFR200 extends Component<any, any> {
* IDID * IDID
* *
*/ */
rmWL200NursingHistory = (WL200NursingHistory, hard = false) => { rmFR200NursingHistory = (FR200NursingHistory, hard = false) => {
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
if (nowWL200NursingHistory.id == WL200NursingHistory.id) {
Taro.removeStorageSync("WL200NursingHistory"); Taro.setStorageSync("FR200Echart", nowFR200NursingHistory); // 临时保存用于观看和调试
this.WL200NursingHistory.id = ""; if (nowFR200NursingHistory.id == FR200NursingHistory.id) {
Taro.removeStorageSync("FR200NursingHistory");
this.FR200NursingHistory.id = "";
} else if (hard) { } else if (hard) {
Taro.removeStorageSync("WL200NursingHistory"); Taro.removeStorageSync("FR200NursingHistory");
this.WL200NursingHistory.id = ""; this.FR200NursingHistory.id = "";
} }
}; };
@ -1522,7 +1587,7 @@ class IotCarePlanFR200 extends Component<any, any> {
let res = await InstrumentInfo.apiClock.addClockInstrument(params); let res = await InstrumentInfo.apiClock.addClockInstrument(params);
console.log(res, "护理完成"); console.log(res, "护理完成");
this.rmWL200NursingHistory(this.WL200NursingHistory); // 护理完成,删除记录 this.rmFR200NursingHistory(this.FR200NursingHistory); // 护理完成,删除记录
if (isJump) { if (isJump) {
this.setState({ this.setState({
isShowNursingSuccess: true, isShowNursingSuccess: true,
@ -1774,15 +1839,12 @@ class IotCarePlanFR200 extends Component<any, any> {
* @returns true * @returns true
*/ */
footerIsDisabled = () => { footerIsDisabled = () => {
// 默认不禁用FR200无法禁用
let isFooterBtnDisabled = false; let isFooterBtnDisabled = false;
// if () { // this.setState({
// isFooterBtnDisabled = true; // isFooterBtnDisabled: isFooterBtnDisabled,
// } // });
this.setState({
isFooterBtnDisabled: isFooterBtnDisabled,
});
// }
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断 return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
}; };

@ -42,7 +42,7 @@ function Index({
return ( return (
<Block> <Block>
<CoverView className="iot-footer"> <View className="iot-footer">
{!isShowNurse && ( {!isShowNurse && (
<Block> <Block>
{isDisabled ? ( {isDisabled ? (
@ -124,7 +124,7 @@ function Index({
</View> </View>
</View> </View>
)} )}
</CoverView> </View>
</Block> </Block>
); );
} }

Loading…
Cancel
Save