Browse Source

[完善]节点删除

智慧矿山应急安全培训、考核、演练管理系统
邵佳豪 2 years ago
parent
commit
a3c8dd58f6
  1. 12
      src/app/ui/collection-tools/collection-tools.component.html
  2. 3
      src/app/ui/collection-tools/collection-tools.component.ts
  3. 181
      src/app/ui/collection-tools/leftFunctionalDomain.ts

12
src/app/ui/collection-tools/collection-tools.component.html

@ -104,12 +104,14 @@
<div id="terrNodePublic" (click)='selectanelPoint(node.origin)'
[ngClass]="{'selectanelPoint': selectDisposalNode==node.origin.id}">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label>
<!-- <div class="planIconDiv" *ngIf="isEditPattern">
<mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId" (click)='editPanelPoint($event,node)'>edit</mat-icon>
<mat-icon *ngIf="node.level===0" (click)='addPanelPoint($event,node.origin,null)'>add</mat-icon>
<mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId" (click)='copyPanelPoint($event,node,treeData)'>library_books</mat-icon>
<div class="planIconDiv">
<mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId"
(click)='editPanelPoint($event,node)'>edit</mat-icon>
<!-- <mat-icon *ngIf="node.level===0" (click)='addPanelPoint($event,node.origin,null)'>add</mat-icon> -->
<!-- <mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId"
(click)='copyPanelPoint($event,node,treeData)'>library_books</mat-icon> -->
<mat-icon (click)='deletePanelPoint($event,node.origin)'>delete_forever</mat-icon>
</div> -->
</div>
</div>
</ng-template>

3
src/app/ui/collection-tools/collection-tools.component.ts

@ -2306,9 +2306,10 @@ export class CollectionToolsComponent implements OnInit {
//删除 处置预案 节点
deletePanelPoint(e, item) {
console.log(item)
e.stopPropagation();
if (confirm(`确定要删除 ${item.name} ?`)) {
this.http.delete(`/api/DisposalNodes/${item.id}`).subscribe((data) => {
this.http.delete(`/api/ExamDisposalNodes/${item.id}`).subscribe((data) => {
this.refurbishTreeData();
});
}

181
src/app/ui/collection-tools/leftFunctionalDomain.ts

@ -1,45 +1,49 @@
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';
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',
templateUrl: './addPlaneFigure.html',
styleUrls: ['./panel.scss']
selector: "app-leftFunctionalDomain",
templateUrl: "./addPlaneFigure.html",
styleUrls: ["./panel.scss"],
})
export class leftFunctionalDomainComponent implements OnInit {
constructor(
private http: HttpClient,
public dialog: MatDialog,
public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<any>,
@Inject(MAT_DIALOG_DATA) public data) { }
@Inject(MAT_DIALOG_DATA) public data
) {}
ngOnInit(): void {
ngOnInit(): void {}
}
params = { companyId: sessionStorage.getItem('companyId') }
checked: boolean = false;//是否为避难层
params = { companyId: sessionStorage.getItem("companyId") };
checked: boolean = false; //是否为避难层
//提交表单创建平面图
onSubmit(e) {
if (!this.data.isBuilding) { //总平面图 创建平面图
if (!this.data.isBuilding) {
//总平面图 创建平面图
let data = {
companyId: sessionStorage.getItem('companyId'),
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 { //建筑 创建楼层/区域
};
this.http.post("/api/SitePlans", data).subscribe((data) => {
this.dialogRef.close("总平面图");
});
} else {
//建筑 创建楼层/区域
let data = {
isRefugeStorey: e.isRefugeStorey,
buildingId: this.data.Panel.id,
@ -49,45 +53,50 @@ export class leftFunctionalDomainComponent implements OnInit {
details: e.details,
enabled: true,
modifiedTime: new Date(),
}
this.http.post('/api/BuildingAreas', data, { params: this.params }).subscribe(data => {
this.dialogRef.close('建筑');
})
};
this.http
.post("/api/BuildingAreas", data, { params: this.params })
.subscribe((data) => {
this.dialogRef.close("建筑");
});
}
}
}
//编辑平面图 楼层/区域
@Component({
selector: 'app-editPlaneFigure',
templateUrl: './editPlaneFigure.html',
styleUrls: ['./panel.scss']
selector: "app-editPlaneFigure",
templateUrl: "./editPlaneFigure.html",
styleUrls: ["./panel.scss"],
})
export class editPlaneFigureComponent implements OnInit {
constructor(private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>, @Inject(MAT_DIALOG_DATA) public data) { }
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 || ''
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') }
params = { companyId: sessionStorage.getItem("companyId") };
name: any; //name
checked: boolean = false;//是否为避难层
checked: boolean = false; //是否为避难层
area: number; //面积
details: string; //详情
//提交表单修改平面图
onSubmit(e) {
if (!this.data.isBuilding) { //总平面图 修改平面图
if (!this.data.isBuilding) {
//总平面图 修改平面图
let data = {
companyId: sessionStorage.getItem('companyId'),
companyId: sessionStorage.getItem("companyId"),
id: this.data.buildingData.id,
name: e.name,
cadUrl: this.data.buildingData.cadUrl,
@ -98,11 +107,14 @@ export class editPlaneFigureComponent implements OnInit {
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 { //建筑 修改楼层/区域
};
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,
@ -116,65 +128,72 @@ export class editPlaneFigureComponent implements OnInit {
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('建筑');
})
};
this.http
.put(`/api/BuildingAreas/${this.data.buildingData.id}`, data, {
params: this.params,
})
.subscribe((data) => {
this.dialogRef.close("建筑");
});
}
}
}
//创建 处置预案 节点
@Component({
selector: 'app-addDisposalNode',
templateUrl: './addDisposalNode.html',
styleUrls: ['./panel.scss']
selector: "app-addDisposalNode",
templateUrl: "./addDisposalNode.html",
styleUrls: ["./panel.scss"],
})
export class addDisposalNodeComponent implements OnInit {
constructor(
private http: HttpClient,
public dialog: MatDialog,
public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<any>,
@Inject(MAT_DIALOG_DATA) public data
) {}
constructor(private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>, @Inject(MAT_DIALOG_DATA) public data) { }
ngOnInit(): void {
}
ngOnInit(): void {}
//提交表单
onSubmit(e) {
this.data.name = e.name
this.http.post('/api/DisposalNodes', this.data).subscribe(data => {
this.dialogRef.close('success');
})
this.data.name = e.name;
this.http.post("/api/DisposalNodes", this.data).subscribe((data) => {
this.dialogRef.close("success");
});
}
}
//编辑 处置预案 节点
@Component({
selector: 'app-editDisposalNode',
templateUrl: './editDisposalNode.html',
styleUrls: ['./panel.scss']
selector: "app-editDisposalNode",
templateUrl: "./editDisposalNode.html",
styleUrls: ["./panel.scss"],
})
export class editDisposalNodeComponent implements OnInit {
constructor(private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>, @Inject(MAT_DIALOG_DATA) public data) { }
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 || ''))
console.log(666, this.data);
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);
})
this.data.name = e.name;
this.http
.put(`/api/ExamDisposalNodes/${this.data.id}`, this.data)
.subscribe((data) => {
this.dialogRef.close(e.name);
});
}
}
}

Loading…
Cancel
Save