对接水分测试报告echarts

master
rongweikang 2 years ago
parent 2d213c6a05
commit a3a27ec2c6

@ -1,9 +1,9 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from "@antmjs/vantui"; import { Progress , Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import { showModal } from "../../../utils/traoAPI"; import { showModal } from "../../../utils/traoAPI";
import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import { import {
Block, View, Text, Image, Input, Button, Textarea, Block, View, Text, Image, Input, Button, Textarea,
} from "@tarojs/components"; } from "@tarojs/components";
@ -125,9 +125,6 @@ export default class Index extends Component<any, any> {
}).then(() => { }).then(() => {
let data = new Date let data = new Date
Taro.setStorageSync('DayTime', data.toISOString()) Taro.setStorageSync('DayTime', data.toISOString())
this.setState({
clockShow: true
})
this.getClockStatistics(); this.getClockStatistics();
this.setShow(false); this.setShow(false);
@ -280,25 +277,25 @@ delImg(i) {
let { name, statistics, recordList, recordData, show,clockStatistics,punchInInfo,monthTime,reportShow } = this.state; let { name, statistics, recordList, recordData, show,clockStatistics,punchInInfo,monthTime,reportShow } = this.state;
return ( return (
<Block> <Block>
<Navbar isBack titleSlot="护理报告"></Navbar> <Navbar isBack titleSlot='护理报告'></Navbar>
<View className="statistic m-x-30 flex aitems"> <View className='statistic m-x-30 flex aitems'>
<View className="statistic_item"> <View className='statistic_item'>
<View className="statistic_title"> <View className='statistic_title'>
<text>{statistics.nursingNum}</text> <text>{statistics.nursingNum}</text>
<text className="num"></text> <text className='num'></text>
</View> </View>
<View className="statistic_desc"></View> <View className='statistic_desc'></View>
</View> </View>
<View className="statistic_item"> <View className='statistic_item'>
<View className="statistic_title">{statistics.nursingTime}</View> <View className='statistic_title'>{statistics.nursingTime}</View>
<View className="statistic_desc"></View> <View className='statistic_desc'></View>
</View> </View>
{/* </block> */} {/* </block> */}
</View> </View>
<View className="main m-x-30"> <View className='main m-x-30'>
<View className="products_item" style="border: none"> <View className='products_item' style='border: none'>
<View className="products_top flex aitems"> <View className='products_top flex aitems'>
<View className="add_time">{recordData.createTime}</View> <View className='add_time'>{recordData.createTime}</View>
<View <View
className={classnames("tag", { className={classnames("tag", {
tag_active: recordData.online === 2, tag_active: recordData.online === 2,
@ -307,23 +304,23 @@ delImg(i) {
{recordData.online == 1 ? "在线" : "离线"} {recordData.online == 1 ? "在线" : "离线"}
</View> </View>
</View> </View>
<View className="products_middle flex"> <View className='products_middle flex'>
<Image <Image
className="cover" className='cover'
src={recordData.modeImage} src={recordData.modeImage}
mode="aspectFill" mode='aspectFill'
></Image> ></Image>
<View className="content"> <View className='content'>
<View className="content_top"> <View className='content_top'>
<View className="title">{recordData.instrumentName}</View> <View className='title'>{recordData.instrumentName}</View>
<View className="desc_box"> <View className='desc_box'>
<View className="desc">{recordData.modeName}</View> <View className='desc'>{recordData.modeName}</View>
<View className="desc"> <View className='desc'>
{recordData.nursingTime} {recordData.nursingTime}
</View> </View>
</View> </View>
</View> </View>
<View className="progress"> <View className='progress'>
<Progress <Progress
percentage={ percentage={
@ -331,10 +328,10 @@ delImg(i) {
? 100 ? 100
: recordData.completionPercentage * 100 : recordData.completionPercentage * 100
} }
strokeWidth="12" strokeWidth='12'
color="linearGradient(to right, #eecda1, #ffe9c7) !important" color='linearGradient(to right, #eecda1, #ffe9c7) !important'
/> />
<View className="percent"> <View className='percent'>
{" "} {" "}
{recordData.completionPercentage * 100 > 100 {recordData.completionPercentage * 100 > 100
? 100 ? 100
@ -345,11 +342,11 @@ delImg(i) {
</View> </View>
</View> </View>
</View> </View>
<View className="main_title"></View> <View className='main_title'></View>
{recordList.map((item) => ( {recordList.map((item) => (
<View className="products_item" style="border: none" key={item.id}> <View className='products_item' style='border: none' key={item.id}>
<View className="products_top flex aitems"> <View className='products_top flex aitems'>
<View className="add_time">{item.createTime}</View> <View className='add_time'>{item.createTime}</View>
<View <View
className={classnames("tag", { className={classnames("tag", {
tag_active: item.online === 2, tag_active: item.online === 2,
@ -358,21 +355,21 @@ delImg(i) {
{item.online == 1 ? "在线" : "离线"} {item.online == 1 ? "在线" : "离线"}
</View> </View>
</View> </View>
<View className="products_middle flex"> <View className='products_middle flex'>
<Image <Image
className="cover" className='cover'
src={item.modeImage} src={item.modeImage}
mode="aspectFill" mode='aspectFill'
></Image> ></Image>
<View className="content"> <View className='content'>
<View className="content_top"> <View className='content_top'>
<View className="title">{item.instrumentName}</View> <View className='title'>{item.instrumentName}</View>
<View className="desc_box"> <View className='desc_box'>
<View className="desc">{item.modeName}</View> <View className='desc'>{item.modeName}</View>
<View className="desc">{item.nursingTime}</View> <View className='desc'>{item.nursingTime}</View>
</View> </View>
</View> </View>
<View className="progress"> <View className='progress'>
<Progress <Progress
percentage={ percentage={
@ -380,10 +377,10 @@ delImg(i) {
? 100 ? 100
: item.completionPercentage * 100 : item.completionPercentage * 100
} }
strokeWidth="12" strokeWidth='12'
color="linearGradient(to right, #eecda1, #ffe9c7) !important" color='linearGradient(to right, #eecda1, #ffe9c7) !important'
/> />
<View className="percent"> <View className='percent'>
{" "} {" "}
{item.completionPercentage * 100 > 100 {item.completionPercentage * 100 > 100
? 100 ? 100
@ -397,76 +394,76 @@ delImg(i) {
))} ))}
</View> </View>
{reportShow ? ( {reportShow ? (
<View className="footer flex aitems"> <View className='footer flex aitems'>
<View className="btn" onClick={this.setShow.bind(this, true)}></View> <View className='btn' onClick={this.setShow.bind(this, true)}></View>
<View className="text flex aitems"> <View className='text flex aitems'>
<View onClick={this.GoIndex}></View> <View onClick={this.GoIndex}></View>
<Image <Image
src={require("@/img/right.png")} src={require("@/img/right.png")}
mode="aspectFill" mode='aspectFill'
></Image> ></Image>
</View> </View>
</View> </View>
): null} ): null}
<Popup show={show} onClose={() => this.setState({ show: false })}> <Popup show={show} onClose={() => this.setState({ show: false })}>
<View className="popBox"> <View className='popBox'>
<Image <Image
className="close_icon" className='close_icon'
src={require("@/img/close.png")} src={require("@/img/close.png")}
mode="widthFix" mode='widthFix'
onClick={this.setShow.bind(this, false)} onClick={this.setShow.bind(this, false)}
></Image> ></Image>
<View className="popTitle"></View> <View className='popTitle'></View>
<View className="popSubtitle"> <View className='popSubtitle'>
<View className="bold">{clockStatistics[0]?.clockNum}</View>{" "} <View className='bold'>{clockStatistics[0]?.clockNum}</View>{" "}
<View className="bold"> <View className='bold'>
{(clockStatistics[0]?.percentage * 100).toFixed(1)}% {(clockStatistics[0]?.percentage * 100).toFixed(1)}%
</View> </View>
</View> </View>
<View className="img_box"> <View className='img_box'>
{punchInInfo.clockImageList.map((item, index) => ( {punchInInfo.clockImageList.map((item, index) => (
<View key={item} className="img"> <View key={item} className='img'>
<Image className="showImg" src={item} mode="widthFix"></Image> <Image className='showImg' src={item} mode='widthFix'></Image>
<Image <Image
className="closeImg" className='closeImg'
src={require("@/img/close1.png")} src={require("@/img/close1.png")}
mode="widthFix" mode='widthFix'
onClick={this.delImg.bind(this, index)} onClick={this.delImg.bind(this, index)}
></Image> ></Image>
</View> </View>
))} ))}
{punchInInfo.clockImageList.length < 3 && ( {punchInInfo.clockImageList.length < 3 && (
<View <View
className="addBox" className='addBox'
onClick={this.handleChooseImage.bind(this)} onClick={this.handleChooseImage.bind(this)}
> >
<Image <Image
className="showImg" className='showImg'
src={require("@/img/clock_in_upload/add-image.png")} src={require("@/img/clock_in_upload/add-image.png")}
mode="widthFix" mode='widthFix'
></Image> ></Image>
</View> </View>
)} )}
</View> </View>
<View className="info4"> <View className='info4'>
<View className="content"> <View className='content'>
<Textarea <Textarea
placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;" placeholderStyle='color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;'
placeholder="请记录一下今天的护理心得吧" placeholder='请记录一下今天的护理心得吧'
maxlength={120} maxlength={120}
onInput={this.handleTextareaInput.bind(this)} onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent} value={punchInInfo.clockContent}
></Textarea> ></Textarea>
</View> </View>
<View className="tip"> <View className='tip'>
{"" + (punchInInfo.clockContent.length || 0) + "/120"} {"" + (punchInInfo.clockContent.length || 0) + "/120"}
</View> </View>
</View> </View>
<View className="popbtnbox flex aitems jcenter"> <View className='popbtnbox flex aitems jcenter'>
<View className="btn1" onClick={this.submit.bind(this)}> <View className='btn1' onClick={this.submit.bind(this)}>
</View> </View>
</View> </View>

@ -2,18 +2,17 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Block, View, Image, Text, Input } from "@tarojs/components"; import { Block, View, Image, Text, Input } from "@tarojs/components";
import { Popup, Progress, Slider } from "@antmjs/vantui"; import { Popup, Progress, Slider } from "@antmjs/vantui";
import { useRef } from "react"; import { useEffect, useRef } from "react";
import Echarts, { EChartOption, EchartsHandle } from "taro-react-echarts"; import Echarts, { EChartOption, EchartsHandle } from "taro-react-echarts";
import echarts from "@/utils/echarts.min.js"; import echarts from "@/utils/echarts.min.js";
import "./index.less"; import "./index.less";
interface Props { interface Props {
Electricity: any; echartsData: any
matrixElectricity: any;
facialMaskConnectStatus: any;
} }
function Index() { function Index(echartsData: Props) {
let { gears, eDate } = echartsData.echartsData;
const echartsRef = useRef<EchartsHandle>(null); const echartsRef = useRef<EchartsHandle>(null);
const option: EChartOption = { const option: EChartOption = {
grid: { grid: {
@ -32,7 +31,7 @@ function Index() {
splitLine: { splitLine: {
show: true, show: true,
}, },
data: ['6.17', '6.18', '6.19', '6.20', '6.21', '6.22', '6.23'], data:eDate,
axisTick: { axisTick: {
show: false show: false
}, },
@ -76,7 +75,7 @@ function Index() {
} }
]) ])
}, },
data: [5, 3, 4, 6, 3, 4, 3], data: gears,
} }
] ]
}; };

@ -4,7 +4,7 @@ import { go } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface"; import { InstrumentInfo } from "@/utils/Interface";
import "taro-ui/dist/style/components/button.scss"; // 按需引入 import "taro-ui/dist/style/components/button.scss"; // 按需引入
import Taro from "@tarojs/taro"; import Taro, { setStorageSync } from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件 // 引入 Swiper, SwiperItem 组件
/*** redux ***/ /*** redux ***/
@ -13,6 +13,7 @@ import { setMobile } from "@/store/features/userInfo";
/*** redux end ***/ /*** redux end ***/
import Navbar from "@/components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
import Echarts from "./Echarts/index"; import Echarts from "./Echarts/index";
import "./moisture_test_report.less"; import "./moisture_test_report.less";
class MoistureTestReport extends Component<any, any> { class MoistureTestReport extends Component<any, any> {
@ -40,7 +41,9 @@ class MoistureTestReport extends Component<any, any> {
imglist: [], imglist: [],
id: 0, id: 0,
show: false, show: false,
modeId: 0 modeId: 0,
echartsData: {},
showEcharts: false
}; };
} }
@ -54,11 +57,9 @@ class MoistureTestReport extends Component<any, any> {
componentDidHide() { } componentDidHide() { }
onLoad(option) { onLoad(option) {
console.log(option.data); console.log(option);
let data = JSON.parse(option.data) let data = JSON.parse(option.data)
console.log(data);
let { reportData } = this.state let { reportData } = this.state
reportData.curDate = option.date reportData.curDate = option.date
data.GearData.map(item => { data.GearData.map(item => {
@ -78,18 +79,10 @@ class MoistureTestReport extends Component<any, any> {
} }
}) })
this.setState({ reportData, modeId: option.modeId }); this.setState({ reportData, modeId: option.modeId, echartsData: JSON.parse(option.echartsData) });
this.moistureTest(option.id, reportData.curDate) // this.moistureTest(option.id, reportData.curDate)
} }
async initData() { } async initData() { }
async moistureTest(id, curDate) {
let data = {
queryDate: curDate,
instrumentId: id
}
let res = await InstrumentInfo.fr200.moistureTest(data);
}
toIndex() { toIndex() {
Taro.reLaunch({ url: "/pages/index/index" }); Taro.reLaunch({ url: "/pages/index/index" });
@ -99,7 +92,7 @@ class MoistureTestReport extends Component<any, any> {
} }
render() { 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, echartsData, showEcharts } = this.state
const getStatusData = (level) => { const getStatusData = (level) => {
var bgCssData = { var bgCssData = {
@ -263,9 +256,9 @@ class MoistureTestReport extends Component<any, any> {
</View> </View>
<View className='report_chart'> <View className='report_chart'>
<View className='chart_title common_title'></View> <View className='chart_title common_title'></View>
<View className='container'> <View className='container'>
<Echarts></Echarts> <Echarts echartsData={echartsData}></Echarts>
</View> </View>
</View> </View>
@ -310,7 +303,7 @@ class MoistureTestReport extends Component<any, any> {
</View> </View>
</View> </View>
</Block> </Block >
); );
} }
} }

@ -337,8 +337,51 @@ export default class Recording extends Component<any, any> {
}; };
// 打开第三种类型 // 打开第三种类型
three = async (item) => { three = async (item) => {
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}&id=${item.instrumentId}`); this.moistureTest(item)
}; };
async moistureTest(allData) {
let data = {
queryDate: allData.createTime,
instrumentId: allData.instrumentId
}
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)}`);
}
// 打开其他类型 // 打开其他类型
AllDevice = async (item) => { AllDevice = async (item) => {
console.log("打开其他类型", item); console.log("打开其他类型", item);

Loading…
Cancel
Save