import { Component, OnInit ,Inject,ViewChild} from '@angular/core'; import { CacheTokenService } from '../http-interceptors/cache-token.service'//引入服务 import { HttpClient,HttpHeaders } from '@angular/common/http'; import { FormControl } from '@angular/forms'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { IsLoginService } from '../is-login.service' import { AllFileComponent } from '../ui/all-file/all-file.component'; import { ComponentServiceService } from '../component-service.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(private router:Router,public emitService: ComponentServiceService,public navmenus:CacheTokenService,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public islogin:IsLoginService) { } isAdmin:boolean = false ngOnInit() { // if(sessionStorage.getItem("roleType") == "0"){ // this.isAdmin = true // } } darktheme = false;//黑夜主题 switchTheme (dark) { this.darktheme = dark; } defaulttheme () { this.darktheme = false } redtheme () { this.darktheme = true} } //新增资料库 @Component({ selector: 'adddatabank', templateUrl: './adddatabank.html', styleUrls: ['./navigation.component.scss'] }) export class AddDataBank { myControl = new FormControl(); constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} onNoClick(): void { this.dialogRef.close(); } onSubmit(value){ if ( value.name.includes('/') ) { let config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 this.snackBar.open('名称不允许有特殊字符','确定',config); } else { this.dialogRef.close(value); } } } //更改资料库名称 @Component({ selector: 'editdatabankname', templateUrl: './editdatabankname.html', styleUrls: ['./navigation.component.scss'] }) export class EditDataBankName { myControl = new FormControl(); constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} dataBankName:any = this.data.name//要修改的资料库原名称 onNoClick(): void { this.dialogRef.close(); } onSubmit(value){ if ( value.name.includes('/') ) { let config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 this.snackBar.open('名称不允许有特殊字符','确定',config); } else { this.dialogRef.close(value); } } }