Pārlūkot izejas kodu

增加用户类型三方人员,增加三方公司

seimin 11 mēneši atpakaļ
vecāks
revīzija
3d4a8b3ef5

+ 1 - 8
src/app/views/configuration-center/configuration-center.component.html

@@ -171,17 +171,10 @@
171
                   <nz-form-item>
171
                   <nz-form-item>
172
                     <nz-form-control [nzSpan]="24" nzErrorTip="请输入值!">
172
                     <nz-form-control [nzSpan]="24" nzErrorTip="请输入值!">
173
                       <nz-input-group>
173
                       <nz-input-group>
174
-                        <nz-input-number [formControlName]="'value_' + data.id" class="valueInput"></nz-input-number>
174
+                        <input [formControlName]="'value_' + data.id" nz-input class="valueInput">
175
                       </nz-input-group>
175
                       </nz-input-group>
176
                     </nz-form-control>
176
                     </nz-form-control>
177
                   </nz-form-item>
177
                   </nz-form-item>
178
-                  <!-- <nz-form-item class="ml8">
179
-                    <nz-form-control [nzSpan]="24" nzErrorTip="请输入排序号!">
180
-                      <nz-input-group>
181
-                        <nz-input-number [formControlName]="'orders_' + data.id" class="nameInput"></nz-input-number>
182
-                      </nz-input-group>
183
-                    </nz-form-control>
184
-                  </nz-form-item> -->
185
                   <i class="icon_transport transport-tag27fuben ml8" (click)="addField(i)"></i>
178
                   <i class="icon_transport transport-tag27fuben ml8" (click)="addField(i)"></i>
186
                   <i class="icon_transport transport-shanchu1 ml8" *ngIf="dictionaryList.length > 1 && !data.system" (click)="removeField(data, i)"></i>
179
                   <i class="icon_transport transport-shanchu1 ml8" *ngIf="dictionaryList.length > 1 && !data.system" (click)="removeField(data, i)"></i>
187
                 </div>
180
                 </div>

+ 15 - 8
src/app/views/configuration-center/configuration-center.component.ts

@@ -1,9 +1,8 @@
1
 import { Component, OnInit, ViewChild, AfterViewInit } from "@angular/core";
1
 import { Component, OnInit, ViewChild, AfterViewInit } from "@angular/core";
2
 import { Location } from '@angular/common';
2
 import { Location } from '@angular/common';
3
-import { NzFormatEmitEvent, NzTreeNodeOptions, NzTreeComponent, NzMessageService } from 'ng-zorro-antd';
3
+import { NzTreeNodeOptions, NzTreeComponent, NzMessageService } from 'ng-zorro-antd';
4
 import { ToolService } from 'src/app/services/tool.service';
4
 import { ToolService } from 'src/app/services/tool.service';
5
 import { MainService } from 'src/app/services/main.service';
5
 import { MainService } from 'src/app/services/main.service';
6
-import cloneDeep from 'lodash-es/cloneDeep'
7
 import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
6
 import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
8
 import { Router, ActivatedRoute } from '@angular/router';
7
 import { Router, ActivatedRoute } from '@angular/router';
9
 import { Subject } from 'rxjs';
8
 import { Subject } from 'rxjs';
@@ -692,7 +691,7 @@ export class ConfigurationCenterComponent implements OnInit, AfterViewInit {
692
       idx: 0,
691
       idx: 0,
693
       sum: 9999,
692
       sum: 9999,
694
       dictionary: {
693
       dictionary: {
695
-        key: "incident_category_score"
694
+        key: this.activeDictionaryKey.key,
696
       }
695
       }
697
     }
696
     }
698
     this.maskFlag = this.message.loading("正在加载中..", {
697
     this.maskFlag = this.message.loading("正在加载中..", {
@@ -729,7 +728,7 @@ export class ConfigurationCenterComponent implements OnInit, AfterViewInit {
729
       this.dictionaryList.forEach((obj, i) => {
728
       this.dictionaryList.forEach((obj, i) => {
730
         for (const key in obj) {
729
         for (const key in obj) {
731
           if(key !== 'id' && key !== 'system'){
730
           if(key !== 'id' && key !== 'system'){
732
-            this.validateDictionaryForm.addControl(key + '_' + obj.id, new FormControl(obj[key], [Validators.required]))
731
+            this.validateDictionaryForm.addControl(key + '_' + obj.id, new FormControl({value: obj[key], disabled: key === 'value' ? obj.system : false}, [Validators.required]))
733
           }
732
           }
734
         }
733
         }
735
       })
734
       })
@@ -743,12 +742,13 @@ export class ConfigurationCenterComponent implements OnInit, AfterViewInit {
743
       name: null,
742
       name: null,
744
       value: null,
743
       value: null,
745
       orders: null,
744
       orders: null,
745
+      system: false,
746
     };
746
     };
747
 
747
 
748
     // 动态添加表单
748
     // 动态添加表单
749
     for (const key in obj) {
749
     for (const key in obj) {
750
       console.log(key + '_' + obj.id)
750
       console.log(key + '_' + obj.id)
751
-      if(key !== 'id'){
751
+      if(key !== 'id' && key !== 'system'){
752
         this.validateDictionaryForm.addControl(key + '_' + obj.id, new FormControl(null, [Validators.required]))
752
         this.validateDictionaryForm.addControl(key + '_' + obj.id, new FormControl(null, [Validators.required]))
753
       }
753
       }
754
     }
754
     }
@@ -791,8 +791,8 @@ export class ConfigurationCenterComponent implements OnInit, AfterViewInit {
791
         name: this.validateDictionaryForm.value['name_' + this.dictionaryList[i].id],
791
         name: this.validateDictionaryForm.value['name_' + this.dictionaryList[i].id],
792
         value: this.validateDictionaryForm.value['value_' + this.dictionaryList[i].id],
792
         value: this.validateDictionaryForm.value['value_' + this.dictionaryList[i].id],
793
         orders: this.validateDictionaryForm.value['orders_' + this.dictionaryList[i].id],
793
         orders: this.validateDictionaryForm.value['orders_' + this.dictionaryList[i].id],
794
-        system: !uuidValidate(this.dictionaryList[i].id),
795
-        key: 'incident_category_score',
794
+        system: uuidValidate(this.dictionaryList[i].id) ? false : this.dictionaryList[i].system,
795
+        key: this.activeDictionaryKey.key,
796
       })
796
       })
797
     }
797
     }
798
     console.log(postData);
798
     console.log(postData);
@@ -884,13 +884,20 @@ export class ConfigurationCenterComponent implements OnInit, AfterViewInit {
884
 
884
 
885
   // 数据字典key列表
885
   // 数据字典key列表
886
   dictionaryKeyList: any[] = [
886
   dictionaryKeyList: any[] = [
887
-    { id: 1, name: '积分配置',},
887
+    { id: 1, name: '积分配置', key: "incident_category_score"},
888
+    { id: 2, name: '事件来源', key: "incident_source"},
889
+    { id: 3, name: '处理结果', key: "incident_closecode"},
890
+    { id: 4, name: '处理方式', key: "incident_handle_type"},
891
+    { id: 5, name: '状态', key: "incident_status"},
892
+    { id: 6, name: '维修记录', key: "repair_type"},
893
+    { id: 7, name: '满意度评价', key: "incident_degree"},
888
   ];
894
   ];
889
 
895
 
890
   // 点击数据字典key
896
   // 点击数据字典key
891
   activeDictionaryKey:any = this.dictionaryKeyList[0];
897
   activeDictionaryKey:any = this.dictionaryKeyList[0];
892
   clickDictionaryKey(item){
898
   clickDictionaryKey(item){
893
     this.activeDictionaryKey = item;
899
     this.activeDictionaryKey = item;
900
+    this.getDictionaryList();
894
   }
901
   }
895
 
902
 
896
   // 点击故障现象
903
   // 点击故障现象

+ 17 - 5
src/app/views/users-management/users-management.component.html

@@ -138,8 +138,22 @@
138
           <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="usertype">用户类型</nz-form-label>
138
           <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="usertype">用户类型</nz-form-label>
139
           <nz-form-control nzErrorTip="请选择用户类型!">
139
           <nz-form-control nzErrorTip="请选择用户类型!">
140
             <nz-select [nzDropdownMatchSelectWidth]="false" type="usertype" nzShowSearch nzAllowClear
140
             <nz-select [nzDropdownMatchSelectWidth]="false" type="usertype" nzShowSearch nzAllowClear
141
-              formControlName="usertype" nzPlaceHolder="请选择用户类型" (ngModelChange)="usertypeChange()">
142
-              <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of userTypes">
141
+              formControlName="usertype" nzPlaceHolder="请选择用户类型" (ngModelChange)="usertypeChange($event)">
142
+              <nz-option nzLabel="{{data.name}}" nzValue="{{data.value}}" *ngFor="let data of userTypes">
143
+              </nz-option>
144
+            </nz-select>
145
+          </nz-form-control>
146
+        </nz-form-item>
147
+        <nz-form-item *ngIf="validateForm.value.usertype == 4">
148
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="companyId">所属公司</nz-form-label>
149
+          <nz-form-control nzErrorTip="请选择所属公司!">
150
+            <nz-select (nzOnSearch)="changeCompanyInp(hosId,'add',$event)" [nzDropdownMatchSelectWidth]="false"
151
+              nzServerSearch nzShowSearch nzAllowClear formControlName="companyId" nzPlaceHolder="请选择所属公司">
152
+              <ng-container *ngFor="let option of allcompany">
153
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
154
+              </ng-container>
155
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
156
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
143
               </nz-option>
157
               </nz-option>
144
             </nz-select>
158
             </nz-select>
145
           </nz-form-control>
159
           </nz-form-control>
@@ -149,8 +163,6 @@
149
           <nz-form-control nzErrorTip="请选择所属科室!">
163
           <nz-form-control nzErrorTip="请选择所属科室!">
150
             <nz-select (nzOnSearch)="changeInp(hosId,'add',$event)" [nzDropdownMatchSelectWidth]="false" type="dept"
164
             <nz-select (nzOnSearch)="changeInp(hosId,'add',$event)" [nzDropdownMatchSelectWidth]="false" type="dept"
151
               nzServerSearch nzShowSearch nzAllowClear formControlName="dept" nzPlaceHolder="请选择所属科室">
165
               nzServerSearch nzShowSearch nzAllowClear formControlName="dept" nzPlaceHolder="请选择所属科室">
152
-              <!-- <nz-option nzLabel="{{data.dept}}" nzValue="{{data.id}}" *ngFor="let data of alldepart">
153
-              </nz-option> -->
154
               <ng-container *ngFor="let option of alldepart">
166
               <ng-container *ngFor="let option of alldepart">
155
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
167
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
156
               </ng-container>
168
               </ng-container>
@@ -169,7 +181,7 @@
169
           </nz-form-control>
181
           </nz-form-control>
170
         </nz-form-item>
182
         </nz-form-item>
171
         <nz-form-item>
183
         <nz-form-item>
172
-          <nz-form-label style="line-height:40px;" [nzSm]="6" [nzXs]="24" nzRequired nzFor="gender">性别</nz-form-label>
184
+          <nz-form-label style="line-height:40px;" [nzSm]="3" [nzXs]="24" nzRequired nzFor="gender">性别</nz-form-label>
173
           <nz-form-control nzErrorTip="请选择性别!">
185
           <nz-form-control nzErrorTip="请选择性别!">
174
             <nz-radio-group type="gender" formControlName="gender">
186
             <nz-radio-group type="gender" formControlName="gender">
175
               <label nz-radio nzValue="{{data.id}}" *ngFor="let data of genders">{{data.name}}</label>
187
               <label nz-radio nzValue="{{data.id}}" *ngFor="let data of genders">{{data.name}}</label>

+ 148 - 46
src/app/views/users-management/users-management.component.ts

@@ -49,6 +49,7 @@ export class UsersManagementComponent implements OnInit {
49
   userTypes: Array<any> = []; //所有用户类型
49
   userTypes: Array<any> = []; //所有用户类型
50
   alldepart: any = []; //所有所属科室
50
   alldepart: any = []; //所有所属科室
51
   alldepart1: any = []; //所有所属科室(搜索)
51
   alldepart1: any = []; //所有所属科室(搜索)
52
+  allcompany: any = []; //所有所属公司
52
   allUserGroup: Array<any>; //所有用户组
53
   allUserGroup: Array<any>; //所有用户组
53
   allUserGroup1: Array<any>; //用户组(搜索)
54
   allUserGroup1: Array<any>; //用户组(搜索)
54
   allUserRole: Array<any>; //所有角色
55
   allUserRole: Array<any>; //所有角色
@@ -64,14 +65,18 @@ export class UsersManagementComponent implements OnInit {
64
   btnLoading: boolean = false; //提交按钮loading状态
65
   btnLoading: boolean = false; //提交按钮loading状态
65
   wxRequired = false; //新增或编辑用户的时候,微信号是否必填
66
   wxRequired = false; //新增或编辑用户的时候,微信号是否必填
66
   changeInpSubject = new Subject(); //防抖
67
   changeInpSubject = new Subject(); //防抖
68
+  changeInpCompanySubject = new Subject(); //防抖
67
 
69
 
68
   ngOnInit() {
70
   ngOnInit() {
69
     //防抖
71
     //防抖
70
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
72
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
71
       this.getDeparts(v[0], v[1], v[2]);
73
       this.getDeparts(v[0], v[1], v[2]);
72
     });
74
     });
75
+    //防抖
76
+    this.changeInpCompanySubject.pipe(debounceTime(500)).subscribe((v) => {
77
+      this.getCompany(v[0], v[1], v[2]);
78
+    });
73
     this.coopBtns = this.tool.initCoopBtns(this.route);
79
     this.coopBtns = this.tool.initCoopBtns(this.route);
74
-    this.initForm();
75
     this.getAllRole();
80
     this.getAllRole();
76
     this.getUserTypes();
81
     this.getUserTypes();
77
     this.getGender();
82
     this.getGender();
@@ -257,6 +262,14 @@ export class UsersManagementComponent implements OnInit {
257
       idx: 0,
262
       idx: 0,
258
       sum: 9999,
263
       sum: 9999,
259
     };
264
     };
265
+    let companyData = {
266
+      company: {
267
+        busiType: {key: "company_busi_type", value: "2"},
268
+        hosId: hid,
269
+      },
270
+      idx: 0,
271
+      sum: 20,
272
+    };
260
     this.maskFlag = this.message.loading("正在加载中..", {
273
     this.maskFlag = this.message.loading("正在加载中..", {
261
       nzDuration: 0,
274
       nzDuration: 0,
262
     }).messageId;
275
     }).messageId;
@@ -266,12 +279,14 @@ export class UsersManagementComponent implements OnInit {
266
       data
279
       data
267
     );
280
     );
268
     let group$ = this.mainService.getFetchDataList("data", "group2", groupData);
281
     let group$ = this.mainService.getFetchDataList("data", "group2", groupData);
269
-    forkJoin(department$, group$).subscribe((res) => {
282
+    let company$ = this.mainService.getFetchDataList("simple/data", "company", companyData);
283
+    forkJoin(department$, group$, company$).subscribe((res) => {
270
       this.message.remove(this.maskFlag);
284
       this.message.remove(this.maskFlag);
271
       this.maskFlag = false;
285
       this.maskFlag = false;
272
       this.modal = true;
286
       this.modal = true;
273
       this.alldepart = res[0]["list"];
287
       this.alldepart = res[0]["list"];
274
       this.allUserGroup = res[1]["list"];
288
       this.allUserGroup = res[1]["list"];
289
+      this.allcompany = res[2]["list"];
275
     });
290
     });
276
   }
291
   }
277
   // 切换院区选项获取对应科室列表(搜索)seimin
292
   // 切换院区选项获取对应科室列表(搜索)seimin
@@ -318,23 +333,25 @@ export class UsersManagementComponent implements OnInit {
318
   showModal() {
333
   showModal() {
319
     this.add = true;
334
     this.add = true;
320
     this.initForm();
335
     this.initForm();
336
+    this.requiredConfigChange('companyId', false);
321
     this.changeHosp();
337
     this.changeHosp();
322
   }
338
   }
323
   hideModal() {
339
   hideModal() {
324
     this.modal = false;
340
     this.modal = false;
325
-    this.initForm();
326
   }
341
   }
327
 
342
 
328
   // 初始化新增form表单
343
   // 初始化新增form表单
329
   initForm() {
344
   initForm() {
330
     if (this.add) {
345
     if (this.add) {
331
       this.alldepart = [];
346
       this.alldepart = [];
347
+      this.allcompany = [];
332
       this.allUserGroup = [];
348
       this.allUserGroup = [];
333
     }
349
     }
334
     this.validateForm = this.fb.group({
350
     this.validateForm = this.fb.group({
335
       name: [null, [Validators.required]],
351
       name: [null, [Validators.required]],
336
       account: [null, [Validators.required]],
352
       account: [null, [Validators.required]],
337
       usertype: [null, [Validators.required]],
353
       usertype: [null, [Validators.required]],
354
+      companyId: [null],
338
       dept: [null, [Validators.required]],
355
       dept: [null, [Validators.required]],
339
       deptPhone: [null, [Validators.required]],
356
       deptPhone: [null, [Validators.required]],
340
       gender: [null, [Validators.required]],
357
       gender: [null, [Validators.required]],
@@ -344,7 +361,7 @@ export class UsersManagementComponent implements OnInit {
344
     });
361
     });
345
   }
362
   }
346
   // 选择用户类型
363
   // 选择用户类型
347
-  usertypeChange() {
364
+  usertypeChange(value) {
348
     // if (this.validateForm.value.usertype == 106) {
365
     // if (this.validateForm.value.usertype == 106) {
349
     //   //配送人员
366
     //   //配送人员
350
     //   this.wxRequired = true;
367
     //   this.wxRequired = true;
@@ -360,6 +377,14 @@ export class UsersManagementComponent implements OnInit {
360
     this.validateForm.get("weixin")!.markAsPristine();
377
     this.validateForm.get("weixin")!.markAsPristine();
361
 
378
 
362
     this.validateForm.get("weixin")!.updateValueAndValidity();
379
     this.validateForm.get("weixin")!.updateValueAndValidity();
380
+
381
+    this.validateForm.controls.companyId.setValue(null);
382
+    if(value == 4){
383
+      // 三方人员
384
+      this.requiredConfigChange('companyId', true);
385
+    }else{
386
+      this.requiredConfigChange('companyId', false);
387
+    }
363
   }
388
   }
364
   // 表单提交
389
   // 表单提交
365
   submitForm(): void {
390
   submitForm(): void {
@@ -385,13 +410,14 @@ export class UsersManagementComponent implements OnInit {
385
         name: that.validateForm.value.name,
410
         name: that.validateForm.value.name,
386
         account: that.validateForm.value.account,
411
         account: that.validateForm.value.account,
387
         gender: { id: that.validateForm.value.gender, key: "user_gender" },
412
         gender: { id: that.validateForm.value.gender, key: "user_gender" },
388
-        usertype: { id: that.validateForm.value.usertype },
413
+        usertype: this.userTypes.find(v => v.value == that.validateForm.value.usertype),
389
         dept: { id: that.validateForm.value.dept },
414
         dept: { id: that.validateForm.value.dept },
390
         group: groups,
415
         group: groups,
391
         role: roles,
416
         role: roles,
392
         phone: that.validateForm.value.deptPhone,
417
         phone: that.validateForm.value.deptPhone,
393
         hospital: { id: that.hosId },
418
         hospital: { id: that.hosId },
394
         weixin: that.validateForm.value.weixin,
419
         weixin: that.validateForm.value.weixin,
420
+        companyId: that.validateForm.value.companyId || undefined,
395
       },
421
       },
396
     };
422
     };
397
     if (!that.validateForm.value.userGroup) {
423
     if (!that.validateForm.value.userGroup) {
@@ -416,9 +442,21 @@ export class UsersManagementComponent implements OnInit {
416
       });
442
       });
417
   }
443
   }
418
 
444
 
445
+  requiredConfigChange(name: string, required: boolean): void {
446
+    if (!required) {
447
+      this.validateForm.get(name)!.clearValidators();
448
+      this.validateForm.get(name)!.markAsPristine();
449
+    } else {
450
+      this.validateForm.get(name)!.setValidators(Validators.required);
451
+      this.validateForm.get(name)!.markAsDirty();
452
+    }
453
+    this.validateForm.get(name)!.updateValueAndValidity();
454
+  }
455
+
419
   // 编辑
456
   // 编辑
420
   maskFlag: any = false;
457
   maskFlag: any = false;
421
   edit(data) {
458
   edit(data) {
459
+    this.initForm();
422
     // ----------------
460
     // ----------------
423
     var hid = data.hospital.id;
461
     var hid = data.hospital.id;
424
     let departmentData = {
462
     let departmentData = {
@@ -436,6 +474,14 @@ export class UsersManagementComponent implements OnInit {
436
       idx: 0,
474
       idx: 0,
437
       sum: 9999,
475
       sum: 9999,
438
     };
476
     };
477
+    let companyData = {
478
+      company: {
479
+        busiType: {key: "company_busi_type", value: "2"},
480
+        hosId: hid,
481
+      },
482
+      idx: 0,
483
+      sum: 20,
484
+    };
439
     this.maskFlag = this.message.loading("正在加载中..", {
485
     this.maskFlag = this.message.loading("正在加载中..", {
440
       nzDuration: 0,
486
       nzDuration: 0,
441
     }).messageId;
487
     }).messageId;
@@ -446,9 +492,6 @@ export class UsersManagementComponent implements OnInit {
446
         this.mainService
492
         this.mainService
447
           .getFetchDataList("data", "department", departmentData)
493
           .getFetchDataList("data", "department", departmentData)
448
           .subscribe((item2) => {
494
           .subscribe((item2) => {
449
-            this.message.remove(this.maskFlag);
450
-            this.maskFlag = false;
451
-            this.modal = true;
452
             this.alldepart = item2.list;
495
             this.alldepart = item2.list;
453
             if (data.dept) {
496
             if (data.dept) {
454
               let has = item2.list.some((d) => d.id == data.dept.id);
497
               let has = item2.list.some((d) => d.id == data.dept.id);
@@ -456,39 +499,56 @@ export class UsersManagementComponent implements OnInit {
456
                 this.alldepart = [data.dept, ...item2.list];
499
                 this.alldepart = [data.dept, ...item2.list];
457
               }
500
               }
458
             }
501
             }
459
-            this.isLoading = false;
460
-            // ------------------------
461
-            this.add = false;
462
-            this.coopId = data.id;
463
-            let groups = [],
464
-              roles = [];
465
-            if (data.group) {
466
-              data.group.forEach((element) => {
467
-                groups.push(element["id"] + "");
468
-              });
469
-            }
470
-            if (data.role) {
471
-              data.role.forEach((element) => {
472
-                roles.push(element["id"] + "");
473
-              });
474
-            }
475
-            this.validateForm.controls.name.setValue(data.name);
476
-            this.validateForm.controls.account.setValue(data.account);
477
-            this.validateForm.controls.usertype.setValue(data.usertype.id + "");
478
-            if (data.dept) {
479
-              this.validateForm.controls.dept.setValue(data.dept.id);
480
-            }
481
-            this.validateForm.controls.deptPhone.setValue(data.phone);
482
-            this.validateForm.controls.gender.setValue(data.gender.id + "");
483
-            this.validateForm.controls.userGroup.setValue(
484
-              groups.length ? groups : null
485
-            );
486
-            this.validateForm.controls.role.setValue(
487
-              roles.length ? roles : null
488
-            );
489
-            this.validateForm.controls.gender.setValue(data.gender.id + "");
490
-            this.validateForm.controls.weixin.setValue(data.weixin);
491
-            this.usertypeChange();
502
+            this.mainService
503
+            .getFetchDataList("simple/data", "company", companyData)
504
+            .subscribe((item3) => {
505
+              this.message.remove(this.maskFlag);
506
+              this.maskFlag = false;
507
+              this.modal = true;
508
+              this.allcompany = item3.list;
509
+              if (data.companyDTO) {
510
+                let has = item3.list.some((d) => d.id == data.companyDTO.id);
511
+                if (!has) {
512
+                  this.allcompany = [data.companyDTO, ...item3.list];
513
+                }
514
+              }
515
+              this.isLoading = false;
516
+              // ------------------------
517
+              this.add = false;
518
+              this.coopId = data.id;
519
+              let groups = [],
520
+                roles = [];
521
+              if (data.group) {
522
+                data.group.forEach((element) => {
523
+                  groups.push(element["id"] + "");
524
+                });
525
+              }
526
+              if (data.role) {
527
+                data.role.forEach((element) => {
528
+                  roles.push(element["id"] + "");
529
+                });
530
+              }
531
+              this.validateForm.controls.name.setValue(data.name);
532
+              this.validateForm.controls.account.setValue(data.account);
533
+              this.validateForm.controls.usertype.setValue(data.usertype.value);
534
+              if (data.dept) {
535
+                this.validateForm.controls.dept.setValue(data.dept.id);
536
+              }
537
+              this.validateForm.controls.deptPhone.setValue(data.phone);
538
+              this.validateForm.controls.gender.setValue(data.gender.id + "");
539
+              this.validateForm.controls.userGroup.setValue(
540
+                groups.length ? groups : null
541
+              );
542
+              this.validateForm.controls.role.setValue(
543
+                roles.length ? roles : null
544
+              );
545
+              this.validateForm.controls.gender.setValue(data.gender.id + "");
546
+              this.validateForm.controls.weixin.setValue(data.weixin);
547
+              this.usertypeChange(data.usertype.value);
548
+              if (data.companyDTO) {
549
+                this.validateForm.controls.companyId.setValue(data.companyDTO.id);
550
+              }
551
+            });
492
           });
552
           });
493
       });
553
       });
494
     // ----------------
554
     // ----------------
@@ -603,8 +663,8 @@ export class UsersManagementComponent implements OnInit {
603
   }
663
   }
604
   // 边输边搜节流阀
664
   // 边输边搜节流阀
605
   isLoading = false;
665
   isLoading = false;
606
-  changeInp(deptId, type, e) {
607
-    if (!deptId) {
666
+  changeInp(hosId, type, e) {
667
+    if (!hosId) {
608
       if (type == "search") {
668
       if (type == "search") {
609
         this.alldepart1 = [];
669
         this.alldepart1 = [];
610
       } else if (type == "add") {
670
       } else if (type == "add") {
@@ -613,17 +673,30 @@ export class UsersManagementComponent implements OnInit {
613
       return;
673
       return;
614
     }
674
     }
615
     this.isLoading = true;
675
     this.isLoading = true;
616
-    this.changeInpSubject.next([deptId, type, e]);
676
+    this.changeInpSubject.next([hosId, type, e]);
677
+  }
678
+
679
+  changeCompanyInp(hosId, type, e) {
680
+    if (!hosId) {
681
+      if (type == "search") {
682
+
683
+      } else if (type == "add") {
684
+        this.allcompany = [];
685
+      }
686
+      return;
687
+    }
688
+    this.isLoading = true;
689
+    this.changeInpCompanySubject.next([hosId, type, e]);
617
   }
690
   }
618
   // 获取所有科室
691
   // 获取所有科室
619
   snum = 0;
692
   snum = 0;
620
-  getDeparts(deptId, type, dept) {
693
+  getDeparts(hosId, type, dept) {
621
     var that = this;
694
     var that = this;
622
     let data = {
695
     let data = {
623
       department: {
696
       department: {
624
         dept,
697
         dept,
625
         hospital: {
698
         hospital: {
626
-          id: deptId,
699
+          id: hosId,
627
         },
700
         },
628
       },
701
       },
629
       idx: 0,
702
       idx: 0,
@@ -644,4 +717,33 @@ export class UsersManagementComponent implements OnInit {
644
         }
717
         }
645
       });
718
       });
646
   }
719
   }
720
+
721
+  // 获取所有科室
722
+  cnum = 0;
723
+  getCompany(hosId, type, keyword) {
724
+    var that = this;
725
+    let data = {
726
+      company: {
727
+        name: keyword,
728
+        busiType: {key: "company_busi_type", value: "2"},
729
+        hosId,
730
+      },
731
+      idx: 0,
732
+      sum: 20,
733
+    };
734
+    this.cnum++;
735
+    that.mainService
736
+      .getFetchDataList("simple/data", "company", data)
737
+      .subscribe((data) => {
738
+        this.cnum--;
739
+        if (type == "search") {
740
+
741
+        } else if (type == "add") {
742
+          that.allcompany = data.list;
743
+        }
744
+        if (this.cnum === 0) {
745
+          that.isLoading = false;
746
+        }
747
+      });
748
+  }
647
 }
749
 }