You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
180 lines
5.2 KiB
180 lines
5.2 KiB
4 years ago
|
import { Component, OnInit, Inject } from '@angular/core';
|
||
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-leftFunctionalDomain-plan',
|
||
|
templateUrl: './addPlaneFigure.html',
|
||
|
styleUrls: ['./panel.scss']
|
||
|
})
|
||
|
export class leftFunctionalDomainComponentPlan implements OnInit {
|
||
|
|
||
|
constructor(
|
||
|
private http:HttpClient,
|
||
|
public dialog: MatDialog,
|
||
|
public snackBar: MatSnackBar,
|
||
|
public dialogRef: MatDialogRef<any>,
|
||
|
@Inject(MAT_DIALOG_DATA) public data) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
|
||
|
}
|
||
|
|
||
|
params = {companyId: sessionStorage.getItem('companyId')}
|
||
|
checked:boolean = false;//是否为避难层
|
||
|
|
||
|
//提交表单创建平面图
|
||
|
onSubmit (e) {
|
||
|
if (!this.data.isBuilding) { //总平面图 创建平面图
|
||
|
let data = {
|
||
|
companyId: sessionStorage.getItem('companyId'),
|
||
|
name: e.name,
|
||
|
order: this.data.order,
|
||
|
area:e.area,
|
||
|
details:e.details,
|
||
|
enabled: true,
|
||
|
modifiedTime: new Date(),
|
||
|
}
|
||
|
this.http.post('/api/SitePlans',data).subscribe(data=>{
|
||
|
this.dialogRef.close('总平面图');
|
||
|
})
|
||
|
} else { //建筑 创建楼层/区域
|
||
|
let data = {
|
||
|
isRefugeStorey: e.isRefugeStorey,
|
||
|
buildingId: this.data.Panel.id,
|
||
|
name: e.name,
|
||
|
order: this.data.order,
|
||
|
area:e.area,
|
||
|
details:e.details,
|
||
|
enabled: true,
|
||
|
modifiedTime: new Date(),
|
||
|
}
|
||
|
this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{
|
||
|
this.dialogRef.close('建筑');
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
//编辑平面图 楼层/区域
|
||
|
@Component({
|
||
|
selector: 'app-editPlaneFigure-plan',
|
||
|
templateUrl: './editPlaneFigure.html',
|
||
|
styleUrls: ['./panel.scss']
|
||
|
})
|
||
|
export class editPlaneFigureComponentPlan implements OnInit {
|
||
|
|
||
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<any>,@Inject(MAT_DIALOG_DATA) public data) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
this.name = this.data.buildingData.name || ''
|
||
|
this.checked = this.data.buildingData.isRefugeStorey || false
|
||
|
this.area = this.data.buildingData.area || 0
|
||
|
this.details = this.data.buildingData.details || ''
|
||
|
}
|
||
|
|
||
|
params = {companyId: sessionStorage.getItem('companyId')}
|
||
|
name:any; //name
|
||
|
checked:boolean = false;//是否为避难层
|
||
|
area:number; //面积
|
||
|
details:string; //详情
|
||
|
|
||
|
//提交表单修改平面图
|
||
|
onSubmit (e) {
|
||
|
if (!this.data.isBuilding) { //总平面图 修改平面图
|
||
|
let data = {
|
||
|
companyId: sessionStorage.getItem('companyId'),
|
||
|
id: this.data.buildingData.id,
|
||
|
name: e.name,
|
||
|
cadUrl: this.data.buildingData.cadUrl,
|
||
|
imageUrl: this.data.buildingData.imageUrl,
|
||
|
imageAngle: this.data.buildingData.imageAngle,
|
||
|
order: this.data.buildingData.order,
|
||
|
area:e.area,
|
||
|
details:e.details,
|
||
|
enabled: this.data.buildingData.enabled,
|
||
|
modifiedTime: new Date(),
|
||
|
}
|
||
|
this.http.put(`/api/SitePlans/${this.data.buildingData.id}`,data).subscribe(data=>{
|
||
|
this.dialogRef.close('总平面图');
|
||
|
})
|
||
|
} else { //建筑 修改楼层/区域
|
||
|
let data = {
|
||
|
isRefugeStorey: e.isRefugeStorey,
|
||
|
buildingId: this.data.Panel.id,
|
||
|
id: this.data.buildingData.id,
|
||
|
name: e.name,
|
||
|
cadUrl: this.data.buildingData.cadUrl,
|
||
|
imageUrl: this.data.buildingData.imageUrl,
|
||
|
imageAngle: this.data.buildingData.imageAngle,
|
||
|
order: this.data.buildingData.order,
|
||
|
area:e.area,
|
||
|
details:e.details,
|
||
|
enabled: this.data.buildingData.enabled,
|
||
|
modifiedTime: new Date(),
|
||
|
}
|
||
|
this.http.put(`/api/BuildingAreas/${this.data.buildingData.id}`,data,{params:this.params}).subscribe(data=>{
|
||
|
this.dialogRef.close('建筑');
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//创建 处置预案 节点
|
||
|
@Component({
|
||
|
selector: 'app-addDisposalNode-plan',
|
||
|
templateUrl: './addDisposalNode.html',
|
||
|
styleUrls: ['./panel.scss']
|
||
|
})
|
||
|
export class addDisposalNodeComponentPlan implements OnInit {
|
||
|
|
||
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<any>,@Inject(MAT_DIALOG_DATA) public data) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
}
|
||
|
|
||
|
//提交表单
|
||
|
onSubmit (e) {
|
||
|
this.data.name = e.name
|
||
|
this.http.post('/api/DisposalNodes',this.data).subscribe(data=>{
|
||
|
this.dialogRef.close('success');
|
||
|
})
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//编辑 处置预案 节点
|
||
|
@Component({
|
||
|
selector: 'app-editDisposalNode-plan',
|
||
|
templateUrl: './editDisposalNode.html',
|
||
|
styleUrls: ['./panel.scss']
|
||
|
})
|
||
|
export class editDisposalNodeComponentPlan implements OnInit {
|
||
|
|
||
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<any>,@Inject(MAT_DIALOG_DATA) public data) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
this.nodeName = JSON.parse(JSON.stringify( this.data.name || '' ))
|
||
|
}
|
||
|
nodeName:string;
|
||
|
|
||
|
//提交表单
|
||
|
onSubmit (e) {
|
||
|
this.data.name = e.name
|
||
|
this.http.put(`/api/DisposalNodes/${this.data.id}`,this.data).subscribe(data=>{
|
||
|
this.dialogRef.close(e.name);
|
||
|
})
|
||
|
}
|
||
|
|
||
|
}
|