From 382a194c4203da415bec2d387bcf373686ef915d Mon Sep 17 00:00:00 2001 From: qsj <731458905@qq.com> Date: Fri, 22 Mar 2024 17:58:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A4=E7=90=86=E6=8A=A5=E5=91=8A=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 19 +++--- .../components/Echart_face/index.tsx | 67 ++----------------- .../pages/face_report_one/face_report_one.tsx | 25 +++---- src/recoding/pages/recording/recording.tsx | 20 ++++-- 4 files changed, 40 insertions(+), 91 deletions(-) diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index e0c8748..c2e3ce5 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -1563,6 +1563,7 @@ class IotCarePlanFR200 extends Component { // 水分测试需要特殊处理 // 水分测试准备 水分测试工作 水分测试启动 if (ActiveModeItem.modeType === "moistureTest") { + let that =this sendParams.testStatus = "standby"; // 切换为准备 let waterStepList = this.state.waterStepList; let waterStepIndex = this.state.waterStepIndex; @@ -1574,16 +1575,16 @@ class IotCarePlanFR200 extends Component { timerIdSuccess = setTimeout(function () { waterStepList[waterStepIndex].finish = true; - this.setState({ + that.setState({ waterStepList, }); }, 2000); - this.setState({ + that.setState({ waterStepList, timerIdSuccess, }); }, 3000); - this.setState({ + that.setState({ isRuningTest: 2, timerIdSchedule, }); @@ -2203,18 +2204,16 @@ class IotCarePlanFR200 extends Component { "headLiftingPro", ].includes(nursingData.workMode) ) { - let obj = { - modeName: nursingData.modeName, - data: nursingData, - }; + // let obj = { + // modeName: nursingData.modeName, + // data: nursingData, + // }; let report = true; go( "/recoding/pages/face_report_one/face_report_one?id=" + id + "&report=" + - report + - "&obj=" + - JSON.stringify(obj) + report ); } else if ("moistureTest" === nursingData.workMode) { console.log("水分测试"); diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx index 7a5fb0f..b54385b 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx @@ -42,15 +42,9 @@ function Index({ default: } - // const chartRef = useRef(null); - // console.log(chartRef,'chartRefchartRef'); - - // let chartInstance = echarts.init(chartRef.current); + const echartsRef = useRef(null); - // const echartsRef = useRef< null>(null); - // let echartsRef:any = React.createRef();; - // console.log(chartRef,'echartsRefechartsRef',chartInstance); - + function generateColorArray(startColor, endColor, steps) { var startRGB = hexToRgb(startColor); var endRGB = hexToRgb(endColor); @@ -91,13 +85,13 @@ const colors = generateColorArray(startColor, endColor, steps); // const xList = [...new Array(type).fill(0).map((item, key) => key)]; let seriesData:any =[] seriesData = EchartsData?.data?.groupedAa -const xList = [...new Array(37).fill(0).map((item, key) => key)]; +const xList = [...new Array(type).fill(0).map((item, key) => key)]; // const seriesData = [ // ...xList.map((item) => { // return Math.random() * 80; // }), // ]; -let [option, setOption] = useState({ +const option: EChartOption = { grid: { // 让图表占满容器 top: "10rpx", @@ -178,40 +172,8 @@ let [option, setOption] = useState({ }, }, ], - }) - useEffect(() =>{ - setOption({...option, - - series:[ - - { - barCategoryGap: '0%', - data: [11,22,33,44,55,55], - type: "bar", - // barWidth: 15, - gapWidth: "0%", - itemStyle: { - normal: { - color: function (params) { - var value = params.data; - return new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: colors[parseInt(value)], // 红色 - }, - { - offset: 1, - color: colors[0], // 黄色 - }, - ]);; - }, - }, - }, - }, - ]}) - console.log(option,'optionoption',xList); - - },[EchartsData]) + } + // 基于 EchartsData 生成 ECharts 配置 // const option: EChartOption ={ // grid: { @@ -295,22 +257,7 @@ let [option, setOption] = useState({ // }, // ], // }; -// const chartOptions = useMemo(() => { - -// console.log(option,'optionoptionoption'); - -// return option; -// }, [EchartsData]); - - - -// // 使用 useMemo 来记住创建的 ECharts 实例 -// const chartRef = useMemo(() => { - - -// return option; -// }, []); // 空数组意味着 chartRef 仅在组件挂载时创建一次 - + return ( diff --git a/src/recoding/pages/face_report_one/face_report_one.tsx b/src/recoding/pages/face_report_one/face_report_one.tsx index 6ba154e..ea715d3 100644 --- a/src/recoding/pages/face_report_one/face_report_one.tsx +++ b/src/recoding/pages/face_report_one/face_report_one.tsx @@ -82,16 +82,16 @@ export default class Index extends Component { data["nursingId"] = ids; } let res = await InstrumentInfo.apiNursingLog.getStatisticsFace(data); - // 获取echarts数据 这个是获取接口更新echarts页面 - let res2 = await InstrumentInfo.apiNursingLog.getStatiCDE(ids); - let nursingData=JSON.parse(res2.data.data.nursingData) - let obj ={ - modeName:res2.data.data.modeName, - data:nursingData - } - this.init({ - obj:JSON.stringify(obj) - }) + // // 获取echarts数据 这个是获取接口更新echarts页面 + // let res2 = await InstrumentInfo.apiNursingLog.getStatiCDE(ids); + // let nursingData=JSON.parse(res2.data.data.nursingData) + // let obj ={ + // modeName:res2.data.data.modeName, + // data:nursingData + // } + // this.init({ + // obj:JSON.stringify(obj) + // }) if (res.data.code === 200) { this.setState({ statistics: res.data.data }); } @@ -286,7 +286,7 @@ export default class Index extends Component { reportShow: Bool }) } - // this.init(options) + this.init(options) this.getRouteId(); // this.getClockStatistics() } @@ -322,9 +322,6 @@ console.log(obj,'obj111111111111111'); ...obj.data } this.setState({recordData,modeImage,EchartsData:{...obj}}) - - - } componentDidShow() { } diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index a3b0803..2517a77 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -316,19 +316,25 @@ export default class Recording extends Component { } // 打开第一种类型 One = async (item) => { + let ids =Number(item.id) + // 获取echarts数据 这个是获取接口更新echarts页面 + let res2 = await InstrumentInfo.apiNursingLog.getStatiCDE(ids); + let nursingData=JSON.parse(res2.data.data.nursingData) + nursingData.groupedAa.push(50) + let obj ={ + modeName:res2.data.data.modeName, + data:nursingData + } + let report = false; - // let nursingData = JSON.parse(item.nursingData) - // let obj = { - // modeName: item.modeName, - // data: nursingData - // } - // console.log("打开第一种类型", item, obj); + go( "/recoding/pages/face_report_one/face_report_one?id=" + item.id + "&report=" + - report + report+ "&obj=" + + JSON.stringify(obj) ); }; // 打开第二种类型