|
@@ -177,7 +177,8 @@
|
177
|
177
|
ref="table_01"
|
178
|
178
|
:height="tableHeight"
|
179
|
179
|
:data="tableData"
|
180
|
|
-
|
|
180
|
+ :summary-method="getSummaries_t1"
|
|
181
|
+ show-summary
|
181
|
182
|
border
|
182
|
183
|
highlight-current-row
|
183
|
184
|
style="width: 100%"
|
|
@@ -275,7 +276,8 @@
|
275
|
276
|
ref="table_01"
|
276
|
277
|
:height="tableHeight"
|
277
|
278
|
:data="tableData"
|
278
|
|
-
|
|
279
|
+ :summary-method="getSummaries_t2"
|
|
280
|
+ show-summary
|
279
|
281
|
border
|
280
|
282
|
highlight-current-row
|
281
|
283
|
style="width: 100%"
|
|
@@ -377,10 +379,11 @@
|
377
|
379
|
</el-table-column>
|
378
|
380
|
</el-table>
|
379
|
381
|
</div>
|
|
382
|
+
|
380
|
383
|
<!-- <div style="background-color: #f5f7fa;display:flex;padding: 10px;justify-content:space-around;position:absolute;width:75.6%;margin-top: 27.5%;
|
381
|
384
|
"><div style="width: 40%;padding-left:3%">合计 </div> <div style="width: 40%;display: flex;justify-content:center;padding-left: 37%">{{total}}</div></div> -->
|
382
|
|
- <div style="margin-top: 25px" v-if="state == 1">
|
383
|
|
- 领药人:
|
|
385
|
+ <div style="margin-top: 25px; display: flex" v-if="state == 1">
|
|
386
|
+ <span style="line-height: 36px;">领药人:</span>
|
384
|
387
|
<el-select v-model="admin_user_id" placeholder="请选择">
|
385
|
388
|
<el-option
|
386
|
389
|
v-for="item in doctorList"
|
|
@@ -390,6 +393,11 @@
|
390
|
393
|
>
|
391
|
394
|
</el-option>
|
392
|
395
|
</el-select>
|
|
396
|
+
|
|
397
|
+ <span
|
|
398
|
+ style="display: inline-block;padding-left: 30px;line-height: 36px;}"
|
|
399
|
+ >选中: {{ select_total }}</span
|
|
400
|
+ >
|
393
|
401
|
</div>
|
394
|
402
|
</div>
|
395
|
403
|
|
|
@@ -493,6 +501,7 @@ export default {
|
493
|
501
|
routeofadministration: [],
|
494
|
502
|
deliveryway: "全部", //给药途径
|
495
|
503
|
total: "", //合计
|
|
504
|
+ select_total: "",
|
496
|
505
|
};
|
497
|
506
|
},
|
498
|
507
|
|
|
@@ -524,16 +533,51 @@ export default {
|
524
|
533
|
}
|
525
|
534
|
});
|
526
|
535
|
},
|
|
536
|
+
|
|
537
|
+ // 单位去重
|
|
538
|
+ unique_unit(arr) {
|
|
539
|
+ return arr.filter(function (item, index, arr) {
|
|
540
|
+ //当前元素,在原始数组中的第一个索引==当前索引值,否则返回当前元素
|
|
541
|
+ return arr.indexOf(item, 0) === index;
|
|
542
|
+ });
|
|
543
|
+ },
|
|
544
|
+
|
527
|
545
|
getSummaries_t1(param) {
|
528
|
546
|
const { columns, data } = param;
|
529
|
547
|
const sums = [];
|
|
548
|
+ let dose_unit = [];
|
|
549
|
+ let unit_1 = [];
|
|
550
|
+ let unit_2 = [];
|
530
|
551
|
columns.forEach((column, index) => {
|
531
|
552
|
if (index === 0) {
|
532
|
553
|
sums[index] = "合计";
|
533
|
554
|
return;
|
534
|
555
|
}
|
535
|
556
|
if (index === 7) {
|
536
|
|
- sums[index] = this.total;
|
|
557
|
+ // 单位裁切
|
|
558
|
+ data.forEach((el, index) => {
|
|
559
|
+ dose_unit.push(el.total.substr(el.total.length - 1, 1));
|
|
560
|
+ });
|
|
561
|
+ dose_unit = this.unique_unit(dose_unit);
|
|
562
|
+ // 数据合计
|
|
563
|
+ 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));
|
|
566
|
+ }
|
|
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));
|
|
569
|
+ }
|
|
570
|
+ });
|
|
571
|
+ unit_1 = eval(unit_1.join("+"));
|
|
572
|
+ unit_2 = eval(unit_2.join("+"));
|
|
573
|
+
|
|
574
|
+ if (dose_unit[0] == undefined) {
|
|
575
|
+ sums[index] = "";
|
|
576
|
+ } else if (dose_unit[1] == undefined || unit_2 == undefined) {
|
|
577
|
+ sums[index] = `${unit_1}${dose_unit[0]}`;
|
|
578
|
+ } else {
|
|
579
|
+ sums[index] = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
|
|
580
|
+ }
|
537
|
581
|
return;
|
538
|
582
|
}
|
539
|
583
|
});
|
|
@@ -544,13 +588,40 @@ export default {
|
544
|
588
|
getSummaries_t2(param) {
|
545
|
589
|
const { columns, data } = param;
|
546
|
590
|
const sums = [];
|
|
591
|
+ let dose_unit = [];
|
|
592
|
+ let unit_1 = [];
|
|
593
|
+ let unit_2 = [];
|
547
|
594
|
columns.forEach((column, index) => {
|
548
|
595
|
if (index === 0) {
|
549
|
596
|
sums[index] = "合计";
|
550
|
597
|
return;
|
551
|
598
|
}
|
552
|
599
|
if (index === 6) {
|
553
|
|
- sums[index] = this.total;
|
|
600
|
+ // 单位裁切
|
|
601
|
+ data.forEach((el, index) => {
|
|
602
|
+ dose_unit.push(el.total.substr(el.total.length - 1, 1));
|
|
603
|
+ });
|
|
604
|
+ dose_unit = this.unique_unit(dose_unit);
|
|
605
|
+ // 数据合计
|
|
606
|
+ 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));
|
|
609
|
+ }
|
|
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));
|
|
612
|
+ }
|
|
613
|
+ });
|
|
614
|
+ unit_1 = eval(unit_1.join("+"));
|
|
615
|
+ unit_2 = eval(unit_2.join("+"));
|
|
616
|
+
|
|
617
|
+ // sums[index] = unit_1+dose_unit[0]+ "+" +unit_2+dose_unit[1];
|
|
618
|
+ if (dose_unit[0] == undefined) {
|
|
619
|
+ sums[index] = "";
|
|
620
|
+ } else if (dose_unit[1] == undefined || unit_2 == undefined) {
|
|
621
|
+ sums[index] = `${unit_1}${dose_unit[0]}`;
|
|
622
|
+ } else {
|
|
623
|
+ sums[index] = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
|
|
624
|
+ }
|
554
|
625
|
return;
|
555
|
626
|
}
|
556
|
627
|
});
|
|
@@ -765,9 +836,47 @@ export default {
|
765
|
836
|
formatJson(filterVal, jsonData) {
|
766
|
837
|
return jsonData.map((v) => filterVal.map((j) => v[j]));
|
767
|
838
|
},
|
768
|
|
- //列表选择
|
|
839
|
+ //列表选择与合计
|
769
|
840
|
handleSelectionChange(val) {
|
770
|
841
|
this.multipleSelection = val;
|
|
842
|
+
|
|
843
|
+ let coculate = val;
|
|
844
|
+ let sums = "";
|
|
845
|
+ let dose_unit = [];
|
|
846
|
+ let unit_1 = [];
|
|
847
|
+ let unit_2 = [];
|
|
848
|
+
|
|
849
|
+ coculate.forEach((el, index) => {
|
|
850
|
+ dose_unit.push(el.total.substr(el.total.length - 1, 1));
|
|
851
|
+ });
|
|
852
|
+ dose_unit = this.unique_unit(dose_unit);
|
|
853
|
+
|
|
854
|
+ // 数据合计
|
|
855
|
+ 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));
|
|
858
|
+ }
|
|
859
|
+ });
|
|
860
|
+
|
|
861
|
+ 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));
|
|
865
|
+ }
|
|
866
|
+ });
|
|
867
|
+
|
|
868
|
+ unit_1 = eval(unit_1.join("+"));
|
|
869
|
+ unit_2 = eval(unit_2.join("+"));
|
|
870
|
+
|
|
871
|
+ if (dose_unit[0] == undefined) {
|
|
872
|
+ sums = "";
|
|
873
|
+ } else if (dose_unit[1] == undefined) {
|
|
874
|
+ sums = `${unit_1}${dose_unit[0]}`;
|
|
875
|
+ } else {
|
|
876
|
+ sums = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
|
|
877
|
+ }
|
|
878
|
+ // sums = `${unit_1}${dose_unit[0]}+${unit_2}${dose_unit[1]}`;
|
|
879
|
+ this.select_total = sums;
|
771
|
880
|
},
|
772
|
881
|
//默认选中
|
773
|
882
|
selectedbydefault() {
|
|
@@ -1033,15 +1142,15 @@ export default {
|
1033
|
1142
|
this.getrouteofadministration();
|
1034
|
1143
|
this.getgetpartitionlist();
|
1035
|
1144
|
},
|
1036
|
|
- // updated() {
|
1037
|
|
- // this.$nextTick(() => {
|
1038
|
|
- // if (this.$refs["table_01"]) {
|
1039
|
|
- // this.$refs["table_01"].doLayout();
|
1040
|
|
- // } else if (this.$refs["table_02"]) {
|
1041
|
|
- // this.$refs["table_02"].doLayout();
|
1042
|
|
- // }
|
1043
|
|
- // });
|
1044
|
|
- // },
|
|
1145
|
+ updated() {
|
|
1146
|
+ this.$nextTick(() => {
|
|
1147
|
+ if (this.$refs["table_01"]) {
|
|
1148
|
+ this.$refs["table_01"].doLayout();
|
|
1149
|
+ } else if (this.$refs["table_02"]) {
|
|
1150
|
+ this.$refs["table_02"].doLayout();
|
|
1151
|
+ }
|
|
1152
|
+ });
|
|
1153
|
+ },
|
1045
|
1154
|
};
|
1046
|
1155
|
</script>
|
1047
|
1156
|
|