diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index c2e3ce5..98f6e4f 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -290,9 +290,9 @@ class IotCarePlanFR200 extends Component { this.getInstrumentClockSummary(); this.getInstrumentClockDetail(); } - componentDidMount() {} + componentDidMount() { } - componentWillUnmount() {} + componentWillUnmount() { } componentDidShow() { console.log("页面显示了"); @@ -660,8 +660,8 @@ class IotCarePlanFR200 extends Component { }); // return; let { currentDevice, ActiveModeItem } = this.state; - let params:any = {}; - + let params: any = {}; + params = { instrumentId: currentDevice.id, instrumentName: currentDevice.name, @@ -672,14 +672,14 @@ class IotCarePlanFR200 extends Component { GearData: [...waterStepList], }) }; - + // params = { ...params, ...nursingData }; let res: any = await InstrumentInfo.apiNursingLog.addLog( JSON.stringify( params ) ); - setTimeout(async() => { + setTimeout(async () => { this.setState({ isShowNursingSuccess: false, }); @@ -688,13 +688,55 @@ class IotCarePlanFR200 extends Component { let year = date.getFullYear(); let month = (date.getMonth() + 1).toString().padStart(2, '0'); let day = date.getDate().toString().padStart(2, '0'); - + let formattedDate = `${year}.${month}.${day}`; - - go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${params.nursingData}&date=${formattedDate}&modeId=${ActiveModeItem.id}&id=${currentDevice.id}`); + this.moistureTest(params.nursingData, formattedDate, ActiveModeItem.id, currentDevice.id) }, 2000); }; + async moistureTest(nursingData, formattedDate, ActiveModeItemId, currentDeviceId) { + let data = { + queryDate: formattedDate, + instrumentId: currentDeviceId + } + let res = await InstrumentInfo.fr200.moistureTest(data); + let echartsData = res.data.rows + for (let i = 0; i < echartsData.length; i++) { + for (let j = i + 1; j < echartsData.length; j++) { + if (echartsData[i].createTime.split(' ')[0] == echartsData[j].createTime.split(' ')[0]) { + let result = Date.parse(echartsData[i].createTime) - Date.parse(echartsData[j].createTime) + if (result < 0) { + echartsData.splice(i, 1) + } else { + echartsData.splice(j, 1) + } + } + } + } + let gears: any = [] + let eDate: any = [] + echartsData.map(item => { + const result = item.createTime.split(' ')[0].substring(5); + eDate.push(result) + item.nursingData = JSON.parse(item.nursingData) + let level: any = 0 + item.nursingData.GearData.map(gear => { + level = level + gear.forehead + }) + level = Math.floor(level / 3) + gears.push(level) + }) + echartsData = { + gears, eDate + } + setStorageSync('moistureEachtsData', JSON.stringify(echartsData)) + + // go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${allData.nursingData}&date=${allData.createTime}&modeId=${allData.modeId}&id=${allData.instrumentId}&echartsData=${JSON.stringify(echartsData)}`); + go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${nursingData}&date=${formattedDate}&modeId=${ActiveModeItemId}&id=${currentDeviceId}&echartsData=${JSON.stringify(echartsData)}`); + + } + + /** * @name 不可切换光照提示 * @description 检测紧贴肌肤 @@ -720,10 +762,10 @@ class IotCarePlanFR200 extends Component { } }, 1000); } - updata() {} + updata() { } // 绘制能量图 - drawProwerPicture() {} + drawProwerPicture() { } /** 切换光照 */ onSwitchChange = async () => { @@ -1313,7 +1355,7 @@ class IotCarePlanFR200 extends Component { * @description 步骤+1并设置视频 */ waterTestNext(index) { - let ActiveModeItem =this.state.ActiveModeItem + let ActiveModeItem = this.state.ActiveModeItem if (index === 0 && ActiveModeItem.stepOneVideo) { this.VideoSrcLoad(ActiveModeItem.stepOneVideo); } else if (index === 1 && ActiveModeItem.stepTwoVideo) { @@ -1563,7 +1605,7 @@ class IotCarePlanFR200 extends Component { // 水分测试需要特殊处理 // 水分测试准备 水分测试工作 水分测试启动 if (ActiveModeItem.modeType === "moistureTest") { - let that =this + let that = this sendParams.testStatus = "standby"; // 切换为准备 let waterStepList = this.state.waterStepList; let waterStepIndex = this.state.waterStepIndex; @@ -1970,8 +2012,8 @@ class IotCarePlanFR200 extends Component { // 脸部one todoPromise = async () => { const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); - console.log(nowFR200NursingHistory,'nowFR200NursingHistory'); - + console.log(nowFR200NursingHistory, 'nowFR200NursingHistory'); + // 护理脸部 if (nowFR200NursingHistory.jsonStatus.workMode === "face") { // 把working=工作中的状态数据筛选出来 @@ -2036,7 +2078,7 @@ class IotCarePlanFR200 extends Component { }; return nursingData; - } + } }; // 计算挡位 @@ -2211,9 +2253,9 @@ class IotCarePlanFR200 extends Component { let report = true; go( "/recoding/pages/face_report_one/face_report_one?id=" + - id + - "&report=" + - report + id + + "&report=" + + report ); } else if ("moistureTest" === nursingData.workMode) { console.log("水分测试"); @@ -2221,9 +2263,9 @@ class IotCarePlanFR200 extends Component { let report = true; go( "/recoding/pages/face_report/face_report?id=" + - this.state.currentDevice.id+ - "&report=" + - report + this.state.currentDevice.id + + "&report=" + + report ); // go( // "/recoding/pages/face_report/face_report?id=" + @@ -2540,9 +2582,9 @@ class IotCarePlanFR200 extends Component { deviceInfo={currentDevice} close={this.connectionClose} isDisconnect={!isConnectionBlutoot} - offlineChange={() => {}} + offlineChange={() => { }} pairingChange={this.pairingChange} - upgradeFun={() => {}} + upgradeFun={() => { }} /> )} @@ -2625,12 +2667,12 @@ class IotCarePlanFR200 extends Component { {(ActiveModeItem.modeType === "maskPenetration" || ActiveModeItem.modeType === "essence") && ( - - )} + + )} {ActiveModeItem.modeType === "moistureTest" && (