Преглед на файлове

被服视图加楼栋筛选

seimin преди 1 година
родител
ревизия
0827d7d2aa

+ 12 - 0
src/app/views/washing-batch-view/washing-batch-view.component.html

@@ -29,6 +29,18 @@
29 29
             </ng-container>
30 30
           </nz-select>
31 31
         </div>
32
+        <div class="searchItem">
33
+          <span class="label">楼栋</span>:
34
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear
35
+            nzPlaceHolder="请选择楼栋" [(ngModel)]="searchDto.buildingId" (nzOnSearch)="changeInp($event, 'building')">
36
+            <ng-container *ngFor="let option of buildingList">
37
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
38
+            </ng-container>
39
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
40
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
41
+            </nz-option>
42
+          </nz-select>
43
+        </div>
32 44
       </div>
33 45
       <div class="display_flex align-items_center">
34 46
         <button nzType="primary" nz-button (click)="getList()">搜索</button>

+ 42 - 0
src/app/views/washing-batch-view/washing-batch-view.component.ts

@@ -3,6 +3,8 @@ import { ToolService } from 'src/app/services/tool.service';
3 3
 import { MainService } from 'src/app/services/main.service';
4 4
 import { ActivatedRoute } from '@angular/router';
5 5
 import { FormGroup, Validators, FormBuilder } from '@angular/forms';
6
+import { Subject } from 'rxjs';
7
+import { debounceTime } from 'rxjs/operators';
6 8
 
7 9
 @Component({
8 10
   selector: "app-washing-batch-view",
@@ -19,8 +21,15 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
19 21
   ){}
20 22
 
21 23
   ngOnInit() {
24
+    //防抖
25
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
26
+      if(v[1] === 'building'){
27
+        this.getBuildingList(v[0]);
28
+      }
29
+    });
22 30
     this.hosId = this.tool.getCurrentHospital().id;
23 31
     this.getParentList();
32
+    this.getBuildingList();
24 33
     this.getChildList();
25 34
     this.getDictionaryList();
26 35
     this.getList();
@@ -48,12 +57,20 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
48 57
   searchDto:any = {
49 58
     parent: null,
50 59
     child: null,
60
+    buildingId: null,
51 61
   }
52 62
   parentList: Array<any> = []; //父级分类数据字典信息
53 63
   childList: Array<any> = []; //分类数据字典信息
54 64
   rows:any[] = [['id', 'clothesState', ''], [], ['','件数', '费用/元']];
55 65
   totalData:any = {};
56 66
 
67
+  //搜索
68
+  changeInpSubject = new Subject(); //防抖
69
+  changeInp(e, type) {
70
+    this.isLoading = true;
71
+    this.changeInpSubject.next([e, type]);
72
+  }
73
+
57 74
   // 查看业务数据
58 75
   washingExceptionModalShow = false; //业务数据弹窗开关
59 76
   viewDetail() {
@@ -121,10 +138,34 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
121 138
       });
122 139
   }
123 140
 
141
+  // 获取楼栋
142
+  buildingList:any[] = [];
143
+  isLoading:boolean = false;
144
+  getBuildingList(keyWord = '') {
145
+    let postData = {
146
+      idx: 0,
147
+      sum: 9999,
148
+      building: {
149
+        simpleQuery: true,
150
+        buildingName: keyWord,
151
+        cascadeHosId: this.hosId,
152
+      }
153
+    };
154
+    this.isLoading = true;
155
+    this.mainService.getFetchDataList("simple/data", "building", postData)
156
+    .subscribe((data) => {
157
+      this.isLoading = false;
158
+      if (data.status == 200) {
159
+        this.buildingList = data.list;
160
+      }
161
+    });
162
+  }
163
+
124 164
   reset(){
125 165
     this.searchDto = {
126 166
       parent: null,
127 167
       child: null,
168
+      buildingId: null,
128 169
     }
129 170
     this.getList();
130 171
   }
@@ -275,6 +316,7 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
275 316
       batchId: this.route.snapshot.paramMap.get("id"),
276 317
       clothesTypeParent: this.searchDto.parent,
277 318
       clothesDeptId: this.searchDto.child,
319
+      buildingId: this.searchDto.buildingId,
278 320
     };
279 321
     this.loading = true;
280 322
     this.mapOfCheckedId = {};