see999 3 years ago
parent
commit
6e4377e314
1 changed files with 35 additions and 2 deletions
  1. 35 2
      src/xt_pages/data/components/addDrugs.vue

+ 35 - 2
src/xt_pages/data/components/addDrugs.vue View File

@@ -663,7 +663,6 @@
663 663
         this.form.intro = ''
664 664
       },
665 665
       show(id, obj) {
666
-
667 666
         this.unitList = []
668 667
         this.packingUnit = []
669 668
         var arr =  getDataConfig('hemodialysis','units')
@@ -672,11 +671,45 @@
672 671
             this.unitList.push(arr[i])
673 672
             this.packingUnit.push(arr[i])
674 673
           }
675
-          if(obj.max_unit == arr[i].name){
674
+          if(obj.dose_unit == arr[i].name){
676 675
             this.unitList.push(arr[i])
676
+          }
677
+          if(obj.max_unit == arr[i].name){
677 678
             this.packingUnit.push(arr[i])
678 679
           } 
680
+
681
+          let idArr = []
682
+          this.unitList.map(item => {
683
+            idArr.push(item.id)
684
+          })
685
+          if(idArr.indexOf(obj.drug_dose_unit) == -1){
686
+            if(obj.drug_dose_unit == arr[i].id){
687
+              this.unitList.push(arr[i])
688
+            }
689
+          }
690
+          let packingIdArr = []
691
+          this.packingUnit.map(item => {
692
+            packingIdArr.push(item.id)
693
+          })
694
+          if(packingIdArr.indexOf(obj.prescribing_number_unit) == -1){
695
+            if(obj.prescribing_number_unit == arr[i].id || obj.prescribing_number_unit == arr[i].name){
696
+              this.packingUnit.push(arr[i])
697
+            }
698
+          }
679 699
         }
700
+        let ojb = {};
701
+        this.unitList = this.unitList.reduce(function(prevArr, currentItem) {
702
+          //利用对象的键名无法重复的特点,mch_id是唯一区别的属性值
703
+          ojb[currentItem.name] ? '' : ojb[currentItem.name] = true && prevArr.push(currentItem);
704
+          return prevArr
705
+        }, [])
706
+
707
+        let newojb = {};
708
+        this.packingUnit = this.packingUnit.reduce(function(prevArr, currentItem) {
709
+          //利用对象的键名无法重复的特点,mch_id是唯一区别的属性值
710
+          newojb[currentItem.name] ? '' : newojb[currentItem.name] = true && prevArr.push(currentItem);
711
+          return prevArr
712
+        }, [])
680 713
         console.log('this.unitList',this.unitList)
681 714
         this.getInitializtion()
682 715
         this.getlist()