|
|
|
/*
|
|
|
|
* @Descripttion:
|
|
|
|
* @version:
|
|
|
|
* @Author: sueRimn
|
|
|
|
* @Date: 2021-05-19 15:50:20
|
|
|
|
* @LastEditors: sueRimn
|
|
|
|
* @LastEditTime: 2021-05-20 17:02:03
|
|
|
|
*/
|
|
|
|
import { Component, Inject, OnInit } from '@angular/core';
|
|
|
|
import { HttpClient } from '@angular/common/http'
|
|
|
|
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-plan-template',
|
|
|
|
templateUrl: './plan-template.component.html',
|
|
|
|
styleUrls: ['./plan-template.component.scss']
|
|
|
|
})
|
|
|
|
export class PlanTemplateComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取左侧单位信息
|
|
|
|
newleftTabledata=[]
|
|
|
|
getLeftdata(){
|
|
|
|
/* this.http.get("/api/PlanTemplate").subscribe((data:any)=>{
|
|
|
|
this.leftTabledata=data
|
|
|
|
console.log(this.leftTabledata)
|
|
|
|
}) */
|
|
|
|
}
|
|
|
|
//新建预案弹窗
|
|
|
|
addKeyunit(){
|
|
|
|
const dialogRef = this.dialog.open(addPlanname, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
width: '340px',
|
|
|
|
height:'330px',
|
|
|
|
disableClose:true
|
|
|
|
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
this.newleftTabledata.push(result)
|
|
|
|
console.log(this.newleftTabledata);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//新建预案
|
|
|
|
@Component({
|
|
|
|
selector: 'addPlanname',
|
|
|
|
templateUrl: './addKeyname.html',
|
|
|
|
styleUrls: ['./addKeyname.scss']
|
|
|
|
})
|
|
|
|
export class addPlanname{
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<addPlanname>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
|
|
|
|
unitname//预案名称
|
|
|
|
level//预案级别
|
|
|
|
//取消按钮
|
|
|
|
close(){
|
|
|
|
this.dialogRef.close();
|
|
|
|
}
|
|
|
|
newplan(){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
if(this.unitname==undefined||this.unitname==''){
|
|
|
|
this.snackBar.open('请输入预案名称!','确定',config);
|
|
|
|
}
|
|
|
|
else if(this.level==undefined||this.level==''){
|
|
|
|
this.snackBar.open('请输入预案级别!','确定',config);
|
|
|
|
}else{
|
|
|
|
let planData={
|
|
|
|
name:this.unitname,
|
|
|
|
level:this.level
|
|
|
|
}
|
|
|
|
this.dialogRef.close(planData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|