对接水分测试报告echarts

master
rongweikang 2 years ago
parent 2d213c6a05
commit a3a27ec2c6

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

@ -2,18 +2,17 @@ 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 { useRef } from "react";
import { useEffect, useRef } 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;
echartsData: any
}
function Index() {
function Index(echartsData: Props) {
let { gears, eDate } = echartsData.echartsData;
const echartsRef = useRef<EchartsHandle>(null);
const option: EChartOption = {
grid: {
@ -32,7 +31,7 @@ function Index() {
splitLine: {
show: true,
},
data: ['6.17', '6.18', '6.19', '6.20', '6.21', '6.22', '6.23'],
data:eDate,
axisTick: {
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 "taro-ui/dist/style/components/button.scss"; // 按需引入
import Taro from "@tarojs/taro";
import Taro, { setStorageSync } from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件
/*** redux ***/
@ -13,6 +13,7 @@ import { setMobile } from "@/store/features/userInfo";
/*** redux end ***/
import Navbar from "@/components/navbar/navbar";
import Echarts from "./Echarts/index";
import "./moisture_test_report.less";
class MoistureTestReport extends Component<any, any> {
@ -40,7 +41,9 @@ class MoistureTestReport extends Component<any, any> {
imglist: [],
id: 0,
show: false,
modeId: 0
modeId: 0,
echartsData: {},
showEcharts: false
};
}
@ -54,11 +57,9 @@ class MoistureTestReport extends Component<any, any> {
componentDidHide() { }
onLoad(option) {
console.log(option.data);
console.log(option);
let data = JSON.parse(option.data)
console.log(data);
let { reportData } = this.state
reportData.curDate = option.date
data.GearData.map(item => {
@ -78,18 +79,10 @@ class MoistureTestReport extends Component<any, any> {
}
})
this.setState({ reportData, modeId: option.modeId });
this.moistureTest(option.id, reportData.curDate)
this.setState({ reportData, modeId: option.modeId, echartsData: JSON.parse(option.echartsData) });
// this.moistureTest(option.id, reportData.curDate)
}
async initData() { }
async moistureTest(id, curDate) {
let data = {
queryDate: curDate,
instrumentId: id
}
let res = await InstrumentInfo.fr200.moistureTest(data);
}
toIndex() {
Taro.reLaunch({ url: "/pages/index/index" });
@ -99,7 +92,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, echartsData, showEcharts } = this.state
const getStatusData = (level) => {
var bgCssData = {
@ -263,9 +256,9 @@ class MoistureTestReport extends Component<any, any> {
</View>
<View className='report_chart'>
<View className='chart_title common_title'></View>
<View className='chart_title common_title'></View>
<View className='container'>
<Echarts></Echarts>
<Echarts echartsData={echartsData}></Echarts>
</View>
</View>
@ -310,7 +303,7 @@ class MoistureTestReport extends Component<any, any> {
</View>
</View>
</Block>
</Block >
);
}
}

@ -337,8 +337,51 @@ 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}&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) => {
console.log("打开其他类型", item);

Loading…
Cancel
Save