Browse Source

药品开单

1178232204@qq.com 3 years ago
parent
commit
01af926731
1 changed files with 13 additions and 22 deletions
  1. 13 22
      src/components/knowledgeExtra/AddNewRule.vue

+ 13 - 22
src/components/knowledgeExtra/AddNewRule.vue

@@ -289,9 +289,7 @@ export default {
       this.parId = info.parId;
       this.isCopy = param.copy;
       this.title = "规则维护-" + (this.isCopy ? "复制" : "修改") + "规则";
-
       this.getDragData(info);
-
       // 编辑初始化选择框
 
       this.initEdidData();
@@ -391,7 +389,7 @@ export default {
           if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
             let klRuleByIdSub = this.form.klRuleByIdSub;
             klRuleByIdSub.forEach((item, i, arr) => {
-              if (arr[i].key != 0 && arr[i].subType == 1) {
+              if (arr[i].key != 0) {
                 const arr = this.baseTypeList.filter((it) => {
                   return it.type == 1;
                 });
@@ -402,14 +400,12 @@ export default {
             });
             if (item.key == 2) {
               //获取互斥项code
-              console.log(item);
               const list = obj.subMenuList.filter((it) => {
                 return (
                   it.code == arr[i - 1].subLenCode &&
                   it.remark.split("|")[0] == 3
                 );
               });
-              console.log(list);
               const dragArr = list[0].remark.split("|")[1].split(",");
               this.dragArr = dragArr;
               this.dragVal = item.subLenCode;
@@ -428,7 +424,7 @@ export default {
                   return it.remark.split("|")[0] == (item.key % 3) + 1;
                 }
               });
-              
+
               this.$set(item, "baseTermTypeList", screenArr);
             }
           }
@@ -673,7 +669,7 @@ export default {
         const arr = this.form.klRuleByIdSub.filter((item, i) => {
           return item.groupId == groupId;
         });
-        if (this.dragArr && arr.length == 3) {
+        if (this.dragArr && arr.length == 3 && key != 0) {
           //获取互斥项code
           const list = obj.subMenuList.filter((it) => {
             return it.code == this.dragVal && it.remark.split("|")[0] == 3;
@@ -847,7 +843,6 @@ export default {
         this.$set(obj, "key", 0);
         this.dragArr = null;
       }
-      console.log(this.form.klRuleByIdSub);
       this.$nextTick(() => {
         this.$refs.tableView.scrollFun();
       });
@@ -902,6 +897,8 @@ export default {
                 del: true,
               },
             ];
+            this.dragVal = null;
+            this.dragArr = null;
           }
         } else if (key == 1) {
           let klRuleByIdSub = JSON.parse(
@@ -912,7 +909,6 @@ export default {
               klRuleByIdSub[i].groupId == groupId &&
               klRuleByIdSub[i].key > 0
             ) {
-              console.log(i);
               klRuleByIdSub.splice(i, 1);
             }
           }
@@ -1032,27 +1028,20 @@ export default {
       const len = this.form.klRuleByIdSub.filter((item, i) => {
         return item.groupId == groupId;
       });
-      const mutex = len.some((item, i, arr) => {
-        return item.subLenCode == "";
-      });
-      const inx =
-        len.length % 3 == 2
-          ? index + 1
-          : len.length % 3 == 0
-            ? index + 1
-            : index;
+      const inx = key % 3 == 2 ? index - 1 : key % 3 == 1 ? index + 1 : index;
       //判断药品合理性总条数是否大于1条,是否存在第二条或第三条类型为1,存在触发互斥
       if (
         //判断3条规则是否都已选中
         dragDel.length > 0 &&
-        len[0].subType == 1 &&
         len.length > 1 &&
         index > 0 &&
         key > 0
       ) {
-        console.log(123);
-        if (!mutex && len.length == 3) {
-          console.log(456);
+        if (
+          len.length == 3 &&
+          len[1].subLenCode != "" &&
+          len[2].subLenCode != ""
+        ) {
           //判断是否存在符合互斥条件的两条出具,若存在,置空另一条出具
           if (this.dragArr.indexOf(this.dragVal) > -1) {
             //剂型给药途径互斥判断
@@ -1078,6 +1067,8 @@ export default {
               subEqValue: "",
               subLenCode: "",
               dataType: "",
+              del: false,
+              key: key == 2 ? 1 : 2,
             });
           }
         } else {