Przeglądaj źródła

1.科室管理增加批量删除按钮,需要进行授权才可显示此按钮

seimin 3 lat temu
rodzic
commit
343b08b7bb

+ 6 - 4
src/app/views/office-management/office-management.component.html

@@ -1,7 +1,7 @@
1 1
 <div class="list-template">
2 2
   <div class="list-template__content">
3 3
     <div class="list-template__top" nz-row>
4
-      <div nz-col nzLg='17' class="list-template__searchBox">
4
+      <div nz-col nzLg='14' class="list-template__searchBox">
5 5
         <div class="list-template__searchItem">
6 6
           <span class="label">科室名称:</span>
7 7
           <input nz-input class="formItem" [(ngModel)]="name" placeholder="请输入科室名称" nzSize="default" />
@@ -22,12 +22,14 @@
22 22
           </nz-select>
23 23
         </div>
24 24
       </div>
25
-      <div nz-col nzLg="7" class="list-template__btns">
25
+      <div nz-col nzLg="10" class="list-template__btns">
26 26
         <button class="btn default" (click)='search()'>搜索</button>
27 27
         <button class="btn default ml8" (click)='reset()'>重置</button>
28 28
         <button *ngIf="coopBtns.add" class="btn default ml8" (click)="showModal()">新增</button>
29 29
         <button class="btn default ml8" nzType="primary" nz-button [disabled]="!checkedDepIds.length"
30 30
           (click)="print($event,true)">批量打印</button>
31
+        <button class="btn default ml8" nzType="primary" nz-button *ngIf="coopBtns.del"
32
+          [disabled]="!checkedDepIds.length" (click)="showDelModal($event,true,checkedDepIds)">批量删除</button>
31 33
       </div>
32 34
     </div>
33 35
     <div class="list-template__bottom">
@@ -63,7 +65,7 @@
63 65
               <div class="coop">
64 66
                 <span *ngIf="coopBtns.look" (click)="detail($event,data.id)">查看</span>
65 67
                 <span *ngIf="coopBtns.edit" (click)="edit($event,data)">编辑</span>
66
-                <span *ngIf="coopBtns.del" (click)="showDelModal($event,data.id)">删除</span>
68
+                <span *ngIf="coopBtns.del" (click)="showDelModal($event,false,data.id)">删除</span>
67 69
                 <span (click)="print($event,false,data.id)">打印</span>
68 70
               </div>
69 71
             </td>
@@ -199,7 +201,7 @@
199 201
   </div>
200 202
   <!-- 删除模态框 -->
201 203
   <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
202
-    (confirmDelEvent)="confirmDel()" content="您确认要删除科室吗?"></app-dialog-delete>
204
+    (confirmDelEvent)="confirmDel()" content="您确认要删除科室吗?"></app-dialog-delete>
203 205
 
204 206
   <!-- 二维码打印 -->
205 207
   <div id="report" style="display: none">

+ 20 - 3
src/app/views/office-management/office-management.component.ts

@@ -514,10 +514,23 @@ export class OfficeManagementComponent implements OnInit {
514 514
   }
515 515
 
516 516
   delModal: boolean = false; //删除模态框
517
-  showDelModal(e, id) {
517
+  coopIds: any;
518
+  coopFlag: any = false;
519
+  /**
520
+   *
521
+   * @param e 事件对象
522
+   * @param flag true是批量删除,false是单个删除
523
+   * @param id
524
+   */
525
+  showDelModal(e, flag, id) {
518 526
     e.stopPropagation();
519 527
     this.delModal = true;
520
-    this.coopId = id;
528
+    this.coopFlag = flag;
529
+    if (flag) {
530
+      this.coopIds = id;
531
+    } else {
532
+      this.coopId = id;
533
+    }
521 534
   }
522 535
   hideDelModal() {
523 536
     this.delModal = false;
@@ -528,7 +541,11 @@ export class OfficeManagementComponent implements OnInit {
528 541
     that.btnLoading = true;
529 542
     that.delModal = false;
530 543
     that.mainService
531
-      .coopData("rmvData", "department", [that.coopId])
544
+      .coopData(
545
+        "rmvData",
546
+        "department",
547
+        this.coopFlag ? this.coopIds : [that.coopId]
548
+      )
532 549
       .subscribe((data) => {
533 550
         that.btnLoading = false;
534 551
         if (data.status == 200) {