see999 4 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
         this.form.intro = ''
663
         this.form.intro = ''
664
       },
664
       },
665
       show(id, obj) {
665
       show(id, obj) {
666
-
667
         this.unitList = []
666
         this.unitList = []
668
         this.packingUnit = []
667
         this.packingUnit = []
669
         var arr =  getDataConfig('hemodialysis','units')
668
         var arr =  getDataConfig('hemodialysis','units')
672
             this.unitList.push(arr[i])
671
             this.unitList.push(arr[i])
673
             this.packingUnit.push(arr[i])
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
             this.unitList.push(arr[i])
675
             this.unitList.push(arr[i])
676
+          }
677
+          if(obj.max_unit == arr[i].name){
677
             this.packingUnit.push(arr[i])
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
         console.log('this.unitList',this.unitList)
713
         console.log('this.unitList',this.unitList)
681
         this.getInitializtion()
714
         this.getInitializtion()
682
         this.getlist()
715
         this.getlist()