import { Component, OnInit,Inject } from '@angular/core'; import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; import {FlatTreeControl} from '@angular/cdk/tree'; import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {FormControl} from '@angular/forms'; import { HttpClient } from '@angular/common/http'; import { TreeService } from '../http-interceptors/tree.service' import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import {CacheTokenService} from '../http-interceptors/cache-token.service'//引入服务 import { Router,ActivatedRoute } from '@angular/router' @Component({ selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.scss'] }) export class NavigationComponent implements OnInit { constructor(public navmenus:CacheTokenService,private http: HttpClient,public dialog: MatDialog,private tree:TreeService,public snackBar: MatSnackBar, private router:Router,private route:ActivatedRoute) { } treedata:any isgrey:boolean olddata:any oldtreedata:any ngOnInit () { this.http.get('/api/Account/NavMenus').subscribe((data:any)=>{ this.olddata = data this.oldtreedata = data let _data = this.tree.toTree(this.oldtreedata) this.treedata = _data }) } ngOnDestroy () { } darktheme = false; switchTheme(dark) { this.darktheme = dark; } defaulttheme(){ this.darktheme = false } redtheme(){ this.darktheme = true } toGis(){ // console.log(123) window.open(`http://39.106.78.171:8000`); } }