fix:护理报告显示bug

master
blak-kong 2 years ago
parent 7ce4b95528
commit 9b93ce8c0a

@ -42,19 +42,26 @@ export default class Index extends Component<any, any> {
}
async getRecord(id, recordId) {
console.log("id, recordId", id, recordId);
let data = {};
if (id != null) {
data["instrumentId"] = id;
}
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, ".");
if (item.id == recordId) {
this.setState({ recordData: item });
}
});
if (recordId) {
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 });
}
});
} else {
this.setState({ recordData: res.data.rows[0] });
}
this.setState({
recordList: res.data.rows.filter((item) => item.id != recordId),
});
@ -140,13 +147,20 @@ export default class Index extends Component<any, any> {
<View className="progress">
<Progress
percentage={recordData.completionPercentage * 100}
percentage={
recordData.completionPercentage * 100 > 100
? 100
: recordData.completionPercentage * 100
}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{recordData.completionPercentage * 100}%
{recordData.completionPercentage * 100 > 100
? 100
: recordData.completionPercentage * 100}
%
</View>
</View>
</View>

@ -222,6 +222,7 @@ class IotCarePlan extends Component<any, any> {
componentWillUnmount() {}
componentDidShow() {
console.log("页面显示了");
this.initData();
this.getWL200NursingHistory();
@ -230,7 +231,10 @@ class IotCarePlan extends Component<any, any> {
this.hadGotInstrumentHistoryData = false;
}
componentDidHide() {}
componentDidHide() {
// 页面隐藏后,下次显示需要重新检查记录
this.hadCheckReport = false;
}
async initData() {
let objStr = getStorageSync("instrument_detail");
@ -985,6 +989,7 @@ class IotCarePlan extends Component<any, any> {
ModeStepIndex,
ActiveModeItem,
} = this.state;
console.log("resetTimer workStatus", workStatus);
if (
workStatus == MODE_WORKING_ENUM.WORKING &&
step == 2 &&
@ -997,6 +1002,7 @@ class IotCarePlan extends Component<any, any> {
console.log("ModeStepTimeArray", ModeStepTimeArray);
this.elapsedTime = checkTime;
if (currentSeconds >= 1) {
// 小程序显示倒计时
this.setState({
currentTime: s_to_ms(--currentSeconds),
});
@ -1004,7 +1010,6 @@ class IotCarePlan extends Component<any, any> {
let length = ModeStepTimeArray.length;
if (length) {
// 模式多个步骤节点切换
// 已运行时间达到下一节点时,切换
if (checkTime > ModeStepTimeArray[ModeStepIndex]) {
// 已运行时间达到下一节点,步骤切换时更新
@ -1181,35 +1186,13 @@ class IotCarePlan extends Component<any, any> {
if (this.checkNurseTime()) {
this.PostNursingLogClock();
} else {
this.showTips("护理时间不足,请重新连接护理");
// 时间不满足,回到主页
this.handleWorkStatus(false, "end");
this.setState({
isEndCarePlan: false,
isNotEnoughTime: true,
});
}
// setTimeout(() => {
// //TODO IOS关闭蓝牙太快导致关机指令没发出去暂时这么解决
// const isEnough = this.checkNurseTime();
// if (!isEnough) {
// Taro.showModal({
// title: "提示",
// content: "护理时间不足,请重新连接护理",
// showCancel: false,
// success: (res) => {
// if (!this.state.endPlace || this.state.endPlace !== "report") {
// // back();
// console.log("back");
// }
// // this.state.innerAudioContext.destroy();
// Taro.closeBluetoothAdapter();
// },
// });
// } else {
// if (!this.state.endPlace || this.state.endPlace !== "report") {
// // back();
// console.log("back");
// }
// // this.state.innerAudioContext.destroy();
// Taro.closeBluetoothAdapter();
// }
// }, 500);
}
/** 检查时间是否达标仪器最低护理时间 */
@ -1368,6 +1351,8 @@ class IotCarePlan extends Component<any, any> {
} else {
// 5.判断设备状态-运行中 正常逻辑,这里不做处理,如果用户操作,则按正常流程判断
console.log("同步异常,但设备运行中");
console.log("同步异常,但设备运行中");
console.log("同步异常,但设备运行中");
}
};
/** 获取小程序本地缓存的历史记录 */
@ -1422,7 +1407,14 @@ class IotCarePlan extends Component<any, any> {
let res: any = await InstrumentInfo.apiNursingLog.addLog(params);
console.log("PostNursingLogClock", res);
this.goFaceReport();
if (res.data.code === 200) {
this.setState({
isShowNursingSuccess: true,
});
setTimeout(() => {
this.goFaceReport();
}, 1000);
}
};
/*** 护理记录 END ***/

Loading…
Cancel
Save