浏览代码

院区复制

seimin 3 年之前
父节点
当前提交
2fd764a6f7

+ 10 - 0
src/app/pipes/filter-self.pipe.ts

@@ -0,0 +1,10 @@
1
+import { Pipe, PipeTransform } from "@angular/core";
2
+
3
+@Pipe({
4
+  name: "filterSelf",
5
+})
6
+export class FilterSelfPipe implements PipeTransform {
7
+  transform(value: any, ...args: any[]): any {
8
+    return value.filter((v) => v.id != args[0]);
9
+  }
10
+}

+ 7 - 1
src/app/services/main.service.ts

@@ -488,7 +488,7 @@ export class MainService {
488
     });
488
     });
489
   }
489
   }
490
   //查区域地点接口
490
   //查区域地点接口
491
-  fetchListBx(type,data) {
491
+  fetchListBx(type, data) {
492
     return this.http.post(host.host + "/itsm/fetchDataList/" + type, data, {
492
     return this.http.post(host.host + "/itsm/fetchDataList/" + type, data, {
493
       headers: this.headers,
493
       headers: this.headers,
494
     });
494
     });
@@ -505,4 +505,10 @@ export class MainService {
505
       headers: this.headers,
505
       headers: this.headers,
506
     });
506
     });
507
   }
507
   }
508
+  //复制院区
509
+  copyHosTaskType(data) {
510
+    return this.http.post(host.host + "/api/copyHosTaskType", data, {
511
+      headers: this.headers,
512
+    });
513
+  }
508
 }
514
 }

+ 3 - 0
src/app/share/share.module.ts

@@ -29,6 +29,7 @@ import { CollapsePanelComponent } from './collapse-panel/collapse-panel.componen
29
 import { HtmlTransformPipe } from '../pipes/html-transform.pipe';
29
 import { HtmlTransformPipe } from '../pipes/html-transform.pipe';
30
 import { BxPromptModalComponent } from './bx-prompt-modal/bx-prompt-modal.component';
30
 import { BxPromptModalComponent } from './bx-prompt-modal/bx-prompt-modal.component';
31
 import { ExcelExportComponent } from './excel-export/excel-export.component';
31
 import { ExcelExportComponent } from './excel-export/excel-export.component';
32
+import { FilterSelfPipe } from '../pipes/filter-self.pipe';
32
 
33
 
33
 @NgModule({
34
 @NgModule({
34
   declarations: [
35
   declarations: [
@@ -55,6 +56,7 @@ import { ExcelExportComponent } from './excel-export/excel-export.component';
55
     CollapseComponent,
56
     CollapseComponent,
56
     CollapsePanelComponent,
57
     CollapsePanelComponent,
57
     HtmlTransformPipe,
58
     HtmlTransformPipe,
59
+    FilterSelfPipe,
58
     ExcelExportComponent,
60
     ExcelExportComponent,
59
   ],
61
   ],
60
   imports: [
62
   imports: [
@@ -97,6 +99,7 @@ import { ExcelExportComponent } from './excel-export/excel-export.component';
97
     CollapseComponent,
99
     CollapseComponent,
98
     CollapsePanelComponent,
100
     CollapsePanelComponent,
99
     HtmlTransformPipe,
101
     HtmlTransformPipe,
102
+    FilterSelfPipe,
100
     ExcelExportComponent,
103
     ExcelExportComponent,
101
   ]
104
   ]
102
 })
105
 })

+ 53 - 4
src/app/views/hospital-management/hospital-management.component.html

@@ -27,6 +27,11 @@
27
             <td>{{ data.hosNo }}</td>
27
             <td>{{ data.hosNo }}</td>
28
             <td>
28
             <td>
29
               <div class="coop">
29
               <div class="coop">
30
+                <span
31
+                  *ngIf="currentUserAccount == 'dsadmin'"
32
+                  (click)="copy(data)"
33
+                  >复制</span
34
+                >
30
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
35
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
31
                 <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)"
36
                 <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)"
32
                   >删除</span
37
                   >删除</span
@@ -103,7 +108,51 @@
103
               </nz-input-group>
108
               </nz-input-group>
104
             </nz-form-control>
109
             </nz-form-control>
105
           </nz-form-item>
110
           </nz-form-item>
106
-          <nz-form-item *ngIf="isShowCopyHosId">
111
+        </form>
112
+      </div>
113
+      <div class="display_flex justify-content_flex-center">
114
+        <button
115
+          nzType="primary"
116
+          [nzLoading]="btnLoading"
117
+          nz-button
118
+          (click)="submitForm()"
119
+        >
120
+          确认
121
+        </button>
122
+        <button
123
+          class="btn cancel"
124
+          nz-button
125
+          nzType="default"
126
+          (click)="hideAddModal()"
127
+        >
128
+          取消
129
+        </button>
130
+      </div>
131
+    </div>
132
+  </div>
133
+  <!-- 复制模态框 -->
134
+  <div
135
+    class="save align-items_center display_flex justify-content_flex-center add"
136
+    *ngIf="modalCopy"
137
+  >
138
+    <div class="modalBody">
139
+      <div class="title">
140
+        复制院区信息<i
141
+          class="icon_transport transport-guanbi"
142
+          (click)="hideAddModalCopy()"
143
+        ></i>
144
+      </div>
145
+      <div class="content">
146
+        <div class="red" style="margin-bottom: 16px">
147
+          请选择您要复制的院区,如院区已经有任务类型则无法复制成功!
148
+        </div>
149
+        <form
150
+          nz-form
151
+          [formGroup]="validateFormCopy"
152
+          class="addForm"
153
+          (ngSubmit)="submitFormCopy()"
154
+        >
155
+          <nz-form-item>
107
             <nz-form-label
156
             <nz-form-label
108
               style="line-height: 1"
157
               style="line-height: 1"
109
               [nzSm]="6"
158
               [nzSm]="6"
@@ -119,7 +168,7 @@
119
                 nzPlaceHolder="请选择复制的院区"
168
                 nzPlaceHolder="请选择复制的院区"
120
               >
169
               >
121
                 <nz-option
170
                 <nz-option
122
-                  *ngFor="let item of listOfData"
171
+                  *ngFor="let item of listOfData | filterSelf: coopId"
123
                   [nzLabel]="item.hosName"
172
                   [nzLabel]="item.hosName"
124
                   [nzValue]="item.id"
173
                   [nzValue]="item.id"
125
                 >
174
                 >
@@ -134,7 +183,7 @@
134
           nzType="primary"
183
           nzType="primary"
135
           [nzLoading]="btnLoading"
184
           [nzLoading]="btnLoading"
136
           nz-button
185
           nz-button
137
-          (click)="submitForm()"
186
+          (click)="submitFormCopy()"
138
         >
187
         >
139
           确认
188
           确认
140
         </button>
189
         </button>
@@ -142,7 +191,7 @@
142
           class="btn cancel"
191
           class="btn cancel"
143
           nz-button
192
           nz-button
144
           nzType="default"
193
           nzType="default"
145
-          (click)="hideAddModal()"
194
+          (click)="hideAddModalCopy()"
146
         >
195
         >
147
           取消
196
           取消
148
         </button>
197
         </button>

+ 44 - 8
src/app/views/hospital-management/hospital-management.component.ts

@@ -27,6 +27,7 @@ export class HospitalManagementComponent implements OnInit {
27
     this.coopBtns = this.tool.initCoopBtns(this.route);
27
     this.coopBtns = this.tool.initCoopBtns(this.route);
28
     this.getList();
28
     this.getList();
29
     this.initForm();
29
     this.initForm();
30
+    this.initFormCopy();
30
   }
31
   }
31
 
32
 
32
   currentUserAccount: any = JSON.parse(localStorage.getItem("user")).user
33
   currentUserAccount: any = JSON.parse(localStorage.getItem("user")).user
@@ -36,8 +37,10 @@ export class HospitalManagementComponent implements OnInit {
36
   pageSize: number = 10; //表格每页展示条数
37
   pageSize: number = 10; //表格每页展示条数
37
   listLength: number = 10; //表格总数据量
38
   listLength: number = 10; //表格总数据量
38
   modal: boolean = false; //新增/编辑模态框
39
   modal: boolean = false; //新增/编辑模态框
40
+  modalCopy: boolean = false; //复制模态框
39
   add: boolean; //true:新增;false:编辑
41
   add: boolean; //true:新增;false:编辑
40
   validateForm: FormGroup; //新增/编辑表单
42
   validateForm: FormGroup; //新增/编辑表单
43
+  validateFormCopy: FormGroup; //复制表单
41
   coopId: number; //当前操作列id
44
   coopId: number; //当前操作列id
42
 
45
 
43
   promptContent: string; //操作提示框提示信息
46
   promptContent: string; //操作提示框提示信息
@@ -72,13 +75,52 @@ export class HospitalManagementComponent implements OnInit {
72
     this.modal = true;
75
     this.modal = true;
73
     this.validateForm.controls.hospitalName.setValue("");
76
     this.validateForm.controls.hospitalName.setValue("");
74
     this.validateForm.controls.hospitalNum.setValue("");
77
     this.validateForm.controls.hospitalNum.setValue("");
75
-    this.validateForm.addControl("copyHosId", new FormControl(null));
76
-    this.isShowCopyHosId = true;
77
   }
78
   }
78
   hideAddModal() {
79
   hideAddModal() {
79
     this.modal = false;
80
     this.modal = false;
80
     this.initForm();
81
     this.initForm();
81
   }
82
   }
83
+  copy(data) {
84
+    this.coopId = data.id;
85
+    this.addModalCopy();
86
+  }
87
+  addModalCopy() {
88
+    this.modalCopy = true;
89
+  }
90
+  hideAddModalCopy() {
91
+    this.modalCopy = false;
92
+    this.initFormCopy();
93
+  }
94
+  // 初始化复制form表单
95
+  initFormCopy() {
96
+    this.validateFormCopy = this.fb.group({
97
+      copyHosId: [null, [Validators.required]],
98
+    });
99
+  }
100
+  // 复制表单提交
101
+  submitFormCopy(): void {
102
+    var that = this;
103
+    for (const i in that.validateFormCopy.controls) {
104
+      that.validateFormCopy.controls[i].markAsDirty();
105
+      that.validateFormCopy.controls[i].updateValueAndValidity();
106
+    }
107
+    if (that.validateFormCopy.invalid) return;
108
+    that.btnLoading = true;
109
+    let data = {
110
+      sourceHosId: this.coopId,
111
+      destHosId: that.validateFormCopy.value.copyHosId,
112
+    };
113
+    that.mainService.copyHosTaskType(data).subscribe((data) => {
114
+      that.btnLoading = false;
115
+      that.hideAddModalCopy();
116
+      if (data["status"] == 200) {
117
+        that.showPromptModal("复制", true, "");
118
+        that.initFormCopy();
119
+      } else {
120
+        that.showPromptModal("复制", false, data["msg"]);
121
+      }
122
+    });
123
+  }
82
   // 初始化新增form表单
124
   // 初始化新增form表单
83
   initForm() {
125
   initForm() {
84
     this.validateForm = this.fb.group({
126
     this.validateForm = this.fb.group({
@@ -102,9 +144,6 @@ export class HospitalManagementComponent implements OnInit {
102
         hosNo: that.validateForm.value.hospitalNum,
144
         hosNo: that.validateForm.value.hospitalNum,
103
       },
145
       },
104
     };
146
     };
105
-    if (that.add && that.validateForm.value.copyHosId) {
106
-      data.hospital["copyHosId"] = that.validateForm.value.copyHosId;
107
-    }
108
     if (!that.add) {
147
     if (!that.add) {
109
       data.hospital["id"] = that.coopId;
148
       data.hospital["id"] = that.coopId;
110
     }
149
     }
@@ -123,15 +162,12 @@ export class HospitalManagementComponent implements OnInit {
123
   }
162
   }
124
 
163
 
125
   // 编辑
164
   // 编辑
126
-  isShowCopyHosId = false;
127
   edit(data) {
165
   edit(data) {
128
     this.add = false;
166
     this.add = false;
129
     this.modal = true;
167
     this.modal = true;
130
     this.coopId = data.id;
168
     this.coopId = data.id;
131
     this.validateForm.controls.hospitalName.setValue(data.hosName);
169
     this.validateForm.controls.hospitalName.setValue(data.hosName);
132
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
170
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
133
-    this.validateForm.removeControl("copyHosId");
134
-    this.isShowCopyHosId = false;
135
   }
171
   }
136
 
172
 
137
   delModal: boolean = false; //删除模态框
173
   delModal: boolean = false; //删除模态框

+ 1 - 1
src/app/views/task-type-management/task-type-management.component.ts

@@ -75,7 +75,7 @@ export class TaskTypeManagementComponent implements OnInit {
75
   //基础信息请求参数
75
   //基础信息请求参数
76
   hosId; //当前院区
76
   hosId; //当前院区
77
   allAssociation: Array<any>; //关联类型
77
   allAssociation: Array<any>; //关联类型
78
-  allTaskType; //任务类型列表
78
+  allTaskType = []; //任务类型列表
79
   allTaskTypeShow; //任务类型列表选择标识
79
   allTaskTypeShow; //任务类型列表选择标识
80
   allGoods: Array<any>; //携带设备
80
   allGoods: Array<any>; //携带设备
81
   allScheduleClass; //班次列表
81
   allScheduleClass; //班次列表