Browse Source

批量打印

huangyw 2 years ago
parent
commit
f3b173a9d7

+ 1 - 1
src/xt_pages/outpatientDoctorStation/batch_print_checkTemplate/printOne.vue View File

@@ -201,7 +201,7 @@ export default {
201 201
 
202 202
       let data = [];
203 203
       projectPrint.map((item) => {
204
-        console.log(item, "999");
204
+        // console.log(item, "999");
205 205
         if (item.team.id == 0) {
206 206
           data.push(item);
207 207
         } else {

+ 32 - 11
src/xt_pages/outpatientDoctorStation/pastInquiries.vue View File

@@ -389,17 +389,12 @@ export default {
389 389
               el.prescriptions.map((item) => {
390 390
                 if (item.project.length > 0) {
391 391
                   item.project.map((it) => {
392
-                    // if (it.type == 2) {
393
-                    //   if (it.project.cost_classify == 3) {
394
-                    //     projectPrint.push(it);
395
-                    //   }
396
-                    // }
397 392
                     projectPrint.push(it);
398 393
                   });
399 394
                 }
400 395
               });
401 396
             });
402
-            console.log(projectPrint, "projectPrint----去重前");
397
+            // console.log(projectPrint, "projectPrint----去重前");
403 398
             // 数组去重
404 399
             projectPrint = this.split_project(projectPrint);
405 400
             // 配对
@@ -408,27 +403,53 @@ export default {
408 403
               if (item.team.id == 0) {
409 404
                 data.push(item);
410 405
               } else {
411
-                if(item.team.project_team != ""){
412
-                  new_patients.push(item)
406
+                if (item.team.project_team != "") {
407
+                  new_patients.push(item);
413 408
                 }
414 409
               }
415 410
             });
411
+            new_patients = this.split_project_1(new_patients)
416 412
           }
417
-
418 413
           this.printData = new_patients;
419 414
         });
420 415
       }
421 416
       this.innerVisible = true;
422 417
     },
423
-
418
+    // 外层去重方
424 419
     split_project(Arr) {
425 420
       let hash = {};
426
-      Arr = Arr.reduce((preVal, curVal) => {
421
+      let new_Arr = [];
422
+      new_Arr = Arr.reduce((preVal, curVal) => {
427 423
         hash[curVal.id] ? "" : (hash[curVal.id] = true && preVal.push(curVal));
428 424
         return preVal;
429 425
       }, []);
426
+      Arr = new_Arr.reduce((preVal, curVal) => {
427
+        hash[curVal.team.project_team]
428
+          ? ""
429
+          : (hash[curVal.team.project_team] = true && preVal.push(curVal));
430
+        return preVal;
431
+      }, []);
430 432
       return Arr;
431 433
     },
434
+
435
+    // 内层去重
436
+    split_project_1(Arr) {
437
+      let hash = {};
438
+      let new_Arr = [];
439
+      Arr = Arr.reduce((preVal, curVal) => {
440
+        hash[curVal.id] ? "" : (hash[curVal.id] = true && preVal.push(curVal));
441
+        return preVal;
442
+      }, []);
443
+
444
+      Arr.forEach(el => {
445
+        if(el.name){
446
+          new_Arr.push(el)
447
+        }
448
+      })
449
+
450
+      console.log(new_Arr, "Arr");
451
+      return new_Arr;
452
+    },
432 453
   },
433 454
   created() {
434 455
     var nowDate = new Date();