Browse Source

优化选中药品

liudan 2 months ago
parent
commit
79cc436f00

+ 68 - 63
src/pages/entryWrite/page/Entry/prescription/addPrescription/customDiagnostics/western/western.vue

@@ -632,6 +632,8 @@ export default {
 		},
 		// 由 treeNode 抛出:选中节点(任意层级)
 		onTreeSelect(node) {
+			// 右侧数据加载中:忽略再次点击,避免重复选中与重复请求
+			if (this.loadingRight) return;
 			const path = this.findPathById(this.treeListRaw, node) || [];
 			this.setData({
 				activePath: path.map((p) => this.buildNodeKey(p.node, p.idx))
@@ -729,80 +731,83 @@ export default {
 			}else{
 			    params.medSubCatID = node.id;
 			}
-			this.setData({ loadingRight: true });
-			$http.post('urlDeault', this, {
-                code: '12100059',
-                data: {
-                    params: [params],
-                    pagination: [{ pageSize: 200, currentPage: 1 }],
-                },
-				
-				success: (res) => {
-					if (res.errorCode === '0') {
-						const data = res?.result?.data || [];
-						this.setData({ medList: data, loadingRight: false, rightFinished: true });
-					} else {
+			this.setData({ loadingRight: true }, () => {
+				$http.post('urlDeault', this, {
+                	code: '12100059',
+                	data: {
+                	    params: [params],
+                	    pagination: [{ pageSize: 200, currentPage: 1 }],
+                	},
+
+					success: (res) => {
+						if (res.errorCode === '0') {
+							const data = res?.result?.data || [];
+							this.setData({ medList: data, loadingRight: false, rightFinished: true });
+						} else {
+							this.setData({ loadingRight: false });
+						}
+					},
+					fail: () => {
 						this.setData({ loadingRight: false });
 					}
-				},
-				fail: () => {
-					this.setData({ loadingRight: false });
-				}
+				});
 			});
+			
 		},
 		// 检验检查/治疗 03050098(参照 inspectionExamine.getMedicalList)
 		// mainCode: Z=治疗,E=检查,L=检验
 		// 返回字段:appOrderID / medDesc / medID / medPrice / orderTypeCode
 		loadCheckList(node) {
 			this.resetRight();
-			this.setData({ loadingRight: true });
-			const params = {
-				hospID: this.hospID,
-				locID: this.logonLocID,
-				admID: this.admID,
-			};
-			// 搜索关键字(参照 inspectionExamine.getMedicalList)
-			if (this.searchR) {
-				params.searchCode = this.searchR;
-			}
-			// 选中 node 时:HBid 有值 -> appTypeID,否则 CBid
-			if (node.HBid) {
-				params.appTypeID = node.HBid;
-			} else {
-				params.CBid = node.CBid || node.id;
-			}
-			$http.post('urlDeault', this, {
-				code: '03050098',
-				data: {
-					params: [params],
-				},
-				success: (res) => {
-					if (res.errorCode === '0') {
-						const data = res.result || [];
-						// 治疗分支由 mainCode === 'Z' 决定
-						const isTreatment = node.mainCode === 'Z';
-						this.setData({
-							checkList: data,
-							isTreatmentNode: isTreatment,
-							rightNode: {
-								// 检查(E)/检验(L) 显示全选;治疗(Z) 不显示
-								visibleCheckAll: node.mainCode === 'E' || node.mainCode === 'L',
-								type: node.mainCode,
-								id: node.id,
-								CBid: node.CBid,
-								HBid: node.HBid,
-								orderTypeCode: ''
-							},
-							loadingRight: false,
-							rightFinished: true
-						});
-					} else {
+			this.setData({ loadingRight: true }, () => {
+					const params = {
+					hospID: this.hospID,
+					locID: this.logonLocID,
+					admID: this.admID,
+				};
+				// 搜索关键字(参照 inspectionExamine.getMedicalList)
+				if (this.searchR) {
+					params.searchCode = this.searchR;
+				}
+				// 选中 node 时:HBid 有值 -> appTypeID,否则 CBid
+				if (node.HBid) {
+					params.appTypeID = node.HBid;
+				} else {
+					params.CBid = node.CBid || node.id;
+				}
+				$http.post('urlDeault', this, {
+					code: '03050098',
+					data: {
+						params: [params],
+					},
+					success: (res) => {
+						if (res.errorCode === '0') {
+							const data = res.result || [];
+							// 治疗分支由 mainCode === 'Z' 决定
+							const isTreatment = node.mainCode === 'Z';
+							this.setData({
+								checkList: data,
+								isTreatmentNode: isTreatment,
+								rightNode: {
+									// 检查(E)/检验(L) 显示全选;治疗(Z) 不显示
+									visibleCheckAll: node.mainCode === 'E' || node.mainCode === 'L',
+									type: node.mainCode,
+									id: node.id,
+									CBid: node.CBid,
+									HBid: node.HBid,
+									orderTypeCode: ''
+								},
+								loadingRight: false,
+								rightFinished: true
+							});
+						} else {
+							this.setData({ loadingRight: false });
+						}
+					},
+					fail: () => {
 						this.setData({ loadingRight: false });
 					}
-				},
-				fail: () => {
-					this.setData({ loadingRight: false });
-				}
+				});
 			});
 		},
 		loadRightList() {