Quellcode durchsuchen

Merge branch 'hotfix/usage' into develop

cc12458 vor 11 Monaten
Ursprung
Commit
cd8d288eef
1 geänderte Dateien mit 22 neuen und 3 gelöschten Zeilen
  1. 22 3
      src/components/ChineseMedicine.vue

+ 22 - 3
src/components/ChineseMedicine.vue

@@ -1122,6 +1122,7 @@ export default {
       doseId: "", // 要展示的 剂量id
 
       medIndex: 0, // 点击的 药品下标
+      defaultUsageMap: {}, // 使用默认用法映射
       usageList: [] // 用法列表
     };
   },
@@ -1811,6 +1812,7 @@ export default {
         return;
       }
 
+      let defaultUsage = false;
       let obj = {
         color: item.kc == 0 ? "red" : "#000",
         id: scope.row.id,
@@ -1821,8 +1823,8 @@ export default {
         unit: item.dw, // 单位
         usage:
           oneself ? scope.row.usage : scope.row.color === "red"
-            ? this.usageList[0].key
-            : scope.row.usage || item.usagestr || this.usageList[0].key, // 用法
+              ? (defaultUsage = true, this.usageList[0].key)
+              : scope.row.usage || item.usagestr || (defaultUsage = true, this.usageList[0].key), // 用法
         //usage: "",
         // price: item.lsjg,
         price: item.price,
@@ -1843,7 +1845,8 @@ export default {
         obj.dose = CC_Basis2Dosage(obj)
       }
 
-      Object.assign(totalData[scope.row.id - 1], obj);
+      const m = Object.assign(totalData[scope.row.id - 1], obj);
+      if (defaultUsage) this.defaultUsageMap[obj.medid] = m;
 
       // 调用 父级合理用药接口
       let father = this.$parent;
@@ -2294,6 +2297,22 @@ export default {
         this.maxDose = +res.data.matmaxdosage;
         this.minDose = +res.data.matmindosage;
         this.doseId = id;
+        // 兼容方案
+        if (this.defaultUsageMap[id] != null) {
+          try {
+            const option = this.usageList.find(item => item.value === res.data.specialUsage || item.key === res.data.specialUsage) || this.usageList[0];
+            const usage = option ? option.key : 0;
+
+            const t1 = this.recipe_tabs[this.recipe_tabs_c].tableData;
+            const t2 = this.recipe_tabs[this.recipe_tabs_c].tableData1;
+
+            const m = t1.find(t => t.medid === id) || t2.find(t => t.medid === id);
+            if (m) m.usage = usage;
+
+            this.defaultUsageMap[id].usage = usage;
+            delete this.defaultUsageMap[id];
+          } catch (e) {}
+        }
       }
     },
     // 获取平台合理用药数据