page-role.component.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Component, OnInit, ViewChild } from '@angular/core';
  2. import { ActivatedRoute, RouterOutlet } from '@angular/router';
  3. import { CompTableListComponent } from '../../../app/comp-table/comp-table-list/comp-table-list.component';
  4. import _Role from '../../../schemas/_Role';
  5. // import { TranslateService } from '@ngx-translate/core';
  6. import * as Parse from "parse";
  7. import { CommonModule } from '@angular/common';
  8. @Component({
  9. selector: 'app-page-role',
  10. templateUrl: './page-role.component.html',
  11. styleUrls: ['./page-role.component.scss'],
  12. imports: [CommonModule,RouterOutlet,CompTableListComponent],
  13. standalone: true,
  14. })
  15. export class PageRoleComponent implements OnInit {
  16. @ViewChild(CompTableListComponent) list:CompTableListComponent|undefined
  17. _Role = _Role
  18. user:Parse.User|undefined
  19. className:string|undefined
  20. queryParams:any|undefined
  21. fieldsArray:Array<any>|undefined
  22. constructor(
  23. private route: ActivatedRoute,
  24. private activeRoute: ActivatedRoute,
  25. // private translate:TranslateService,
  26. ) {
  27. this.user = Parse.User.current();
  28. this.className = this._Role.className
  29. this.fieldsArray = this._Role.fieldsArray
  30. this.queryParams = {where:{
  31. // user:this.user?.toPointer(),
  32. isDeleted:{$ne:true},
  33. }}
  34. }
  35. ngOnInit(): void {
  36. this.activeRoute.paramMap.subscribe(async (params) => {
  37. let isDeleted = params.get('isDeleted')
  38. if(isDeleted){
  39. this.queryParams.where['isDeleted'] = {$eq:true}
  40. }else{
  41. this.queryParams.where['isDeleted'] = {$ne:true}
  42. }
  43. this.list?.ngOnInit()
  44. });
  45. }
  46. }