seimin %!s(int64=3) %!d(string=hai) anos
pai
achega
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 492
     return this.http.post(host.host + "/itsm/fetchDataList/" + type, data, {
493 493
       headers: this.headers,
494 494
     });
@@ -505,4 +505,10 @@ export class MainService {
505 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 29
 import { HtmlTransformPipe } from '../pipes/html-transform.pipe';
30 30
 import { BxPromptModalComponent } from './bx-prompt-modal/bx-prompt-modal.component';
31 31
 import { ExcelExportComponent } from './excel-export/excel-export.component';
32
+import { FilterSelfPipe } from '../pipes/filter-self.pipe';
32 33
 
33 34
 @NgModule({
34 35
   declarations: [
@@ -55,6 +56,7 @@ import { ExcelExportComponent } from './excel-export/excel-export.component';
55 56
     CollapseComponent,
56 57
     CollapsePanelComponent,
57 58
     HtmlTransformPipe,
59
+    FilterSelfPipe,
58 60
     ExcelExportComponent,
59 61
   ],
60 62
   imports: [
@@ -97,6 +99,7 @@ import { ExcelExportComponent } from './excel-export/excel-export.component';
97 99
     CollapseComponent,
98 100
     CollapsePanelComponent,
99 101
     HtmlTransformPipe,
102
+    FilterSelfPipe,
100 103
     ExcelExportComponent,
101 104
   ]
102 105
 })

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

@@ -27,6 +27,11 @@
27 27
             <td>{{ data.hosNo }}</td>
28 28
             <td>
29 29
               <div class="coop">
30
+                <span
31
+                  *ngIf="currentUserAccount == 'dsadmin'"
32
+                  (click)="copy(data)"
33
+                  >复制</span
34
+                >
30 35
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
31 36
                 <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)"
32 37
                   >删除</span
@@ -103,7 +108,51 @@
103 108
               </nz-input-group>
104 109
             </nz-form-control>
105 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 156
             <nz-form-label
108 157
               style="line-height: 1"
109 158
               [nzSm]="6"
@@ -119,7 +168,7 @@
119 168
                 nzPlaceHolder="请选择复制的院区"
120 169
               >
121 170
                 <nz-option
122
-                  *ngFor="let item of listOfData"
171
+                  *ngFor="let item of listOfData | filterSelf: coopId"
123 172
                   [nzLabel]="item.hosName"
124 173
                   [nzValue]="item.id"
125 174
                 >
@@ -134,7 +183,7 @@
134 183
           nzType="primary"
135 184
           [nzLoading]="btnLoading"
136 185
           nz-button
137
-          (click)="submitForm()"
186
+          (click)="submitFormCopy()"
138 187
         >
139 188
           确认
140 189
         </button>
@@ -142,7 +191,7 @@
142 191
           class="btn cancel"
143 192
           nz-button
144 193
           nzType="default"
145
-          (click)="hideAddModal()"
194
+          (click)="hideAddModalCopy()"
146 195
         >
147 196
           取消
148 197
         </button>

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

@@ -27,6 +27,7 @@ export class HospitalManagementComponent implements OnInit {
27 27
     this.coopBtns = this.tool.initCoopBtns(this.route);
28 28
     this.getList();
29 29
     this.initForm();
30
+    this.initFormCopy();
30 31
   }
31 32
 
32 33
   currentUserAccount: any = JSON.parse(localStorage.getItem("user")).user
@@ -36,8 +37,10 @@ export class HospitalManagementComponent implements OnInit {
36 37
   pageSize: number = 10; //表格每页展示条数
37 38
   listLength: number = 10; //表格总数据量
38 39
   modal: boolean = false; //新增/编辑模态框
40
+  modalCopy: boolean = false; //复制模态框
39 41
   add: boolean; //true:新增;false:编辑
40 42
   validateForm: FormGroup; //新增/编辑表单
43
+  validateFormCopy: FormGroup; //复制表单
41 44
   coopId: number; //当前操作列id
42 45
 
43 46
   promptContent: string; //操作提示框提示信息
@@ -72,13 +75,52 @@ export class HospitalManagementComponent implements OnInit {
72 75
     this.modal = true;
73 76
     this.validateForm.controls.hospitalName.setValue("");
74 77
     this.validateForm.controls.hospitalNum.setValue("");
75
-    this.validateForm.addControl("copyHosId", new FormControl(null));
76
-    this.isShowCopyHosId = true;
77 78
   }
78 79
   hideAddModal() {
79 80
     this.modal = false;
80 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 124
   // 初始化新增form表单
83 125
   initForm() {
84 126
     this.validateForm = this.fb.group({
@@ -102,9 +144,6 @@ export class HospitalManagementComponent implements OnInit {
102 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 147
     if (!that.add) {
109 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 165
   edit(data) {
128 166
     this.add = false;
129 167
     this.modal = true;
130 168
     this.coopId = data.id;
131 169
     this.validateForm.controls.hospitalName.setValue(data.hosName);
132 170
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
133
-    this.validateForm.removeControl("copyHosId");
134
-    this.isShowCopyHosId = false;
135 171
   }
136 172
 
137 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 76
   hosId; //当前院区
77 77
   allAssociation: Array<any>; //关联类型
78
-  allTaskType; //任务类型列表
78
+  allTaskType = []; //任务类型列表
79 79
   allTaskTypeShow; //任务类型列表选择标识
80 80
   allGoods: Array<any>; //携带设备
81 81
   allScheduleClass; //班次列表