From a6a0a9f7fb70dea8fcdc6104666e6198d1e54893 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Tue, 4 Jan 2022 17:18:05 +0800 Subject: [PATCH] edit --- .../edit/edit.component.spec.ts | 23 ---------- .../staff-management.component.ts | 11 +++-- .../staff-modal/staff-modal.component.html | 18 +------- .../staff-modal/staff-modal.component.ts | 28 +++++------- .../staff-modal/staff-modal.less | 25 ----------- .../transpower/transpower.component.html | 25 +++++------ .../transpower/transpower.component.ts | 43 +++++++++---------- .../transpower/transpower.less | 41 ------------------ .../sys-setting/services/system.service.ts | 5 +++ .../services/business/captcha.service.ts | 15 +++---- 10 files changed, 59 insertions(+), 175 deletions(-) delete mode 100644 src/app/routes/sys-setting/components/role-management/edit/edit.component.spec.ts delete mode 100644 src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.less delete mode 100644 src/app/routes/sys-setting/components/staff-management/transpower/transpower.less diff --git a/src/app/routes/sys-setting/components/role-management/edit/edit.component.spec.ts b/src/app/routes/sys-setting/components/role-management/edit/edit.component.spec.ts deleted file mode 100644 index 0690cbe6..00000000 --- a/src/app/routes/sys-setting/components/role-management/edit/edit.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [CucRoleEditComponent], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CucRoleEditComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts b/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts index 846d6e7b..4142d33c 100644 --- a/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts +++ b/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts @@ -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(); + } }); } diff --git a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.html b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.html index 1d16b237..87d7b3b2 100644 --- a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.html +++ b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.html @@ -2,23 +2,9 @@
- - - - -
- -
- -
{{ i.phone }}
-
-
-
-
-
-
+
+ \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts index 3ecab520..1fb167e4 100644 --- a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts +++ b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts @@ -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, diff --git a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.less b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.less deleted file mode 100644 index 79ab5bb0..00000000 --- a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.less +++ /dev/null @@ -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; - } - } -} diff --git a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.html b/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.html index 767478a2..47c06860 100644 --- a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.html +++ b/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.html @@ -1,22 +1,17 @@ - -
- 张三(13411223344) + + {{i.name}}({{i.telephone}})
为了账户安全,需超管手机验证({{ superPhone }})
-
-
-
- -
-
- -
+
+
+ +
+
+
diff --git a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.ts b/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.ts index 7b9106d4..ff704a04 100644 --- a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.ts +++ b/src/app/routes/sys-setting/components/staff-management/transpower/transpower.component.ts @@ -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); } }); } diff --git a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.less b/src/app/routes/sys-setting/components/staff-management/transpower/transpower.less deleted file mode 100644 index 665d6a15..00000000 --- a/src/app/routes/sys-setting/components/staff-management/transpower/transpower.less +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/src/app/routes/sys-setting/services/system.service.ts b/src/app/routes/sys-setting/services/system.service.ts index 26d49caf..32d1f4fa 100644 --- a/src/app/routes/sys-setting/services/system.service.ts +++ b/src/app/routes/sys-setting/services/system.service.ts @@ -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'; diff --git a/src/app/shared/services/business/captcha.service.ts b/src/app/shared/services/business/captcha.service.ts index 73cfad31..43621559 100644 --- a/src/app/shared/services/business/captcha.service.ts +++ b/src/app/shared/services/business/captcha.service.ts @@ -10,7 +10,7 @@ import { Observable, Subject } from 'rxjs'; import { BaseService } from '../core/base.service'; @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class EACaptchaService extends BaseService { // 通过手机号发送短信验证码 @@ -26,7 +26,7 @@ export class EACaptchaService extends BaseService { $api_captcha_sms_code = `/scce/pbc/pbc/verification/getSMVerificationCodeByToken`; // 获取应用租户的管理员用户发送验证码 - $api_getAppLesseeAdminSMVerificationCode = `/chiauserBasicInfo/getAppLesseeAdminSMVerificationCode`; + $api_getAppLesseeAdminSMVerificationCode = `/api/mdc/cuc/userAuthority/adminSmverificationCode?_allow_badcode=true`; /** * 根据当前登录用户绑定的手机号码获取短信验证码 @@ -34,12 +34,7 @@ export class EACaptchaService extends BaseService { getCaptchaBySMSNoPhone(): Observable { return this.request(this.$api_captcha_sms_code, { appId: this.envSrv.getEnvironment().appId }, 'POST', true, 'FORM'); } - /** - * 获取应用租户的管理员用户发送验证码 - */ - getAppLesseeAdminSMVerificationCode(): Observable { - return this.request(this.$api_getAppLesseeAdminSMVerificationCode, { appId: this.envSrv.getEnvironment().appId }, 'POST', true, 'FORM'); - } + constructor(public injector: Injector) { super(injector); } @@ -54,7 +49,7 @@ export class EACaptchaService extends BaseService { { appId: this.envSrv.getEnvironment()?.appId, phoneNumber: mobile }, 'POST', true, - 'FORM', + 'FORM' ); } @@ -70,7 +65,7 @@ export class EACaptchaService extends BaseService { { appId: this.envSrv.getEnvironment()?.appId, phoneNumber: mobile, user: mobile, validate }, 'POST', true, - 'FORM', + 'FORM' ); } }