huangyw 2 年 前
コミット
e56906acfe
共有1 個のファイルを変更した51 個の追加26 個の削除を含む
  1. 51 26
      src/xt_pages/Pharmacy/DrugDispensing.vue

+ 51 - 26
src/xt_pages/Pharmacy/DrugDispensing.vue ファイルの表示

@@ -383,7 +383,7 @@
383 383
         <!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
384 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 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 387
           <el-select v-model="admin_user_id" placeholder="请选择">
388 388
             <el-option
389 389
               v-for="item in doctorList"
@@ -541,6 +541,37 @@ export default {
541 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 576
     getSummaries_t1(param) {
546 577
       const { columns, data } = param;
@@ -556,16 +587,18 @@ export default {
556 587
         if (index === 7) {
557 588
           // 单位裁切
558 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 593
           dose_unit = this.unique_unit(dose_unit);
562
-          // 数据合计
594
+          console.log(dose_unit,'dose_unit')
595
+          // // 数据合计
563 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 604
           unit_1 = eval(unit_1.join("+"));
@@ -599,16 +632,16 @@ export default {
599 632
         if (index === 6) {
600 633
           // 单位裁切
601 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 637
           dose_unit = this.unique_unit(dose_unit);
605 638
           // 数据合计
606 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 647
           unit_1 = eval(unit_1.join("+"));
@@ -839,7 +872,6 @@ export default {
839 872
     //列表选择与合计
840 873
     handleSelectionChange(val) {
841 874
       this.multipleSelection = val;
842
-
843 875
       let coculate = val;
844 876
       let sums = "";
845 877
       let dose_unit = [];
@@ -847,21 +879,20 @@ export default {
847 879
       let unit_2 = [];
848 880
 
849 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 885
       dose_unit = this.unique_unit(dose_unit);
853
-
854 886
       // 数据合计
855 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 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,7 +922,6 @@ export default {
891 922
     },
892 923
     //包装selectedbydefault
893 924
     fun2() {
894
-      console.log("3333333this.waitmount_data", this.waiting_drug);
895 925
       // return new Promise((resolve, reject) => {
896 926
       if (this.state == 1 && this.waiting_drug.length > 0) {
897 927
         this.$refs.table01.setCurrentRow(this.waiting_drug[0]);
@@ -997,13 +1027,11 @@ export default {
997 1027
         if (res.data.state == 1) {
998 1028
           this.waiting_drug = res.data.data.list;
999 1029
         }
1000
-        console.log("fun1lil1111i");
1001 1030
       });
1002 1031
       await dispensemedicine(params).then((res) => {
1003 1032
         if (res.data.state == 1) {
1004 1033
           this.issued_drug = res.data.data.list;
1005 1034
         }
1006
-        console.log("fun122222222");
1007 1035
       });
1008 1036
       console.log("fun1");
1009 1037
     },
@@ -1011,7 +1039,6 @@ export default {
1011 1039
     morencreatename() {
1012 1040
       var param = {};
1013 1041
       getcurrentname(param).then((res) => {
1014
-        console.log("res(药)", res);
1015 1042
         if (res.data.state == 1) {
1016 1043
           this.admin_user_id = res.data.data.list;
1017 1044
           console.log("this.admin_user_id(药)", this.admin_user_id);
@@ -1027,7 +1054,6 @@ export default {
1027 1054
       getTodayAdviceList(params).then((response) => {
1028 1055
         if (response.data.state == 1) {
1029 1056
           this.doctorList = response.data.data.doctorlist;
1030
-          console.log("this.admin_user_id(药2)", this.admin_user_id);
1031 1057
           // this.admin_user_id = this.doctorList[0].admin_user_id
1032 1058
           // this.admin_user_id = this.tmp
1033 1059
         }
@@ -1041,7 +1067,6 @@ export default {
1041 1067
     },
1042 1068
     handleCurrentChange(val) {
1043 1069
       this.currentRow = val;
1044
-      console.log("currentRow", this.currentRow);
1045 1070
       this.total = "";
1046 1071
       if (this.state == 1) {
1047 1072
         this.getdrugsdetails(0);