Przeglądaj źródła

bug-743:代煎代配弹框弹了两次

张田田 1 tydzień temu
rodzic
commit
9a2d4717c5
1 zmienionych plików z 29 dodań i 51 usunięć
  1. 29 51
      src/views/diagnosis/Prescribing.vue

+ 29 - 51
src/views/diagnosis/Prescribing.vue

@@ -1463,13 +1463,13 @@ export default {
     this._processRouteQuery();
   },
   beforeRouteLeave(to, from, next) {
-    console.log('query===处方页面跳转', to.path);
+    // console.log('query===处方页面跳转', to.path);
     if (to.path == "/index/recipe") {
-      console.log('清缓存', to.path);
+      // console.log('清缓存', to.path);
       sessionStorage.removeItem("prescr" + this.getPatiensInfo.pid);
       next();
     } else {
-      console.log('存缓存', to.path);   
+      // console.log('存缓存', to.path);   
       this._setDataToStorage(next);
     }
   },
@@ -1565,10 +1565,10 @@ export default {
     // 处理路由参数
     async _processRouteQuery() {
       const query = this.$route.query || {};
-      console.log('query======', sessionStorage.getItem("prescr" + this.getPatiensInfo.pid));
+      // console.log('query======', sessionStorage.getItem("prescr" + this.getPatiensInfo.pid));
       // 暂存处方数据(不含药品)
       if (sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)) await this._showDataFromStorage(true);
-      console.log(query,"query获取的缓存的数据")
+      // console.log(query,"query获取的缓存的数据")
       // 名医名方 —> 方剂查询
       if (query.recipeID && query.kjType === "kj-fj") await this.getPreDetal(query.recipeID);
       // 就诊记录转方
@@ -1599,9 +1599,9 @@ export default {
       else {
         // 跟据就诊记录id获取处方号
         let res = await getPreNumber({pid: this.getPatiensInfo.pid}).catch(() => void 0);
-        console.log('获取处方id的数据', res);
+        // console.log('获取处方id的数据', res);
         const has = res && res.ResultCode == 0 && res.Data.length > 0;
-        console.log('是否有处方', has);
+        // console.log('是否有处方', has);
         if (has) await this.getRecipeShowData();
 
         else if (this.getEditPreNo()) await this.getRecipeDataByid(this.getEditPreNo());
@@ -1678,7 +1678,6 @@ export default {
               });
             }
             // 不管当前在哪个 tab 点推导,适宜技术都自动填入第一个推荐方案内容
-            // (当前 tab 是适宜技术时已由上方 inferRecipe(2,'7') 内部 fillSuitTechOnInfer 处理,此处补非适宜技术 tab)
             if (current.id !== '2' && results['7']) {
               this.fillSuitTechOnInfer(results['7']);
             }
@@ -1709,8 +1708,7 @@ export default {
       let child2 = children[1];
       let child3 = children[2];
 
-      // 适宜技术:存前先把当前活动处方页的编辑同步进 prescriptionDataMap,
-      // 否则缓存的 map 会漏当前页(镜像 detailTables 没存回 map),切页/提交时丢编辑
+      // 适宜技术:存前先把当前活动处方页的编辑同步进 prescriptionDataMap
       if (child3 && child3.saveCurrentTabData) child3.saveCurrentTabData();
 
       let obj = {
@@ -1758,7 +1756,7 @@ export default {
       let storageData = JSON.parse(
         sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)
       );
-      console.log(storageData, "storageData");
+      // console.log(storageData, "storageData");
       let children = this.$children.filter(item => {
         return (
           item.name == "中药处方" ||
@@ -1772,15 +1770,15 @@ export default {
 
       child1.recipe_tabs = storageData.child1.recipe_tabs;
       child1.recipe_tabs_c = storageData.child1.recipe_tabs_c;
+      // 仅在 (中药处方)时才弹「请和患者确认信息」地址窗,
+      this.contentTabs = storageData.contentTabs;
+      this.container_i = storageData.container_i;
       if (typeof child1.loaded === 'function') await child1.loaded(storageData.child1);
 
       if (storageData.child1.recipe_tabs[0].totalTableD.length > 1) {
         this.isTuiDaoZy = true;
       }
 
-      // [原逻辑·保留] 适宜技术迁移到 AcupointTable 后 $data 无 tableData4 字段,
-      // 改用 prescriptions 判断是否推导过,并兼容旧缓存(tableData4)+ 判空避免 undefined.length 崩溃
-      // if (storageData.child3.tableData4.length > 1) {
       const suitPres = storageData.child3.prescriptions;
       if ((suitPres && suitPres.length > 0) || (storageData.child3.tableData4 && storageData.child3.tableData4.length > 1)) {
         this.isTuiDaoSuit = true;
@@ -1795,8 +1793,6 @@ export default {
         storageData.child2.tableData3 = [];
         storageData.child3.tableData4 = [];
       }
-      this.contentTabs = storageData.contentTabs;
-      this.container_i = storageData.container_i;
       this.rRecomendR = Array.isArray(storageData.rRecomendR) ? storageData.rRecomendR : [];
       this.suggestDiag = Array.isArray(storageData.suggestDiag) ? storageData.suggestDiag : [];
       this.suggestDiagAll = Array.isArray(storageData.suggestDiagAll) ? storageData.suggestDiagAll : [];
@@ -2407,7 +2403,7 @@ export default {
 
             // }
             console.group("debug:20250558")
-            console.log('配送原始', item.isdelivery);
+            // console.log('配送原始', item.isdelivery);
             obj.bottom_form.radio = item.isdelivery == null ? null : Number(item.isdelivery);
             console.log('配送赋值', obj.bottom_form.radio);
             console.groupEnd()
@@ -3126,7 +3122,6 @@ export default {
       }
     },
     // 候选来源为后端 suggestDiagAll,打开下拉不再搜全库、不再滚动加载
-    // searchWesternDisease / loadMoreWesternDisease 代码保留不删,仅此处不再调用
     onWesternDiseaseVisible(show) {
       if (!show) {
         const wrap = document.querySelector(
@@ -3137,7 +3132,6 @@ export default {
         }
       }
     },
-    // 候选来源为后端 suggestDiagAll,不再调 searchWesternDisease 搜全库
     queryWesternDisease(queryString, cb) {
       const selectedCodes = Array.isArray(this.suggestDiag) ? this.suggestDiag : [];
       const kw = (queryString || '').trim();
@@ -3192,9 +3186,6 @@ export default {
       if (item.id === '0') {
         try { this.tjRecipeId = child.recipe_tabs[child.recipe_tabs_c].id; } catch (e) { this.tjRecipeId = "" }
       } else if (item.id === '2') {
-        // [原逻辑·保留] AcupointTable 无 recipeId 字段,child.recipeId 为 undefined,
-        // 覆盖会清空 inferRecipe 已设的适宜技术默认高亮(pres[0]),故不再覆盖
-        // try { this.tjRecipeId = child.recipeId; } catch (e) { this.tjRecipeId = "" }
         // 适宜技术高亮由独立变量 suitTjRecipeId 管理(fillSuitTechOnInfer/onSuitRecommendSelect 设置),切tab无需在此处理
       }
     },
@@ -3740,7 +3731,7 @@ export default {
           this._recipeIsPay(res.Data.zhongchengyao.preId, 2);
         }
         if (this.contentTabs[2].check) {
-          // 适宜技术支持多条处方,按数组回显(assignRecipe3 内部已兼容数组并合并 treatmentList)
+          // 适宜技术支持多条处方
           this.assignRecipe3(res.Data.technologies, loading);
           res.Data.technologies.forEach((item, index) => {
             if (item && item.preId) this._recipeIsPay(item.preId, 2, index);
@@ -3752,7 +3743,7 @@ export default {
       }
     },
 
-    // 据id 获取处方回显数据
+    // 据id 获取处方回显数据
     async getRecipeDataByid(id) {
       let params = {
         pid: id
@@ -3809,7 +3800,7 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
         await this._recipeIsPay(id, 1);
       }
     },
-    // 适宜技术病历转方回显(getRecipeBySuitTech,入参 recordId=来源就诊记录id)
+    // 适宜技术病历转方回显
     async suitTechRecordTurn(recordId,visitId) {
       const loading = this.$loading({
         lock: true,
@@ -3822,7 +3813,7 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
         const res = await getRecipeBySuitTech({ recordId ,visitId});
         console.log('适宜技术病历转方回显', res);
         if (res.ResultCode === 0 && res.Data) {
-          // 转方前校验:跳过开方页面已支付的相同项目
+          // 转方前校验
           const checkResult = this.checkPaidProjects(res.Data, 'treatItemName');
           if (checkResult.skippedPaid.length > 0) {
             this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
@@ -3837,7 +3828,7 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
           this.contentTabs[0].check = false;
           this.contentTabs[1].check = false;
           this.contentTabs[2].check = true;
-          // 转方是主动换方案:清掉切tab缓存,避免 assignRecipe3 开头 restoreCachedData 拦截
+          // 转方是主动换方案
           if (this.$refs.suitScience) {
             this.$refs.suitScience._cachedPrescriptions = null;
             this.$refs.suitScience._cachedPrescriptionDataMap = null;
@@ -3883,7 +3874,7 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
           this.contentTabs[0].check = false;
           this.contentTabs[1].check = false;
           this.contentTabs[2].check = true;
-          // 转方是主动换方案:清掉切tab缓存,避免 assignRecipe3 开头 restoreCachedData 拦截
+          // 转方是主动换方案
           if (this.$refs.suitScience) {
             this.$refs.suitScience._cachedPrescriptions = null;
             this.$refs.suitScience._cachedPrescriptionDataMap = null;
@@ -4060,7 +4051,6 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
         loading.close();
 
         let arr = [];
-console.log(res.data, "获取的数据");
         res.data.expList.forEach(item => {
           item.showType = 1; // 专家经验
           item.book = item.book ? item.book : "(暂无)";
@@ -4072,7 +4062,6 @@ console.log(res.data, "获取的数据");
         });
         // this.inferRecipeId = res.data.schemes[0].preid
         let arr2 = res.data.expList.concat(res.data.schemes[0].pres);
-console.log(arr2, "arr2");
         if (type == 4) {
           try { this.contentTabs.find(tab => tab.businesstype === businesstype).color = arr2.length > 0 ? "red" : ""; } catch (e) {}
           return;
@@ -4098,9 +4087,7 @@ console.log(arr2, "arr2");
           }
         }
         this.rRecomendR = arr2;
-console.log(this.rRecomendR, "this.rRecomendR");
-        // 适宜技术:用独立高亮变量 suitTjRecipeId(与中药处方/制剂的 tjRecipeId 解耦),
-        // 仅推导(type!=3)时默认设第一个;切tab不重置,保留 fillSuitTechOnInfer/onSuitRecommendSelect 已设的值
+        // 适宜技术:用独立高亮变量 suitTjRecipeId
         if (this.container_i == 2 && type !== 3) {
           const presList = (res.data.schemes && res.data.schemes[0] && res.data.schemes[0].pres) || [];
           if (presList.length > 0) {
@@ -4147,7 +4134,6 @@ console.log(this.rRecomendR, "this.rRecomendR");
             // && child.recipe_tabs[child.recipe_tabs_c].totalTableD.length == 1
             this.container_i == 0
           ) {
-            // console.log(arr, 'res.data');
             this.addRecipeFrom("4");
 
             if (arr2[0].showType == 1) {
@@ -4163,7 +4149,7 @@ console.log(this.rRecomendR, "this.rRecomendR");
             }
           } else if (this.container_i == 2) {
             if (type !== 3) {
-              // 适宜技术推导填入第一个方案(逻辑提取到 fillSuitTechOnInfer,tcmClick 非适宜技术tab也复用)
+              // 适宜技术推导填入第一个方案
               this.fillSuitTechOnInfer(res);
               this.addRecipeFrom("4", 2);
             }
@@ -4190,7 +4176,6 @@ console.log(this.rRecomendR, "this.rRecomendR");
         }, 500);
       }
     },
-    // 打开顶层协定方详情弹窗(查询弹窗点行触发;提到顶层,避免详情弹窗嵌套在查询弹窗里被 mask 遮挡)
     async openSuitDetail(pid) {
       if (!pid) return;
       this.suitDetailPid = pid;
@@ -4207,14 +4192,11 @@ console.log(this.rRecomendR, "this.rRecomendR");
         this.suitDetailLoading = false;
       }
     },
-    // 顶层详情弹窗点转方:走协定方转方回填(onSuitTechTurn 内部会关闭查询弹窗)
     onSuitDetailTurn() {
       if (!this.suitDetailPid) return;
       this.suitDetailShow = false;
       this.onSuitTechTurn(this.suitDetailPid, this.suitDetailData);
     },
-    // 适宜技术·回填诊断信息:病名/证型/治法 → TCM.setParams;西医诊断 → 建议诊断(suggestDiag)
-    // 协定方转方 / 推荐方案载入 共用;detail 来自 getSuitableTechInfo / getLocalSuitableTechInfo
     fillSuitTechDiagnosis(detail) {
       if (!detail) return;
       if (this.$refs.TCM && (detail.disName || detail.synName || detail.theName)) {
@@ -4239,9 +4221,8 @@ console.log(this.rRecomendR, "this.rRecomendR");
         this.suggestDiagAll = wdCodes.map((code, i) => ({ westcode: code, westname: wdNames[i] || this.westernDiseaseNameMap[code] || code }));
       }
     },
-    // 适宜技术 · 协定方转方(详情弹窗转方」触发
+    // 适宜技术 · 协定方转方(详情弹窗转方)
     async onSuitTechTurn(pid, detail) {
-      console.log('onSuitTechTurn 参数:', { pid, detail });
       const loading = this.$loading({
         lock: true,
         text: '正在转方',
@@ -4266,9 +4247,9 @@ console.log(this.rRecomendR, "this.rRecomendR");
           }
           res.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
 
-          // 协定方转方:回填病名/证型/治法 + 建议诊断(公共方法,推荐方案也复用)
+          // 协定方转方:回填病名/证型/治法 + 建议诊断
           this.fillSuitTechDiagnosis(detail);
-          // 转方是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
+          // 转方是主动换方案
           if (this.$refs.suitScience) {
             this.$refs.suitScience._cachedPrescriptions = null;
             this.$refs.suitScience._cachedPrescriptionDataMap = null;
@@ -4321,7 +4302,7 @@ console.log(this.rRecomendR, "this.rRecomendR");
           }
           recipeRes.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
 
-          // 推荐方案换入是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
+          // 推荐方案换入是主动换方案
           if (this.$refs.suitScience) {
             this.$refs.suitScience._cachedPrescriptions = null;
             this.$refs.suitScience._cachedPrescriptionDataMap = null;
@@ -4341,12 +4322,11 @@ console.log(this.rRecomendR, "this.rRecomendR");
       this.addRecipeFrom("4", 2);
     },
     // 适宜技术 · 推导后自动填入第一个推荐方案内容(不管当前在哪个 tab)
-    // 当前 tab 是适宜技术时由 inferRecipe(2,'7') 调用;当前 tab 非适宜技术时由 tcmClick 调用
     async fillSuitTechOnInfer(res) {
       if (!res || res.code !== 0 || !res.data) return;
       const presList = (res.data.schemes && res.data.schemes[0] && res.data.schemes[0].pres) || [];
       if (presList.length === 0) return; // 没有推荐方案则不填入
-      // 默认高亮第一个推荐方案(适宜技术专用高亮变量,立即生效)
+      // 默认高亮第一个推荐方案
       this.suitTjRecipeId = presList[0].pid;
       const acupointTable = this.$refs.suitScience;
       if (!acupointTable) return;
@@ -4467,12 +4447,10 @@ console.log(this.rRecomendR, "this.rRecomendR");
     },
     // 协定方转方 判断
     async changeBasisPre(id) {
-      console.log('[协定方转方] agreeInfo:', this.agreeInfo);
       let params = {
         basisPreId: id
       };
       let res = await changeBasisPre(params);
-      console.log('[协定方转方] changeBasisPre 接口返回:', res);
       if (res.ResultCode == 0) {
         this.agreeAssignToTCM(this.agreeInfo);
       }
@@ -4913,15 +4891,15 @@ console.log(this.rRecomendR, "this.rRecomendR");
     },
     // 获取协定方详细信息
     async getAccordDetail(id) {
-      console.log('[协定方详情] id:', id);
+      // console.log('[协定方详情] id:', id);
       addRecipeFrom({ type: 2 }).catch();
       let res = await getAccordDetail({
         pid: id
       });
-      console.log('[协定方详情] 接口返回:', res);
+      // console.log('[协定方详情] 接口返回:', res);
       if (res.ResultCode == 0) {
         this.agreeInfo = res.Data;
-        console.log('[协定方详情] agreeInfo:', this.agreeInfo);
+        // console.log('[协定方详情] agreeInfo:', this.agreeInfo);
         this.showAgree = true;
       }
     },