qsj 2 years ago
commit b846139769

@ -83,12 +83,16 @@
}
}
}
.block {
margin-top: 40rpx;
}
.block2 {
margin-top: 40rpx;
}
.block-msg-one {
margin-top: 80rpx;
}
.images,
.videos {

@ -125,7 +125,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
<View className="blue-device-tips">
{currentDeviceType === "WE200" && (
<Block>
<View className="block">
<View className="block block-msg-one">
<View className="icon">
<Image
className="images"
@ -144,7 +144,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
<Block>
{isConnection ? (
<Block>
<View className="block">
<View className="block block-msg-one">
<View className="icon">
<Image
className="images"
@ -159,7 +159,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
</Block>
) : (
<Block>
<View className="block">
<View className="block block-msg-one">
<View className="icon">
<Image
className="images"

@ -78,7 +78,6 @@ export default class PopupBinding extends Component<any, any> {
isRegisterBoolean,
isClose,
isLarge,
type,
} = this.props;
// let serial = Taro.getStorageSync("serial");
@ -119,55 +118,49 @@ export default class PopupBinding extends Component<any, any> {
></PopupAlert>
)}
{isRegisterBoolean &&
(type === 1 || type === 2) &&
!isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx">
</View>
</View>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不绑定"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
{isRegisterBoolean &&
(type === 1 || type === 2) &&
isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx">
<View></View>
<View></View>
</View>
{isRegisterBoolean && !isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx"></View>
</View>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不绑定"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
{isRegisterBoolean && isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx">
<View></View>
<View></View>
</View>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不换绑"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
</View>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不换绑"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
</Block>
);
}

@ -7,8 +7,9 @@ import "./index.less";
interface Props {
isShowNurse: boolean;
ActiveModeItem: any;
ModeStepIndex: number;
}
function Index({ isShowNurse, ActiveModeItem }: Props) {
function Index({ isShowNurse, ActiveModeItem, ModeStepIndex }: Props) {
const ModeColor = {
"590nm": "#CF231D",
"630nm": "#CF231D",
@ -16,17 +17,35 @@ function Index({ isShowNurse, ActiveModeItem }: Props) {
};
return (
<Block>
{isShowNurse && (
{isShowNurse && ActiveModeItem?.combineData.length > 0 && (
<View className="modelInfo-box">
<View className="modelInfo-line is-effect">
<View className="modelInfo-title"></View>
<View className="modelInfo-effect">{ActiveModeItem.modeDesc}</View>
<View className="modelInfo-effect">
{ActiveModeItem.combineData[ModeStepIndex].effectContent}
</View>
</View>
{ActiveModeItem?.combineData && (
<View className="modelInfo-line">
<View className="modelInfo-title"></View>
<View className="modelInfo-light-box">
{ActiveModeItem.combineData.map((item) => {
<View className="modelInfo-line">
<View className="modelInfo-title"></View>
<View className="modelInfo-light-box">
<View
className="modelInfo-light-item"
key={ActiveModeItem.combineData[ModeStepIndex].id}
>
<View
className="modelInfo-light-color"
style={{
backgroundColor:
ModeColor[
ActiveModeItem.combineData[ModeStepIndex].technologyInfo
],
}}
></View>
<View className="modelInfo-light-colorname">
{ActiveModeItem.combineData[ModeStepIndex].technologyInfo}
</View>
</View>
{/* {ActiveModeItem.combineData.map((item) => {
return (
<View className="modelInfo-light-item" key={item.id}>
<View
@ -40,10 +59,9 @@ function Index({ isShowNurse, ActiveModeItem }: Props) {
</View>
</View>
);
})}
</View>
})} */}
</View>
)}
</View>
</View>
)}
</Block>

@ -146,3 +146,37 @@
width: 690rpx;
height: 320rpx;
}
.custom-popup {
background: none !important;
}
.van-popup {
border-radius: 30rpx;
.sync-history-msg {
// box-sizing: border-box;
// width: 670rpx;
// height: 840rpx;
// background: #ffffff;
// border-radius: 30rpx;
// position: relative;
// padding: 42rpx 30rpx 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 670rpx;
height: 250rpx;
background: rgba(0, 0, 0, 0.4);
border-radius: 30rpx;
position: relative;
text-align: center;
color: #ffff;
line-height: 250rpx;
opacity: 0.8;
.close_icon {
position: absolute;
width: 50rpx;
height: 50rpx;
top: 34rpx;
right: 34rpx;
}
}
}

@ -56,9 +56,10 @@ import {
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
import { minSecToS, s_to_ms, s_to_hms, sleep } from "@/utils/util";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import commandMap from "@/utils/commandMap";
import { Popup } from "@antmjs/vantui";
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
@ -217,6 +218,7 @@ class IotCarePlan extends Component<any, any> {
// 不涉及渲染的页面变量
isRuning: any = false; // 设备是否运行中
jsonStatus: any = {}; // 同步设备返回数据,用于结束
workJsonStatus: any = {}; // 同步工作中的仪器
tempModeCurrent: any = {}; // 临时保存的当前模式
elapsedTime: any = 0; // 设备已运行时间
workStatus: any = ""; // 工作状态
@ -443,6 +445,7 @@ class IotCarePlan extends Component<any, any> {
}
let currentTime = data.modeTimeStr;
let modeArray = ["all", "visor", "cabin", "yimeish"];
this.setState({
ActiveModeItem: data,
activeModeID: data.id,
@ -450,6 +453,7 @@ class IotCarePlan extends Component<any, any> {
currentServiceData,
ModeStepIndex: 0,
currentTime,
ModeType: modeArray[data.modeClass],
});
setTimeout(() => {
@ -536,9 +540,6 @@ class IotCarePlan extends Component<any, any> {
this.setState({
ModeType: modeArray[SwitchActiveModeItem.modeClass],
});
setTimeout(() => {
console.log("ModeType", this.state.ModeType);
}, 100);
};
stepNext = () => {
@ -800,7 +801,10 @@ class IotCarePlan extends Component<any, any> {
jsonStatus
);
this.workJsonStatus = jsonStatus;
this.workStatus = jsonStatus.workStatus;
setTimeout(() => console.log("this.workStatus", this.workStatus));
this.setState({
Electricity: jsonStatus.battery,
// fr200Electricity: jsonStatus.battery,
@ -816,7 +820,6 @@ class IotCarePlan extends Component<any, any> {
500
);
}
return;
}
@ -1440,21 +1443,39 @@ class IotCarePlan extends Component<any, any> {
checkInstrumentRecord = async (jsonStatus: any) => {
console.log("检查护理记录");
let { currentDevice, ActiveModeItem, ModeList } = this.state;
if (jsonStatus) {
}
// 1.判断是否存在工作状态:如果不存在,则等待两秒用于连接设备与赋值,再执行后面的代码
if (!this.workStatus) {
await sleep(2);
}
await sleep(2);
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
this.setState({ isShowHistoryMsg: false });
Taro.removeStorageSync("isSyncHistory");
}
console.log(
"this.workJsonStatus",
this.workJsonStatus,
this.workJsonStatus.workMode
);
this.setState({
isFooterBtnDisabled: false,
});
if (this.workJsonStatus.workMode) {
console.log("this.workJsonStatus.workMode", this.workJsonStatus.workMode);
if (this.workJsonStatus.workMode.indexOf("Stand") > -1) {
console.log(
"this.workJsonStatus.workMode",
this.workJsonStatus.workMode
);
this.setState({
isStandStatus: true,
});
setTimeout(() => this.footerIsDisabled(), 100);
}
}
// 2.判断是否已存在缓存的护理记录:如果没有历史,则缓存
let workStatus = this.workStatus;
let workStatus = this.workJsonStatus.workStatus;
let WL200NursingHistory = this.WL200NursingHistory;
if (!this.WL200NursingHistory) {
console.log("小程序缓存没有数据, 忽略");
@ -1484,6 +1505,19 @@ class IotCarePlan extends Component<any, any> {
return;
}
console.log("workStatus", workStatus);
console.log("jsonStatus", jsonStatus, this.workJsonStatus);
console.log("currentTime", WL200NursingHistory.currentTime);
console.log("isStandStatus", this.state.isStandStatus);
let historyElapsedTime =
minSecToS(recordModeItem.modeTimeStr) -
minSecToS(WL200NursingHistory.currentTime);
this.elapsedTime =
this.elapsedTime > historyElapsedTime
? this.elapsedTime
: historyElapsedTime;
// 4.判断设备状态-未运行/已完成/待机
if (
workStatus == MODE_WORKING_ENUM.STANDBY ||
@ -1494,12 +1528,7 @@ class IotCarePlan extends Component<any, any> {
if (jsonStatus.id == WL200NursingHistory.id) {
console.log("id一致, 设备没有运行/已完成/待机");
let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间
let neededTotalSeconds = jsonStatus.neededTotalSeconds; // 从仪器上获取的使用时间
console.log(
"从仪器上获取的使用时间 totalSeconds: %d neededTotalSeconds: %d",
totalSeconds,
neededTotalSeconds
);
let nursingTimeStr = currentDevice?.nursingTimeStr;
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
@ -1523,6 +1552,7 @@ class IotCarePlan extends Component<any, any> {
modeName: ActiveModeItem.modeName,
nursingTime: timeValue,
};
this.handleWorkStatus(false, "end");
let res: any = await this.PostNursingLogClock(params);
console.log("res", res);
this.rmWL200NursingHistory(WL200NursingHistory);
@ -1535,15 +1565,23 @@ class IotCarePlan extends Component<any, any> {
modeName: ActiveModeItem.modeName,
nursingTime: "00:01:00",
};
this.handleWorkStatus(false, "end");
let res: any = await this.PostNursingLogClock(params);
console.log("res", res);
this.rmWL200NursingHistory(WL200NursingHistory);
}
} else {
// 5.判断设备状态-运行中 正常逻辑,这里不做处理,如果用户操作,则按正常流程判断
console.log("同步异常,但设备运行中");
console.log("同步异常,但设备运行中");
console.log("同步异常,但设备运行中");
console.log("id一致, 设备运行中或暂停");
// 5.判断设备状态-运行中
// 同步时间
if (jsonStatus.id == WL200NursingHistory.id) {
if (WL200NursingHistory.currentTime) {
this.setState({
step: 2,
});
this.resetTimer();
}
}
}
};
@ -1554,11 +1592,27 @@ class IotCarePlan extends Component<any, any> {
// 是否同步历史记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
let ActiveModeItem = this.WL200NursingHistory.ActiveModeItem;
// 直接进入开始护理状态
this.setState({
isShowNurse: true,
isShowHistoryMsg: true,
currentServiceData: this.WL200NursingHistory.currentServiceData,
tempModeCurrent: ActiveModeItem,
ActiveModeItem: ActiveModeItem,
activeModeID: ActiveModeItem.id,
ModeID: "mode_" + ActiveModeItem.id,
currentTime: this.WL200NursingHistory.currentTime,
});
setTimeout(() => {
// 设置时间组合
if (ActiveModeItem.serviceData.length > 0) {
this.setServiceTimeData();
}
// 存在组合模式时,设置组合模式
if (ActiveModeItem.combineData.length > 0) {
this.setCustomMaskData();
}
});
}
}
@ -1575,6 +1629,7 @@ class IotCarePlan extends Component<any, any> {
id: jsonStatus.id,
neededTotalSeconds: jsonStatus.neededTotalSeconds,
jsonStatus,
ActiveModeItem: this.state.ActiveModeItem,
};
this.WL200NursingHistory = JSON.parse(JSON.stringify(params));
Taro.setStorageSync("WL200NursingHistory", params);
@ -1977,6 +2032,7 @@ class IotCarePlan extends Component<any, any> {
isStopNurse,
ModeList,
ModeType,
ModeStepIndex,
currentServiceData,
ActiveModeItem,
SwitchActiveModeItem,
@ -2003,6 +2059,7 @@ class IotCarePlan extends Component<any, any> {
isShowReReadRecordSave,
isFooterBtnDisabled,
isShowHistoryMsg,
stepIndex,
} = this.state;
return (
@ -2141,11 +2198,15 @@ class IotCarePlan extends Component<any, any> {
upgradeFun={() => {}}
/>
)}
</View>
{isShowHistoryMsg && (
<View className="sync-history-msg">...</View>
)}
<Popup
show={isShowHistoryMsg}
className="custom-popup"
overlay={false}
>
<View className="sync-history-msg">...</View>
</Popup>
</View>
<View>
<View className="iot-main">
@ -2220,6 +2281,7 @@ class IotCarePlan extends Component<any, any> {
<ModeContent
isShowNurse={isShowNurse}
ActiveModeItem={ActiveModeItem}
ModeStepIndex={ModeStepIndex}
/>
)}

@ -2,7 +2,7 @@ page {
background: #f3f3f3;
}
.mb10{
.mb10 {
margin-bottom: 20rpx;
font-size: 32rpx;
}
@ -997,7 +997,7 @@ page {
padding-top: 32rpx;
background-color: #fff;
box-shadow: 0rpx 2rpx 25rpx 18rpx rgba(210, 210, 210, 0.1);
border-radius:30rpx;
border-radius: 30rpx;
.date-title {
position: absolute;
top: 32rpx;
@ -1015,7 +1015,7 @@ page {
}
}
}
.custom-popup{
.custom-popup {
background: none !important;
}
.van-popup {
@ -1032,7 +1032,7 @@ page {
box-sizing: border-box;
width: 670rpx;
height: 250rpx;
background: rgba(0,0,0,0.6);
background: rgba(0, 0, 0, 0.6);
border-radius: 30rpx;
position: relative;
text-align: center;
@ -1046,6 +1046,5 @@ page {
top: 34rpx;
right: 34rpx;
}
}
}
}

@ -680,10 +680,7 @@ class Index extends Component<any, any> {
(item) => item.id === instrumentInfo.id
);
if (isBind) {
this.setState({
isBeforeBindingError: true,
BeforeBindingErrorText: "序列号已绑定",
});
msg("序列号已绑定");
} else {
this.setState({
isBeforeBindingError: true,
@ -761,14 +758,16 @@ class Index extends Component<any, any> {
this.getInstrumentIntroInfo(instrumentInfo.id);
}, 1000);
return;
} else if (data.code === 204) {
this.setState({
isBeforeBindingError: true,
BeforeBindingErrorText: "您选择的仪器有误,请重新选择确认",
});
} else if (data.code === 203) {
this.setState({ isBindingError203: true });
} else if (data.code === 202) {
// 换绑操作
this.setState({ isExchangeBinding: true, isVisibleBinding: true });
} else if (data.code === 201) {
// 跳转联系客服
this.setState({ isBindingError: true });
} else {
this.setState({ isBindingError: true });
}
@ -1162,7 +1161,6 @@ class Index extends Component<any, any> {
/>
<PopupBinding
type={instrumentInfo.bindingStatus}
isShow={isVisibleBinding}
isRegisterBoolean={isRegisterBoolean}
isExchangeBinding={isExchangeBinding}

@ -72,7 +72,7 @@ export default class Instrument extends Component<any, any> {
isRegisterBoolean: false,
isExchangeBinding: false,
/** INPUT序列号拎出来防止上传图片被清空bug */
instrumentInfo: {},
};
}
$instance = Taro.getCurrentInstance();
@ -274,6 +274,44 @@ export default class Instrument extends Component<any, any> {
}
};
// 根据扫码的序列号获取仪器信息
getInstrumentInfoBySerial = async (serial) => {
let { data } = await InstrumentInfo.getInstrumentInfoBySerial({
serial: serial,
});
if (data.code === 200) {
let instrumentInfo = data.data;
// 更新扫码进入仪器信息
this.setState({ instrumentInfo: instrumentInfo });
}
};
/**删除扫码缓存*/
removeScanFun = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
};
/** 查询是否可以绑定 */
isBindingSerial = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { instrumentInfo } = this.state;
let res = await InstrumentInfo.isBindingSerial({
serial: instrumentInfo.serial,
});
console.log("isBindingSerial", res);
if (res.data.code === 201) {
// 绑定
this.setState({ isExchangeBinding: false, isVisibleBinding: true });
} else if (res.data.code === 202) {
// 换绑
this.setState({ isExchangeBinding: true, isVisibleBinding: true });
}
Taro.hideLoading();
};
/**
* @name
* @return code===204
@ -285,6 +323,7 @@ export default class Instrument extends Component<any, any> {
});
let { channelInfo } = this.state;
await this.getInstrumentInfoBySerial(channelInfo.serialCode);
let res = await InstrumentInfo.manualCodeBinding({
serial: channelInfo.serialCode,
serialImage: channelInfo.serialImage,
@ -293,38 +332,42 @@ export default class Instrument extends Component<any, any> {
Taro.hideLoading();
// 文件上传接口返回格式不需要加data
let code = Number(res.code); // 强制类型转换
if (code === 200) {
msg("绑定成功");
setTimeout(() => {
setStorageSync("instrument_item", JSON.stringify(channelInfo));
go("/pages/instrument/intro?id=" + channelInfo.id);
}, 1000);
} else if (res.data.code === 202) {
this.changeBindBox();
} else if (res.data.code === 203) {
this.setState({ isBindingError203: true });
} else if (res.data.code === 204) {
this.onBindCheckErrorOpen();
} else if (res.data.code === 205 || res.data.code === 206) {
this.onBindErrorOpen();
}
setTimeout(() => {
if (code === 200) {
// msg("绑定成功");
// setTimeout(() => {
// setStorageSync("instrument_item", JSON.stringify(channelInfo));
// go("/pages/instrument/intro?id=" + channelInfo.id);
// }, 1000);
this.openBindingVisible();
} else if (code === 202) {
this.changeBindBox();
} else if (code === 203) {
this.setState({ isBindingError203: true });
} else if (code === 204) {
this.onBindCheckErrorOpen();
} else if (code === 205 || code === 206) {
this.onBindErrorOpen();
}
}, 100);
};
/**
* @name
* @return code===204
*/
scanCodeBinding = async () => {
// Taro.showLoading({
// title: "请求中...",
// mask: true,
// });
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { channelInfo } = this.state;
await this.getInstrumentInfoBySerial(channelInfo.serialCode);
let res = await InstrumentInfo.scanCodeBinding({
serial: channelInfo.serialCode,
instrumentId: channelInfo.id,
});
// Taro.hideLoading();
Taro.hideLoading();
let code = Number(res.data.code);
console.log("scanCodeBinding code", code);
setTimeout(() => {
@ -361,7 +404,7 @@ export default class Instrument extends Component<any, any> {
Taro.hideLoading();
setTimeout(() => {
if (res.data.code === 200) {
// this.setState({ isVisibleBinding: false });
this.setState({ isVisibleBinding: false });
msg("绑定成功");
setStorageSync("instrument_item", JSON.stringify(channelInfo));
setTimeout(() => {
@ -378,6 +421,7 @@ export default class Instrument extends Component<any, any> {
}
}, 100);
};
// 换绑仪器
exchangeBinding = async () => {
Taro.showLoading({
@ -436,7 +480,16 @@ export default class Instrument extends Component<any, any> {
// 打开绑定弹窗
openBindingVisible = () => {
this.setState({ isVisibleBinding: true });
setTimeout(() => {
this.setState({ isVisibleBinding: true, isExchangeBinding: false });
}, 10);
setTimeout(() => {
console.log(
"openBindingVisible",
this.state.isVisibleBinding,
this.state.channelInfo
);
}, 100);
};
closeBinding = () => {
this.setState({ isVisibleBinding: false });
@ -460,6 +513,7 @@ export default class Instrument extends Component<any, any> {
isBindingCheckError,
show,
channelInfo,
instrumentInfo,
inputType,
style,
equipmentList,
@ -488,11 +542,10 @@ export default class Instrument extends Component<any, any> {
<View catchMove>
<PopupBinding
type={channelInfo.bindingStatus}
isShow={isVisibleBinding}
isRegisterBoolean={isRegisterBoolean}
isExchangeBinding={isExchangeBinding}
data={channelInfo}
data={instrumentInfo}
close={this.closeBinding}
confirm={this.confirmBinding}
/>
@ -704,7 +757,7 @@ export default class Instrument extends Component<any, any> {
{inputType == 1 && (
<View
className="btn"
onClick={throttle(this.onSubmit.bind(this), 1000)}
onClick={throttle(this.onSubmit.bind(this), 300)}
>
</View>

Loading…
Cancel
Save