|
@@ -0,0 +1,603 @@
|
|
1
|
+import { Component, OnInit, ViewChild } from "@angular/core";
|
|
2
|
+import { ActivatedRoute, Router } from "@angular/router";
|
|
3
|
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
|
|
4
|
+
|
|
5
|
+import { MainService } from "../../services/main.service";
|
|
6
|
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
|
|
7
|
+import { ToolService } from "../../services/tool.service";
|
|
8
|
+import { forkJoin, Subject } from "rxjs";
|
|
9
|
+import { debounceTime } from "rxjs/operators";
|
|
10
|
+import { NzMessageService } from "ng-zorro-antd";
|
|
11
|
+
|
|
12
|
+@Component({
|
|
13
|
+ selector: "app-clinical-users-management",
|
|
14
|
+ templateUrl: "./clinical-users-management.component.html",
|
|
15
|
+ styleUrls: ["./clinical-users-management.component.less"],
|
|
16
|
+})
|
|
17
|
+export class ClinicalUsersManagementComponent implements OnInit {
|
|
18
|
+ @ViewChild("osComponentRef1", {
|
|
19
|
+ read: OverlayScrollbarsComponent,
|
|
20
|
+ static: false,
|
|
21
|
+ })
|
|
22
|
+ osComponentRef1: OverlayScrollbarsComponent;
|
|
23
|
+ constructor(
|
|
24
|
+ private message: NzMessageService,
|
|
25
|
+ private fb: FormBuilder,
|
|
26
|
+ private route: ActivatedRoute,
|
|
27
|
+ private router: Router,
|
|
28
|
+ private mainService: MainService,
|
|
29
|
+ private tool: ToolService
|
|
30
|
+ ) {}
|
|
31
|
+
|
|
32
|
+ listOfData: any[] = []; //表格数据
|
|
33
|
+
|
|
34
|
+ modal: boolean = false; //新增/编辑模态框
|
|
35
|
+ add: boolean; //true:新增;false:编辑
|
|
36
|
+ validateForm: FormGroup; //新增/编辑表单
|
|
37
|
+ coopId: number; //表格中执行操作的id
|
|
38
|
+ department: any; //所属科室
|
|
39
|
+ num; //工号
|
|
40
|
+ name; //姓名
|
|
41
|
+ userType: any; //用户类型
|
|
42
|
+ hosId: any; //院区(搜索)
|
|
43
|
+ userGroup; //所属组
|
|
44
|
+ userGroup1; //所属组(搜索)
|
|
45
|
+ userTypes: Array<any>; //所有用户类型
|
|
46
|
+ alldepart: any = []; //所有所属科室
|
|
47
|
+ alldepart1: any = []; //所有所属科室(搜索)
|
|
48
|
+ hospitals1: any = []; //院区列表(搜索)
|
|
49
|
+ allUserGroup: Array<any>; //所有用户组
|
|
50
|
+ allUserGroup1: Array<any>; //用户组(搜索)
|
|
51
|
+ allUserRole: Array<any>; //所有角色
|
|
52
|
+ pageIndex: number = 1; //页码
|
|
53
|
+ listLength: number = 10; //总条数
|
|
54
|
+ pageSize: number = 10; //每页条数
|
|
55
|
+
|
|
56
|
+ promptContent: string; //操作提示框提示信息
|
|
57
|
+ ifSuccess: boolean; //操作成功/失败
|
|
58
|
+ promptInfo: string; //操作结果提示信息
|
|
59
|
+ promptModalShow: boolean; //操作提示框是否展示
|
|
60
|
+
|
|
61
|
+ btnLoading: boolean = false; //提交按钮loading状态
|
|
62
|
+ wxRequired = false; //新增或编辑用户的时候,微信号是否必填
|
|
63
|
+ changeInpSubject = new Subject(); //防抖
|
|
64
|
+ changeInpHospitalSubject = new Subject(); //防抖
|
|
65
|
+
|
|
66
|
+ ngOnInit() {
|
|
67
|
+ //防抖
|
|
68
|
+ this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
69
|
+ this.getDeparts(v[0], v[1], v[2]);
|
|
70
|
+ });
|
|
71
|
+ //防抖
|
|
72
|
+ this.changeInpHospitalSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
73
|
+ this.getHospitals(v[0], v[1], v[2]);
|
|
74
|
+ });
|
|
75
|
+ this.coopBtns = this.tool.initCoopBtns(this.route);
|
|
76
|
+ this.initForm();
|
|
77
|
+ this.getUserTypes();
|
|
78
|
+ this.getAllRole();
|
|
79
|
+ this.getGender();
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ // 初始化增删改按钮
|
|
83
|
+ coopBtns: any = {};
|
|
84
|
+ // 搜索
|
|
85
|
+ search() {
|
|
86
|
+ this.pageIndex = 1;
|
|
87
|
+ this.getList();
|
|
88
|
+ }
|
|
89
|
+ // 重置
|
|
90
|
+ reset() {
|
|
91
|
+ this.pageIndex = 1;
|
|
92
|
+ this.name = "";
|
|
93
|
+ this.num = "";
|
|
94
|
+ this.userType = null;
|
|
95
|
+ this.department = null;
|
|
96
|
+ this.userGroup1 = null;
|
|
97
|
+ this.changeHosp1(this.hosId);
|
|
98
|
+ this.getList();
|
|
99
|
+ }
|
|
100
|
+ // 表格数据
|
|
101
|
+ loading1 = false;
|
|
102
|
+ getList() {
|
|
103
|
+ let data = {
|
|
104
|
+ idx: this.pageIndex - 1,
|
|
105
|
+ sum: this.pageSize,
|
|
106
|
+ user: {
|
|
107
|
+ name: this.name || "",
|
|
108
|
+ dept: { id: this.department || "" },
|
|
109
|
+ usertype: { id: this.userType || "" },
|
|
110
|
+ account: this.num || "",
|
|
111
|
+ groupdata: { id: this.userGroup1 || "" },
|
|
112
|
+ hospital: { id: this.hosId || "" },
|
|
113
|
+ },
|
|
114
|
+ };
|
|
115
|
+ if (!data.user.dept || !data.user.dept.id) {
|
|
116
|
+ delete data.user.dept;
|
|
117
|
+ }
|
|
118
|
+ if (!data.user.usertype || !data.user.usertype.id) {
|
|
119
|
+ delete data.user.usertype;
|
|
120
|
+ }
|
|
121
|
+ if (!data.user.groupdata || !data.user.groupdata.id) {
|
|
122
|
+ delete data.user.groupdata;
|
|
123
|
+ }
|
|
124
|
+ if (!data.user.hospital || !data.user.hospital.id) {
|
|
125
|
+ delete data.user.hospital;
|
|
126
|
+ }
|
|
127
|
+ this.loading1 = true;
|
|
128
|
+ this.mainService
|
|
129
|
+ .getFetchDataList("data", "user", data)
|
|
130
|
+ .subscribe((data) => {
|
|
131
|
+ this.loading1 = false;
|
|
132
|
+ this.listOfData = data.list;
|
|
133
|
+ this.listLength = data.totalNum;
|
|
134
|
+ });
|
|
135
|
+ }
|
|
136
|
+
|
|
137
|
+ // 获取所有用户类型
|
|
138
|
+ getUserTypes() {
|
|
139
|
+ this.mainService.getDictionary("list", "usertype").subscribe((data) => {
|
|
140
|
+ this.userTypes = data;
|
|
141
|
+ let userType = data.find(v=>v.value == 1);
|
|
142
|
+ this.userType = userType ? String(userType.id) : null;
|
|
143
|
+ this.getAllHospital();
|
|
144
|
+ });
|
|
145
|
+ }
|
|
146
|
+
|
|
147
|
+ // 获取相应的院区
|
|
148
|
+ getAllHospital() {
|
|
149
|
+ let topLevelParentHosList$ = this.mainService.apiPostAll("topLevelParentHosList", {});
|
|
150
|
+ let topLevelParentHos$ = this.mainService.apiPostAll("topLevelParentHos", {hosId: this.tool.getCurrentHospital().id});
|
|
151
|
+ forkJoin(topLevelParentHosList$, topLevelParentHos$).subscribe((dataArray:any[]) => {
|
|
152
|
+ let [data1, data2] = dataArray;
|
|
153
|
+ this.hospitals1 = data1.topLevelParentHosList || [];
|
|
154
|
+ this.hosId = data2.topHospital ? data2.topHospital.id : null;
|
|
155
|
+ this.changeHosp1(this.hosId);
|
|
156
|
+ this.getList();
|
|
157
|
+ })
|
|
158
|
+ }
|
|
159
|
+
|
|
160
|
+ // 角色列表
|
|
161
|
+ getAllRole() {
|
|
162
|
+ var that = this;
|
|
163
|
+ let data = {
|
|
164
|
+ idx: 0,
|
|
165
|
+ sum: 1000,
|
|
166
|
+ };
|
|
167
|
+ that.mainService
|
|
168
|
+ .getFetchDataList("data", "role", data)
|
|
169
|
+ .subscribe((data) => {
|
|
170
|
+ that.allUserRole = data.list;
|
|
171
|
+ });
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ // 切换院区选项获取对应科室列表
|
|
175
|
+ changeHosp() {
|
|
176
|
+ let hid = this.hosId - 0;
|
|
177
|
+ let data = {
|
|
178
|
+ department: {
|
|
179
|
+ hospital: { id: hid },
|
|
180
|
+ },
|
|
181
|
+ idx: 0,
|
|
182
|
+ sum: 20,
|
|
183
|
+ };
|
|
184
|
+ let groupData = {
|
|
185
|
+ group2: {
|
|
186
|
+ hospitals: hid,
|
|
187
|
+ type:1
|
|
188
|
+ },
|
|
189
|
+ idx: 0,
|
|
190
|
+ sum: 9999,
|
|
191
|
+ };
|
|
192
|
+ this.maskFlag = this.message.loading("正在加载中..", {
|
|
193
|
+ nzDuration: 0,
|
|
194
|
+ }).messageId;
|
|
195
|
+ let department$ = this.mainService.getFetchDataList(
|
|
196
|
+ "data",
|
|
197
|
+ "department",
|
|
198
|
+ data
|
|
199
|
+ );
|
|
200
|
+ let group$ = this.mainService.getFetchDataList("data", "group2", groupData);
|
|
201
|
+ forkJoin(department$, group$).subscribe((res) => {
|
|
202
|
+ this.message.remove(this.maskFlag);
|
|
203
|
+ this.maskFlag = false;
|
|
204
|
+ this.modal = true;
|
|
205
|
+ this.alldepart = res[0]["list"];
|
|
206
|
+ this.allUserGroup = res[1]["list"];
|
|
207
|
+ });
|
|
208
|
+ }
|
|
209
|
+ // 切换院区选项获取对应科室列表(搜索)seimin
|
|
210
|
+ changeHosp1(id) {
|
|
211
|
+ this.department = null;
|
|
212
|
+ this.userGroup1 = null;
|
|
213
|
+ let departmentData = {
|
|
214
|
+ department: {
|
|
215
|
+ hospital: { id },
|
|
216
|
+ },
|
|
217
|
+ idx: 0,
|
|
218
|
+ sum: 20,
|
|
219
|
+ };
|
|
220
|
+ let groupData = {
|
|
221
|
+ group2: {
|
|
222
|
+ hospitals: id,
|
|
223
|
+ type:1
|
|
224
|
+ },
|
|
225
|
+ idx: 0,
|
|
226
|
+ sum: 9999,
|
|
227
|
+ };
|
|
228
|
+ this.mainService
|
|
229
|
+ .getFetchDataList("data", "department", departmentData)
|
|
230
|
+ .subscribe((data) => {
|
|
231
|
+ this.alldepart1 = data.list;
|
|
232
|
+ });
|
|
233
|
+ this.mainService
|
|
234
|
+ .getFetchDataList("data", "group2", groupData)
|
|
235
|
+ .subscribe((data) => {
|
|
236
|
+ this.allUserGroup1 = data.list;
|
|
237
|
+ });
|
|
238
|
+ }
|
|
239
|
+
|
|
240
|
+ // 获取性别
|
|
241
|
+ genders: Array<any> = [];
|
|
242
|
+ getGender() {
|
|
243
|
+ var that = this;
|
|
244
|
+ that.mainService.getDictionary("list", "user_gender").subscribe((data) => {
|
|
245
|
+ that.genders = data;
|
|
246
|
+ });
|
|
247
|
+ }
|
|
248
|
+
|
|
249
|
+ // 新增弹框
|
|
250
|
+ showModal() {
|
|
251
|
+ this.add = true;
|
|
252
|
+ this.initForm();
|
|
253
|
+ this.changeHosp();
|
|
254
|
+ }
|
|
255
|
+ hideModal() {
|
|
256
|
+ this.modal = false;
|
|
257
|
+ this.initForm();
|
|
258
|
+ }
|
|
259
|
+
|
|
260
|
+ // 初始化新增form表单
|
|
261
|
+ initForm() {
|
|
262
|
+ if (this.add) {
|
|
263
|
+ this.alldepart = [];
|
|
264
|
+ this.allUserGroup = [];
|
|
265
|
+ }
|
|
266
|
+ this.validateForm = this.fb.group({
|
|
267
|
+ name: [null, [Validators.required]],
|
|
268
|
+ account: [null, [Validators.required]],
|
|
269
|
+ usertype: [null, [Validators.required]],
|
|
270
|
+ dept: [null, [Validators.required]],
|
|
271
|
+ deptPhone: [null, [Validators.required]],
|
|
272
|
+ gender: [null, [Validators.required]],
|
|
273
|
+ userGroup: [null],
|
|
274
|
+ role: [null, [Validators.required]],
|
|
275
|
+ weixin: [null],
|
|
276
|
+ });
|
|
277
|
+ }
|
|
278
|
+ // 选择用户类型
|
|
279
|
+ usertypeChange() {
|
|
280
|
+ if (this.validateForm.value.usertype == 106) {
|
|
281
|
+ //支助人员
|
|
282
|
+ this.wxRequired = true;
|
|
283
|
+ this.validateForm.get("weixin")!.setValidators(Validators.required);
|
|
284
|
+ this.validateForm.get("weixin")!.markAsDirty();
|
|
285
|
+ } else {
|
|
286
|
+ this.wxRequired = false;
|
|
287
|
+ this.validateForm.get("weixin")!.clearValidators();
|
|
288
|
+ this.validateForm.get("weixin")!.markAsPristine();
|
|
289
|
+ }
|
|
290
|
+ this.validateForm.get("weixin")!.updateValueAndValidity();
|
|
291
|
+ }
|
|
292
|
+ // 表单提交
|
|
293
|
+ submitForm(): void {
|
|
294
|
+ var that = this;
|
|
295
|
+ for (const i in that.validateForm.controls) {
|
|
296
|
+ that.validateForm.controls[i].markAsDirty({ onlySelf: true });
|
|
297
|
+ that.validateForm.controls[i].updateValueAndValidity();
|
|
298
|
+ }
|
|
299
|
+ if (that.validateForm.invalid) return;
|
|
300
|
+ that.btnLoading = true;
|
|
301
|
+ let groups = [],
|
|
302
|
+ roles = [];
|
|
303
|
+ if (that.validateForm.value.userGroup) {
|
|
304
|
+ that.validateForm.value.userGroup.forEach((element) => {
|
|
305
|
+ groups.push({ id: element });
|
|
306
|
+ });
|
|
307
|
+ }
|
|
308
|
+ that.validateForm.value.role.forEach((element) => {
|
|
309
|
+ roles.push({ id: element });
|
|
310
|
+ });
|
|
311
|
+ let data = {
|
|
312
|
+ user: {
|
|
313
|
+ name: that.validateForm.value.name,
|
|
314
|
+ account: that.validateForm.value.account,
|
|
315
|
+ gender: { id: that.validateForm.value.gender, key: "user_gender" },
|
|
316
|
+ usertype: { id: that.validateForm.value.usertype },
|
|
317
|
+ dept: { id: that.validateForm.value.dept },
|
|
318
|
+ group: groups,
|
|
319
|
+ role: roles,
|
|
320
|
+ phone: that.validateForm.value.deptPhone,
|
|
321
|
+ hospital: { id: that.hosId },
|
|
322
|
+ weixin: that.validateForm.value.weixin,
|
|
323
|
+ },
|
|
324
|
+ };
|
|
325
|
+ if (!that.validateForm.value.userGroup) {
|
|
326
|
+ delete data.user.group;
|
|
327
|
+ } else if (that.validateForm.value.userGroup.length === 0) {
|
|
328
|
+ delete data.user.group;
|
|
329
|
+ }
|
|
330
|
+ if (!that.add) {
|
|
331
|
+ data.user["id"] = that.coopId;
|
|
332
|
+ }
|
|
333
|
+ that.mainService
|
|
334
|
+ .coopData(that.add ? "addData" : "updData", "user", data)
|
|
335
|
+ .subscribe((data) => {
|
|
336
|
+ that.btnLoading = false;
|
|
337
|
+ that.hideModal();
|
|
338
|
+ that.initForm();
|
|
339
|
+ if (data.status == 200) {
|
|
340
|
+ that.showPromptModal(that.add ? "新增" : "编辑", true, "");
|
|
341
|
+ } else {
|
|
342
|
+ that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
|
|
343
|
+ }
|
|
344
|
+ });
|
|
345
|
+ }
|
|
346
|
+
|
|
347
|
+ // 编辑
|
|
348
|
+ maskFlag: any = false;
|
|
349
|
+ edit(data) {
|
|
350
|
+ // ----------------
|
|
351
|
+ var hid = data.hospital.id;
|
|
352
|
+ let departmentData = {
|
|
353
|
+ department: {
|
|
354
|
+ hospital: { id: hid },
|
|
355
|
+ },
|
|
356
|
+ idx: 0,
|
|
357
|
+ sum: 20,
|
|
358
|
+ };
|
|
359
|
+ let groupData = {
|
|
360
|
+ group2: {
|
|
361
|
+ hospitals: hid,
|
|
362
|
+ type:1
|
|
363
|
+ },
|
|
364
|
+ idx: 0,
|
|
365
|
+ sum: 9999,
|
|
366
|
+ };
|
|
367
|
+ this.maskFlag = this.message.loading("正在加载中..", {
|
|
368
|
+ nzDuration: 0,
|
|
369
|
+ }).messageId;
|
|
370
|
+ this.mainService
|
|
371
|
+ .getFetchDataList("data", "group2", groupData)
|
|
372
|
+ .subscribe((item1) => {
|
|
373
|
+ this.allUserGroup = item1.list;
|
|
374
|
+ this.mainService
|
|
375
|
+ .getFetchDataList("data", "department", departmentData)
|
|
376
|
+ .subscribe((item2) => {
|
|
377
|
+ this.message.remove(this.maskFlag);
|
|
378
|
+ this.maskFlag = false;
|
|
379
|
+ this.modal = true;
|
|
380
|
+ this.alldepart = item2.list;
|
|
381
|
+ if (data.dept) {
|
|
382
|
+ let has = item2.list.some((d) => d.id == data.dept.id);
|
|
383
|
+ if (!has) {
|
|
384
|
+ this.alldepart = [data.dept, ...item2.list];
|
|
385
|
+ }
|
|
386
|
+ }
|
|
387
|
+ this.isLoading = false;
|
|
388
|
+ // ------------------------
|
|
389
|
+ this.add = false;
|
|
390
|
+ this.coopId = data.id;
|
|
391
|
+ let groups = [],
|
|
392
|
+ roles = [];
|
|
393
|
+ if (data.group) {
|
|
394
|
+ data.group.forEach((element) => {
|
|
395
|
+ groups.push(element["id"] + "");
|
|
396
|
+ });
|
|
397
|
+ }
|
|
398
|
+ if (data.role) {
|
|
399
|
+ data.role.forEach((element) => {
|
|
400
|
+ roles.push(element["id"] + "");
|
|
401
|
+ });
|
|
402
|
+ }
|
|
403
|
+ this.validateForm.controls.name.setValue(data.name);
|
|
404
|
+ this.validateForm.controls.account.setValue(data.account);
|
|
405
|
+ this.validateForm.controls.usertype.setValue(data.usertype.id + "");
|
|
406
|
+ if (data.dept) {
|
|
407
|
+ this.validateForm.controls.dept.setValue(data.dept.id);
|
|
408
|
+ }
|
|
409
|
+ this.validateForm.controls.deptPhone.setValue(data.phone);
|
|
410
|
+ this.validateForm.controls.gender.setValue(data.gender.id + "");
|
|
411
|
+ this.validateForm.controls.userGroup.setValue(
|
|
412
|
+ groups.length ? groups : null
|
|
413
|
+ );
|
|
414
|
+ this.validateForm.controls.role.setValue(
|
|
415
|
+ roles.length ? roles : null
|
|
416
|
+ );
|
|
417
|
+ this.validateForm.controls.gender.setValue(data.gender.id + "");
|
|
418
|
+ this.validateForm.controls.weixin.setValue(data.weixin);
|
|
419
|
+ this.usertypeChange();
|
|
420
|
+ });
|
|
421
|
+ });
|
|
422
|
+ // ----------------
|
|
423
|
+ }
|
|
424
|
+
|
|
425
|
+ // 删除
|
|
426
|
+ delModal: boolean = false; //删除模态框
|
|
427
|
+ del(data) {
|
|
428
|
+ let that = this;
|
|
429
|
+ that.coopId = data.id;
|
|
430
|
+ that.delModal = true;
|
|
431
|
+ }
|
|
432
|
+ // 确认删除(删除企业微信用户)
|
|
433
|
+ confirmDel() {
|
|
434
|
+ let that = this;
|
|
435
|
+ that.btnLoading = true;
|
|
436
|
+ that.mainService
|
|
437
|
+ .rmvDataAndWeChatNum([that.coopId], true)
|
|
438
|
+ .subscribe((data) => {
|
|
439
|
+ that.btnLoading = false;
|
|
440
|
+ that.hideDelModal();
|
|
441
|
+ if (data["status"] == 200) {
|
|
442
|
+ if (
|
|
443
|
+ that.listOfData.length == 1 &&
|
|
444
|
+ that.pageIndex == Math.ceil(that.listLength / that.pageSize)
|
|
445
|
+ ) {
|
|
446
|
+ that.listLength--;
|
|
447
|
+ that.pageIndex = Math.ceil(that.listLength / that.pageSize);
|
|
448
|
+ }
|
|
449
|
+ that.showPromptModal("删除", true, "");
|
|
450
|
+ } else {
|
|
451
|
+ that.showPromptModal("删除", false, data["msg"]);
|
|
452
|
+ }
|
|
453
|
+ });
|
|
454
|
+ }
|
|
455
|
+ // 确认删除(不删除企业用户)
|
|
456
|
+ cancenlLoading = false;
|
|
457
|
+ cancelDel() {
|
|
458
|
+ let that = this;
|
|
459
|
+ that.cancenlLoading = true;
|
|
460
|
+ that.mainService
|
|
461
|
+ .rmvDataAndWeChatNum([that.coopId], false)
|
|
462
|
+ .subscribe((data) => {
|
|
463
|
+ that.cancenlLoading = false;
|
|
464
|
+ that.hideDelModal();
|
|
465
|
+ if (data["status"] == 200) {
|
|
466
|
+ if (
|
|
467
|
+ that.listOfData.length == 1 &&
|
|
468
|
+ that.pageIndex == Math.ceil(that.listLength / that.pageSize)
|
|
469
|
+ ) {
|
|
470
|
+ that.listLength--;
|
|
471
|
+ that.pageIndex = Math.ceil(that.listLength / that.pageSize);
|
|
472
|
+ }
|
|
473
|
+ that.showPromptModal("删除", true, "");
|
|
474
|
+ } else {
|
|
475
|
+ that.showPromptModal("删除", false, data["msg"]);
|
|
476
|
+ }
|
|
477
|
+ });
|
|
478
|
+ }
|
|
479
|
+ // 关闭删除模态框
|
|
480
|
+ hideDelModal() {
|
|
481
|
+ this.delModal = false;
|
|
482
|
+ }
|
|
483
|
+
|
|
484
|
+ // ==================重置密码start====================
|
|
485
|
+ // 重置密码
|
|
486
|
+ resetModal: boolean = false; //删除模态框
|
|
487
|
+ resetPwd(data) {
|
|
488
|
+ this.coopId = data.id;
|
|
489
|
+ this.resetModal = true;
|
|
490
|
+ }
|
|
491
|
+ // 确认重置密码
|
|
492
|
+ confirmReset() {
|
|
493
|
+ this.btnLoading = true;
|
|
494
|
+ this.mainService
|
|
495
|
+ .resetpwd(this.coopId)
|
|
496
|
+ .subscribe((data) => {
|
|
497
|
+ this.btnLoading = false;
|
|
498
|
+ this.hideResetModal();
|
|
499
|
+ if (data["status"] == 200) {
|
|
500
|
+ this.showPromptModal("重置密码", true, "");
|
|
501
|
+ } else {
|
|
502
|
+ this.showPromptModal("重置密码", false, data["msg"]);
|
|
503
|
+ }
|
|
504
|
+ });
|
|
505
|
+ }
|
|
506
|
+ // 取消
|
|
507
|
+ cancelReset() {
|
|
508
|
+ this.resetModal = false;
|
|
509
|
+ }
|
|
510
|
+ // 关闭删除模态框
|
|
511
|
+ hideResetModal() {
|
|
512
|
+ this.resetModal = false;
|
|
513
|
+ }
|
|
514
|
+ // ==================重置密码end====================
|
|
515
|
+
|
|
516
|
+ // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
517
|
+ showPromptModal(con, success, promptInfo?) {
|
|
518
|
+ this.promptModalShow = false;
|
|
519
|
+ this.promptContent = con;
|
|
520
|
+ this.ifSuccess = success;
|
|
521
|
+ this.promptInfo = promptInfo;
|
|
522
|
+ setTimeout(() => {
|
|
523
|
+ this.promptModalShow = true;
|
|
524
|
+ }, 100);
|
|
525
|
+ this.getList();
|
|
526
|
+ }
|
|
527
|
+
|
|
528
|
+ // 查看
|
|
529
|
+ detail(id) {
|
|
530
|
+ this.router.navigateByUrl("/main/usersManagement/userDetail/" + id);
|
|
531
|
+ }
|
|
532
|
+ // 边输边搜节流阀
|
|
533
|
+ isLoading = false;
|
|
534
|
+ changeInp(deptId, type, e) {
|
|
535
|
+ if (!deptId) {
|
|
536
|
+ if (type == "search") {
|
|
537
|
+ this.alldepart1 = [];
|
|
538
|
+ } else if (type == "add") {
|
|
539
|
+ this.alldepart = [];
|
|
540
|
+ }
|
|
541
|
+ return;
|
|
542
|
+ }
|
|
543
|
+ this.isLoading = true;
|
|
544
|
+ this.changeInpSubject.next([deptId, type, e]);
|
|
545
|
+ }
|
|
546
|
+ // 边输边搜节流阀
|
|
547
|
+ changeInpHospital(hosId, type, e) {
|
|
548
|
+ if (!hosId) {
|
|
549
|
+ if (type == "search") {
|
|
550
|
+ this.hospitals1 = [];
|
|
551
|
+ } else if (type == "add") {}
|
|
552
|
+ return;
|
|
553
|
+ }
|
|
554
|
+ this.isLoading = true;
|
|
555
|
+ this.changeInpHospitalSubject.next([hosId, type, e]);
|
|
556
|
+ }
|
|
557
|
+ // 获取所有科室
|
|
558
|
+ snum = 0;
|
|
559
|
+ getDeparts(deptId, type, dept) {
|
|
560
|
+ var that = this;
|
|
561
|
+ let data = {
|
|
562
|
+ department: {
|
|
563
|
+ dept,
|
|
564
|
+ hospital: {
|
|
565
|
+ id: deptId,
|
|
566
|
+ },
|
|
567
|
+ },
|
|
568
|
+ idx: 0,
|
|
569
|
+ sum: 20,
|
|
570
|
+ };
|
|
571
|
+ this.snum++;
|
|
572
|
+ that.mainService
|
|
573
|
+ .getFetchDataList("data", "department", data)
|
|
574
|
+ .subscribe((data) => {
|
|
575
|
+ this.snum--;
|
|
576
|
+ if (type == "search") {
|
|
577
|
+ that.alldepart1 = data.list;
|
|
578
|
+ } else if (type == "add") {
|
|
579
|
+ that.alldepart = data.list;
|
|
580
|
+ }
|
|
581
|
+ if (this.snum === 0) {
|
|
582
|
+ that.isLoading = false;
|
|
583
|
+ }
|
|
584
|
+ });
|
|
585
|
+ }
|
|
586
|
+ // 获取院区
|
|
587
|
+ hnum = 0;
|
|
588
|
+ getHospitals(hosId, type, keword) {
|
|
589
|
+ this.hnum++;
|
|
590
|
+ this.mainService
|
|
591
|
+ .apiPostAll("topLevelParentHosList", {})
|
|
592
|
+ .subscribe((data:any) => {
|
|
593
|
+ this.hnum--;
|
|
594
|
+ if (type == "search") {
|
|
595
|
+ this.hospitals1 = data.list;
|
|
596
|
+ } else if (type == "add") {}
|
|
597
|
+ if (this.hnum === 0) {
|
|
598
|
+ this.isLoading = false;
|
|
599
|
+ }
|
|
600
|
+ });
|
|
601
|
+ }
|
|
602
|
+}
|
|
603
|
+
|