瀏覽代碼

父级部门

seimin 4 月之前
父節點
當前提交
7a448235ae

+ 1 - 1
proxy.conf.json

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

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

@@ -17,10 +17,11 @@
17
       >
17
       >
18
         <thead>
18
         <thead>
19
           <tr class="thead">
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
             <th nzWidth="20%">操作</th>
25
             <th nzWidth="20%">操作</th>
25
           </tr>
26
           </tr>
26
         </thead>
27
         </thead>
@@ -29,18 +30,13 @@
29
             <td>{{ data.hosName || '无' }}</td>
30
             <td>{{ data.hosName || '无' }}</td>
30
             <td>{{ data.type ? data.type.name : '无' }}</td>
31
             <td>{{ data.type ? data.type.name : '无' }}</td>
31
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
32
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
33
+            <td>{{ data.parentDeptDTO ? data.parentDeptDTO.hosName : '无' }}</td>
32
             <td>{{ data.hosNo || '无' }}</td>
34
             <td>{{ data.hosNo || '无' }}</td>
33
             <td>
35
             <td>
34
               <div class="coop">
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
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
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
               </div>
40
               </div>
45
             </td>
41
             </td>
46
           </tr>
42
           </tr>
@@ -61,16 +57,9 @@
61
   </div>
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
     <div class="modalBody">
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
       </div>
63
       </div>
75
       <div class="content">
64
       <div class="content">
76
         <form
65
         <form
@@ -80,14 +69,9 @@
80
           (ngSubmit)="submitForm()"
69
           (ngSubmit)="submitForm()"
81
         >
70
         >
82
           <nz-form-item>
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
             <nz-form-control nzErrorTip="请选择父院区!">
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
               (nzOpenChange)="openHospitalSelect($event)" (ngModelChange)="changeHospitalSelect($event)">
75
               (nzOpenChange)="openHospitalSelect($event)" (ngModelChange)="changeHospitalSelect($event)">
92
                 <ng-container *ngFor="let option of parentHospitals">
76
                 <ng-container *ngFor="let option of parentHospitals">
93
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
77
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
@@ -100,6 +84,21 @@
100
             </nz-form-control>
84
             </nz-form-control>
101
           </nz-form-item>
85
           </nz-form-item>
102
           <nz-form-item>
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
             <nz-form-label
102
             <nz-form-label
104
               [nzSm]="6"
103
               [nzSm]="6"
105
               [nzXs]="24"
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
   ngOnInit() {
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
     this.coopBtns = this.tool.initCoopBtns(this.route);
47
     this.coopBtns = this.tool.initCoopBtns(this.route);
38
     this.getList();
48
     this.getList();
@@ -63,11 +73,12 @@ export class HospitalManagementComponent implements OnInit {
63
   coopBtns: any = {};
73
   coopBtns: any = {};
64
   //所有院区
74
   //所有院区
65
   parentHospitals: any = [];
75
   parentHospitals: any = [];
76
+  parentDepts: any = [];
66
   searchParentHospitalSubject = new Subject();
77
   searchParentHospitalSubject = new Subject();
67
   //搜索父级院区
78
   //搜索父级院区
68
-  changeInp(e) {
79
+  changeInp(e, type) {
69
     this.isLoading = true;
80
     this.isLoading = true;
70
-    this.searchParentHospitalSubject.next(e);
81
+    this.searchParentHospitalSubject.next({e, type});
71
   }
82
   }
72
   // 打开父级科室下拉框
83
   // 打开父级科室下拉框
73
   isLoading = false;
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
   changeHospitalSelect(e) {
109
   changeHospitalSelect(e) {
87
     if(!e){
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
     this.validateForm = this.fb.group({
247
     this.validateForm = this.fb.group({
205
       hospitalType: [null],
248
       hospitalType: [null],
206
       parentHospital: [null],
249
       parentHospital: [null],
250
+      parentDeptId: [null],
207
       hospitalName: [null, [Validators.required]],
251
       hospitalName: [null, [Validators.required]],
208
       hospitalNum: [null, [Validators.required]],
252
       hospitalNum: [null, [Validators.required]],
209
     });
253
     });
@@ -227,6 +271,9 @@ export class HospitalManagementComponent implements OnInit {
227
     if (this.validateForm.value.parentHospital) {
271
     if (this.validateForm.value.parentHospital) {
228
       data.hospital.parent = { id: this.validateForm.value.parentHospital };
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
     if (this.validateForm.value.hospitalType) {
277
     if (this.validateForm.value.hospitalType) {
231
       data.hospital.type = { id: this.validateForm.value.hospitalType };
278
       data.hospital.type = { id: this.validateForm.value.hospitalType };
232
     }
279
     }
@@ -253,12 +300,12 @@ export class HospitalManagementComponent implements OnInit {
253
     this.modal = true;
300
     this.modal = true;
254
     this.coopId = data.id;
301
     this.coopId = data.id;
255
     if (data.parent) {
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
     if(data.type){
310
     if(data.type){
264
       this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
311
       this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {