seimin před 4 měsíci
rodič
revize
7a448235ae

+ 1 - 1
proxy.conf.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "/service": {
3
-		"target": "http://192.168.3.108",
3
+		"target": "http://192.168.4.105",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

+ 27 - 28
src/app/views/hospital-management/hospital-management.component.html

@@ -17,10 +17,11 @@
17 17
       >
18 18
         <thead>
19 19
           <tr class="thead">
20
-            <th nzWidth="20%">院区/部门名称</th>
21
-            <th nzWidth="20%">部门类型</th>
22
-            <th nzWidth="20%">父院区</th>
23
-            <th nzWidth="20%">院区编码</th>
20
+            <th nzWidth="16%">院区/部门名称</th>
21
+            <th nzWidth="16%">部门类型</th>
22
+            <th nzWidth="16%">父院区</th>
23
+            <th nzWidth="16%">父级部门</th>
24
+            <th nzWidth="16%">院区编码</th>
24 25
             <th nzWidth="20%">操作</th>
25 26
           </tr>
26 27
         </thead>
@@ -29,18 +30,13 @@
29 30
             <td>{{ data.hosName || '无' }}</td>
30 31
             <td>{{ data.type ? data.type.name : '无' }}</td>
31 32
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
33
+            <td>{{ data.parentDeptDTO ? data.parentDeptDTO.hosName : '无' }}</td>
32 34
             <td>{{ data.hosNo || '无' }}</td>
33 35
             <td>
34 36
               <div class="coop">
35
-                <span
36
-                  *ngIf="currentUserAccount == 'dsadmin'"
37
-                  (click)="copy(data)"
38
-                  >复制</span
39
-                >
37
+                <span *ngIf="currentUserAccount == 'dsadmin'" (click)="copy(data)">复制</span>
40 38
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
41
-                <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)"
42
-                  >删除</span
43
-                >
39
+                <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)">删除</span>
44 40
               </div>
45 41
             </td>
46 42
           </tr>
@@ -61,16 +57,9 @@
61 57
   </div>
62 58
 
63 59
   <!-- 新增/编辑模态框 -->
64
-  <div
65
-    class="save align-items_center display_flex justify-content_flex-center add"
66
-    *ngIf="modal"
67
-  >
60
+  <div class="save align-items_center display_flex justify-content_flex-center add" *ngIf="modal">
68 61
     <div class="modalBody">
69
-      <div class="title">
70
-        {{ add ? "新增" : "编辑" }}<i
71
-          class="icon_transport transport-guanbi"
72
-          (click)="hideAddModal()"
73
-        ></i>
62
+      <div class="title">{{ add ? "新增" : "编辑" }}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
74 63
       </div>
75 64
       <div class="content">
76 65
         <form
@@ -80,14 +69,9 @@
80 69
           (ngSubmit)="submitForm()"
81 70
         >
82 71
           <nz-form-item>
83
-            <nz-form-label
84
-              [nzSm]="6"
85
-              [nzXs]="24"
86
-              nzFor="parentHospital"
87
-              >父院区</nz-form-label
88
-            >
72
+            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="parentHospital">父院区</nz-form-label>
89 73
             <nz-form-control nzErrorTip="请选择父院区!">
90
-              <nz-select formControlName="parentHospital" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择父院区" nzShowSearch nzAllowClear nzServerSearch (nzOnSearch)="changeInp($event)"
74
+              <nz-select formControlName="parentHospital" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择父院区" nzShowSearch nzAllowClear nzServerSearch (nzOnSearch)="changeInp($event, 'parent')"
91 75
               (nzOpenChange)="openHospitalSelect($event)" (ngModelChange)="changeHospitalSelect($event)">
92 76
                 <ng-container *ngFor="let option of parentHospitals">
93 77
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
@@ -100,6 +84,21 @@
100 84
             </nz-form-control>
101 85
           </nz-form-item>
102 86
           <nz-form-item>
87
+            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="parentDeptId">父级部门</nz-form-label>
88
+            <nz-form-control nzErrorTip="请选择父级部门!">
89
+              <nz-select formControlName="parentDeptId" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择父级部门" nzShowSearch nzAllowClear nzServerSearch (nzOnSearch)="changeInp($event, 'parentDept')"
90
+              (nzOpenChange)="openParentDeptSelect($event)">
91
+                <ng-container *ngFor="let option of parentDepts">
92
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
93
+                </ng-container>
94
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
95
+                  <i nz-icon nzType="loading" class="loading-icon"></i>
96
+                  搜索中...
97
+                </nz-option>
98
+              </nz-select>
99
+            </nz-form-control>
100
+          </nz-form-item>
101
+          <nz-form-item>
103 102
             <nz-form-label
104 103
               [nzSm]="6"
105 104
               [nzXs]="24"

+ 74 - 27
src/app/views/hospital-management/hospital-management.component.ts

@@ -26,13 +26,23 @@ export class HospitalManagementComponent implements OnInit {
26 26
   ) {}
27 27
 
28 28
   ngOnInit() {
29
-    this.searchParentHospitalSubject.pipe(debounceTime(500)).subscribe((v: any) => {
30
-      this.getAllParentHospital(v).subscribe((result) => {
31
-        this.isLoading = false;
32
-        if (result.status == 200) {
33
-          this.parentHospitals = result.list;
34
-        }
35
-      });
29
+    this.searchParentHospitalSubject.pipe(debounceTime(500)).subscribe(({e, type}) => {
30
+      if(type === 'parentDept'){
31
+        this.getAllParentHospital(e, type === 'parentDept').subscribe((result) => {
32
+          this.isLoading = false;
33
+          if (result.status == 200) {
34
+            this.parentDepts = result.list;
35
+          }
36
+        });
37
+      }else if(type === 'parent'){
38
+        this.getAllParentHospital(e, type === 'parentDept').subscribe((result) => {
39
+          this.isLoading = false;
40
+          if (result.status == 200) {
41
+            this.parentHospitals = result.list;
42
+          }
43
+        });
44
+      }
45
+
36 46
     });
37 47
     this.coopBtns = this.tool.initCoopBtns(this.route);
38 48
     this.getList();
@@ -63,11 +73,12 @@ export class HospitalManagementComponent implements OnInit {
63 73
   coopBtns: any = {};
64 74
   //所有院区
65 75
   parentHospitals: any = [];
76
+  parentDepts: any = [];
66 77
   searchParentHospitalSubject = new Subject();
67 78
   //搜索父级院区
68
-  changeInp(e) {
79
+  changeInp(e, type) {
69 80
     this.isLoading = true;
70
-    this.searchParentHospitalSubject.next(e);
81
+    this.searchParentHospitalSubject.next({e, type});
71 82
   }
72 83
   // 打开父级科室下拉框
73 84
   isLoading = false;
@@ -82,6 +93,18 @@ export class HospitalManagementComponent implements OnInit {
82 93
       });
83 94
     }
84 95
   }
96
+  // 打开父级部门下拉框
97
+  openParentDeptSelect(flag) {
98
+    if (flag) {
99
+      this.isLoading = true;
100
+      this.getAllParentHospital('', true).subscribe((result) => {
101
+        this.isLoading = false;
102
+        if (result.status == 200) {
103
+          this.parentDepts = result.list;
104
+        }
105
+      });
106
+    }
107
+  }
85 108
   // 选择父级科室下拉框
86 109
   changeHospitalSelect(e) {
87 110
     if(!e){
@@ -102,19 +125,39 @@ export class HospitalManagementComponent implements OnInit {
102 125
     }
103 126
   }
104 127
   //获取所有的父级院区列表
105
-  getAllParentHospital(keyWord = "") {
106
-    let postData: any = {
107
-      idx: 0,
108
-      sum: 10,
109
-      hospital: {
110
-        keyWord: keyWord,
111
-      },
112
-    };
113
-    if (this.coopId) {
114
-      // 过滤这个院区及其子院区
115
-      postData.hospital.filterByHosId = this.coopId;
128
+  getAllParentHospital(keyWord = "", isParentDept = false) {
129
+    if(isParentDept){
130
+      this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
131
+        this.hospitalTypes = result || [];
132
+      });
133
+
134
+      let postData: any = {
135
+        idx: 0,
136
+        sum: 10,
137
+        hospital: {
138
+          keyWord: keyWord,
139
+          type: isParentDept ? this.hospitalTypes.find(v => v.value == 6) : undefined
140
+        },
141
+      };
142
+      if (this.coopId) {
143
+        // 过滤这个院区及其子院区
144
+        postData.hospital.filterByHosId = this.coopId;
145
+      }
146
+      return this.mainService.getFetchDataList("data", "hospital", postData);
147
+    }else{
148
+      let postData: any = {
149
+        idx: 0,
150
+        sum: 10,
151
+        hospital: {
152
+          keyWord: keyWord,
153
+        },
154
+      };
155
+      if (this.coopId) {
156
+        // 过滤这个院区及其子院区
157
+        postData.hospital.filterByHosId = this.coopId;
158
+      }
159
+      return this.mainService.getFetchDataList("data", "hospital", postData);
116 160
     }
117
-    return this.mainService.getFetchDataList("data", "hospital", postData);
118 161
   }
119 162
 
120 163
   // 表格数据
@@ -204,6 +247,7 @@ export class HospitalManagementComponent implements OnInit {
204 247
     this.validateForm = this.fb.group({
205 248
       hospitalType: [null],
206 249
       parentHospital: [null],
250
+      parentDeptId: [null],
207 251
       hospitalName: [null, [Validators.required]],
208 252
       hospitalNum: [null, [Validators.required]],
209 253
     });
@@ -227,6 +271,9 @@ export class HospitalManagementComponent implements OnInit {
227 271
     if (this.validateForm.value.parentHospital) {
228 272
       data.hospital.parent = { id: this.validateForm.value.parentHospital };
229 273
     }
274
+    if (this.validateForm.value.parentDeptId) {
275
+      data.hospital.parentDeptId =  this.validateForm.value.parentDeptId;
276
+    }
230 277
     if (this.validateForm.value.hospitalType) {
231 278
       data.hospital.type = { id: this.validateForm.value.hospitalType };
232 279
     }
@@ -253,12 +300,12 @@ export class HospitalManagementComponent implements OnInit {
253 300
     this.modal = true;
254 301
     this.coopId = data.id;
255 302
     if (data.parent) {
256
-      this.getAllParentHospital(data.parent.dept).subscribe((res) => {
257
-        if (res.status == 200) {
258
-          this.parentHospitals = res.list;
259
-          this.validateForm.controls.parentHospital.setValue(data.parent.id);
260
-        }
261
-      });
303
+      this.parentHospitals = [data.parent];
304
+      this.validateForm.controls.parentHospital.setValue(data.parent.id);
305
+    }
306
+    if (data.parentDeptId && data.parentDeptDTO) {
307
+      this.parentDepts = [data.parentDeptDTO];
308
+      this.validateForm.controls.parentDeptId.setValue(data.parentDeptId);
262 309
     }
263 310
     if(data.type){
264 311
       this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {