|
@@ -1,6 +1,13 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div id="prescriptionPrint" class="prescription-print">
|
3
|
|
- <div v-for="(i, index) in printData" :key="index" style="box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;">
|
|
3
|
+ <div
|
|
4
|
+ v-for="(i, index) in printData"
|
|
5
|
+ :key="index"
|
|
6
|
+ style="
|
|
7
|
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
|
|
8
|
+ 0 0 40px rgba(0, 0, 0, 0.06) inset;
|
|
9
|
+ "
|
|
10
|
+ >
|
4
|
11
|
<!-- <img style="width:100%;height:80px" v-if="org_id == 10138" src="https://kuyi.shengws.com/bailin/bltotle.jpg" alt="">-->
|
5
|
12
|
<!--/* <img style="width:100%;height:80px" v-if="org_id == 10278" src="https://kuyi.shengws.com/bailinbeier.png" alt="">*/-->
|
6
|
13
|
<div
|
|
@@ -32,7 +39,12 @@
|
32
|
39
|
: ""
|
33
|
40
|
}}
|
34
|
41
|
</div>
|
35
|
|
- <div>金额:{{ total }}</div>
|
|
42
|
+ <div
|
|
43
|
+ v-for="item in getSingleTeam(i.prescriptions)" :key="item"
|
|
44
|
+ style="margin-bottom: 10px"
|
|
45
|
+ >
|
|
46
|
+ 金额:{{ item }}
|
|
47
|
+ </div>
|
36
|
48
|
</div>
|
37
|
49
|
<div
|
38
|
50
|
style="
|
|
@@ -74,11 +86,12 @@
|
74
|
86
|
<div>
|
75
|
87
|
<div
|
76
|
88
|
v-for="item in getTeam(i.prescriptions)"
|
|
89
|
+ :key="item.id"
|
77
|
90
|
style="margin-bottom: 10px"
|
78
|
91
|
>
|
79
|
92
|
{{ item.team.project_team }}
|
80
|
93
|
</div>
|
81
|
|
- <div v-for="item in getSingleTeam(i.prescriptions)" style="margin-bottom:10px;">{{ item.project.project_name }}</div>
|
|
94
|
+
|
82
|
95
|
</div>
|
83
|
96
|
</div>
|
84
|
97
|
<div
|
|
@@ -135,6 +148,7 @@ export default {
|
135
|
148
|
doctor: "",
|
136
|
149
|
org_id: "",
|
137
|
150
|
singleProjectPrint: [],
|
|
151
|
+ total_copy:[]
|
138
|
152
|
};
|
139
|
153
|
},
|
140
|
154
|
|
|
@@ -164,8 +178,9 @@ export default {
|
164
|
178
|
return "";
|
165
|
179
|
},
|
166
|
180
|
|
167
|
|
- getTeam(prescriptions) {
|
168
|
|
- // console.log(prescriptions, "prescriptions");
|
|
181
|
+
|
|
182
|
+ getTeam(prescriptions, isUpdate = false) {
|
|
183
|
+ console.log(prescriptions, "prescriptions");
|
169
|
184
|
let projectPrint = [];
|
170
|
185
|
let total = 0;
|
171
|
186
|
prescriptions.map((item) => {
|
|
@@ -174,7 +189,6 @@ export default {
|
174
|
189
|
if (it.type == 2) {
|
175
|
190
|
if (it.project.cost_classify == 3) {
|
176
|
191
|
projectPrint.push(it);
|
177
|
|
- total += it.project.price * parseInt(it.count);
|
178
|
192
|
}
|
179
|
193
|
}
|
180
|
194
|
});
|
|
@@ -182,43 +196,41 @@ export default {
|
182
|
196
|
});
|
183
|
197
|
let data = [];
|
184
|
198
|
projectPrint.map((item) => {
|
185
|
|
- if (item.team.id != 0) {
|
|
199
|
+ if (item.team.id == 0) {
|
|
200
|
+ data.push(item);
|
|
201
|
+ } else {
|
186
|
202
|
let status = data.some((it) => it.team.id == item.team.id);
|
187
|
203
|
if (!status) {
|
188
|
204
|
data.push(item);
|
189
|
|
- console.log(data, "oodata");
|
190
|
205
|
}
|
191
|
206
|
}
|
192
|
207
|
});
|
193
|
|
- this.total = total.toFixed(2);
|
194
|
|
- this.projectPrint = data;
|
|
208
|
+ if (isUpdate) {
|
|
209
|
+ this.projectPrint = data;
|
|
210
|
+ }
|
195
|
211
|
return data;
|
196
|
212
|
},
|
197
|
213
|
|
198
|
|
- getSingleTeam(prescriptions){
|
199
|
|
- let projectPrint = []
|
200
|
|
- let total = 0
|
201
|
|
- prescriptions.map(item => {
|
202
|
|
- if(item.project.length > 0){
|
203
|
|
- item.project.map(it => {
|
204
|
|
- if(it.type == 2){
|
205
|
|
- if(it.project.cost_classify == 3){
|
206
|
|
- projectPrint.push(it)
|
207
|
|
- total += (it.project.price*parseInt(it.count))
|
208
|
|
- }
|
209
|
|
- }
|
210
|
|
- })
|
211
|
|
- }
|
212
|
|
- })
|
213
|
|
- let data = []
|
214
|
|
- projectPrint.map(item => {
|
215
|
|
- if(item.team.id == 0){
|
216
|
|
- data.push(item)
|
|
214
|
+ // 计算金额(单独从上面的方法割开来,防止进入死循环)
|
|
215
|
+ getSingleTeam(prescriptions) {
|
|
216
|
+ let projectPrint = [];
|
|
217
|
+ let total = 0;
|
|
218
|
+ prescriptions.map((item) => {
|
|
219
|
+ if (item.project.length > 0) {
|
|
220
|
+ item.project.map((it) => {
|
|
221
|
+ if (it.type == 2) {
|
|
222
|
+ if (it.project.cost_classify == 3) {
|
|
223
|
+ projectPrint.push(it);
|
|
224
|
+ total += it.project.price * parseInt(it.count);
|
217
|
225
|
}
|
218
|
|
- })
|
219
|
|
- this.total = total.toFixed(2)
|
220
|
|
- return data
|
221
|
|
- },
|
|
226
|
+ }
|
|
227
|
+ });
|
|
228
|
+ }
|
|
229
|
+ });
|
|
230
|
+ let total_copy=[]
|
|
231
|
+ total_copy.push(total.toFixed(2))
|
|
232
|
+ return total_copy;
|
|
233
|
+ },
|
222
|
234
|
|
223
|
235
|
getInitData() {
|
224
|
236
|
getInitData().then((response) => {
|
|
@@ -329,6 +341,7 @@ export default {
|
329
|
341
|
newNameArr.push(...nameArr);
|
330
|
342
|
return newNameArr.join(" ");
|
331
|
343
|
},
|
|
344
|
+
|
332
|
345
|
compare(property) {
|
333
|
346
|
return function (a, b) {
|
334
|
347
|
var value1 = a[property];
|
|
@@ -445,6 +458,16 @@ export default {
|
445
|
458
|
this.ids = val;
|
446
|
459
|
this.getPrescriptionPrint();
|
447
|
460
|
},
|
|
461
|
+ // printData: {
|
|
462
|
+ // immediate: true,
|
|
463
|
+ // deep: true,
|
|
464
|
+ // handler(val) {
|
|
465
|
+ // console.log(val, "val");
|
|
466
|
+ // val.forEach((el) => {
|
|
467
|
+ // this.getTeam(el.prescriptions, true);
|
|
468
|
+ // });
|
|
469
|
+ // },
|
|
470
|
+ // },
|
448
|
471
|
},
|
449
|
472
|
};
|
450
|
473
|
</script>
|