page-role.component.ts 1.7 KB

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