|
|
@@ -399,6 +399,9 @@ export default {
|
|
|
treatQtyMap: {}, // 治疗 medID -> qty
|
|
|
// 底部抽屉
|
|
|
showSheet: false,
|
|
|
+ // 属性面板数据加载中(点击药品 -> 面板数据就绪)
|
|
|
+ sheetLoading: false,
|
|
|
+ sheetLoadingTimer: null,
|
|
|
// 保存中(防止重复点击)
|
|
|
saving: false,
|
|
|
// 已选医嘱弹窗
|
|
|
@@ -537,6 +540,9 @@ export default {
|
|
|
},
|
|
|
|
|
|
destroyed() {
|
|
|
+ // 组件销毁时清理属性面板 loading,避免遮罩残留
|
|
|
+ this.clearSheetLoadingTimer();
|
|
|
+ if (this.sheetLoading) uni.hideLoading();
|
|
|
// 组件销毁时不自动回传,避免重复提交;由用户点击「保存」统一提交
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -819,6 +825,33 @@ export default {
|
|
|
return '治疗';
|
|
|
},
|
|
|
|
|
|
+ /* ============ 属性面板数据 loading ============ */
|
|
|
+ // 打开属性面板前调用:展示页面 loading,等 03050020 及派生下拉数据就绪后关闭
|
|
|
+ showSheetLoading() {
|
|
|
+ this.clearSheetLoadingTimer();
|
|
|
+ if (!this.sheetLoading) {
|
|
|
+ this.setData({ sheetLoading: true });
|
|
|
+ uni.showLoading({ title: '加载中...', mask: true });
|
|
|
+ }
|
|
|
+ // 兜底:接口长时间无响应时自动关闭,避免遮罩卡死页面
|
|
|
+ this.setData({ sheetLoadingTimer: setTimeout(() => this.hideSheetLoading(), 10000) });
|
|
|
+ },
|
|
|
+ // 属性面板数据就绪(或加载失败)后关闭;传入 medID 时仅关闭当前药品的 loading,
|
|
|
+ // 避免切换药品时旧请求晚到把新药品的 loading 提前关掉
|
|
|
+ hideSheetLoading(medID) {
|
|
|
+ if (medID && this.medID !== medID) return;
|
|
|
+ this.clearSheetLoadingTimer();
|
|
|
+ if (!this.sheetLoading) return;
|
|
|
+ this.setData({ sheetLoading: false });
|
|
|
+ uni.hideLoading();
|
|
|
+ },
|
|
|
+ clearSheetLoadingTimer() {
|
|
|
+ if (this.sheetLoadingTimer) {
|
|
|
+ clearTimeout(this.sheetLoadingTimer);
|
|
|
+ this.setData({ sheetLoadingTimer: null });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/* ============ 药品选中/抽屉 ============ */
|
|
|
openAttrSheet(med) {
|
|
|
this.setData({ sheetMed: med });
|
|
|
@@ -1111,10 +1144,12 @@ export default {
|
|
|
delete medObjMap[med.medID];
|
|
|
this.setData({ medQtyMap, medObjMap });
|
|
|
} else {
|
|
|
+ // 先展示页面 loading,再请求属性面板数据,面板打开后关闭
|
|
|
+ this.showSheetLoading();
|
|
|
this.openAttrSheet(med);
|
|
|
}
|
|
|
- },
|
|
|
- isChecked(it) {
|
|
|
+ },
|
|
|
+ isChecked(it) {
|
|
|
return !!this.selectedMap[it.medID || it.appOrderID];
|
|
|
},
|
|
|
toggleCheck(it) {
|
|
|
@@ -1551,6 +1586,7 @@ export default {
|
|
|
const admID = this.admID || (patientData && patientData.admID) || '';
|
|
|
const { medID, ordSetID } = this;
|
|
|
if (!medID || medID === '') {
|
|
|
+ this.hideSheetLoading(medID);
|
|
|
return;
|
|
|
}
|
|
|
$http.post('urlDeault', this, {
|
|
|
@@ -1569,17 +1605,21 @@ export default {
|
|
|
if (this.medID !== medID) return;
|
|
|
const errorData = (res.errorData && res.errorData[0]) || null;
|
|
|
if (res.errorCode !== '0' || !res.data || !res.data[0]) {
|
|
|
+ // 面板数据未就绪(含网络异常 errorCode = '-1'),关闭 loading
|
|
|
+ this.hideSheetLoading(medID);
|
|
|
return;
|
|
|
}
|
|
|
if (errorData) {
|
|
|
- Dialog.alert({
|
|
|
+ this.hideSheetLoading(medID);
|
|
|
+ Dialog.alert({
|
|
|
title: '提示',
|
|
|
message: errorData.errorMessage,
|
|
|
context: this
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
- this.setData({ showSheet: true });
|
|
|
+ // 属性面板数据已就绪并打开 -> 关闭页面 loading
|
|
|
+ this.setData({ showSheet: true }, () => this.hideSheetLoading(medID));
|
|
|
this.selectData1Fun();
|
|
|
this.selectData2Fun();
|
|
|
this.selectData3Fun();
|