qsj 2 years ago
commit b846139769

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

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

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

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

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

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

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

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

Loading…
Cancel
Save