edit
This commit is contained in:
		| @ -1,23 +0,0 @@ | ||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||||
| import { CucRoleEditComponent } from './edit.component'; | ||||
|  | ||||
| describe('CucRoleEditComponent', () => { | ||||
|   let component: CucRoleEditComponent; | ||||
|   let fixture: ComponentFixture<CucRoleEditComponent>; | ||||
|  | ||||
|   beforeEach(async(() => { | ||||
|     TestBed.configureTestingModule({ | ||||
|       declarations: [CucRoleEditComponent], | ||||
|     }).compileComponents(); | ||||
|   })); | ||||
|  | ||||
|   beforeEach(() => { | ||||
|     fixture = TestBed.createComponent(CucRoleEditComponent); | ||||
|     component = fixture.componentInstance; | ||||
|     fixture.detectChanges(); | ||||
|   }); | ||||
|  | ||||
|   it('should create', () => { | ||||
|     expect(component).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
| @ -61,17 +61,17 @@ export class StaffManagementComponent implements OnInit { | ||||
|         }, | ||||
|         { | ||||
|           text: '冻结', | ||||
|           iif: item => item.stateLocked === 0, | ||||
|           iif: item => item.stateLocked === 0 && item.roleCode.split(',').indexOf('Administrator') === -1, | ||||
|           click: item => this.action(item, 1) | ||||
|         }, | ||||
|         { | ||||
|           text: '超管转授', | ||||
|           iif: item => item.status === 0, | ||||
|           iif: item => item.stateLocked === 0 && item.roleCode.split(',').indexOf('Administrator') === -1, | ||||
|           click: item => this.transpowerAction(item) | ||||
|         }, | ||||
|         { | ||||
|           text: '删除', | ||||
|           iif: item => item.stateLocked === 0, | ||||
|           iif: item => item.stateLocked === 0 && item.roleCode.split(',').indexOf('Administrator') === -1, | ||||
|           click: item => this.action(item, 3) | ||||
|         } | ||||
|       ] | ||||
| @ -124,12 +124,15 @@ export class StaffManagementComponent implements OnInit { | ||||
|  | ||||
|   transpowerAction(item: any) { | ||||
|     const modal = this.nzModalService.create({ | ||||
|       nzTitle: '超级管理员转授', | ||||
|       nzContent: BuyerTranspowerComponent, | ||||
|       nzComponentParams: { i: { ...item } }, | ||||
|       nzFooter: null | ||||
|     }); | ||||
|     modal.afterClose.subscribe(res => { | ||||
|       this.st.load(); | ||||
|       if (res) { | ||||
|         this.st.load(); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|  | ||||
| @ -2,23 +2,9 @@ | ||||
|   <div class="modal-title">{{ i.id === 0 ? '添加员工' : '编辑员工' }}</div> | ||||
| </div> | ||||
| <div> | ||||
|   <sf #sf [ui]="ui" [schema]="schema" [button]="'none'"> | ||||
|     <ng-template sf-template="account" let-me let-ui="ui" let-schema="schema"> | ||||
|       <sv-container labelWidth="1"> | ||||
|         <sv label=""> | ||||
|           <div class="staffBox"> | ||||
|             <!-- <img [src]="i.avatar" alt="" /> --> | ||||
|             <dl> | ||||
|               <!-- <dt>{{ i.name }}</dt> --> | ||||
|               <dd>{{ i.phone }}</dd> | ||||
|             </dl> | ||||
|           </div> | ||||
|         </sv> | ||||
|       </sv-container> | ||||
|     </ng-template> | ||||
|   </sf> | ||||
|   <sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf> | ||||
| </div> | ||||
| <div class="modal-footer"> | ||||
|   <button nz-button type="button" (click)="close()">取消</button> | ||||
|   <button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf.valid">保存</button> | ||||
| </div> | ||||
| </div> | ||||
| @ -8,8 +8,7 @@ import { SystemService } from '../../../services/system.service'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-system-add', | ||||
|   templateUrl: './staff-modal.component.html', | ||||
|   styleUrls: ['./staff-modal.less'] | ||||
|   templateUrl: './staff-modal.component.html' | ||||
| }) | ||||
| export class SystemStaffStaffModalComponent implements OnInit { | ||||
|   @ViewChild('sf', { static: false }) | ||||
| @ -17,20 +16,12 @@ export class SystemStaffStaffModalComponent implements OnInit { | ||||
|   i: any; | ||||
|   schema!: SFSchema; | ||||
|   ui!: SFUISchema; | ||||
|   roleList = []; | ||||
|   roleNames: any = []; | ||||
|   constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public service: SystemService) {} | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|     if (this.i?.userId !== 0) { | ||||
|       // this.i.roleIds = this.i.roleId !== '' ? this.i.roleId.split(',') : []; | ||||
|     } | ||||
|  | ||||
|     this.initSF(this.i); | ||||
|   } | ||||
|   initSF(staff: any) { | ||||
|     console.log(staff); | ||||
|      | ||||
|     this.schema = { | ||||
|       properties: { | ||||
|         staffName: { | ||||
| @ -59,10 +50,11 @@ export class SystemStaffStaffModalComponent implements OnInit { | ||||
|             asyncData: () => { | ||||
|               return this.service.request(this.service.$api_getAppRoleList).pipe( | ||||
|                 map((res: any) => { | ||||
|                   this.roleList = res; | ||||
|                   return res.map((item: any) => { | ||||
|                     return { label: item.roleName, value: item.id }; | ||||
|                   }); | ||||
|                   return res | ||||
|                     .filter((role: any) => role.roleCode !== 'Administrator') | ||||
|                     .map((item: any) => { | ||||
|                       return { label: item.roleName, value: item.id }; | ||||
|                     }); | ||||
|                 }) | ||||
|               ); | ||||
|             } | ||||
| @ -81,10 +73,10 @@ export class SystemStaffStaffModalComponent implements OnInit { | ||||
|   } | ||||
|  | ||||
|   sure() { | ||||
|     // if (!this.sf.value.roleIds || this.sf.value.roleIds.length === 0) { | ||||
|     //   this.service.msgSrv.error('员工角色不能为空!'); | ||||
|     //   return; | ||||
|     // } | ||||
|     if (!this.sf.value.roleId || this.sf.value.roleId.length === 0) { | ||||
|       this.service.msgSrv.error('员工角色不能为空!'); | ||||
|       return; | ||||
|     } | ||||
|     if (this.i.userId === 0) { | ||||
|       const params: any = { | ||||
|         ...this.sf.value, | ||||
|  | ||||
| @ -1,25 +0,0 @@ | ||||
| .info { | ||||
|   width: 100%; | ||||
|   margin: 0 auto 10px auto; | ||||
|   color: #333; | ||||
|   text-indent: 24px; | ||||
| } | ||||
| .staffBox { | ||||
|   display: flex; | ||||
|   img { | ||||
|     width: 30px; | ||||
|     height: 30px; | ||||
|     overflow: hidden; | ||||
|     border-radius: 50px; | ||||
|   } | ||||
|   dl { | ||||
|     margin: 0 0 0 5px; | ||||
|     dt { | ||||
|       font-size: 14px; | ||||
|       line-height: 28px; | ||||
|     } | ||||
|     dd { | ||||
|       font-size: 12px; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,22 +1,17 @@ | ||||
| <div class="modal-header"> | ||||
|   <div class="modal-title">超级管理员转授</div> | ||||
| </div> | ||||
| <form nz-form #f="ngForm" se-container="1"> | ||||
|   <se label="转授员工">张三(13411223344)</se> | ||||
| <form nz-form #f="ngForm" se-container="1" labelWidth="100"> | ||||
|   <se label="转授对象">{{i.name}}({{i.telephone}})</se> | ||||
|   <se style="margin:0"> | ||||
|     <div class="code">为了账户安全,需超管手机验证({{ superPhone }})</div> | ||||
|   </se> | ||||
|   <se label="验证码"> | ||||
|     <div class="inputBox"> | ||||
|       <div nz-row [nzGutter]="8"> | ||||
|         <div nz-col [nzSpan]="12"> | ||||
|           <input nz-input name="smsVerifyCode" [(ngModel)]="smsVerifyCode" maxlength="6" placeholder="请输入短信验证码" /> | ||||
|         </div> | ||||
|         <div nz-col [nzSpan]="12"> | ||||
|           <button nz-button (click)="sendCode()" [disabled]="count > 0"> | ||||
|             {{ count > 0 ? '请等待' + count + 's' : '发送验证码' }} | ||||
|           </button> | ||||
|         </div> | ||||
|     <div nz-row [nzGutter]="8"> | ||||
|       <div nz-col [nzSpan]="12"> | ||||
|         <input nz-input name="smsVerifyCode" [(ngModel)]="smsVerifyCode" maxlength="6" placeholder="请输入短信验证码" /> | ||||
|       </div> | ||||
|       <div nz-col [nzSpan]="12"> | ||||
|         <button nz-button (click)="sendCode()" [disabled]="count > 0"> | ||||
|           {{ count > 0 ? '请等待' + count + 's' : '发送验证码' }} | ||||
|         </button> | ||||
|       </div> | ||||
|     </div> | ||||
|   </se> | ||||
|  | ||||
| @ -4,24 +4,21 @@ import { interval } from 'rxjs'; | ||||
| import { take } from 'rxjs/operators'; | ||||
| import { DunHelper } from 'src/app/shared/components/captcha/dun.helper'; | ||||
| import { EACaptchaService } from 'src/app/shared/services/business/captcha.service'; | ||||
| import { SystemService } from '../../../services/system.service'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-buyer-transpower', | ||||
|   templateUrl: './transpower.component.html', | ||||
|   styleUrls: ['./transpower.less'] | ||||
|   templateUrl: './transpower.component.html' | ||||
| }) | ||||
| export class BuyerTranspowerComponent implements OnInit { | ||||
|   record: any = {}; | ||||
|   count = 0; | ||||
|   interval$: any; | ||||
|   i: any; | ||||
|   smsVerifyCode = ''; | ||||
|   superPhone = ''; | ||||
|   staffId = 1; | ||||
|   staffList: any = []; | ||||
|   constructor( | ||||
|     private modal: NzModalRef, | ||||
|     public captchaService: EACaptchaService, | ||||
|     public service: SystemService, | ||||
|     public eACaptchaService: EACaptchaService, | ||||
|     private dunHelper: DunHelper, | ||||
|     private cdr: ChangeDetectorRef | ||||
|   ) {} | ||||
| @ -30,24 +27,24 @@ export class BuyerTranspowerComponent implements OnInit { | ||||
|     this.getPhone(); | ||||
|   } | ||||
|   getPhone() { | ||||
|     // this.service.request(this.service.$api_getAppLesseeAdmin).subscribe((res) => { | ||||
|     //   console.log(res); | ||||
|     //   if (res) { | ||||
|     //     this.superPhone = res.telephone; | ||||
|     //   } | ||||
|     // }); | ||||
|     this.service.request(this.service.$api_get_app_admin_info).subscribe(res => { | ||||
|       if (res) { | ||||
|         this.superPhone = res.telephone; | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   sure() { | ||||
|     const params = { | ||||
|       appUserId: this.i.appUserId, | ||||
|       smsVerifyCode: this.smsVerifyCode | ||||
|       smsVerifyCode: this.smsVerifyCode, | ||||
|       telephone: this.i.telephone | ||||
|     }; | ||||
|     // this.service.request(this.service.$api_shiftResellerAdmin, params).subscribe((res) => { | ||||
|     //   if (res) { | ||||
|     //     this.service.msgSrv.success('操作成功!'); | ||||
|     //     this.modal.close(true); | ||||
|     //   } | ||||
|     // }); | ||||
|     this.service.request(this.service.$api_set_shift_admin, params).subscribe(res => { | ||||
|       if (res) { | ||||
|         this.service.msgSrv.success('操作成功!'); | ||||
|         this.modal.close(true); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   close() { | ||||
|     this.modal.destroy(); | ||||
| @ -56,9 +53,9 @@ export class BuyerTranspowerComponent implements OnInit { | ||||
|    * 获取手机验证码 | ||||
|    */ | ||||
|   sendCode() { | ||||
|     this.captchaService.getAppLesseeAdminSMVerificationCode().subscribe(res => { | ||||
|     this.eACaptchaService.request(this.eACaptchaService.$api_getAppLesseeAdminSMVerificationCode).subscribe(res => { | ||||
|       if (res.success && res.data.code === '1') { | ||||
|         this.captchaService.msgSrv.success('发送验证码成功'); | ||||
|         this.eACaptchaService.msgSrv.success('发送验证码成功'); | ||||
|         this.createInterval(); | ||||
|       } else if (res.data.code === '503046') { | ||||
|         this.dunHelper.popUp().subscribe(_ => { | ||||
| @ -66,7 +63,7 @@ export class BuyerTranspowerComponent implements OnInit { | ||||
|           this.dunHelper.destory(); | ||||
|         }); | ||||
|       } else { | ||||
|         this.captchaService.msgSrv.warning(res.msg); | ||||
|         this.eACaptchaService.msgSrv.warning(res.msg); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
| @ -1,41 +0,0 @@ | ||||
| .info { | ||||
|   width      : 90%; | ||||
|   margin     : 0 auto; | ||||
|   color      : #333; | ||||
|   text-indent: 24px; | ||||
| } | ||||
|  | ||||
| .staffBox { | ||||
|   display    : flex; | ||||
|   align-items: center; | ||||
|  | ||||
|   img { | ||||
|     width        : 30px; | ||||
|     height       : 30px; | ||||
|     overflow     : hidden; | ||||
|     border-radius: 50px; | ||||
|   } | ||||
|  | ||||
|   dl { | ||||
|     margin: 0 0 0 5px; | ||||
|  | ||||
|     dt { | ||||
|       font-size  : 14px; | ||||
|       line-height: 28px; | ||||
|     } | ||||
|  | ||||
|     dd { | ||||
|       font-size: 12px; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| .inputBox { | ||||
|   position: relative; | ||||
|  | ||||
|   a { | ||||
|     position: absolute; | ||||
|     top     : 0; | ||||
|     right   : 5px; | ||||
|   } | ||||
| } | ||||
| @ -23,6 +23,11 @@ export class SystemService extends BaseService { | ||||
|   $api_delete_staff = '/api/mdc/cuc/userApp/deleteAppUser'; | ||||
|   // 冻结或恢复员工 | ||||
|   $api_free_or_resume_staff = '/api/mdc/cuc/userApp/freezeOrResumeStaff'; | ||||
|   // 获取应用企业的管理员用户 | ||||
|   $api_get_app_admin_info = `/api/mdc/cuc/userApp/getAppEnterpriseAdmin`; | ||||
|   // 运营管理后台转授超管角色 | ||||
|   $api_set_shift_admin = `/api/mdc/cuc/userAuthority/shiftAdmin`; | ||||
|  | ||||
|  | ||||
|   // 分页获取应用角色列表 | ||||
|   $api_get_role_page = '/api/mdc/cuc/roleInfo/getAppRoleInfoList'; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user