diff --git a/src/components/bluetoot/connection/index.tsx b/src/components/bluetoot/connection/index.tsx index 16753da..c4b5df8 100644 --- a/src/components/bluetoot/connection/index.tsx +++ b/src/components/bluetoot/connection/index.tsx @@ -117,11 +117,11 @@ class ConnectionBluetoot extends Component { // WL200匹配 tranType: [ - "WE100", // 发箍 - "WE200", // 发箍 - "WL200", // 面罩 - "12CAA", // 面罩前缀名 - "FR200", // FR200 + // "WE100", // 发箍 + // "WE200", // 发箍 + // "WL200", // 面罩 + // "12CAA", // 面罩前缀名 + // "FR200", // FR200 ], currentDeviceType: "", // 现在的设备类型: WE200 WL200 @@ -319,14 +319,15 @@ class ConnectionBluetoot extends Component { /** 4.蓝牙查找 */ onBluetoothDeviceFound() { Taro.onBluetoothDeviceFound((item: any) => { - console.log("蓝牙查找item", item, item.devices[0].name); - console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name); - console.log(">>>>>>>当前传入设备类型>>>>>", this.props.deviceInfo.model); - // 先匹配到哪个连接哪个 - let tranType = [ - this.props.deviceInfo.model, // 当前传入设备类型 - ...this.state.tranType, - ]; + let model = this.props.deviceInfo.model; // 限制只匹配当前传入的设备类型 + // 匹配数组:先匹配到哪个连接哪个 + let tranType: string[] = []; + // 判断条件随着设备的增加而增加 + if (model === "WL200") { + tranType = ["WL200", "WE200", "WE100", "12CAA"]; + } else if (model === "FR200") { + tranType = ["FR200"]; + } for (let i = 0; i < item.devices.length; i++) { let devicesName = item.devices[i].localName || item.devices[i].name; // 是否匹配可连接设备 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); } } diff --git a/src/moduleIOT/pages/iotCarePlan/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/WL200.tsx index c02f734..3444020 100644 --- a/src/moduleIOT/pages/iotCarePlan/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WL200.tsx @@ -11,8 +11,8 @@ import React, { useRef, } from "react"; -import Echarts from "./components/Echart/index"; -import EchartFace from "./components/Echart_face/index"; +// import Echarts from "./components/Echart/index"; +// import EchartFace from "./components/Echart_face/index"; import { Block, View, @@ -378,9 +378,12 @@ class IotCarePlanWL200 extends Component { let res = await InstrumentInfo.modeInfoList(params); if (res.data.code === 200) { if (res.data.data.length > 0) { + this.tempModeCurrent = res.data.data[0]; this.setState({ ActiveModeItem: res.data.data[0], ModeList: res.data.data, + activeModeID: res.data.data[0].id, + ModeID: "mode_" + res.data.data[0].id, }); // setTimeout(() => { @@ -458,9 +461,16 @@ class IotCarePlanWL200 extends Component { currentServiceData, ModeStepIndex: 0, currentTime, - ModeType: modeArray[data.modeClass], + // ModeType: modeArray[data.modeClass], }); + // 只有点击过开始,才隐藏其他模式类型 + if (isShowNurse) { + this.setState({ + ModeType: modeArray[data.modeClass], + }); + } + setTimeout(() => { // 设置时间组合 if (data.serviceData.length > 0) { @@ -2271,7 +2281,7 @@ class IotCarePlanWL200 extends Component { onTimeUpdate={this.GetVideosTime} /> )} - + {/* */} {/* */} {/* */} {isShowNurse && ( @@ -2340,8 +2350,8 @@ class IotCarePlanWL200 extends Component { /> )} - - + {/* + */}