master
rongweikang 2 years ago
parent 9a0e253ba0
commit 57c2834de2

@ -192,7 +192,9 @@ class IotCarePlanFR200 extends Component<any, any> {
// isFirstEntryMode: false, // 模式首次打开
isShowHistoryMsg: false, // 是否显示正在同步历史
showEcharts: false
showEcharts: false,
echartsData: '' //传给echarts图表的数据
};
}
@ -634,10 +636,22 @@ class IotCarePlanFR200 extends Component<any, any> {
});
};
look() {
this.setState({ showEcharts: !this.state.showEcharts });
let that = this
// this.setState({ showEcharts: !this.state.showEcharts });
let stop = 0
let time = setInterval(function () {
stop++
let random = Math.random();
that.setState({ echartsData: random })
if (stop >= 20) {
clearInterval(time)
}
}, 1000)
}
updata() {
}
// 绘制能量图
@ -1565,6 +1579,7 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("保存setFR200NursingHistory");
};
/** 更新WL200护理历史运行时间 */
updateFR200NursingHistory = (data: any = null, jsonStatus = null) => {
this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
@ -1593,6 +1608,8 @@ class IotCarePlanFR200 extends Component<any, any> {
if (!params.dataArray) params.dataArray = [];
params.dataArray.push(jsonStatus);
params.jsonStatus = jsonStatus;
}
}
Taro.setStorageSync("FR200NursingHistory", params);
@ -1601,7 +1618,7 @@ class IotCarePlanFR200 extends Component<any, any> {
// 基础模式可在这里调用函数更新图标Echarts
// 最新一条数据jsonStatus
// 注意事项只拿working状态
// todo
// todo
} else {
this.setFR200NursingHistory(jsonStatus);
}
@ -2092,7 +2109,8 @@ class IotCarePlanFR200 extends Component<any, any> {
isShowHistoryMsg,
isModeLock,
TestModeStepIndex,
showEcharts
showEcharts,
echartsData
} = this.state;
return (
@ -2326,7 +2344,7 @@ class IotCarePlanFR200 extends Component<any, any> {
<button onClick={this.updata.bind(this)} > </button>
<View className={classnames({ 'show': showEcharts })}><Echarts></Echarts></View>
<View className={classnames({ 'show': showEcharts })}><Echarts data={echartsData} ></Echarts></View>
{/* {(ActiveModeItem.modeType === "face" ||
ActiveModeItem.modeType === "eyes") && <Echarts></Echarts>} */}

@ -2,25 +2,23 @@ import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Block, View, Image, Text, Input } from "@tarojs/components";
import { Popup, Progress, Slider } from "@antmjs/vantui";
import { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState, useCallback } from "react";
import Echarts, { EChartOption, EchartsHandle } from "taro-react-echarts";
import echarts from "@/utils/echarts.min.js";
import "./index.less";
interface Props {
Electricity: any;
matrixElectricity: any;
facialMaskConnectStatus: any;
data: any
}
function Index() {
function Index({ data }: Props) {
const buttonRef = useRef(null);
const echartsRef = useRef<EchartsHandle>(null);
const [options, setOptions] = useState({
animation:false,
animation: false,
grid: {
// 让图表占满容器
top: "28rpx",
@ -262,47 +260,78 @@ function Index() {
const level = [8, 7, 6, 5, 4, 3, 2];
const [newOptions, setNewOptions] = useState(options)
const full = () => {
const [newData, setNewData] = useState(0)
const full = useCallback(() => {
// let box = document.getElementById("box");
// box?.classList.add('fullscreen')
let stop = 0
let time = setInterval(function () {
stop++
let option = JSON.parse(JSON.stringify(options))
let num = Math.floor(Math.random() * 9)
let count = 0
options.series.map(item => {
if (item.type === 'line') {
item.data.splice(0, 1)
item.data.push(num)
}
if (item.type === 'bar') {
count++
item.data.splice(0, 1)
if (count <= num) {
item.data.push(1)
} else {
item.data.push(0)
}
// let time = setInterval(function () {
// stop++
let option = JSON.parse(JSON.stringify(options))
let num = Math.floor(Math.random() * 9)
let count = 0
options.series.map(item => {
if (item.type === 'line') {
item.data.splice(0, 1)
item.data.push(num)
}
if (item.type === 'bar') {
count++
item.data.splice(0, 1)
if (count <= num) {
item.data.push(1)
} else {
item.data.push(0)
}
})
console.log(option);
// 更新图表数据
setNewOptions(option)
if (stop > 10) {
clearInterval(time)
}
}, 1000)
})
console.log(option);
}
// 更新图表数据
setNewOptions(option)
// if (stop > 20) {
// clearInterval(time)
// }
// }, 1000)
}, [data])
useEffect(() => {
setOptions(newOptions)
}, [newOptions]); // 当 someProp 变化时执行
}, [newOptions]);
useEffect(() => {
setNewData(data)
}, [data]);
useEffect(() => {
let option = JSON.parse(JSON.stringify(options))
let num = Math.floor(newData * 9)
let count = 0
options.series.map(item => {
if (item.type === 'line') {
item.data.splice(0, 1)
item.data.push(num)
}
if (item.type === 'bar') {
count++
item.data.splice(0, 1)
if (count <= num) {
item.data.push(1)
} else {
item.data.push(0)
}
}
})
console.log(option, data);
// 更新图表数据
setNewOptions(option)
}, [newData])
// 当 someProp 变化时执行
// const quanping = () => {
// T.setPageOrientation({
// orientation: "portrait",
@ -315,6 +344,7 @@ function Index() {
// },
return (
<Block>
<View id='box' className='box'>
@ -328,7 +358,7 @@ function Index() {
style={{ width: "630rpx", height: "260rpx", zIndex: 1 }}
/>
<View className='box_background'>
<Image className='full' src={require("@/img/full-scran.png")} onClick={full}></Image>
<Image className='full' ref={buttonRef} src={require("@/img/full-scran.png")} onClick={full}></Image>
<View className='power'></View>
{level.map((item) => (
<View className='line' key={item}>

@ -1,6 +1,7 @@
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { go } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import Taro from "@tarojs/taro";
@ -34,6 +35,7 @@ class MoistureTestReport extends Component<any, any> {
rightFace: 0
}
},
instrumentId: 0,
isClock: false,
xinde: '',
imglist: [],
@ -72,9 +74,19 @@ class MoistureTestReport extends Component<any, any> {
reportData.shuifenGear.rightFace = gear
}
})
this.setState({ reportData, modeId: option.modeId });
this.setState({ reportData, modeId: option.modeId, instrumentId: option.id });
this.moistureTest()
}
async initData() { }
async moistureTest() {
let data = {
queryDate: this.state.reportData.curDate,
instrumentId: this.state.instrumentId
}
let res = await InstrumentInfo.fr200.moistureTest(data);
}
toIndex() {
Taro.reLaunch({ url: "/pages/index/index" });
}
@ -83,7 +95,7 @@ class MoistureTestReport extends Component<any, any> {
}
render() {
let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show, modeId } = this.state
let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show, modeId, instrumentId } = this.state
const getStatusData = (level) => {
var bgCssData = {

@ -299,8 +299,8 @@ export default class Recording extends Component<any, any> {
setStorageSync("instrument_detail", instrument);
}
})
if ([1,2,3,4,5].includes(item.jumpType)) {
if ([1, 2, 3, 4, 5].includes(item.jumpType)) {
this.One(item);
} else if (item.jumpType === 0) {
this.two(item);
@ -309,26 +309,26 @@ export default class Recording extends Component<any, any> {
} else {
this.AllDevice(item);
}
// let report =false
// go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report );
}
// 打开第一种类型
One = async (item) => {
let report = false;
let nursingData=JSON.parse(item.nursingData)
let obj ={
modeName:item.modeName,
data:nursingData
let nursingData = JSON.parse(item.nursingData)
let obj = {
modeName: item.modeName,
data: nursingData
}
console.log("打开第一种类型", item,obj);
console.log("打开第一种类型", item, obj);
go(
"/recoding/pages/face_report_one/face_report_one?id=" +
item.id +
"&report=" +
report+ "&obj=" +
JSON.stringify(obj)
item.id +
"&report=" +
report + "&obj=" +
JSON.stringify(obj)
);
};
// 打开第二种类型
@ -337,7 +337,7 @@ export default class Recording extends Component<any, any> {
};
// 打开第三种类型
three = async (item) => {
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}`);
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}&id=${item.instrumentId}`);
};
// 打开其他类型
AllDevice = async (item) => {

@ -415,6 +415,15 @@ export const InstrumentInfo = {
});
},
},
fr200:{
// 查询用户FR200水分报告护理记录
moistureTest: (data) => {
return Ajax({
url: "/nursingLog/record/fr200/moistureTest" + paramsToUrlQueryString(data),
method: "get",
});
},
}
};
//localhost:9204/instrument/getInstrumentInfoBySerial

Loading…
Cancel
Save