huangyw 2 years ago
parent
commit
e56906acfe
1 changed files with 51 additions and 26 deletions
  1. 51 26
      src/xt_pages/Pharmacy/DrugDispensing.vue

+ 51 - 26
src/xt_pages/Pharmacy/DrugDispensing.vue View File

383
         <!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
383
         <!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
384
 "><div style="width: 40%;padding-left:3%">合计 </div> <div style="width: 40%;display: flex;justify-content:center;padding-left: 37%">{{total}}</div></div> -->
384
 "><div style="width: 40%;padding-left:3%">合计 </div> <div style="width: 40%;display: flex;justify-content:center;padding-left: 37%">{{total}}</div></div> -->
385
         <div style="margin-top: 25px; display: flex" v-if="state == 1">
385
         <div style="margin-top: 25px; display: flex" v-if="state == 1">
386
-          <span style="line-height: 36px;">领药人:</span> 
386
+          <span style="line-height: 36px">领药人:</span>
387
           <el-select v-model="admin_user_id" placeholder="请选择">
387
           <el-select v-model="admin_user_id" placeholder="请选择">
388
             <el-option
388
             <el-option
389
               v-for="item in doctorList"
389
               v-for="item in doctorList"
541
         return arr.indexOf(item, 0) === index;
541
         return arr.indexOf(item, 0) === index;
542
       });
542
       });
543
     },
543
     },
544
+    // 获取单位
545
+    getDose_unit(val) {
546
+      // console.log(val);
547
+      var newLength = 0;
548
+      var singleChar = "";
549
+      var newStr = "";
550
+      var chineseRegex = /[^\x00-\xff]/g;
551
+      let strLength = val.replace(chineseRegex, "**").length;
552
+      // console.log(strLength, "strLength");
553
+      for (var i = 0; i < strLength; i++) {
554
+        singleChar = val.charAt(i).toString();
555
+        // console.log(singleChar,'singleChar')
556
+        // console.log(singleChar.match(chineseRegex),'')
557
+        if (singleChar.match(chineseRegex) != null) {
558
+          newLength += 2;
559
+          newStr += singleChar;
560
+        } else {
561
+          newLength++;
562
+        }
563
+        if (newLength > strLength) {
564
+          break;
565
+        }
566
+        // newStr += singleChar;
567
+      }
568
+
569
+      // if (hasDot && strLength > len) {
570
+      //   newStr += "...";
571
+      // }
572
+      // console.log(newStr,'newStr')
573
+      return newStr;
574
+    },
544
 
575
 
545
     getSummaries_t1(param) {
576
     getSummaries_t1(param) {
546
       const { columns, data } = param;
577
       const { columns, data } = param;
556
         if (index === 7) {
587
         if (index === 7) {
557
           // 单位裁切
588
           // 单位裁切
558
           data.forEach((el, index) => {
589
           data.forEach((el, index) => {
559
-            dose_unit.push(el.total.substr(el.total.length - 1, 1));
590
+            dose_unit.push(this.getDose_unit(el.total));
560
           });
591
           });
592
+        
561
           dose_unit = this.unique_unit(dose_unit);
593
           dose_unit = this.unique_unit(dose_unit);
562
-          // 数据合计
594
+          console.log(dose_unit,'dose_unit')
595
+          // // 数据合计
563
           data.forEach((el, index) => {
596
           data.forEach((el, index) => {
564
-            if (el.total.substr(el.total.length - 1, 1) === dose_unit[0]) {
565
-              unit_1.push(el.total.substr(0, el.total.length - 1));
597
+            if (this.getDose_unit(el.total) === dose_unit[0]) {
598
+              unit_1.push(parseInt(el.total));
566
             }
599
             }
567
-            if (el.total.substr(el.total.length - 1, 1) === dose_unit[1]) {
568
-              unit_2.push(el.total.substr(0, el.total.length - 1));
600
+            if (this.getDose_unit(el.total) === dose_unit[1]) {
601
+              unit_2.push(parseInt(el.total));
569
             }
602
             }
570
           });
603
           });
571
           unit_1 = eval(unit_1.join("+"));
604
           unit_1 = eval(unit_1.join("+"));
599
         if (index === 6) {
632
         if (index === 6) {
600
           // 单位裁切
633
           // 单位裁切
601
           data.forEach((el, index) => {
634
           data.forEach((el, index) => {
602
-            dose_unit.push(el.total.substr(el.total.length - 1, 1));
635
+            dose_unit.push(this.getDose_unit(el.total));
603
           });
636
           });
604
           dose_unit = this.unique_unit(dose_unit);
637
           dose_unit = this.unique_unit(dose_unit);
605
           // 数据合计
638
           // 数据合计
606
           data.forEach((el, index) => {
639
           data.forEach((el, index) => {
607
-            if (el.total.substr(el.total.length - 1, 1) === dose_unit[0]) {
608
-              unit_1.push(el.total.substr(0, el.total.length - 1));
640
+            if (this.getDose_unit(el.total) === dose_unit[0]) {
641
+              unit_1.push(parseInt(el.total));
609
             }
642
             }
610
-            if (el.total.substr(el.total.length - 1, 1) === dose_unit[1]) {
611
-              unit_2.push(el.total.substr(0, el.total.length - 1));
643
+            if (this.getDose_unit(el.total) === dose_unit[1]) {
644
+              unit_1.push(parseInt(el.total));
612
             }
645
             }
613
           });
646
           });
614
           unit_1 = eval(unit_1.join("+"));
647
           unit_1 = eval(unit_1.join("+"));
839
     //列表选择与合计
872
     //列表选择与合计
840
     handleSelectionChange(val) {
873
     handleSelectionChange(val) {
841
       this.multipleSelection = val;
874
       this.multipleSelection = val;
842
-
843
       let coculate = val;
875
       let coculate = val;
844
       let sums = "";
876
       let sums = "";
845
       let dose_unit = [];
877
       let dose_unit = [];
847
       let unit_2 = [];
879
       let unit_2 = [];
848
 
880
 
849
       coculate.forEach((el, index) => {
881
       coculate.forEach((el, index) => {
850
-        dose_unit.push(el.total.substr(el.total.length - 1, 1));
882
+        // dose_unit.push(el.total.substr(el.total.length - 1, 1));
883
+        dose_unit.push(this.getDose_unit(el.total))
851
       });
884
       });
852
       dose_unit = this.unique_unit(dose_unit);
885
       dose_unit = this.unique_unit(dose_unit);
853
-
854
       // 数据合计
886
       // 数据合计
855
       coculate.forEach((el, index) => {
887
       coculate.forEach((el, index) => {
856
-        if (el.total.substr(el.total.length - 1, 1) === dose_unit[0]) {
857
-          unit_1.push(el.total.substr(0, el.total.length - 1));
888
+        if (this.getDose_unit(el.total) === dose_unit[0]) {
889
+          unit_1.push(parseInt(el.total));
858
         }
890
         }
859
       });
891
       });
860
 
892
 
861
       coculate.forEach((el, index) => {
893
       coculate.forEach((el, index) => {
862
-        if (el.total.substr(el.total.length - 1, 1) === dose_unit[1]) {
863
-          console.log(el, "oooel");
864
-          unit_2.push(el.total.substr(0, el.total.length - 1));
894
+        if (this.getDose_unit(el.total) === dose_unit[1]) {
895
+          unit_2.push(parseInt(el.total));
865
         }
896
         }
866
       });
897
       });
867
 
898
 
891
     },
922
     },
892
     //包装selectedbydefault
923
     //包装selectedbydefault
893
     fun2() {
924
     fun2() {
894
-      console.log("3333333this.waitmount_data", this.waiting_drug);
895
       // return new Promise((resolve, reject) => {
925
       // return new Promise((resolve, reject) => {
896
       if (this.state == 1 && this.waiting_drug.length > 0) {
926
       if (this.state == 1 && this.waiting_drug.length > 0) {
897
         this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
927
         this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
997
         if (res.data.state == 1) {
1027
         if (res.data.state == 1) {
998
           this.waiting_drug = res.data.data.list;
1028
           this.waiting_drug = res.data.data.list;
999
         }
1029
         }
1000
-        console.log("fun1lil1111i");
1001
       });
1030
       });
1002
       await dispensemedicine(params).then((res) => {
1031
       await dispensemedicine(params).then((res) => {
1003
         if (res.data.state == 1) {
1032
         if (res.data.state == 1) {
1004
           this.issued_drug = res.data.data.list;
1033
           this.issued_drug = res.data.data.list;
1005
         }
1034
         }
1006
-        console.log("fun122222222");
1007
       });
1035
       });
1008
       console.log("fun1");
1036
       console.log("fun1");
1009
     },
1037
     },
1011
     morencreatename() {
1039
     morencreatename() {
1012
       var param = {};
1040
       var param = {};
1013
       getcurrentname(param).then((res) => {
1041
       getcurrentname(param).then((res) => {
1014
-        console.log("res(药)", res);
1015
         if (res.data.state == 1) {
1042
         if (res.data.state == 1) {
1016
           this.admin_user_id = res.data.data.list;
1043
           this.admin_user_id = res.data.data.list;
1017
           console.log("this.admin_user_id(药)", this.admin_user_id);
1044
           console.log("this.admin_user_id(药)", this.admin_user_id);
1027
       getTodayAdviceList(params).then((response) => {
1054
       getTodayAdviceList(params).then((response) => {
1028
         if (response.data.state == 1) {
1055
         if (response.data.state == 1) {
1029
           this.doctorList = response.data.data.doctorlist;
1056
           this.doctorList = response.data.data.doctorlist;
1030
-          console.log("this.admin_user_id(药2)", this.admin_user_id);
1031
           // this.admin_user_id = this.doctorList[0].admin_user_id
1057
           // this.admin_user_id = this.doctorList[0].admin_user_id
1032
           // this.admin_user_id = this.tmp
1058
           // this.admin_user_id = this.tmp
1033
         }
1059
         }
1041
     },
1067
     },
1042
     handleCurrentChange(val) {
1068
     handleCurrentChange(val) {
1043
       this.currentRow = val;
1069
       this.currentRow = val;
1044
-      console.log("currentRow", this.currentRow);
1045
       this.total = "";
1070
       this.total = "";
1046
       if (this.state == 1) {
1071
       if (this.state == 1) {
1047
         this.getdrugsdetails(0);
1072
         this.getdrugsdetails(0);