liudan 3 месяцев назад
Родитель
Сommit
08f9c1c60f

+ 136 - 101
src/pages/entryWrite/page/Entry/prescription/addPrescription/customDiagnostics/western/western.vue

@@ -124,7 +124,10 @@
 				<text class="ie-footer__num">{{ totalSelected }}</text>
 				<text> 项</text>
 			</view>
-			<view class="ie-footer__btn" @tap="saveAll">保存</view>
+			<view class="ie-footer__btn" :class="{ 'ie-footer__btn--loading': saving }" @tap="saveAll">
+				<view v-if="saving" class="ie-footer__loading" />
+				<text>{{ saving ? '保存中…' : '保存' }}</text>
+			</view>
 		</view>
 
 		<!-- 已选医嘱底部弹窗 -->
@@ -390,6 +393,8 @@ export default {
 			treatQtyMap: {}, // 治疗 medID -> qty
 			// 底部抽屉
 			showSheet: false,
+			// 保存中(防止重复点击)
+			saving: false,
 			// 已选医嘱弹窗
 			showSelectedSheet: false,
 			sheetMed: {},
@@ -1101,109 +1106,114 @@ export default {
 		/* ============ 保存 ============ */
 		// 仅组装保存数据(参考 docs/文档.md),不走接口保存
 		saveAll() {
-			const patientData = Cache.get('patientData');
-			const userData = Cache.get('userData');
-			const { admID } = patientData;
-			const { userID, locID, hospID, groupID } = userData;
+			if (this.saving) return; // 防止重复点击
+			this.setData({ saving: true }, () => {
+				const patientData = Cache.get('patientData');
+				const userData = Cache.get('userData');
+				const { admID } = patientData;
+				const { userID, locID, hospID, groupID } = userData;
 
-			// ============ 1. 西药(03100050) ============
-			const westOrders = [];
-			Object.keys(this.medObjMap).forEach((k, index) => {
-				const item = this.medObjMap[k] || {};
-				westOrders.push({
-					ordSeqNo: item.xh || '',                          // 序号
-					ordLinkSeqNo: '',                                 // 关联序号
-					ordDate: '',                                      // 开医嘱日期
-					ordTime: '',                                      // 开医嘱时间
-					ordStartDate: '',                                 // 医嘱开始日期
-					ordStartTime: '',                                 // 医嘱开始时间
-					ordEndDate: '',                                   // 医嘱结束日期
-					ordEndTime: '',                                   // 医嘱结束时间
-					ordPriorityID: item.ordPriorityID || '',          // 医嘱优先级10
-					ordAdmReasonID: this.listId('selectData1', 'picakIndex1', 'id'), // 结算类型
-					medID: item.medID || '',                          // 医嘱项id
-					ordFirstDayNum: '',                               // 首日次数
-					ordUsageID: this.listId('selectData3', 'picakIndex3', 'id'),     // 药品用法
-					ordFreqID: this.listId('selectData2', 'picakIndex2', 'id'),      // 频次
-					ordDose: item.dose || '',                         // 剂量
-					ordDoseUnitID: this.listId('selectData4', 'picakIndex4', 'doseUnitID'), // 剂量单位
-					ordQty: item.qty || item.stepper2 || '',          // 数量
-					ordQtyUomID: this.listId('selectData5', 'picakIndex5', 'unitID'), // 数量单位
-					ordDurQty: item.stepper || '',                    // 疗程数量
-					ordDurationID: this.listId('courseUnitList', 'picakIndex9', 'id') || item.ordDurationID || '', // 疗程单位
-					ordInfuseSpeed: '',                               // 滴速
-					ordSpeedUnitID: '',                               // 滴速单位
-					ordStage: '',                                     // 医嘱阶段
-					ordRecLocID: this.listId('selectData8', 'picakIndex8', 'recLocID'), // 接收科室
-					ordOPer: '',                                      // 手术id
-					ordEMFlag: '',                                    // 加急标志
-					ordPriorityExtID: '',                             // 二级医嘱优先级
-					ordNote: item.remark || '',                       // 备注
-					orderResourceCode: '',                            // 医嘱来源代码
-					ordSeqNo: index,
-					ordTypeCode: 'M',                                 // 医嘱类型 M=西药
-					extvalue: [                                       // 诊断信息(03100050 通过 extvalue 传递)
-						{
-							code: 'Diag',
-							refDescripts: (this.diagData && this.diagData.diagCode) || '',
-							value: (this.diagData && this.diagData.id) || ''
-						}
-					]
-				});
-			});
-			// ============ 2. 检验检查治疗:先 03050020 获取默认数据,再按 03050001 组装 ============
-			const selectedKeys = Object.keys(this.selectedMap);
-			if (selectedKeys.length === 0) {
-				// 仅西药:直接提交
-				this.submitMixedOrders(westOrders, [], [], [], admID, locID, userID, hospID, groupID);
-				return;
-			}
-			const queryOrders = selectedKeys.map((k) => {
-				const it = this.selectedMap[k] || {};
-				return { medID: it.medID || '', ordSetID: '' };
-			});
-			$http.post('urlDeault', this, {
-				code: '03050020',
-				data: {
-					params: [{
-						admID: admID || '',
-						orders: queryOrders
-					}]
-				},
-				success: (res) => {
-					if (res.errorCode === '0') {
-						const dataList = res.data || [];
-						// medID -> defaultData 映射,便于按选中顺序构造 orders
-						const defaultMap = {};
-						dataList.forEach((d) => {
-							if (d && d.defaultData && d.defaultData.medID) {
-								defaultMap[d.defaultData.medID] = d.defaultData;
+				// ============ 1. 西药(03100050) ============
+				const westOrders = [];
+				Object.keys(this.medObjMap).forEach((k, index) => {
+					const item = this.medObjMap[k] || {};
+					westOrders.push({
+						ordSeqNo: item.xh || '',                          // 序号
+						ordLinkSeqNo: '',                                 // 关联序号
+						ordDate: '',                                      // 开医嘱日期
+						ordTime: '',                                      // 开医嘱时间
+						ordStartDate: '',                                 // 医嘱开始日期
+						ordStartTime: '',                                 // 医嘱开始时间
+						ordEndDate: '',                                   // 医嘱结束日期
+						ordEndTime: '',                                   // 医嘱结束时间
+						ordPriorityID: item.ordPriorityID || '',          // 医嘱优先级10
+						ordAdmReasonID: this.listId('selectData1', 'picakIndex1', 'id'), // 结算类型
+						medID: item.medID || '',                          // 医嘱项id
+						ordFirstDayNum: '',                               // 首日次数
+						ordUsageID: this.listId('selectData3', 'picakIndex3', 'id'),     // 药品用法
+						ordFreqID: this.listId('selectData2', 'picakIndex2', 'id'),      // 频次
+						ordDose: item.dose || '',                         // 剂量
+						ordDoseUnitID: this.listId('selectData4', 'picakIndex4', 'doseUnitID'), // 剂量单位
+						ordQty: item.qty || item.stepper2 || '',          // 数量
+						ordQtyUomID: this.listId('selectData5', 'picakIndex5', 'unitID'), // 数量单位
+						ordDurQty: item.stepper || '',                    // 疗程数量
+						ordDurationID: this.listId('courseUnitList', 'picakIndex9', 'id') || item.	ordDurationID || '', // 疗程单位
+						ordInfuseSpeed: '',                               // 滴速
+						ordSpeedUnitID: '',                               // 滴速单位
+						ordStage: '',                                     // 医嘱阶段
+						ordRecLocID: this.listId('selectData8', 'picakIndex8', 'recLocID'), // 接收科室
+						ordOPer: '',                                      // 手术id
+						ordEMFlag: '',                                    // 加急标志
+						ordPriorityExtID: '',                             // 二级医嘱优先级
+						ordNote: item.remark || '',                       // 备注
+						orderResourceCode: '',                            // 医嘱来源代码
+						ordSeqNo: index,
+						ordTypeCode: 'M',                                 // 医嘱类型 M=西药
+						extvalue: [                                       // 诊断信息(03100050 通过 extvalue 	传递)
+							{
+								code: 'Diag',
+								refDescripts: (this.diagData && this.diagData.diagCode) || '',
+								value: (this.diagData && this.diagData.id) || ''
 							}
-						});
-						const { checkOrders, lisOrders, treatOrders } = this.buildCheckTreatOrders(
-							selectedKeys,
-							defaultMap,
-							locID
-						);
-						this.submitMixedOrders(
-							westOrders,
-							checkOrders,
-							lisOrders,
-							treatOrders,
-							admID,
-							locID,
-							userID,
-							hospID,
-							groupID
-						);
-					} else {
-						uni.showToast({ title: res.errorMessage || '获取医嘱默认数据失败', icon: 'none' });
-					}
-				},
-				fail: () => {
-					uni.showToast({ title: '获取医嘱默认数据失败', icon: 'none' });
+						]
+					});
+				});
+				// ============ 2. 检验检查治疗:先 03050020 获取默认数据,再按 03050001 组装 ============
+				const selectedKeys = Object.keys(this.selectedMap);
+				if (selectedKeys.length === 0) {
+					// 仅西药:直接提交
+					this.submitMixedOrders(westOrders, [], [], [], admID, locID, userID, hospID, groupID);
+					return;
 				}
-			});
+				const queryOrders = selectedKeys.map((k) => {
+					const it = this.selectedMap[k] || {};
+					return { medID: it.medID || '', ordSetID: '' };
+				});
+				$http.post('urlDeault', this, {
+					code: '03050020',
+					data: {
+						params: [{
+							admID: admID || '',
+							orders: queryOrders
+						}]
+					},
+					success: (res) => {
+						if (res.errorCode === '0') {
+							const dataList = res.data || [];
+							// medID -> defaultData 映射,便于按选中顺序构造 orders
+							const defaultMap = {};
+							dataList.forEach((d) => {
+								if (d && d.defaultData && d.defaultData.medID) {
+									defaultMap[d.defaultData.medID] = d.defaultData;
+								}
+							});
+							const { checkOrders, lisOrders, treatOrders } = this.buildCheckTreatOrders(
+								selectedKeys,
+								defaultMap,
+								locID
+							);
+							this.submitMixedOrders(
+								westOrders,
+								checkOrders,
+								lisOrders,
+								treatOrders,
+								admID,
+								locID,
+								userID,
+								hospID,
+								groupID
+							);
+						} else {
+							uni.showToast({ title: res.errorMessage || '获取医嘱默认数据失败', icon: 'none' });
+							this.setData({ saving: false });
+						}
+					},
+					fail: () => {
+						uni.showToast({ title: '获取医嘱默认数据失败', icon: 'none' });
+						this.setData({ saving: false });
+					}
+				});
+			});	
 		},
 		// 按 03050001 组装检验检查治疗订单,并按 ordTypeCode 拆分为 check/lis/treat
 		// mainCode: E=检查 L=检验 O=治疗 -> ordTypeCode: C / L / T
@@ -1303,6 +1313,7 @@ export default {
 			};
 			if (!westOrders.length && !checkOrders.length && !lisOrders.length && !treatOrders.length) {
 				uni.showToast({ title: '请先选择医嘱', icon: 'none' });
+				this.setData({ saving: false });
 				return;
 			}
 			$http.post('urlDeault', this, {
@@ -1315,6 +1326,7 @@ export default {
 						uni.showToast({ title: '保存成功', icon: 'success' });
 						// 保存成功后跳转到医嘱录入页
 						setTimeout(() => {
+							this.setData({ saving: false });
 							uni.navigateTo({
 								url: '/pages/entryWrite/page/Entry/Entry?select=2&addText=添加医嘱'
 							});
@@ -1325,10 +1337,12 @@ export default {
 							res.errorMessage ||
 							'保存失败';
 						uni.showToast({ title: msg, icon: 'none' });
+						this.setData({ saving: false });
 					}
 				},
 				fail: () => {
 					uni.showToast({ title: '保存失败,请重试', icon: 'none' });
+					this.setData({ saving: false });
 				}
 			});
 		},
@@ -1691,6 +1705,8 @@ export default {
 	height: 100%;
 	background: #fafbfc;
 	overflow: hidden;
+	box-sizing: border-box;
+	padding-bottom: 100rpx;
 }
 /* 栏内搜索框 */
 .ie-search {
@@ -1972,6 +1988,25 @@ export default {
 	color: #fff;
 	font-size: 28rpx;
 	border-radius: 36rpx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+.ie-footer__btn--loading {
+	background: #a5c9f5;
+}
+.ie-footer__loading {
+	width: 28rpx;
+	height: 28rpx;
+	margin-right: 12rpx;
+	border: 3rpx solid rgba(255, 255, 255, 0.4);
+	border-top-color: #fff;
+	border-radius: 50%;
+	animation: ieSpin 0.8s linear infinite;
+}
+@keyframes ieSpin {
+	from { transform: rotate(0deg); }
+	to { transform: rotate(360deg); }
 }
 /* 底部抽屉 */
 .wa-mask {