This commit is contained in:
wangshiming
2022-04-25 14:48:09 +08:00
parent b6d76dad82
commit 81bfaea6f5
3 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,13 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-04-21 13:49:22
* @LastEditors : Shiming
* @LastEditTime : 2022-04-25 14:32:43
* @FilePath : \\tms-obc-web\\src\\app\\routes\\sys-setting\\components\\role-management\\edit\\edit.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<div class="modal-header">
<div class="modal-title">{{ params.id === 0 ? '新增角色' : '编辑角色' }}</div>
</div>
@ -11,7 +21,7 @@
<se label="角色权限" required [labelWidth]="120">
<app-cuc-menu #menu (changeData)="getData($event)" [type]="params.id === 0 ? 'add' : 'edit'" [roleId]="params.id" [appId]="params.appId"
[isAuthorityIdDTOList]="roleInfoData.authority || []"
[authorityAssistId]="roleInfoData.authorityAssistId || []">
[authorityAssistId]="roleInfoData.authorityAssistId || []" (changeIF)="changeIF($event)">
</app-cuc-menu>
</se>
</se-container>

View File

@ -21,6 +21,7 @@ export class SettingRoleEditComponent implements OnInit {
roleInfoData: any = {};
authorityAssistId: any[] = [];
params: any;
changeValue: boolean = false
schema!: SFSchema;
authority: any[] = [];
constructor(private modal: NzModalRef, public service: SystemService) {}
@ -81,11 +82,18 @@ console.log(this.params.infoUrl)
close() {
this.modal.destroy();
}
changeIF(value: boolean) {
console.log(value);
console.log('54545');
this.changeValue = true
}
sure() {
if (!this.sf?.valid) {
this.service.msgSrv.warning('角色名称不能为空');
return;
}
console.log(this.changeValue);
const auths = this.menu?.washTree();
if (auths.authorityAssistId.length === 0) {
this.service.msgSrv.warning('请选择权限!');
@ -97,6 +105,10 @@ console.log(this.params.infoUrl)
authority: auths.authority,
authorityAssistId: auths.authorityAssistId
};
if(this.changeValue) {
params.isUpdateAuthority = 1
}
if (this.params.id === 0) {
delete params.id;
}

View File

@ -26,6 +26,7 @@ export class SettingMenuComponent implements OnInit, OnChanges {
@Input() isAuthorityIdDTOList: any[] = [];
@Input() authorityAssistId: any[] = [];
@Input() roleId: any;
@Output() changeIF= new EventEmitter();
@Output() changeData = new EventEmitter();
constructor(public service: SystemService, private cdr: ChangeDetectorRef, private envSrv: EAEnvironmentService) {}
ngOnChanges(changes: SimpleChanges): void {
@ -67,6 +68,7 @@ export class SettingMenuComponent implements OnInit, OnChanges {
if (menuItem.authorityId === origin.id) {
menuItem.buttonAuthorityIds = menuItem.buttonAuthorityIds || []; // 防止属性不存在,给属性指定数据类型
if (item) {
this.changeIF.emit(true);
// 单选
if (item.checked) {
if (menuItem.buttonAuthorityIds.indexOf(item.functionButtonId) === -1) {