@ -1,8 +1,8 @@
 
			
		
	
		
		
			
				
					
					import  {  ChangeDetectorRef ,  Component ,  EventEmitter ,  Input ,  OnChanges ,  OnInit ,  Output ,  SimpleChanges ,  ViewChild  }  from  '@angular/core' ; import  {  ChangeDetectorRef ,  Component ,  EventEmitter ,  Input ,  OnChanges ,  OnInit ,  Output ,  SimpleChanges ,  ViewChild  }  from  '@angular/core' ;  
			
		
	
		
		
			
				
					
					import  {  EAEnvironmentService  }  from  '@shared' ; import  {  EAEnvironmentService  }  from  '@shared' ;  
			
		
	
		
		
			
				
					
					import  {  NzTreeComponent   }  from  'ng-zorro-antd/tree' ; import  {  NzFormatEmitEvent ,  NzTreeComponent ,  NzTreeNode   }  from  'ng-zorro-antd/tree' ;  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					import  {  SystemService  }  from  '../../../services/system.service' ; import  {  SystemService  }  from  '../../../services/system.service' ;  
			
		
	
		
		
			
				
					
					// TODO 父节点修改  更新子节点权限点  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					@Component ( { @Component ( {  
			
		
	
		
		
			
				
					
					  selector :  'app-menu-tree' , 
  selector :  'app-menu-tree' , 
 
			
		
	
		
		
			
				
					
					  templateUrl :  './menu-tree.component.html' , 
  templateUrl :  './menu-tree.component.html' , 
 
			
		
	
	
		
		
			
				
					
					
						
					 
					@ -11,14 +11,9 @@ import { SystemService } from '../../../services/system.service';
 
			
		
	
		
		
			
				
					
					export  class  MenuTreeComponent  implements  OnInit ,  OnChanges  { export  class  MenuTreeComponent  implements  OnInit ,  OnChanges  {  
			
		
	
		
		
			
				
					
					  @ViewChild ( 'nzTreeComponent' ,  {  static :  false  } )  nzTreeComponent ! :  NzTreeComponent ; 
  @ViewChild ( 'nzTreeComponent' ,  {  static :  false  } )  nzTreeComponent ! :  NzTreeComponent ; 
 
			
		
	
		
		
			
				
					
					  origin : any  =  {  buttonInfoList :  [ ] ,  dictList :  [ ]  } ; 
  origin : any  =  {  buttonInfoList :  [ ] ,  dictList :  [ ]  } ; 
 
			
		
	
		
		
			
				
					
					  node : any  =  { }  ; 
  node ! :  NzTreeNode ; 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					  authority : any [ ]  =  [ ] ; 
  authority : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  defaultSelectedKeys : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  defaultExpandedKeys : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  defaultCheckedKeys : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  functionList : any [ ]  =  [ ] ; 
  functionList : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  allChecked  =  false ; 
 
			
		
	
		
		
			
				
					
					  indeterminate  =  true ; 
 
			
		
	
		
		
			
				
					
					  @Input ( )  type  =  'edit' ; 
  @Input ( )  type  =  'edit' ; 
 
			
		
	
		
		
			
				
					
					  @Input ( )  source  =  '' ; 
  @Input ( )  source  =  '' ; 
 
			
		
	
		
		
			
				
					
					  @Input ( )  appId  =  this . envSrv . env . appId ; 
  @Input ( )  appId  =  this . envSrv . env . appId ; 
 
			
		
	
	
		
		
			
				
					
					
						
					 
					@ -26,11 +21,20 @@ export class MenuTreeComponent implements OnInit, OnChanges {
 
			
		
	
		
		
			
				
					
					  @Input ( )  authorityAssistId : any [ ]  =  [ ] ; 
  @Input ( )  authorityAssistId : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					  @Input ( )  roleId : any ; 
  @Input ( )  roleId : any ; 
 
			
		
	
		
		
			
				
					
					  @Output ( )  changeData  =  new  EventEmitter < any > ( ) ; 
  @Output ( )  changeData  =  new  EventEmitter < any > ( ) ; 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  _apiAuthSet  =  new  Set < string > ( ) ; 
 
			
		
	
		
		
			
				
					
					  _NodeAuthMap  =  new  Map < string ,  {  authorityId :  string ;  buttonAuthorityIds :  string [ ] ;  isUpdateAuthority :  0  |  1  } > ( ) ; 
 
			
		
	
		
		
			
				
					
					  constructor ( public  service : SystemService ,  private  cdr : ChangeDetectorRef ,  private  envSrv : EAEnvironmentService )  { } 
  constructor ( public  service : SystemService ,  private  cdr : ChangeDetectorRef ,  private  envSrv : EAEnvironmentService )  { } 
 
			
		
	
		
		
			
				
					
					  ngOnChanges ( changes : SimpleChanges ) :  void  { 
  ngOnChanges ( changes : SimpleChanges ) :  void  { 
 
			
		
	
		
		
			
				
					
					    if  ( changes . isAuthorityIdDTOList )  { 
    if  ( changes . isAuthorityIdDTOList )  { 
 
			
		
	
		
		
			
				
					
					      if  ( this . type  ===  'edit' )  { 
      if  ( this . type  ===  'edit' )  { 
 
			
		
	
		
		
			
				
					
					        this . authority  =  this . isAuthorityIdDTOList  ||  [ ] ; 
        this . authority  =  this . isAuthorityIdDTOList  ||  [ ] ; 
 
			
		
	
		
		
			
				
					
					        this . authority . forEach ( auth  = >  { 
 
			
		
	
		
		
			
				
					
					          this . _NodeAuthMap . set ( auth . authorityId ,  auth ) ; 
 
			
		
	
		
		
			
				
					
					          if  ( auth . buttonAuthorityIds )  { 
 
			
		
	
		
		
			
				
					
					            auth . buttonAuthorityIds . forEach ( ( buttonId : string )  = >  this . _apiAuthSet . add ( buttonId ) ) ; 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					      } 
      } 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
	
		
		
			
				
					
					
						
					 
					@ -38,376 +42,209 @@ export class MenuTreeComponent implements OnInit, OnChanges {
 
			
		
	
		
		
			
				
					
					  ngOnInit() { 
  ngOnInit() { 
 
			
		
	
		
		
			
				
					
					    this . getAllFunction ( ) ; 
    this . getAllFunction ( ) ; 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  getAllFunction() { 
  getAllFunction() { 
 
			
		
	
		
		
			
				
					
					    this . service 
    this . service 
 
			
		
	
		
		
			
				
					
					      . request ( this . service . $api_getAllFunctionInfoByAppId ,  {  appId : this.appId  ||  this . envSrv . env . appId  } ,  'POST' ,  true ,  'FORM' ) 
      . request ( this . service . $api_getAllFunctionInfoByAppId ,  {  appId : this.appId  ||  this . envSrv . env . appId  } ,  'POST' ,  true ,  'FORM' ) 
 
			
		
	
		
		
			
				
					
					      . subscribe ( res  = >  { 
      . subscribe ( res  = >  { 
 
			
		
	
		
		
			
				
					
					        this . functionList  =  res ; 
        this . functionList  =  res ; 
 
			
		
	
		
		
			
				
					
					        // 重赋值选中权限 
 
			
		
	
		
		
			
				
					
					this . authorityAssistId  =  [ . . . this . authorityAssistId ] ; this . authorityAssistId  =  [ . . . this . authorityAssistId ] ;  
			
		
	
		
		
			
				
					
					        this . cdr . detectChanges ( ) ; 
        this . cdr . detectChanges ( ) ; 
 
			
		
	
		
		
			
				
					
					      } ) ; 
      } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  addAuthority ( origin :  {  id : any ;  all : any  } ,  node :  {  buttonInfoList : any [ ]  } ,  item ? :  {  checked : any ;  functionButtonId : any  } )  { 
  addAuthority ( 
 
			
				
				
			
		
	
		
		
			
				
					
					    console . log ( origin ,  node ) ; 
    status : boolean , 
 
			
				
				
			
		
	
		
		
			
				
					
					    origin :  {  buttonInfoList : any [ ] ;  [ key : string ] :  any  } , 
 
			
				
				
			
		
	
		
		
			
				
					
					    if  ( this . authority ? . length  &&  this . authority . filter ( authItem  = >  authItem . authorityId  ===  origin . id ) . length )  { 
    node : NzTreeNode , 
 
			
				
				
			
		
	
		
		
			
				
					
					      // 判断此菜单权限是否已经存在权限列表中  
    item :  {  checked : any ;  functionButtonId : string  } 
 
			
				
				
			
		
	
		
		
			
				
					
					// 当前操作菜单id存在权限列表里  
			
		
	
		
		
			
				
					
					this . authority . forEach ( menuItem  = >  {  
			
		
	
		
		
			
				
					
					        console . log ( menuItem ) ; 
 
			
		
	
		
		
			
				
					
					        console . log ( item ) ; 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					        if  ( menuItem . authorityId  ===  origin . id )  { 
 
			
		
	
		
		
			
				
					
					          menuItem . buttonAuthorityIds  =  menuItem . buttonAuthorityIds  ||  [ ] ;  // 防止属性不存在,给属性指定数据类型 
 
			
		
	
		
		
			
				
					
					if  ( item )  {  
			
		
	
		
		
			
				
					
					            // 单选 
 
			
		
	
		
		
			
				
					
					if  ( item . checked )  {  
			
		
	
		
		
			
				
					
					              if  ( menuItem . buttonAuthorityIds . indexOf ( item . functionButtonId )  ===  - 1 )  { 
 
			
		
	
		
		
			
				
					
					                // 如果该按钮在数据权限数组中不存在 
 
			
		
	
		
		
			
				
					
					menuItem . buttonAuthorityIds . push ( item . functionButtonId ) ;  
			
		
	
		
		
			
				
					
					              } 
 
			
		
	
		
		
			
				
					
					            }  else  { 
 
			
		
	
		
		
			
				
					
					              if  ( menuItem . buttonAuthorityIds  &&  menuItem . buttonAuthorityIds . length )  { 
 
			
		
	
		
		
			
				
					
					                menuItem . buttonAuthorityIds . forEach ( ( btnItem : any ,  index : any )  = >  { 
 
			
		
	
		
		
			
				
					
					                  if  ( btnItem  ===  item . functionButtonId )  { 
 
			
		
	
		
		
			
				
					
					                    menuItem . buttonAuthorityIds . splice ( index ,  1 ) ; 
 
			
		
	
		
		
			
				
					
					                  } 
 
			
		
	
		
		
			
				
					
					                } ) ; 
 
			
		
	
		
		
			
				
					
					              } 
 
			
		
	
		
		
			
				
					
					            } 
 
			
		
	
		
		
			
				
					
					          }  else  { 
 
			
		
	
		
		
			
				
					
					            // 全选 
 
			
		
	
		
		
			
				
					
					if  ( origin . all )  {  
			
		
	
		
		
			
				
					
					              node . buttonInfoList . forEach ( ( nodeItem :  {  id : any ;  checked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					                if  ( menuItem . buttonAuthorityIds . indexOf ( nodeItem . id )  ===  - 1 )  { 
 
			
		
	
		
		
			
				
					
					                  menuItem . buttonAuthorityIds . push ( nodeItem . id ) ; 
 
			
		
	
		
		
			
				
					
					                  nodeItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					                } 
 
			
		
	
		
		
			
				
					
					              } ) ; 
 
			
		
	
		
		
			
				
					
					            }  else  { 
 
			
		
	
		
		
			
				
					
					              if  ( menuItem . buttonAuthorityIds  &&  menuItem . buttonAuthorityIds . length )  { 
 
			
		
	
		
		
			
				
					
					                menuItem . buttonAuthorityIds  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					                node . buttonInfoList . forEach ( ( nodeItem :  {  checked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					                  nodeItem . checked  =  false ; 
 
			
		
	
		
		
			
				
					
					                } ) ; 
 
			
		
	
		
		
			
				
					
					              } 
 
			
		
	
		
		
			
				
					
					            } 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      } ) ; 
 
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      // 数组为空的时候 
 
			
		
	
		
		
			
				
					
					const  buttonAuthorityIds  =  [ ] ;  
			
		
	
		
		
			
				
					
					      if  ( item )  { 
 
			
		
	
		
		
			
				
					
					        // 全选 
 
			
		
	
		
		
			
				
					
					buttonAuthorityIds . push ( item . functionButtonId ) ;  
			
		
	
		
		
			
				
					
					      }  else  { 
 
			
		
	
		
		
			
				
					
					        node . buttonInfoList . forEach ( ( nodeItem :  {  id : any ;  checked : boolean ;  _isHalfChecked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					          if  ( origin . all )  { 
 
			
		
	
		
		
			
				
					
					            buttonAuthorityIds . push ( nodeItem . id ) ; 
 
			
		
	
		
		
			
				
					
					            nodeItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					      const  obj : any  =  { 
 
			
		
	
		
		
			
				
					
					        authorityId : origin.id , 
 
			
		
	
		
		
			
				
					
					        buttonAuthorityIds 
 
			
		
	
		
		
			
				
					
					      } ; 
 
			
		
	
		
		
			
				
					
					      this . authority . push ( obj ) ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					    this . checkTreeNode ( node ,  origin ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  addDict ( item :  {  checked : any ;  itemId : any ;  itemKey : any  } ,  dictItem :  {  dictId : any  } ,  origin :  {  id : any  } ,  node : any )  { 
 
			
		
	
		
		
			
				
					
					    if  ( this . authority . length )  { 
 
			
		
	
		
		
			
				
					
					      // 判断此菜单权限是否已经存在权限列表中 
 
			
		
	
		
		
			
				
					
					if  ( this . authority . filter ( authItem  = >  authItem . authorityId  ===  origin . id ) . length )  {  
			
		
	
		
		
			
				
					
					        // 当前操作菜单id存在权限列表里 
 
			
		
	
		
		
			
				
					
					this . authority . forEach ( ( menuItem ,  menuIndex )  = >  {  
			
		
	
		
		
			
				
					
					          if  ( menuItem . authorityId  ===  origin . id )  { 
 
			
		
	
		
		
			
				
					
					            menuItem . dataAuthority  =  menuItem . dataAuthority  ||  [ ] ;  // 防止属性不存在,给属性指定数据类型 
 
			
		
	
		
		
			
				
					
					if  ( item . checked )  {  
			
		
	
		
		
			
				
					
					              if  ( menuItem . dataAuthority . filter ( ( ele :  {  dictItemId : any  } )  = >  ele . dictItemId  ===  item . itemId ) . length  ===  0 )  { 
 
			
		
	
		
		
			
				
					
					                // 如果该按钮在数据权限数组中不存在 
 
			
		
	
		
		
			
				
					
					menuItem . dataAuthority . push ( {  dictItemId : item.itemId ,  itemKey : item.itemKey ,  dictId : dictItem.dictId  } ) ;  
			
		
	
		
		
			
				
					
					              } 
 
			
		
	
		
		
			
				
					
					            }  else  { 
 
			
		
	
		
		
			
				
					
					              if  ( menuItem . dataAuthority  &&  menuItem . dataAuthority . length )  { 
 
			
		
	
		
		
			
				
					
					                menuItem . dataAuthority . forEach ( ( btnItem :  {  dictItemId : any  } ,  index : any )  = >  { 
 
			
		
	
		
		
			
				
					
					                  if  ( btnItem . dictItemId  ===  item . itemId )  { 
 
			
		
	
		
		
			
				
					
					                    menuItem . dataAuthority . splice ( index ,  1 ) ; 
 
			
		
	
		
		
			
				
					
					                  } 
 
			
		
	
		
		
			
				
					
					                } ) ; 
 
			
		
	
		
		
			
				
					
					              } 
 
			
		
	
		
		
			
				
					
					            } 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					      }  else  { 
 
			
		
	
		
		
			
				
					
					        // 当前操作菜单id不存在权限列表里 
 
			
		
	
		
		
			
				
					
					const  dataAuthority  =  [ ] ;  
			
		
	
		
		
			
				
					
					        dataAuthority . push ( {  dictItemId : item.itemId ,  itemKey : item.itemKey ,  dictId : dictItem.dictId  } ) ; 
 
			
		
	
		
		
			
				
					
					        const  obj : any  =  { 
 
			
		
	
		
		
			
				
					
					          authorityId : origin.id , 
 
			
		
	
		
		
			
				
					
					          dataAuthority 
 
			
		
	
		
		
			
				
					
					        } ; 
 
			
		
	
		
		
			
				
					
					        this . authority . push ( obj ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      // 数组为空的时候 
 
			
		
	
		
		
			
				
					
					const  dataAuthority  =  [ ] ;  
			
		
	
		
		
			
				
					
					      dataAuthority . push ( {  dictItemId : item.itemId ,  itemKey : item.itemKey ,  dictId : dictItem.dictId  } ) ; 
 
			
		
	
		
		
			
				
					
					      const  obj : any  =  { 
 
			
		
	
		
		
			
				
					
					        authorityId : origin.id , 
 
			
		
	
		
		
			
				
					
					        dataAuthority 
 
			
		
	
		
		
			
				
					
					      } ; 
 
			
		
	
		
		
			
				
					
					      this . authority . push ( obj ) ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					    this . checkTreeNode ( node ,  origin ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  checkTreeNode ( node : any ,  origin :  {  id : any  } )  { 
 
			
		
	
		
		
			
				
					
					    const  checkedNode : any  =  this . nzTreeComponent . getCheckedNodeList ( ) ; 
 
			
		
	
		
		
			
				
					
					    const  allCheckedArr : any [ ]  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					    this . overTree ( checkedNode ,  allCheckedArr ) ; 
 
			
		
	
		
		
			
				
					
					    this . authority . forEach ( authItem  = >  { 
 
			
		
	
		
		
			
				
					
					      if  ( authItem . authorityId  ===  origin . id )  { 
 
			
		
	
		
		
			
				
					
					        if  ( 
 
			
		
	
		
		
			
				
					
					          ( authItem . buttonAuthorityIds  &&  authItem . buttonAuthorityIds . length )  || 
 
			
		
	
		
		
			
				
					
					          ( authItem . dataAuthority  &&  authItem . dataAuthority . length ) 
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					  )  { 
  )  { 
 
			
		
	
		
		
			
				
					
					          if  ( allCheckedArr . indexOf ( node . key )  ===  - 1 )  {  
    // 更新完整操作权限数据 
 
			
				
				
			
		
	
		
		
			
				
					
					             allCheckedArr . push ( node . key  ) ; if  ( status )  {   
			
				
				
			
		
	
		
		
			
				
					
					          }  
      this . _apiAuthSet . add ( item . functionButtonId ) ; 
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    }  else  { 
    }  else  { 
 
			
		
	
		
		
			
				
					
					          if  ( allCheckedArr . indexOf  ( node . key )  !==  - 1 )  {  
      this . _apiAuthSet . delete ( item . functionButtonId ) ; 
 
			
				
				
			
		
	
		
		
			
				
					
					            allCheckedArr . forEach ( ( ele ,  index )  = >  { 
 
			
		
	
		
		
			
				
					
					              if  ( ele  ===  origin . id )  { 
 
			
		
	
		
		
			
				
					
					                allCheckedArr . splice ( index ,  1 ) ; 
 
			
		
	
		
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					            } )  ; 
    origin . _selected  =  false ; 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					    let  isHasChecked  =  false ; 
 
			
		
	
		
		
			
				
					
					    const  checkedButIds  =  [ ] ;  // 当前操作权限中勾选的权限 
 
			
		
	
		
		
			
				
					
					// 判断当前操作权限列表的全选状态  
			
		
	
		
		
			
				
					
					for  ( let  index  =  0 ;  index  <  origin . buttonInfoList . length ;  index ++ )  {  
			
		
	
		
		
			
				
					
					      const  but  =  origin . buttonInfoList [ index ] ; 
 
			
		
	
		
		
			
				
					
					      if  ( this . _apiAuthSet . has ( but . functionButtonId ) )  { 
 
			
		
	
		
		
			
				
					
					        isHasChecked  =  true ; 
 
			
		
	
		
		
			
				
					
					        checkedButIds . push ( but . functionButtonId ) ; 
 
			
		
	
		
		
			
				
					
					      } 
      } 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					    this . defaultCheckedKeys  =  allCheckedArr ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  overTree ( children : any [ ] ,  a : any [ ] )  { 
    // 更新树节点选中状态  
 
			
				
				
			
		
	
		
		
			
				
					
					    children . forEach ( item  = > { 
if  ( checkedButIds ? . length  >  0 ) {  
			
				
				
			
		
	
		
		
			
				
					
					      a . push ( item . key ) ; 
      origin . checked  =  true ; 
 
			
				
				
			
		
	
		
		
			
				
					
					      if  ( item . isLeaf )  { 
      // TODO 去重 
 
			
				
				
			
		
	
		
		
			
				
					
					        return  ; 
const  auths  =  [ . . . this . authorityAssistId ] ;  
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					      auths . push ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      const  authsSet  =  new  Set < string > ( auths ) ; 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId  =  [ . . . Array . from ( authsSet ) ] ; 
 
			
		
	
		
		
			
				
					
					      // 更新菜单权限数据源 
 
			
		
	
		
		
			
				
					
					this . _NodeAuthMap . set ( origin . id ,  {  authorityId : origin.id ,  buttonAuthorityIds : checkedButIds ,  isUpdateAuthority : 1  } ) ;  
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      origin . checked  =  false ; 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId  =  this . authorityAssistId . filter ( auth  = >  auth  !==  origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . _NodeAuthMap . delete ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . recursionDeleteParantNode ( node ) ; 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					      if  ( item . children  &&  item . children . length )  { 
 
			
		
	
		
		
			
				
					
					        this . overTree ( item . children ,  a ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  addDisabledTree ( arr : any [ ] )  { 
  /** 
 
			
				
				
			
		
	
		
		
			
				
					
					    arr . forEach ( ( item : any )  = >  {     * 点击树节点事件  
			
				
				
			
		
	
		
		
			
				
					
					      item . disableCheckbox  =  true ;  
* @param event  
			
				
				
			
		
	
		
		
			
				
					
					      if  ( item . isLeaf )  {     */  
			
				
				
			
		
	
		
		
			
				
					
					        return ;  
  clickTreeNodeAction ( event : any ) :  void  { 
 
			
				
				
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					      if  ( item . children  &&  item . children . length )  { 
 
			
		
	
		
		
			
				
					
					        this . addDisabledTree ( item . children ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					  addDisabledLeafTree ( arr : any [ ] )  { 
 
			
		
	
		
		
			
				
					
					    arr . forEach ( ( item : any )  = >  { 
 
			
		
	
		
		
			
				
					
					      if  ( item . isLeaf )  { 
 
			
		
	
		
		
			
				
					
					        return ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					      item . disableCheckbox  =  true ; 
 
			
		
	
		
		
			
				
					
					      if  ( item . children  &&  item . children . length )  { 
 
			
		
	
		
		
			
				
					
					        this . addDisabledLeafTree ( item . children ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					  nzEvent ( event : any ) :  void  { 
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    this . origin  =  event . node . origin ; 
    this . origin  =  event . node . origin ; 
 
			
		
	
		
		
			
				
					
					    this . node  =  event . node . origin 
    this . node  =  event . node ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    if  ( ! event . node . origin . isLeaf )  {  
    console . log ( this . node ) ; 
 
			
				
				
			
		
	
		
		
			
				
					
					      event . node . isExpanded  =  ! event . node . isExpanded ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    }  else  { 
    // 叶子节点获取操作权限, 非叶子节点则展开 
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					if  ( event . node . origin . isLeaf )  {  
			
		
	
		
		
			
				
					
					      this . initButtonList ( event . node . key ,  event . node . origin ) ; 
      this . initButtonList ( event . node . key ,  event . node . origin ) ; 
 
			
		
	
		
		
			
				
					
					      // this.initDictList(event.node.key, event.node.origin);  
    }  else  { 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					      event . node . isExpanded  =  ! event . node . isExpanded ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  // 勾选叶子节点菜单时同步处理按钮权限数据 
 
			
		
	
		
		
			
				
					
					changeTreeCheckEvent ( event : NzFormatEmitEvent  |  {  eventName : string ;  node : NzTreeNode ;  keys : string [ ] ;  checkedKeys : NzTreeNode [ ]  } )  {  
			
		
	
		
		
			
				
					
					    // 叶子节点 
 
			
		
	
		
		
			
				
					
					if  ( event . node ? . origin . isLeaf )  {  
			
		
	
		
		
			
				
					
					      // 如果当前操作权限列表为该树节点的,则直接勾选 
 
			
		
	
		
		
			
				
					
					if  ( this . origin . id  ===  event . node ? . origin . id )  {  
			
		
	
		
		
			
				
					
					        this . updateDataSource ( event . node ? . isChecked ! ,  this . origin . buttonInfoList ,  event . node ? . origin ,  event . node ) ; 
 
			
		
	
		
		
			
				
					
					      }  else  { 
 
			
		
	
		
		
			
				
					
					        this . service . request ( this . service . $api_getFunctionButtonInfo ,  {  id : event.node?.origin.id  } ) . subscribe ( ( res : any [ ] )  = >  { 
 
			
		
	
		
		
			
				
					
					          if  ( res )  { 
 
			
		
	
		
		
			
				
					
					            this . updateDataSource ( event . node ? . isChecked ! ,  res ,  event . node ? . origin ,  event . node ! ) ; 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      if  ( event . node ? . isChecked )  { 
 
			
		
	
		
		
			
				
					
					        this . recursionSetNodeAuth ( event . node . origin ) ; 
 
			
		
	
		
		
			
				
					
					        if  ( this . origin . checked )  { 
 
			
		
	
		
		
			
				
					
					          this . origin . buttonInfoList . forEach ( ( auth : any )  = >  this . _apiAuthSet . add ( auth . functionButtonId ) ) ; 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      }  else  { 
 
			
		
	
		
		
			
				
					
					        this . recursionDeleteNodeAuth ( event . node ? . origin ) ; 
 
			
		
	
		
		
			
				
					
					        if  ( ! this . origin . checked )  { 
 
			
		
	
		
		
			
				
					
					          this . origin . buttonInfoList . forEach ( ( auth : any )  = >  this . _apiAuthSet . delete ( auth . functionButtonId ) ) ; 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  private  recursionSetNodeAuth ( origin : any )  { 
 
			
		
	
		
		
			
				
					
					    this . _NodeAuthMap . set ( origin . id ,  {  authorityId : origin.id ,  buttonAuthorityIds :  [ ] ,  isUpdateAuthority : 1  } ) ; 
 
			
		
	
		
		
			
				
					
					    let  auths  =  [ . . . this . authorityAssistId ] ; 
 
			
		
	
		
		
			
				
					
					    origin . children ? . forEach ( ( node : any )  = >  { 
 
			
		
	
		
		
			
				
					
					      auths . push ( node . id ) ; 
 
			
		
	
		
		
			
				
					
					      node . _selected  =  true ; 
 
			
		
	
		
		
			
				
					
					      const  _auth  =  this . _NodeAuthMap . get ( node . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . _NodeAuthMap . set ( node . id ,  { 
 
			
		
	
		
		
			
				
					
					        authorityId : node.id , 
 
			
		
	
		
		
			
				
					
					        buttonAuthorityIds : _auth?.buttonAuthorityIds  ||  [ ] , 
 
			
		
	
		
		
			
				
					
					        isUpdateAuthority : 1 
 
			
		
	
		
		
			
				
					
					      } ) ; 
 
			
		
	
		
		
			
				
					
					      if  ( node ? . children ? . length  >  0 )  { 
 
			
		
	
		
		
			
				
					
					        this . recursionSetNodeAuth ( node ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					    auths  =  [ . . . auths ,  . . . this . authorityAssistId ] ; 
 
			
		
	
		
		
			
				
					
					    const  authsSet  =  new  Set < string > ( auths ) ; 
 
			
		
	
		
		
			
				
					
					    this . authorityAssistId  =  [ . . . Array . from ( authsSet ) ] ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  private  recursionDeleteNodeAuth ( origin : any )  { 
 
			
		
	
		
		
			
				
					
					    this . _NodeAuthMap . delete ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					    this . authorityAssistId  =  this . authorityAssistId . filter ( auth  = >  auth  !==  origin . id ) ; 
 
			
		
	
		
		
			
				
					
					    origin . children ? . forEach ( ( node : any )  = >  { 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId  =  this . authorityAssistId . filter ( auth  = >  auth  !==  node . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . _NodeAuthMap . delete ( node . id ) ; 
 
			
		
	
		
		
			
				
					
					      if  ( node ? . children ? . length  >  0 )  { 
 
			
		
	
		
		
			
				
					
					        this . recursionDeleteNodeAuth ( node ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  /** 
 
			
		
	
		
		
			
				
					
					   * 根据树勾选状态更新数据源  
			
		
	
		
		
			
				
					
					   * 1.更新操作权限点数据源 _apiAuthSet  
			
		
	
		
		
			
				
					
					   * 2.更新菜单权限数据源 _NodeAuthMap  
			
		
	
		
		
			
				
					
					   *  
			
		
	
		
		
			
				
					
					   * @param isChecked  
			
		
	
		
		
			
				
					
					   * @param data  
			
		
	
		
		
			
				
					
					   */  
			
		
	
		
		
			
				
					
					  private  updateDataSource ( isChecked : boolean ,  data : any [ ] ,  origin : any ,  node : NzTreeNode )  { 
 
			
		
	
		
		
			
				
					
					    if  ( isChecked )  { 
 
			
		
	
		
		
			
				
					
					      data . forEach ( auth  = >  this . _apiAuthSet . add ( auth . functionButtonId ) ) ; 
 
			
		
	
		
		
			
				
					
					      const  _auth  =  this . _NodeAuthMap . get ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . _NodeAuthMap . set ( origin . id ,  { 
 
			
		
	
		
		
			
				
					
					        authorityId : origin.id , 
 
			
		
	
		
		
			
				
					
					        buttonAuthorityIds : _auth?.buttonAuthorityIds  ||  [ ] , 
 
			
		
	
		
		
			
				
					
					        isUpdateAuthority : 1 
 
			
		
	
		
		
			
				
					
					      } ) ; 
 
			
		
	
		
		
			
				
					
					      const  auths  =  [ . . . this . authorityAssistId ] ; 
 
			
		
	
		
		
			
				
					
					      auths . push ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      const  authsSet  =  new  Set < string > ( auths ) ; 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId  =  [ . . . Array . from ( authsSet ) ] ; 
 
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      data . forEach ( auth  = >  this . _apiAuthSet . delete ( auth . functionButtonId ) ) ; 
 
			
		
	
		
		
			
				
					
					      this . _NodeAuthMap . delete ( origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId  =  this . authorityAssistId . filter ( auth  = >  auth  !==  origin . id ) ; 
 
			
		
	
		
		
			
				
					
					      this . recursionDeleteParantNode ( node ) ; 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  washTree() { 
  washTree() { 
 
			
		
	
		
		
			
				
					
					    authorityMenu [ ]  =  [ ] ;  // this.authority 
    //  const checkedNode : any = this.nzTreeComponent.getCheckedNodeList(); 
 
			
				
				
			
		
	
		
		
			
				
					
					tempAuthorityIdDTOListMenu [ ]  =  [ ] ; //  const halfCheckedNode : any = this.nzTreeComponent.getHalfCheckedNodeList();  
			
				
				
			
		
	
		
		
			
				
					
					    const  checkedNode : any  =  this . nzTreeComponent . getCheckedNodeList ( ) ; 
const  authority : any [ ]  =  [ ] ;  
			
				
				
			
		
	
		
		
			
				
					
					    const  halfCheckedNode : any  =  this . nzTreeComponent . getHalfCheckedNodeList ( ) ; 
    this . _NodeAuthMap . forEach ( nodeAuth  = >  authority . push ( nodeAuth ) ) ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    this . authorityAssistId  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					    halfCheckedNode . forEach ( ( item :  {  key : any  } )  = >  { 
 
			
		
	
		
		
			
				
					
					      authorityMenu . push ( {  authorityId : item.key ,  isUpdateAuthority : 0  } ) ; 
 
			
		
	
		
		
			
				
					
					      tempAuthorityIdDTOListMenu . push ( item . key ) ; 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					    this . overWashTree ( checkedNode ,  tempAuthorityIdDTOListMenu ,  authorityMenu ) ; 
 
			
		
	
		
		
			
				
					
					    if  ( this . authority  &&  this . authority . length )  { 
 
			
		
	
		
		
			
				
					
					      this . authority . forEach ( item  = >  { 
 
			
		
	
		
		
			
				
					
					        item . isUpdateAuthority  =  1 ; 
 
			
		
	
		
		
			
				
					
					        if  ( tempAuthorityIdDTOListMenu . indexOf ( item . authorityId )  !==  - 1 )  { 
 
			
		
	
		
		
			
				
					
					          tempAuthorityIdDTOListMenu . forEach ( ( oldItem ,  oldIndex )  = >  { 
 
			
		
	
		
		
			
				
					
					            if  ( oldItem  ===  item . authorityId )  { 
 
			
		
	
		
		
			
				
					
					              authorityMenu [ oldIndex ]  =  item ; 
 
			
		
	
		
		
			
				
					
					            } 
 
			
		
	
		
		
			
				
					
					          } ) ; 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      } ) ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    const  result  =  { 
    const  result  =  { 
 
			
		
	
		
		
			
				
					
					      authority : authorityMenu  , 
      authority : authority , 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					      authorityAssistId : this.authorityAssistId 
      authorityAssistId : this.authorityAssistId 
 
			
		
	
		
		
			
				
					
					    } ; 
    } ; 
 
			
		
	
		
		
			
				
					
					    console . log ( result ) ; 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					    this . changeData . emit ( result ) ; 
    this . changeData . emit ( result ) ; 
 
			
		
	
		
		
			
				
					
					    return  result ; 
    return  result ; 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					  overWashTree ( children : any [ ] ,  tempAuthorityIdDTOListMenu : any [ ] ,  authorityMenu : any [ ] )  { 
 
			
		
	
		
		
			
				
					
					    children . forEach ( ( item : any )  = >  { 
 
			
		
	
		
		
			
				
					
					      this . authorityAssistId . push ( item . key ) ; 
 
			
		
	
		
		
			
				
					
					      tempAuthorityIdDTOListMenu . push ( item . key ) ; 
 
			
		
	
		
		
			
				
					
					      authorityMenu . push ( {  authorityId : item.key ,  isUpdateAuthority : 1  } ) ; 
 
			
		
	
		
		
			
				
					
					      if  ( item . isLeaf )  { 
 
			
		
	
		
		
			
				
					
					        return ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					      if  ( item . children )  { 
 
			
		
	
		
		
			
				
					
					        this . overWashTree ( item . children ,  tempAuthorityIdDTOListMenu ,  authorityMenu ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  initButtonList ( id : any ,  origin : any )  { 
  initButtonList ( id : any ,  origin : any )  { 
 
			
		
	
		
		
			
				
					
					    if  ( origin . expanded ) { 
    this . service . request ( this . service . $api_getFunctionButtonInfo ,  {  id  } ) . subscribe ( ( res : any [ ] )  = > { 
 
			
				
				
			
		
	
		
		
			
				
					
					      origin . children . forEach ( ( item : any ,  index : number )  = >  { 
 
			
		
	
		
		
			
				
					
					        if  ( item . selected )  { 
 
			
		
	
		
		
			
				
					
					          if  ( origin . checked )  { 
 
			
		
	
		
		
			
				
					
					            this . authority . splice ( index ,  1 ) ; 
 
			
		
	
		
		
			
				
					
					            const  buttonAuthorityIds : any  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					            item . buttonInfoList . forEach ( ( btnItem : any )  = >  { 
 
			
		
	
		
		
			
				
					
					              btnItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					              buttonAuthorityIds . push ( btnItem . functionButtonId ) ; 
 
			
		
	
		
		
			
				
					
					            } ) ; 
 
			
		
	
		
		
			
				
					
					            this . authority . push ( {  authorityId : origin.key ,  buttonAuthorityIds ,  isUpdateAuthority : 1  } ) ; 
 
			
		
	
		
		
			
				
					
					          }  else  { 
 
			
		
	
		
		
			
				
					
					            this . authority . splice ( index ,  1 ) ; 
 
			
		
	
		
		
			
				
					
					            item . buttonInfoList . forEach ( ( btnItem : any )  = >  { 
 
			
		
	
		
		
			
				
					
					              btnItem . checked  =  false ; 
 
			
		
	
		
		
			
				
					
					            } ) ; 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      } ) ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					    const  params  =  { 
 
			
		
	
		
		
			
				
					
					      id 
 
			
		
	
		
		
			
				
					
					    } ; 
 
			
		
	
		
		
			
				
					
					    this . service . request ( this . service . $api_getFunctionButtonInfo ,  params ) . subscribe ( res  = >  { 
 
			
		
	
		
		
	
		
		
			
				
					
					      if  ( res )  { 
      if  ( res )  { 
 
			
		
	
		
		
			
				
					
					        origin . buttonInfoList  =  res ; 
        origin . buttonInfoList  =  res ; 
 
			
		
	
		
		
			
				
					
					        origin . all  =  false ; 
        origin . all  =  false ; 
 
			
		
	
		
		
			
				
					
					        console . log ( origin ) ; 
        // 如果树节点未勾选  剔除源数据中该节点的权限数据 
 
			
				
				
			
		
	
		
		
			
				
					
					if  ( ! origin . checked )  {  
			
				
				
			
		
	
		
		
			
				
					
					        // 判断此菜单下是否已有此按钮权限 
          res . forEach ( auth  = >  this . _apiAuthSet . delete ( auth . functionButtonId ) ) ;  
 
			
				
				
			
		
	
		
		
			
				
					
					this . againGetBtn ( id ,  origin ) ;  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
        if  ( origin . _selected  )  {  
 
			
				
				
			
		
	
		
		
			
				
					
					  } 
          res . forEach ( auth  = >  this . _apiAuthSet . add ( auth . functionButtonId ) ) ;  
 
			
				
				
			
		
	
		
		
			
				
					
					  // 再次请求,需要判断暂存权限数组是否已有此权限 
 
			
		
	
		
		
			
				
					
					againGetBtn ( id : any ,  origin : any )  {  
			
		
	
		
		
			
				
					
					    if  ( this . authority  &&  this . authority . length  ===  0 )  { 
 
			
		
	
		
		
			
				
					
					      const  buttonAuthorityIds : any  =  [ ] ; 
 
			
		
	
		
		
			
				
					
					      if  ( origin . checked )  { 
 
			
		
	
		
		
			
				
					
					        origin . buttonInfoList . forEach ( ( btnItem :  {  functionButtonId : any ;  checked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					          btnItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					          buttonAuthorityIds . push ( btnItem . functionButtonId ) ; 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					        this . authority . push ( {  authorityId : origin.key ,  buttonAuthorityIds ,  isUpdateAuthority : 1  } ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    }  else  { 
 
			
		
	
		
		
			
				
					
					      if  ( origin . checked )  { 
 
			
		
	
		
		
			
				
					
					        //菜单勾选情况下 
 
			
		
	
		
		
			
				
					
					if  ( this . authority . some ( item  = >  item . authorityId  ===  id ) )  {  
			
		
	
		
		
			
				
					
					          this . authority . forEach ( item  = >  { 
 
			
		
	
		
		
			
				
					
					            if  ( item . authorityId  ===  id )  { 
 
			
		
	
		
		
			
				
					
					              // 如果当前菜单Id存在权限列表里,  
 
			
		
	
		
		
			
				
					
					if  ( item . buttonAuthorityIds  &&  item . buttonAuthorityIds . length )  {  
			
		
	
		
		
			
				
					
					                // 如果当前菜单Id权限数组不为空 
 
			
		
	
		
		
			
				
					
					origin . buttonInfoList . forEach ( ( btnItem :  {  functionButtonId : any ;  checked : boolean  } )  = >  {  
			
		
	
		
		
			
				
					
					                  // 判断已有权限id是否存在 
 
			
		
	
		
		
			
				
					
					if  ( item . buttonAuthorityIds . indexOf ( btnItem . functionButtonId )  !==  - 1 )  {  
			
		
	
		
		
			
				
					
					                    btnItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					                  }  else  { 
 
			
		
	
		
		
			
				
					
					                    btnItem . checked  =  false ; 
 
			
		
	
		
		
			
				
					
					                  } 
 
			
		
	
		
		
			
				
					
					                } ) ; 
 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					      } 
      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
    } ) ; 
 
			
		
	
		
		
			
				
					
					        }  else  { 
 
			
		
	
		
		
			
				
					
					          this . authority . push ( {  authorityId : origin.key ,  buttonAuthorityIds :  [ ] ,  isUpdateAuthority : 1  } ) ; 
 
			
		
	
		
		
			
				
					
					          this . authority . forEach ( item  = >  { 
 
			
		
	
		
		
			
				
					
					            origin . buttonInfoList . forEach ( ( btnItem :  {  functionButtonId : any ;  checked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					              btnItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					              item . buttonAuthorityIds . push ( btnItem . functionButtonId ) ; 
 
			
		
	
		
		
			
				
					
					            } ) ; 
 
			
		
	
		
		
			
				
					
					          } ) ; 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      }  else  { 
 
			
		
	
		
		
			
				
					
					        // 菜单未勾选,要删除权限 
 
			
		
	
		
		
			
				
					
					this . authority . forEach ( ( item ,  index )  = >  {  
			
		
	
		
		
			
				
					
					          if  ( item . authorityId  ===  id )  { 
 
			
		
	
		
		
			
				
					
					            // 如果当前菜单Id存在权限列表里,  
 
			
		
	
		
		
			
				
					
					this . authority . splice ( index ,  1 ) ;  
			
		
	
		
		
			
				
					
					            origin . buttonInfoList . forEach ( ( btnItem :  {  functionButtonId : any ;  checked : boolean  } )  = >  { 
 
			
		
	
		
		
			
				
					
					              btnItem . checked  =  false ; 
 
			
		
	
		
		
			
				
					
					            } ) ; 
 
			
		
	
		
		
			
				
					
					          } 
 
			
		
	
		
		
			
				
					
					        } ) ; 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					 
			
		
	
		
		
			
				
					
					  initDictList ( id : any ,  origin : any )  { 
  /** 
 
			
				
				
			
		
	
		
		
			
				
					
					    const  params  =  {     * 向上递归取消父节点勾选  
			
				
				
			
		
	
		
		
			
				
					
					      id  
* 清理勾选数据  
			
				
				
			
		
	
		
		
			
				
					
					     } ; *  
			
				
				
			
		
	
		
		
			
				
					
					     this . service . request ( this . service . $api_getFunctionDataInfo ,  params ) . subscribe ( res  = >  { * @param node  
			
				
				
			
		
	
		
		
			
				
					
					      if  ( res )  {     */  
			
				
				
			
		
	
		
		
			
				
					
					        origin  . dictList  =  res ; 
  private  recursionDeleteParantNode ( node : NzTreeNode )  { 
 
			
				
				
			
		
	
		
		
			
				
					
					        // 判断此菜单下是否已有此按钮权限  
    this . authorityAssistId  =  this . authorityAssistId . filter ( auth  = >  auth  !==  node . origin . id ) ; 
 
			
				
				
			
		
	
		
		
			
				
					
					this . againGetDict ( id ,  origin ) ;     if  ( node  . parentNode )  {   
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					      this . recursionDeleteParantNode ( node . parentNode ) ; 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
 
			
		
	
		
		
			
				
					
					  // 再次请求,需要判断暂存权限数组是否已有此权限 
 
			
		
	
		
		
			
				
					
					againGetDict ( id : any ,  origin : any )  {  
			
		
	
		
		
			
				
					
					    if  ( this . authority . length  ===  0 )  { 
 
			
		
	
		
		
			
				
					
					      return ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					    this . authority . forEach ( item  = >  { 
 
			
		
	
		
		
			
				
					
					      if  ( item . authorityId  ===  id )  { 
 
			
		
	
		
		
			
				
					
					        // 如果当前菜单Id等于暂存权限数组的Id 
 
			
		
	
		
		
			
				
					
					if  ( item . dataAuthority  &&  item . dataAuthority . length )  {  
			
		
	
		
		
			
				
					
					          // 如果当前菜单Id权限数组不为空 
 
			
		
	
		
		
			
				
					
					origin . dictList . forEach ( ( ele :  {  dictItem : any [ ]  } )  = >  {  
			
		
	
		
		
			
				
					
					            // 判断已有权限id是否存在 
 
			
		
	
		
		
			
				
					
					ele . dictItem . forEach ( ( dictItem :  {  itemId : any ;  checked : boolean ;  cheked : boolean  } )  = >  {  
			
		
	
		
		
			
				
					
					              item . dataAuthority . forEach ( ( dataItem :  {  dictItemId : any  } )  = >  { 
 
			
		
	
		
		
			
				
					
					                if  ( dataItem . dictItemId  ===  dictItem . itemId )  { 
 
			
		
	
		
		
			
				
					
					                  dictItem . checked  =  true ; 
 
			
		
	
		
		
			
				
					
					                }  else  { 
 
			
		
	
		
		
			
				
					
					                  dictItem . cheked  =  false ; 
 
			
		
	
		
		
			
				
					
					                } 
 
			
		
	
		
		
			
				
					
					              } ) ; 
 
			
		
	
		
		
			
				
					
					            } ) ; 
 
			
		
	
		
		
			
				
					
					          } ) ; 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					      } 
 
			
		
	
		
		
			
				
					
					    } ) ; 
 
			
		
	
		
		
			
				
					
					  } 
  } 
 
			
		
	
		
		
			
				
					
					} }