From 226f20392f7f10cef362ac1d296cbf35e2d10389 Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Mon, 18 Mar 2024 15:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4=E7=BB=99?= =?UTF-8?q?=E5=88=AB=E7=9A=84=E5=89=8D=E7=AB=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 49 +++++++++++++++-------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index f517d81..fb50e3c 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -225,7 +225,7 @@ class IotCarePlanFR200 extends Component { nasolabialOrMandibularOutput: false, // 鼻唇或下颌输出 partition: 0, // 分割? pointOutChangeSide: false, // 交叉输出点 - impedance: 107, // 阻抗? + impedance: 107, // 阻抗/能量等级:1档<200 200<2档<280 280<3档<360 后面以此类推每加一档+80抗阻 }; /** FR200模式类型:名称 */ @@ -426,13 +426,14 @@ class IotCarePlanFR200 extends Component { /** 选中护理模式 */ modeCurrentFun = async (data, isNotCheck = false) => { + let { isShowNurse } = this.state; // 护理检查改变模式,是否提示切换护理模式 // isNotCheck为真时,不进行校验,直接切换 this.tempModeCurrent = data; // 仅在未开始护理前,切换模式的时候提示模式弹窗 // FR200默认开始护理 - if (!this.state.isShowNurse) { + if (!isShowNurse) { this.openStepTips(); } @@ -443,7 +444,6 @@ class IotCarePlanFR200 extends Component { if (isReturn) return; } - let { isShowNurse } = this.state; let currentServiceData = { startSource: "", stopSource: "", @@ -471,15 +471,13 @@ class IotCarePlanFR200 extends Component { } }); - // 如果是正在运行中切换,则直接准备运行 - if (isShowNurse) { - if (!this.footerIsDisabled()) { - this.stepNext(); // 如果切换模式,则不执行开始逻辑 - setTimeout(() => { - this.onNursingTap("switch"); - }, 800); - } - } + // 开发中,暂时允许直接切换 + // 每次切换模式时清空一下历史数据 + this.changeItemUpdateFR200NursingHistory(); + this.stepNext(); // 如果切换模式,则不执行开始逻辑 + setTimeout(() => { + this.onNursingTap("switch"); + }, 800); }; /** 设备运行中切换模式 */ modeRuningChange() { @@ -1516,7 +1514,7 @@ class IotCarePlanFR200 extends Component { instrumentName: currentDevice.name, modeId: ActiveModeItem.id, modeName: ActiveModeItem.modeName, - id: jsonStatus.id, + id: dayjs().format("YYYY-MM-DD HH:mm:ss"), neededTotalSeconds: jsonStatus.neededTotalSeconds, jsonStatus, ActiveModeItem: this.state.ActiveModeItem, @@ -1553,6 +1551,7 @@ class IotCarePlanFR200 extends Component { // 缓存每秒数据 if (!params.dataArray) params.dataArray = []; params.dataArray.push(jsonStatus); + params.jsonStatus = jsonStatus; } } Taro.setStorageSync("FR200NursingHistory", params); @@ -1561,6 +1560,13 @@ class IotCarePlanFR200 extends Component { this.setFR200NursingHistory(jsonStatus); } }; + changeItemUpdateFR200NursingHistory() { + this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); + if (this.FR200NursingHistory) { + this.FR200NursingHistory.dataArray = []; + Taro.setStorageSync("FR200NursingHistory", this.FR200NursingHistory); + } + } /** * @name 删除WL200护理历史 * @description 参数1 护理历史 参数2 强制删除 @@ -1580,10 +1586,20 @@ class IotCarePlanFR200 extends Component { } }; - /** 提交护理记录 */ + todoPromise = () => { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(); + }); + }); + }; + + /** 提交护理记录:完成护理后自动调用,会跳转页面 */ PostNursingLogClock = async (data: any = null, isJump = true) => { - let { currentDevice, ActiveModeItem } = this.state; + // todo 建议写一个Promise异步函数,用 await 执行,在提交前处理好数据 + return; + let { currentDevice, ActiveModeItem } = this.state; let params = {}; if (data) { params = data; @@ -1599,7 +1615,6 @@ class IotCarePlanFR200 extends Component { let res: any = await InstrumentInfo.apiNursingLog.addLog(params); console.log("PostNursingLogClock", res); - if (res.data.code === 200) { let params = { instrumentId: currentDevice.id, @@ -1617,7 +1632,7 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowNursingSuccess: false, }); - this.goFaceReport(); + this.goFaceReport(); // 跳转 }, 2000); } }