临时提交

master
blak-kong 2 years ago
parent 479306b979
commit 7ce4b95528

@ -0,0 +1,14 @@
.popup-status-title {
margin-bottom: 50rpx;
}
.popup-status-box {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
margin: 0 auto;
margin-bottom: 50rpx;
.popup-status {
width: 100%;
height: 100%;
}
}

@ -0,0 +1,159 @@
import classnames from "classnames";
import { Component } from "react";
import {
Block,
View,
Image,
Text,
Button,
PageMeta,
ScrollView,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-status.less";
/** props
* isLarge
* isShow
* isClose
* title
* content
* confirmButtonText
* textAlgin left right center
* type: 1
* @confirm
*/
export default class PopupStatus extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "图标状态提示组件",
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
onClose = () => {
this.props.close();
};
onConfirm = () => {
this.props.confirm();
};
onClickStop = (e) => {
e.stopPropagation();
};
onTouchMove = () => {
return true;
};
render() {
let {
title,
content,
confirmButtonText,
textAlgin,
isShow,
isClose,
isBtn,
isLarge,
myClassName,
zIndex,
type,
} = this.props;
if (!zIndex) zIndex = 10001;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
className={myClassName}
overlayStyle={`width: 100vw;padding: 0;z-index: ${
zIndex || 10001
} !important`}
show={isShow}
closeOnClickOverlay={false}
round
onClick={this.onClickStop}
>
{isClose && (
<View
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
)}
<View
className={classnames("common-box", {
"common-large": isLarge,
})}
catchMove
>
{title && (
<View
className={classnames(
"common-popup-title",
"opup-status-title",
{
"margin-samll": isLarge,
}
)}
>
{title}
</View>
)}
<View className="common-popup-content-box">
<ScrollView
scrollY
className={classnames("common-popup-content", {
"text-left": textAlgin === "left",
"text-right": textAlgin === "right",
"text-center": textAlgin === "center",
})}
>
<View className="popup-status-box">
{type === "success" && (
<Image
className="popup-status"
src={require("../../img/status/success.png")}
mode="aspectFit"
/>
)}
{type === "error" && (
<Image
className="popup-status"
src={require("../../img/status/error.png")}
mode="aspectFit"
/>
)}
</View>
{content}
</ScrollView>
</View>
{isBtn && (
<View className="alert-popup-btns">
<Button className="alert-popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
</View>
)}
</View>
</Popup>
</Block>
);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

@ -1,7 +1,7 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from '@antmjs/vantui'
import { Progress } from "@antmjs/vantui";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { date, getdates, previewImage } from "../../utils/util";
@ -9,7 +9,7 @@ import { date, getdates, previewImage } from "../../utils/util";
/** 自定义组件 **/
import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import { InstrumentInfo } from '../../utils/Interface'
import { InstrumentInfo } from "../../utils/Interface";
/** 自定义组件 **/
import "./face_report.less";
@ -21,54 +21,53 @@ export default class Index extends Component<any, any> {
name: "template模板页",
statistics: {},
recordList: [],
recordData: {}
recordData: {},
};
}
componentDidMount() { }
componentDidMount() {}
componentWillUnmount() { }
componentWillUnmount() {}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
let data = {}
let data = {};
if (id != null) {
data['instrumentId'] = id
data["instrumentId"] = id;
}
let res = await InstrumentInfo.apiNursingLog.getStatistics(data)
let res = await InstrumentInfo.apiNursingLog.getStatistics(data);
if (res.data.code === 200) {
this.setState({ statistics: res.data.data })
this.setState({ statistics: res.data.data });
}
}
async getRecord(id, recordId) {
let data = {}
let data = {};
if (id != null) {
data['instrumentId'] = id
data["instrumentId"] = id;
}
let res = await InstrumentInfo.apiNursingLog.getRecord(data)
let res = await InstrumentInfo.apiNursingLog.getRecord(data);
if (res.data.code === 200) {
res.data.rows.map(item => {
item.nursingTime = this.getTime(item.nursingTime)
item.createTime = getdates(item.createTime).replace(/-/g, '.')
res.data.rows.map((item) => {
item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, ".");
if (item.id == recordId) {
this.setState({ recordData: item })
this.setState({ recordData: item });
}
})
this.setState({ recordList: res.data.rows.filter(item => item.id != recordId) })
});
this.setState({
recordList: res.data.rows.filter((item) => item.id != recordId),
});
}
}
getRouteId() {
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get('id');
const recordId = searchParams.get('recordId');
this.getStatistics(id)
this.getRecord(id, recordId)
const id = searchParams.get("id");
const recordId = searchParams.get("recordId");
this.getStatistics(id);
this.getRecord(id, recordId);
console.log(recordId);
}
getTime(time) {
const hour = time.slice(0, 2);
@ -76,188 +75,145 @@ export default class Index extends Component<any, any> {
const second = time.slice(6, 8);
if (hour > 0) {
return hour + '时' + minute + '分' + second + '秒'
return hour + "时" + minute + "分" + second + "秒";
} else {
return minute + '分' + second + '秒'
return minute + "分" + second + "秒";
}
}
async onLoad() {
this.getRouteId()
this.getRouteId();
}
componentDidShow() { }
componentDidShow() {}
componentDidHide() { }
componentDidHide() {}
async initData() { }
async initData() {}
render() {
let { name, statistics, recordList, recordData } = this.state;
return (
<Block>
<Navbar isBack titleSlot='护理报告'></Navbar>
{/* <View className="time m-x-30">{{reportData.curDate}}</View> */}
{/* <View className="time m-x-30"></View> */}
<View className='statistic m-x-30 flex aitems'>
{/* <block wx:if="{{ reportData.instrument_type !== 5 && reportData.instrument_type !== 4 }}"> */}
<View className='statistic_item'>
<View className='statistic_title'>
<text>3</text>
<text className='num'></text>
</View>
{/* <View wx:if="{{ reportData.instrument_id == 74 || reportData.instrument_id == 73 }}" className="statistic_desc">
</View> */}
<View className='statistic_desc'>
</View>
{/* <View className="statistic_desc">{{options.type == 'led' ? '本月光照天数': '本月促渗天数'}}</View> */}
<View className='statistic_desc'></View>
</View>
<View className='statistic_item'>
<View className='statistic_title'>28:00</View>
{/* <View className="statistic_desc">{{options.type == 'led' ? '本月护理时间': '本月促渗时间'}}</View> */}
<View className='statistic_desc'></View>
</View>
{/* </block> */}
{/* <block wx:if="{{ reportData.instrument_type == 4 || reportData.instrument_type == 5 }}"> */}
<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>
</View>
<View className='statistic_desc'>
<text className="num"></text>
</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'>
{/* <block wx:if="{{ reportData.instrument_type !== 4 && reportData.instrument_type !== 5 }}"> */}
<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,
})}
>{recordData.online == 1 ? '在线' : '离线'}</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,
})}
>
{recordData.online == 1 ? "在线" : "离线"}
</View>
</View>
<View className='products_middle flex'>
<Image className='cover' src={recordData.modeImage} 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'>{recordData.nursingTime}</View>
<View className="products_middle flex">
<Image
className="cover"
src={recordData.modeImage}
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">
{recordData.nursingTime}
</View>
</View>
</View>
<View className='progress'>
<View className="progress">
<Progress percentage={recordData.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> {recordData.completionPercentage * 100}%</View>
<Progress
percentage={recordData.completionPercentage * 100}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{recordData.completionPercentage * 100}%
</View>
</View>
</View>
</View>
</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={classnames("tag", {
tag_active: item.online === 2,
})}
>{item.online == 1 ? '在线' : '离线'}</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={classnames("tag", {
tag_active: item.online === 2,
})}
>
{item.online == 1 ? "在线" : "离线"}
</View>
</View>
<View className='products_middle flex'>
<Image className='cover' src={item.modeImage} 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="products_middle flex">
<Image
className="cover"
src={item.modeImage}
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>
</View>
<View className='progress'>
<View className="progress">
<Progress percentage={item.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> {item.completionPercentage * 100}%</View>
<Progress
percentage={
item.completionPercentage * 100 > 100
? 100
: item.completionPercentage * 100
}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{item.completionPercentage * 100 > 100
? 100
: item.completionPercentage * 100}
%
</View>
</View>
</View>
</View>
</View>
))}
{/* </block> */}
{/* <block wx:if="{{ reportData.instrument_type == 4 || reportData.instrument_type == 5 }}"> */}
{/* <View className='products_item' style='border: none'>
<View className='products_top flex aitems'>
<View className='add_time'>2024.01.01</View>
<View className="{{reportData.online === 2 ? 'tag tag_active' : 'tag'}}">线</View>
</View>
<View className='products_middle flex'>
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'></View>
<View className='desc_box'>
<View className='desc'></View>
<View className='desc'>10:00</View>
</View>
</View>
<View className='progress'>
<Progress percentage='80' strokeWidth='12' pivotText='' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> 80%</View>
</View>
</View>
</View>
</View> */}
{/* <View className='main_title' ></View>
<View className='products_item' >
<View className='products_top flex aitems'>
<View className='add_time'>2024.01.01</View>
<View className="{{item.online === 2 ? 'tag tag_active' : 'tag'}}">线</View>
</View>
<View className='products_middle flex'>
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'></View>
<View className='desc_box'>
<View className='desc'></View>
<View className='desc'>10:00</View>
</View>
</View>
<View className='progress'>
<Progress percentage='80' strokeWidth='12' pivotText='' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> 80%</View>
</View>
</View>
</View>
</View> */}
{/* </block> */}
</View>
<View className='footer flex aitems' >
<View className='btn'></View>
<View className='text flex aitems'>
<View className="footer flex aitems">
<View className="btn"></View>
<View className="text flex aitems">
<View></View>
<Image src='../../img/right.png' mode='aspectFill'></Image>
<Image
src={require("../../img/right.png")}
mode="aspectFill"
></Image>
</View>
</View>
{/* <clockInDialog id="clockInDialog" instrumentId="{{reportData.instrument_id}}" isCustom="{{ true }}" bind:submitFun="confirmSubmit"/> */}
</Block>
);
}

@ -23,6 +23,7 @@ import PopupCountdown from "@/components/popup/popup-countdown";
import PopupStepTips from "@/components/popup/popup-step-tips";
import PopupConfirm from "@/components/popup/popup-confirm";
import PopupAlert from "@/components/popup/popup-alert";
import PopupStatus from "@/components/popup/popup-status";
/* 公共组件 END */
/* 本页组件 */
@ -32,7 +33,7 @@ import ModeContent from "./components/ModeContent/index";
import Footer from "./components/Footer";
/* 本页组件 END */
import { getStorageSync, setStorageSync } from "@/utils/traoAPI";
import { go, getStorageSync, setStorageSync } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import "./iotCarePlan.less";
@ -188,13 +189,18 @@ class IotCarePlan extends Component<any, any> {
endPlace: "",
currentTime: "01:00",
// 护理时间不够
isNotEnoughTime: false,
// 通用错误提示
isShowErrorTipsText: false, // 护理模式切换错误弹窗
errorTipsText: "", // 护理模式切换错误提示
isShowNursingSuccess: false, // 护理成功弹窗
};
}
// 不涉及渲染的页面变量
elapsedTime: any = 0; // 设备已运行时间
workStatus: any = ""; // 工作状态
WL200NursingHistory: any = null; // 护理缓存历史
hadCheckReport = false; // 是否已检查仪器护理记录
@ -217,6 +223,11 @@ class IotCarePlan extends Component<any, any> {
componentDidShow() {
this.initData();
this.getWL200NursingHistory();
// 重置初始值,每次进入页面重新检查面罩护理记录
this.hadCheckReport = false;
this.hadGotInstrumentHistoryData = false;
}
componentDidHide() {}
@ -474,17 +485,21 @@ class IotCarePlan extends Component<any, any> {
// }
let { isStandStatus, ActiveModeItem } = this.state;
if (isStandStatus && ActiveModeItem.isCabinMode) {
let isCabinMode = ActiveModeItem.isCabinMode === 1;
if (isStandStatus && isCabinMode) {
this.stepNext();
return;
}
if (isStandStatus) {
console.log("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
}
} else {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
if (ActiveModeItem.isCabinMode === 1) {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
}
}
};
/** 切换光照 */
@ -956,7 +971,7 @@ class IotCarePlan extends Component<any, any> {
}
};
// 重置计时器
// 重置并同步计时器
resetTimer = () => {
// 切换模式后, 需要重新设置计时器, 以防进行中的计时器
currentTimeTimer && clearInterval(currentTimeTimer);
@ -980,6 +995,7 @@ class IotCarePlan extends Component<any, any> {
let checkTime = totalSeconds - currentSeconds;
console.log("设备已运行多少秒", checkTime);
console.log("ModeStepTimeArray", ModeStepTimeArray);
this.elapsedTime = checkTime;
if (currentSeconds >= 1) {
this.setState({
currentTime: s_to_ms(--currentSeconds),
@ -1152,13 +1168,22 @@ class IotCarePlan extends Component<any, any> {
}
// 开始执行护理
this.handleWorkStatus(true, MODE_WORKING_ENUM.WORKING);
this.showCountdownFun(3, () => {}); // 倒计时弹窗
let downNum = CountDownTime[ActiveModeItem.modeName] || 3;
this.showCountdownFun(downNum, () => {}); // 倒计时弹窗
}
// 结束护理?
endNurseFun() {
this.handleWorkStatus(false, "end");
this.PostNursingLogClock();
console.log("this.checkNurseTime()", this.checkNurseTime());
if (this.checkNurseTime()) {
this.PostNursingLogClock();
} else {
this.showTips("护理时间不足,请重新连接护理");
}
// setTimeout(() => {
// //TODO IOS关闭蓝牙太快导致关机指令没发出去暂时这么解决
// const isEnough = this.checkNurseTime();
@ -1322,7 +1347,7 @@ class IotCarePlan extends Component<any, any> {
instrumentName: currentDevice.name,
modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName,
nursingTime: ActiveModeItem.modeTimeStr,
nursingTime: s_to_ms(this.elapsedTime),
};
let res: any = await this.PostNursingLogClock(params);
console.log("res", res);
@ -1345,8 +1370,28 @@ class IotCarePlan extends Component<any, any> {
console.log("同步异常,但设备运行中");
}
};
/** 获取小程序本地缓存的历史记录 */
getWL200NursingHistory() {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
}
/** 设置WL200护理历史 */
setWL200NursingHistory = (jsonStatus: any) => {};
setWL200NursingHistory = (jsonStatus: any) => {
let { currentDevice, ActiveModeItem, ModeList } = this.state;
const params = {
createDate: dayjs().format("YYYY-MM-DD"),
workMode: jsonStatus.workMode,
instrumentId: currentDevice.id,
instrumentName: currentDevice.name,
modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName,
id: jsonStatus.id,
neededTotalSeconds: jsonStatus.neededTotalSeconds,
jsonStatus,
};
this.WL200NursingHistory = JSON.parse(JSON.stringify(params));
Taro.setStorageSync("WL200NursingHistory", params);
console.log("保存setWL200NursingHistory");
};
/** 删除WL200护理历史 */
rmWL200NursingHistory = (WL200NursingHistory, hard = false) => {
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
@ -1358,8 +1403,9 @@ class IotCarePlan extends Component<any, any> {
};
/** 提交护理记录 */
PostNursingLogClock = async (data: any) => {
PostNursingLogClock = async (data: any = null) => {
let { currentDevice, ActiveModeItem } = this.state;
let params = {};
if (data) {
params = data;
@ -1369,12 +1415,14 @@ class IotCarePlan extends Component<any, any> {
instrumentName: currentDevice.name,
modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName,
nursingTime: ActiveModeItem.modeTimeStr,
nursingTime: s_to_ms(this.elapsedTime),
};
}
let res: any = await InstrumentInfo.apiNursingLog.addLog(params);
console.log("PostNursingLogClock", res);
this.goFaceReport();
};
/*** 护理记录 END ***/
@ -1394,8 +1442,10 @@ class IotCarePlan extends Component<any, any> {
getServiceTimeData() {
const { ActiveModeItem } = this.state;
let serviceData = ActiveModeItem.serviceData.map((item) => {
let totalWorkingMinutes = parseInt(item.modeTimeStr.split(":")[0]); // 仅分钟数
let totalWorkingSeconds = parseInt(item.modeTimeStr.split(":")[1]); // 仅秒数
let totalWorkingMinutes = parseInt(
item.serviceStartTimeStr.split(":")[0]
); // 仅分钟数
let totalWorkingSeconds = parseInt(item.serviceEndTimeStr.split(":")[1]); // 仅秒数
// let totalWorkingMinutes = 1; // 仅分钟数
// let totalWorkingSeconds = 0; // 仅秒数
return {
@ -1519,8 +1569,17 @@ class IotCarePlan extends Component<any, any> {
});
};
confirmEndBtn = () => {
this.endNurseFun();
this.cancelEndBtn();
console.log("confirmEndBtn", this.checkNurseTime());
if (this.checkNurseTime()) {
this.endNurseFun();
this.cancelEndBtn();
} else {
this.handleWorkStatus(false, "end");
this.setState({
isEndCarePlan: false,
isNotEnoughTime: true,
});
}
};
cancelEndBtn = () => {
this.setState({
@ -1543,6 +1602,20 @@ class IotCarePlan extends Component<any, any> {
});
};
closeNotEnoughTime = () => {
this.setState({
isNotEnoughTime: false,
});
Taro.switchTab({
url: "/pages/index/index",
});
};
/** 完成护理提交:跳转护理报告页 */
goFaceReport = () => {
go("/pages/face_report/face_report?id=" + this.state.currentDevice.id);
};
render() {
let {
name,
@ -1572,6 +1645,8 @@ class IotCarePlan extends Component<any, any> {
facialMaskConnectStatus,
isShowErrorTipsText,
errorTipsText,
isNotEnoughTime,
isShowNursingSuccess,
} = this.state;
return (
<Block>
@ -1628,6 +1703,17 @@ class IotCarePlan extends Component<any, any> {
/>
)}
<PopupAlert
isShow={isNotEnoughTime}
isClose
title="提示"
content="您的本次护理时间不足,请重新护理"
confirmButtonText="确认"
textAlgin="center"
close={this.closeNotEnoughTime}
confirm={this.closeNotEnoughTime}
/>
<PopupAlert
isShow={isShowErrorTipsText}
isClose
@ -1640,6 +1726,19 @@ class IotCarePlan extends Component<any, any> {
close={this.closeErrorTipsText}
confirm={this.closeErrorTipsText}
/>
<PopupStatus
isShow={isShowNursingSuccess}
isClose
title="您已结束本次护理"
type="success"
content="正在上传护理记录……"
confirmButtonText="知道了"
textAlgin="center"
close={() => {
/*不需要做处理*/
}}
/>
</View>
<View>

Loading…
Cancel
Save