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) { } @ViewChild('child') child:AllFileComponent; //父组件中获得子组件的引用 allDataBank:any //所有的资料库 selectedDataBank:any //当前选中的资料库 hoverDataBank:any//当前鼠标移入的资料库 isOneClick:boolean //是否第一次进入网页 leftMenuname="found" //左侧菜单点击事件 clickLeftmenu(name){ this.leftMenuname=name } //支队级菜单 detachmentMenus:any = [ { id:"支队级-主官", name:"主官" }, { id:"支队级-副官", name:"副官" }, { id:"支队级-灭火救援指挥岗位", name:"灭火救援指挥岗位" }, { id:"支队级-政工岗位", name:"政工岗位" }, { id:"支队级-后勤与保障岗位", name:"后勤与保障岗位" }, { id:"支队级-防火监督岗位", name:"防火监督岗位" }, { id:"支队级-指挥中心", name:"指挥中心" }, { id:"支队级-安全员", name:"安全员" }, ] //大队级菜单 brigadeMenus:any = [ { id:"大队级-主官", name:"主官" }, { id:"大队级-副官", name:"副官" }, { id:"大队级-灭火救援指挥岗位", name:"灭火救援指挥岗位" }, { id:"大队级-政工岗位", name:"政工岗位" }, { id:"大队级-后勤与保障岗位", name:"后勤与保障岗位" }, { id:"大队级-防火监督岗位", name:"防火监督岗位" }, { id:"大队级-安全员", name:"安全员" }, ] //消防救援站菜单 rescueStationMenus:any = [ { id:"消防救援站-消防站指挥员", name:"消防站指挥员" }, { id:"消防救援站-站长助理", name:"站长助理" }, { id:"消防救援站-战斗员", name:"战斗员" }, { id:"消防救援站-供水源", name:"供水源" }, { id:"消防救援站-训导员", name:"训导员" }, { id:"消防救援站-通信员", name:"通信员" }, { id:"消防救援站-无人机飞手", name:"无人机飞手" }, { id:"消防救援站-消防车驾驶员", name:"消防车驾驶员" }, { id:"消防救援站-装备技师", name:"装备技师" } ] //系统管理菜单 systemManagement:any = [ { id:"学员管理", name:"学员管理" }, { id:"教员管理", name:"教员管理" } ] 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); } } }