Browse Source

批量打印

huangyw 2 years ago
parent
commit
f3b173a9d7

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

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

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

389
               el.prescriptions.map((item) => {
389
               el.prescriptions.map((item) => {
390
                 if (item.project.length > 0) {
390
                 if (item.project.length > 0) {
391
                   item.project.map((it) => {
391
                   item.project.map((it) => {
392
-                    // if (it.type == 2) {
393
-                    //   if (it.project.cost_classify == 3) {
394
-                    //     projectPrint.push(it);
395
-                    //   }
396
-                    // }
397
                     projectPrint.push(it);
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
             projectPrint = this.split_project(projectPrint);
399
             projectPrint = this.split_project(projectPrint);
405
             // 配对
400
             // 配对
408
               if (item.team.id == 0) {
403
               if (item.team.id == 0) {
409
                 data.push(item);
404
                 data.push(item);
410
               } else {
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
           this.printData = new_patients;
413
           this.printData = new_patients;
419
         });
414
         });
420
       }
415
       }
421
       this.innerVisible = true;
416
       this.innerVisible = true;
422
     },
417
     },
423
-
418
+    // 外层去重方
424
     split_project(Arr) {
419
     split_project(Arr) {
425
       let hash = {};
420
       let hash = {};
426
-      Arr = Arr.reduce((preVal, curVal) => {
421
+      let new_Arr = [];
422
+      new_Arr = Arr.reduce((preVal, curVal) => {
427
         hash[curVal.id] ? "" : (hash[curVal.id] = true && preVal.push(curVal));
423
         hash[curVal.id] ? "" : (hash[curVal.id] = true && preVal.push(curVal));
428
         return preVal;
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
       return Arr;
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
   created() {
454
   created() {
434
     var nowDate = new Date();
455
     var nowDate = new Date();