Explorar o código

Merge branch 'feature/20241219' into develop

cc12458 hai 1 ano
pai
achega
c1a45b69b9

+ 58 - 145
src/components/ChineseMedicine.vue

@@ -1143,6 +1143,20 @@ export default {
   },
   mounted() {},
   methods: {
+    _splitDataToView(totalData) {
+      if (!Array.isArray(totalData)) totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
+      const forceUpdate = (data) => Object.assign({}, data);
+      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
+        (item, index) => {
+          return item.id % 2 !== 0;
+        }
+      ).map(forceUpdate);
+      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
+        (item, index) => {
+          return item.id % 2 === 0;
+        }
+      ).map(forceUpdate);
+    },
     // 打开父级安全合理用药监测
     openSafeDrug() {
       this.$parent.opensafeD();
@@ -1209,6 +1223,8 @@ export default {
     },
     // 监听键盘事件
     drugDown(e, scope) {
+      e.stopPropagation();
+      e.preventDefault();
       let index = scope.row.id ? scope.row.id - 1 : 0;
 
       let totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
@@ -1233,15 +1249,8 @@ export default {
       // 表格 fixed 时 去 下标 为 1
 
       if (totalData[index].drugList.length > 5) {
-        document.querySelectorAll(
-          `#infiniteList${scope.row.id}`
-        )[1].scrollTop += 36;
-
-        console.log(
-          document.querySelectorAll(`#infiniteList${scope.row.id}`)[1]
-            .scrollTop,
-          "top"
-        );
+        const el = document.querySelectorAll(`#infiniteList${scope.row.id}`)[0];
+        if (el) el.scrollTop += 36;
       }
       this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
       totalData.filter((item, index) => {
@@ -1249,19 +1258,12 @@ export default {
         return (item.id = index + 1);
       });
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
       this.$forceUpdate();
     },
     drugUp(e, scope) {
+      e.stopPropagation();
+      e.preventDefault();
       let index = scope.row.id ? scope.row.id - 1 : 0;
       let totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
       // 如果到最后一个 判断是否需要分页
@@ -1271,30 +1273,16 @@ export default {
         totalData[index].search_i -= 1;
       }
 
-      if (
-        document.querySelectorAll(`#infiniteList${scope.row.id}`)[1].scrollTop >
-        0
-      ) {
-        document.querySelectorAll(
-          `#infiniteList${scope.row.id}`
-        )[1].scrollTop -= 36;
-      }
+
+      const el = document.querySelectorAll(`#infiniteList${scope.row.id}`)[0];
+      if (el && el.scrollTop > 0) el.scrollTop -= 36;
       this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
       totalData.filter((item, index) => {
         // this.getSelectType('中药药品用法', index)
         return (item.id = index + 1);
       });
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
     },
     drugEnter(scope) {
       this.chooseDis1(
@@ -1309,16 +1297,7 @@ export default {
 
       this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].usage = e;
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
     },
     doseFocus(scope) {
       let width = window.innerWidth;
@@ -1810,17 +1789,7 @@ export default {
         scope.row.id - 1
       ].total = total;
 
-      const forceUpdate = (data) => Object.assign({}, data);
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      ).map(forceUpdate);
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      ).map(forceUpdate);
+      this._splitDataToView(totalData);
 
       if (this.recipe_tabs[this.recipe_tabs_c].bottom_form.doseNum) {
         // this.countNowRecipeMoney();
@@ -1905,16 +1874,7 @@ export default {
         return (item.id = index + 1);
       });
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
 
       if (from != "now") return;
       setTimeout(() => {
@@ -1965,16 +1925,7 @@ export default {
 
       this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
       if (type != "click") return;
       setTimeout(() => {
         if (
@@ -2017,16 +1968,7 @@ export default {
         // father.getRationalMed(item.medid)
         return (item.id = index + 1);
       });
-      this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
-        (item, index) => {
-          return item.id % 2 != 0;
-        }
-      );
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
-        (item, index) => {
-          return item.id % 2 == 0;
-        }
-      );
+      this._splitDataToView(totalData);
       this.countNowRecipeMoney();
     },
     clickName(scope) {
@@ -2057,10 +1999,6 @@ export default {
       ].search_i = 0;
 
       debounce(this.getTableDrug(scope.row.key, 1, scope.row.id - 1), 10000);
-      setTimeout(() => {
-        // console.log(document.querySelectorAll('#searchD' + scope.row.id));
-        document.querySelectorAll("#searchD" + scope.row.id)[0].focus();
-      }, 800);
     },
     // 输入框获取 药品列表
     searchDrug(e, scope) {
@@ -2077,7 +2015,6 @@ export default {
       let index = scope.row.id ? scope.row.id - 1 : 0;
       // console.log(this.recipe_tabs[this.recipe_tabs_c].totalTableD[index], '我是key')
 
-      this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].key = e;
       let ids = document.querySelectorAll("#operate2");
       ids.forEach((item, index) => {
         item.style["z-index"] = "auto";
@@ -2092,21 +2029,15 @@ export default {
       //     ].showSearch = false
       // }
 
-      this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
-        this.recipe_tabs_c
-      ].totalTableD.filter((item, index) => {
-        return item.id % 2 != 0;
-      });
-      this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
-        this.recipe_tabs_c
-      ].totalTableD.filter((item, index) => {
-        return item.id % 2 == 0;
-      });
+      const totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
+      totalData[index].key = e;
+      totalData[index].search_i = 0;
+      this._splitDataToView(totalData);
       this.index = scope.row.id - 1;
 
       // this.getTableDrug(scope.row.key, 1, scope.row.id - 1)
 
-      debounce(this.getTableDrug(scope.row.key, 1, index), 10000);
+      debounce(this.getTableDrug(e, 1, index), 10000);
     },
     drugFocus(scope) {
       this.medIndex = scope.$index;
@@ -2137,16 +2068,7 @@ export default {
         this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
           item.drugList = [];
         });
-        this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 != 0;
-        });
-        this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 == 0;
-        });
+        this._splitDataToView();
       }, 500);
     },
     drugBlur1(e, scope) {
@@ -2176,16 +2098,7 @@ export default {
         this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
           item.drugList = [];
         });
-        this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 != 0;
-        });
-        this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 == 0;
-        });
+        this._splitDataToView();
       }, 500);
     },
     // 合并表一 表二
@@ -2535,6 +2448,7 @@ export default {
 
     // 切换中药类型时 切换 药房 获取 药品里面有没有这条数据
     async changePharmacy(type, val) {
+      // TODO 此处 if 不会调用 触发在 [this.$emit("updateDp", res.Data)](src/components/ChineseMedicine.vue:2831)
       if (this.recipe_tabs[this.recipe_tabs_c].radio == val) {
         this.$parent.openAddress();
         return;
@@ -2584,6 +2498,12 @@ export default {
         this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(
           (item1, index1) => {
             if (item1.name) {
+              const getUsage = (function (list = [], value = '') {
+                if (!Array.isArray(list) || list.length === 0) return void 0;
+                const option = value && list.find(item => item.value === value || item.key == value);
+                return option ? option.key : list[0].key;
+              }).bind(null, this.usageList);
+
               res.Data.forEach((item, index) => {
                 if (item == item1.medid) {
                   item1.color = "red";
@@ -2598,7 +2518,7 @@ export default {
                     spec: item.gg, // 规格
                     dose: item.dose, // 剂量
                     unit: item.dw, // 单位
-                    usage: item.usagestr || item.usage || this.usegeList[0].key, // 用法
+                    usage: item.usagestr || item.usage, // || this.usegeList[0].key, // 用法
                     // usage: "",
                     // price: item.lsjg,
                     price: item.price,
@@ -2612,6 +2532,7 @@ export default {
                     usageList: [],
                     oldDose: item1.oldDose
                   };
+                  /* 修正 */ item1.usage = item1.useage = getUsage(item1.usage);
 
                   item1.color = "#000";
                 }
@@ -2631,16 +2552,7 @@ export default {
             return (item.id = index + 1);
           }
         );
-        this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 != 0;
-        });
-        this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
-          this.recipe_tabs_c
-        ].totalTableD.filter((item, index) => {
-          return item.id % 2 == 0;
-        });
+        this._splitDataToView();
 
         // this.recipe_tabs[this.recipe_tabs_c].lastType = this.recipe_tabs[this.recipe_tabs_c]
         //     .radio // 存储这一次的 药房类型
@@ -2724,22 +2636,23 @@ export default {
               return (item.id = index + 1);
             }
           );
-          this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
-            this.recipe_tabs_c
-          ].totalTableD.filter((item, index) => {
-            return item.id % 2 != 0;
-          });
-          this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
-            this.recipe_tabs_c
-          ].totalTableD.filter((item, index) => {
-            return item.id % 2 == 0;
-          });
+          this._splitDataToView();
         } else {
           this.recipe_tabs[this.recipe_tabs_c].totalTableD[
             index
           ].loadMore = false;
         }
+
+        if (page === 1) {
+          const el = document.querySelectorAll(`#infiniteList${index+1}`)[0];
+          if (el && el.scrollTop > 0) el.scrollTop = 0;
+        }
       }
+      setTimeout(() => {
+        const el = document.querySelectorAll(`#searchD${index+1}`)[0];
+        console.log(el);
+        if (el) el.focus();
+      }, 100);
     },
     // 获取省数据
     async getProver() {

+ 1 - 0
src/utils/minix/prescribing.js

@@ -145,6 +145,7 @@ export default {
             this.isShowDj = isShowDj
             this.isShowPs = isShowPs
 
+            if (!this.isShowDj) this.isPs = 1;
             this.openAddress()
 
         },

+ 25 - 26
src/views/diagnosis/Prescribing.vue

@@ -1414,6 +1414,13 @@ export default {
     }
   },
   methods: {
+    // 处理路由参数
+   async _processRouteQuery() {
+      const query = this.$route.query;
+      if (!query) return;
+      if (query.recipeID && query.kjType === "kj-fj") await this.getPreDetal(query.recipeID);
+      else if (query.doctorCase) await this.changeAndJoin();
+    },
     // 参考医案
     // 中医诊断推导点击
     tcmClick(isauto = true) {
@@ -3038,19 +3045,9 @@ export default {
           }
 
           const recipeID = this.getEditPreNo();
-
-          if (!!recipeID) {
-            if (this.$route.query.kjType) {
-              if (this.$route.query.kjType == "kj-fj") {
-                this.getPreDetal(recipeID);
-              }
-            } else {
-              this.getRecipeDataByid(recipeID);
-            }
-          } else if (this.$route.query.doctorCase) {
-            setTimeout(() => {
-              this.changeAndJoin();
-            }, 1000);
+          debugger
+          if (!!recipeID && !this.$route.query.kjType) {
+            await this.getRecipeDataByid(recipeID);
           } else if (this.$route.query.type == "tuidao") {
             this.isTuiDaoZy = true;
             // setTimeout(() => {
@@ -3059,9 +3056,10 @@ export default {
           }
         } else {
           // 有处方号
-          this.getRecipeShowData();
+          await this.getRecipeShowData();
         }
       }
+      await this._processRouteQuery();
     },
     // 药方是否支付
     async _recipeIsPay(id, type, index) {
@@ -3233,7 +3231,7 @@ export default {
         if (!res.Data.flag) {
           loading.close();
           if (this.getPatiensInfo.pid) {
-            this.getPatiensBasisM();
+            await this.getPatiensBasisM();
           }
           return;
         }
@@ -3273,12 +3271,6 @@ export default {
         if (this.getPatiensInfo.pid) {
           this.getPatiensBasisM();
         }
-
-        if (this.$route.query.doctorCase) {
-          setTimeout(() => {
-            this.changeAndJoin();
-          }, 1000);
-        }
       }
     },
 
@@ -3908,6 +3900,12 @@ export default {
       if (this.container_i == 0) {
         // 中药处方
         if (res.ResultCode == 0) {
+          const getUsage = (function (list = [], value = '') {
+            if (!Array.isArray(list) || list.length === 0) return void 0;
+            const option = value && list.find(item => item.value === value || item.key == value);
+            return option ? option.key : list[0].key;
+          }).bind(null, child.usageList);
+
           let noDrugs = []; // 查找不到的药品
           let hasDrugs = []; // 查找的到的药品
           res.Data.forEach((item, index) => {
@@ -3931,15 +3929,14 @@ export default {
                   pid: item1.matid,
                   color: "red",
                   dose: item1.dose,
-                  useage:
-                    item1.useage || item1.usagestr || child.usegeList[0].key,
+                  usage: item1.useage || item1.usagestr, // child.usegeList[0].key,
                   showSearch: false,
                   matid: item1.matid,
 
                   key: "",
                   search_i: index
                 };
-
+                /* 修正 */ obj.usage = obj.useage = getUsage(obj.usage);
                 noDrugs.push(obj);
                 // noDrugs.push(item1.matname)
               }
@@ -3966,7 +3963,7 @@ export default {
                 dose: item.dose, // 剂量
                 unit: item.dw, // 单位
                 // usage: item.usagestr, // 用法
-                usage: item.useage || item.usagestr || child.usegeList[0].key,
+                usage: item.useage || item.usagestr, // child.usegeList[0].key,
                 // price: item.lsjg,
                 price: item.price ? item.price : 0,
                 total: item.price * item.dose,
@@ -3978,6 +3975,7 @@ export default {
                 showSearch: false,
                 color: item.color ? item.color : "#000"
               };
+              /* 修正 */ obj1.usage = obj1.useage = getUsage(obj1.usage);
 
               child.recipe_tabs[child.recipe_tabs_c].totalTableD.push(obj1);
               child.getSelectType("中药药品用法", index);
@@ -4051,7 +4049,7 @@ export default {
                 dose: item.dose, // 剂量
                 unit: item.dw, // 单位
                 // usage: item.usagestr, // 用法
-                usage: item.useage || child.usegeList[0].key,
+                usage: item.useage || item.usagestr, // child.usegeList[0].key,
                 // price: item.lsjg,
                 price: item.price ? item.price : 0,
                 total: item.price * item.dose,
@@ -4062,6 +4060,7 @@ export default {
                 originname: item.cdmc, // 产地名称
                 showSearch: false
               };
+              /* 修正 */ obj1.usage = obj1.useage = getUsage(obj1.usage);
 
               child.recipe_tabs[child.recipe_tabs_c].totalTableD.push(obj1);
               child.getSelectType("中药药品用法", index);

+ 7 - 7
src/views/diagnosis/components/prescription.vue

@@ -25,20 +25,20 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="共享状态" v-if="activeName==2">
+        <!--<el-form-item label="共享状态" v-if="activeName==2">
           <el-select v-model="form.share" placeholder="请选择" size="small">
-            <!-- <el-option
+            &lt;!&ndash; <el-option
               :label="item.name"
               :value="item.pid"
               v-for="(item,index) in shareSelect"
               :key="index"
-            ></el-option>-->
+            ></el-option>&ndash;&gt;
             <el-option label="个人" :value="0"></el-option>
             <el-option label="二级科室" :value="1"></el-option>
             <el-option label="科室" :value="2"></el-option>
             <el-option label="本院" :value="3"></el-option>
           </el-select>
-        </el-form-item>
+        </el-form-item>-->
       </el-form>
       <el-button size="small" type="primary" @click="searchDis">搜索</el-button>
       <el-button size="small" type="warning" @click="clearDis">清空</el-button>
@@ -106,7 +106,7 @@ export default {
       form: {
         name: "", // 方名
         type: "", // 类型
-        share: "" // 共享状态
+        share: 0 // 共享状态
       },
       shareSelect: [],
       types: [],
@@ -137,7 +137,7 @@ export default {
       this.form = {
         name: "", // 方名
         type: "", // 类型
-        share: "" // 共享状态
+        share: 0 // 共享状态
       };
       if (this.activeName == 1) {
         this.getPrescriptionsList();
@@ -167,7 +167,7 @@ export default {
       this.form = {
         name: "", // 方名
         type: "", // 类型
-        share: "" // 共享状态
+        share: 0 // 共享状态
       };
       if (this.activeName == 1) {
         // this.form.name = this.$parent.$parent.$parent.agree_key;

+ 5 - 5
src/views/knowledge/Prescription.vue

@@ -66,10 +66,10 @@ export default {
     };
   },
   created() {
-    this.getEffectQuery();
-    setTimeout(() => {
-      this.getPrescriptionsList();
-    }, 500);
+    this.getEffectQuery().then(() => this.getPrescriptionsList());
+    // setTimeout(() => {
+    //   this.getPrescriptionsList();
+    // }, 500);
   },
   methods: {
     clearFilter() {
@@ -95,7 +95,7 @@ export default {
         pagesize: 9999,
         searchtype: "",
         keyword: this.form.name,
-        effected: this.tabs[this.tab_current].effectid,
+        effected: this.tabs[this.tab_current] ? this.tabs[this.tab_current].effectid : null,
         effect: this.form.gongxiao
       };
       let res = await getPrescriptionsList(params);