27 changed files with 84 additions and 1250 deletions
@ -1,24 +0,0 @@ |
|||||||
<div class="functionalDomainContent"> |
|
||||||
<div mat-dialog-title> |
|
||||||
<label *ngIf="!data.parentId">新建处置节点</label> |
|
||||||
<label *ngIf="data.parentId">新建节点</label> |
|
||||||
</div> |
|
||||||
|
|
||||||
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div class="keyMargin"> |
|
||||||
<mat-form-field> |
|
||||||
<input matInput name="name" required ngModel placeholder="名称"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="submitBottom"> |
|
||||||
<button mat-raised-button color="primary" type="submit" [disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
|
|
||||||
</form> |
|
||||||
|
|
||||||
</div> |
|
@ -1,23 +0,0 @@ |
|||||||
<div class="functionalDomainContent"> |
|
||||||
<div mat-dialog-title> |
|
||||||
<label>修改灾情节点名称</label> |
|
||||||
</div> |
|
||||||
|
|
||||||
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div class="keyMargin"> |
|
||||||
<mat-form-field> |
|
||||||
<input matInput name="name" required [(ngModel)]="nodeName" placeholder="名称"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="submitBottom"> |
|
||||||
<button mat-raised-button color="primary" type="submit" [disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
|
|
||||||
</form> |
|
||||||
|
|
||||||
</div> |
|
@ -1,300 +0,0 @@ |
|||||||
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 {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.service' //引入服务
|
|
||||||
// 保存想定作业第一个弹窗
|
|
||||||
@Component({ |
|
||||||
selector: 'dialog-overview-example-dialog-building', |
|
||||||
templateUrl: 'saveOne.html', |
|
||||||
styleUrls: ['./collection-tools.component.scss'] |
|
||||||
}) |
|
||||||
export class saveOneDialogBuilding { |
|
||||||
|
|
||||||
constructor( |
|
||||||
private http:HttpClient, |
|
||||||
public dialog: MatDialog, |
|
||||||
public snackBar: MatSnackBar, |
|
||||||
public dialogRef: MatDialogRef<any>, |
|
||||||
@Inject(MAT_DIALOG_DATA) public data) {} |
|
||||||
|
|
||||||
onNoClick(): void { |
|
||||||
this.dialogRef.close() |
|
||||||
} |
|
||||||
allDisposalNode = this.data.allDisposalNode |
|
||||||
|
|
||||||
saveType(type){ |
|
||||||
this.dialogRef.close() |
|
||||||
const dialogRef = this.dialog.open(saveTwoDialogBuilding, { |
|
||||||
data: {type: type, |
|
||||||
allDisposalNode: this.data.allDisposalNode, |
|
||||||
selectedBuildingData:this.data.selectedBuildingData, |
|
||||||
selectedSiteData:this.data.selectedSiteData, |
|
||||||
siteOrbuilding:this.data.siteOrbuilding, |
|
||||||
disasterId:this.data.disasterId} |
|
||||||
}); |
|
||||||
dialogRef.afterClosed().subscribe(result => { |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
// 保存想定作业第二个弹窗
|
|
||||||
@Component({ |
|
||||||
selector: 'dialog-overview-example-dialog-building', |
|
||||||
templateUrl: 'saveTwo.html', |
|
||||||
styleUrls: ['./collection-tools.component.scss'] |
|
||||||
}) |
|
||||||
export class saveTwoDialogBuilding { |
|
||||||
|
|
||||||
constructor( |
|
||||||
private http:HttpClient, |
|
||||||
public dialogRef: MatDialogRef<any>, |
|
||||||
public canvasData: CanvasShareDataService, |
|
||||||
public snackBar: MatSnackBar, |
|
||||||
@Inject(MAT_DIALOG_DATA) public data) {} |
|
||||||
|
|
||||||
type = this.data.type |
|
||||||
allDisposalNode = this.data.allDisposalNode |
|
||||||
allPlanDisposalNode = [] |
|
||||||
allRootDisposalNode = [{name:"根节点",id:null}] |
|
||||||
allDisposalNodeChild = [] |
|
||||||
ngOnInit(): void { |
|
||||||
//所有非数据节点
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.sitePlanId && !item.buildingAreaId){ |
|
||||||
this.allPlanDisposalNode.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
//所有一级节点
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.parentId){ |
|
||||||
this.allRootDisposalNode.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
this.allDisposalNodeChild = JSON.parse(JSON.stringify(this.allDisposalNode)) |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
item.children = [] |
|
||||||
this.allDisposalNodeChild.forEach(i => { |
|
||||||
if(i.parentId == item.id){ |
|
||||||
item.children.push(i) |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
// console.log(this.nodeItem.id)
|
|
||||||
} |
|
||||||
onNoClick(): void { |
|
||||||
this.dialogRef.close(); |
|
||||||
} |
|
||||||
nodeItem |
|
||||||
itemChildNum = 0 //点击处置节点子数据节点的数量
|
|
||||||
clickNode(item){ |
|
||||||
// console.log(item)
|
|
||||||
this.nodeItem = item |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
if(item.id == this.nodeItem.id){ |
|
||||||
this.itemChildNum = item.children.length |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
|
|
||||||
selectedBuildingData = this.data.selectedBuildingData |
|
||||||
selectedSiteData = this.data.selectedSiteData |
|
||||||
onSubmit(value,type){ |
|
||||||
// console.log(type)
|
|
||||||
let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name |
|
||||||
//如果保存到已有节点
|
|
||||||
var postdata = { |
|
||||||
id: "", |
|
||||||
name: name, |
|
||||||
level: 0, |
|
||||||
order: this.itemChildNum, |
|
||||||
description: "", |
|
||||||
notes: "", |
|
||||||
weather: null, |
|
||||||
airTemperature: null, |
|
||||||
windDirection: null, |
|
||||||
windScale: null, |
|
||||||
imageNames: null, |
|
||||||
imageUrls: null, |
|
||||||
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
||||||
disasterId: this.data.disasterId, |
|
||||||
planComponentId: sessionStorage.getItem('planId') || '', |
|
||||||
companyId: this.data.siteOrbuilding == -1 ? sessionStorage.getItem('companyId') : null, |
|
||||||
sitePlanId: this.data.siteOrbuilding==-1 ? this.selectedSiteData.id : null, |
|
||||||
buildingId: this.selectedBuildingData.id || null, |
|
||||||
buildingAreaId: this.data.siteOrbuilding!=-1 ? this.selectedSiteData.id : null |
|
||||||
} |
|
||||||
if(type == 'old'){ |
|
||||||
let istrue = this.canvasData.findDisposalNode(this.nodeItem.id,name) |
|
||||||
let putdata = this.nodeItem |
|
||||||
putdata.weather = this.canvasData.selectPanelPointBaseData.weather |
|
||||||
putdata.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) |
|
||||||
putdata.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
|
|
||||||
putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
|
|
||||||
putdata.description = this.canvasData.selectPanelPointBaseData.description |
|
||||||
putdata.notes = this.canvasData.selectPanelPointBaseData.notes |
|
||||||
|
|
||||||
|
|
||||||
if(istrue){//如果该处置节点下已有同名数据节点 则只修改 2个接口
|
|
||||||
new Promise((resolve,reject)=>{ |
|
||||||
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { |
|
||||||
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") |
|
||||||
}) |
|
||||||
}).then((values)=>{ |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
// 保存平面图数据到当前节点
|
|
||||||
let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
|
|
||||||
postdata.Data = JSON.stringify(postdata.Data) |
|
||||||
this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
}) |
|
||||||
|
|
||||||
}else{//需要3个接口
|
|
||||||
new Promise((resolve,reject)=>{ |
|
||||||
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { |
|
||||||
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") |
|
||||||
}) |
|
||||||
}).then((values)=>{ |
|
||||||
// console.log(values)
|
|
||||||
postdata.level = putdata.level + 1
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
this.http.post(`/api/DisposalNodes`,postdata).subscribe(data => { |
|
||||||
resolve(data) |
|
||||||
}) |
|
||||||
}).then((data:any)=>{ |
|
||||||
// console.log(7788,data)
|
|
||||||
let objData = { |
|
||||||
id: "", |
|
||||||
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
||||||
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
||||||
disposalNodeId: data.id, |
|
||||||
planComponentId: sessionStorage.getItem("planId"), |
|
||||||
} |
|
||||||
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
|
|
||||||
}else{//如果保存到新建节点
|
|
||||||
let dispositionNodeData //处置节点data
|
|
||||||
let order |
|
||||||
let oneLevelNum = [] |
|
||||||
//将order赋值为所有一级节点最后一个+1
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.parentId){ |
|
||||||
oneLevelNum.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
if(oneLevelNum.length == 0){ |
|
||||||
order = 0 |
|
||||||
}else{ |
|
||||||
order = oneLevelNum[oneLevelNum.length - 1].order + 1 |
|
||||||
} |
|
||||||
|
|
||||||
if(this.nodeItem){//如果点击了下拉选择框
|
|
||||||
if(this.nodeItem.id != null){ |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
if(item.id == this.nodeItem.id){ |
|
||||||
order = item.children.length |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
dispositionNodeData = { |
|
||||||
id: "", |
|
||||||
name: value.name, |
|
||||||
level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, |
|
||||||
order: order, |
|
||||||
description: "", |
|
||||||
notes: "", |
|
||||||
weather: null, |
|
||||||
airTemperature: 0, |
|
||||||
windDirection: 0, |
|
||||||
windScale: 0, |
|
||||||
imageNames: null, |
|
||||||
imageUrls: null, |
|
||||||
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
||||||
disasterId: this.data.disasterId, |
|
||||||
planComponentId: sessionStorage.getItem('planId') || '', |
|
||||||
companyId: null, |
|
||||||
sitePlanId: null, |
|
||||||
buildingId: null, |
|
||||||
buildingAreaId: null |
|
||||||
} |
|
||||||
|
|
||||||
dispositionNodeData.weather = this.canvasData.selectPanelPointBaseData.weather |
|
||||||
dispositionNodeData.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) |
|
||||||
dispositionNodeData.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
|
|
||||||
dispositionNodeData.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
|
|
||||||
dispositionNodeData.description = this.canvasData.selectPanelPointBaseData.description |
|
||||||
dispositionNodeData.notes = this.canvasData.selectPanelPointBaseData.notes |
|
||||||
//1.先创建一个处置节点 然后 .then 2.创建数据节点到刚创建的处置节点 3.然后拿着创建好的数据节点的id 将平面图data保存
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
this.http.post("/api/DisposalNodes",dispositionNodeData).subscribe((data:any) => { |
|
||||||
resolve(data.id) |
|
||||||
}) |
|
||||||
}).then((id) => { |
|
||||||
let dataNodeData
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
postdata.parentId = id |
|
||||||
postdata.level = dispositionNodeData.level + 1 |
|
||||||
this.http.post("/api/DisposalNodes",postdata).subscribe((data:any) => { |
|
||||||
resolve(data) |
|
||||||
}) |
|
||||||
}).then((data:any) => { |
|
||||||
// 保存平面图数据到当前节点
|
|
||||||
// console.log(6666,data)
|
|
||||||
// let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
|
|
||||||
// postdata.Data = JSON.stringify(postdata.Data)
|
|
||||||
let objData = { |
|
||||||
id: "", |
|
||||||
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
||||||
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
||||||
disposalNodeId: data.id, |
|
||||||
planComponentId: sessionStorage.getItem("planId"), |
|
||||||
} |
|
||||||
|
|
||||||
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
|
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage("send a message") |
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
<div mat-dialog-title>处置节点保存</div> |
|
||||||
<div style="display: flex;"> |
|
||||||
<button mat-stroked-button style="margin-right: 5px;" (click)="saveType('new')">新建节点并保存</button> |
|
||||||
<button mat-stroked-button (click)="saveType('old')">保存到已有节点</button> |
|
||||||
</div> |
|
@ -1,53 +0,0 @@ |
|||||||
<div *ngIf="type == 'new'"> |
|
||||||
<div mat-dialog-title>新增节点</div> |
|
||||||
<div> |
|
||||||
<form (ngSubmit)="onSubmit(form.value,'new')" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<input type="text" matInput ngModel |
|
||||||
required name="name" placeholder="节点名称" autocomplete="off"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<mat-select [(value)]="allRootDisposalNode[0].name" required placeholder="父节点名称"> |
|
||||||
<mat-option *ngFor="let item of allRootDisposalNode" [value]="item.name" (click)="clickNode(item)"> |
|
||||||
{{item.name}} |
|
||||||
</mat-option> |
|
||||||
</mat-select> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-actions> |
|
||||||
<button mat-raised-button color="primary" type="submit" |
|
||||||
[disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
</form> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div *ngIf="type == 'old'"> |
|
||||||
<div mat-dialog-title>保存到已有节点</div> |
|
||||||
<div> |
|
||||||
<form (ngSubmit)="onSubmit(form.value,'old')" #form="ngForm" class="example-container"> |
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<mat-select required ngModel placeholder="父节点名称" name="nodeId"> |
|
||||||
<mat-option *ngFor="let item of allPlanDisposalNode" [value]="item.id" (click)="clickNode(item)"> |
|
||||||
{{item.name}} |
|
||||||
</mat-option> |
|
||||||
</mat-select> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-actions> |
|
||||||
<button mat-raised-button color="primary" type="submit" |
|
||||||
[disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
</form> |
|
||||||
</div> |
|
||||||
</div> |
|
@ -1,24 +0,0 @@ |
|||||||
<div style="position: relative;width: 1400px;height: 800px;line-height: 800px;" class="swiper-container"> |
|
||||||
<div style="position: absolute;right: -2px;top: -392px;cursor: pointer;z-index: 999;width: 24px;height: 24px;" (click)="closeDialog()"> |
|
||||||
<span><mat-icon>clear</mat-icon></span> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="swiper-wrapper"> |
|
||||||
<div class="swiper-slide" style="text-align: center;" *ngFor="let img of imagesArr"> |
|
||||||
<img id="bigimg" (mousewheel)="zoomimg($event)" style=" |
|
||||||
max-width: 96%; |
|
||||||
max-height: 100%; |
|
||||||
min-width: 1px; |
|
||||||
min-height: 1px; |
|
||||||
position: absolute; |
|
||||||
top: 0; |
|
||||||
left: 0; |
|
||||||
bottom: 0; |
|
||||||
right: 0; |
|
||||||
margin: auto;" [src]="img.PropertyValue" alt=""> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<!-- 如果需要导航按钮 --> |
|
||||||
<div class="swiper-button-next"></div> |
|
||||||
<div class="swiper-button-prev"></div> |
|
||||||
</div> |
|
@ -1,24 +0,0 @@ |
|||||||
<div class="functionalDomainContent"> |
|
||||||
<div mat-dialog-title> |
|
||||||
<label *ngIf="!data.parentId">新建处置节点</label> |
|
||||||
<label *ngIf="data.parentId">新建节点</label> |
|
||||||
</div> |
|
||||||
|
|
||||||
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div class="keyMargin"> |
|
||||||
<mat-form-field> |
|
||||||
<input matInput name="name" required ngModel placeholder="名称"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="submitBottom"> |
|
||||||
<button mat-raised-button color="primary" type="submit" [disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
|
|
||||||
</form> |
|
||||||
|
|
||||||
</div> |
|
@ -1,23 +0,0 @@ |
|||||||
<div class="functionalDomainContent"> |
|
||||||
<div mat-dialog-title> |
|
||||||
<label>修改灾情节点名称</label> |
|
||||||
</div> |
|
||||||
|
|
||||||
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div class="keyMargin"> |
|
||||||
<mat-form-field> |
|
||||||
<input matInput name="name" required [(ngModel)]="nodeName" placeholder="名称"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="submitBottom"> |
|
||||||
<button mat-raised-button color="primary" type="submit" [disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
|
|
||||||
</form> |
|
||||||
|
|
||||||
</div> |
|
@ -1,300 +0,0 @@ |
|||||||
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 {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.service' //引入服务
|
|
||||||
// 保存想定作业第一个弹窗
|
|
||||||
@Component({ |
|
||||||
selector: 'dialog-overview-example-dialog', |
|
||||||
templateUrl: 'saveOne.html', |
|
||||||
styleUrls: ['./collection-tools.component.scss'] |
|
||||||
}) |
|
||||||
export class saveOneDialogPlan { |
|
||||||
|
|
||||||
constructor( |
|
||||||
private http:HttpClient, |
|
||||||
public dialog: MatDialog, |
|
||||||
public snackBar: MatSnackBar, |
|
||||||
public dialogRef: MatDialogRef<saveOneDialogPlan>, |
|
||||||
@Inject(MAT_DIALOG_DATA) public data) {} |
|
||||||
|
|
||||||
onNoClick(): void { |
|
||||||
this.dialogRef.close() |
|
||||||
} |
|
||||||
allDisposalNode = this.data.allDisposalNode |
|
||||||
|
|
||||||
saveType(type){ |
|
||||||
this.dialogRef.close() |
|
||||||
const dialogRef = this.dialog.open(saveTwoDialogPlan, { |
|
||||||
data: {type: type, |
|
||||||
allDisposalNode: this.data.allDisposalNode, |
|
||||||
selectedBuildingData:this.data.selectedBuildingData, |
|
||||||
selectedSiteData:this.data.selectedSiteData, |
|
||||||
siteOrbuilding:this.data.siteOrbuilding, |
|
||||||
disasterId:this.data.disasterId} |
|
||||||
}); |
|
||||||
dialogRef.afterClosed().subscribe(result => { |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
// 保存想定作业第二个弹窗
|
|
||||||
@Component({ |
|
||||||
selector: 'dialog-overview-example-dialog', |
|
||||||
templateUrl: 'saveTwo.html', |
|
||||||
styleUrls: ['./collection-tools.component.scss'] |
|
||||||
}) |
|
||||||
export class saveTwoDialogPlan { |
|
||||||
|
|
||||||
constructor( |
|
||||||
private http:HttpClient, |
|
||||||
public dialogRef: MatDialogRef<saveTwoDialogPlan>, |
|
||||||
public canvasData: CanvasShareDataService, |
|
||||||
public snackBar: MatSnackBar, |
|
||||||
@Inject(MAT_DIALOG_DATA) public data) {} |
|
||||||
|
|
||||||
type = this.data.type |
|
||||||
allDisposalNode = this.data.allDisposalNode |
|
||||||
allPlanDisposalNode = [] |
|
||||||
allRootDisposalNode = [{name:"根节点",id:null}] |
|
||||||
allDisposalNodeChild = [] |
|
||||||
ngOnInit(): void { |
|
||||||
//所有非数据节点
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.sitePlanId && !item.buildingAreaId){ |
|
||||||
this.allPlanDisposalNode.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
//所有一级节点
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.parentId){ |
|
||||||
this.allRootDisposalNode.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
this.allDisposalNodeChild = JSON.parse(JSON.stringify(this.allDisposalNode)) |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
item.children = [] |
|
||||||
this.allDisposalNodeChild.forEach(i => { |
|
||||||
if(i.parentId == item.id){ |
|
||||||
item.children.push(i) |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
// console.log(this.nodeItem.id)
|
|
||||||
} |
|
||||||
onNoClick(): void { |
|
||||||
this.dialogRef.close(); |
|
||||||
} |
|
||||||
nodeItem |
|
||||||
itemChildNum = 0 //点击处置节点子数据节点的数量
|
|
||||||
clickNode(item){ |
|
||||||
// console.log(item)
|
|
||||||
this.nodeItem = item |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
if(item.id == this.nodeItem.id){ |
|
||||||
this.itemChildNum = item.children.length |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
|
|
||||||
selectedBuildingData = this.data.selectedBuildingData |
|
||||||
selectedSiteData = this.data.selectedSiteData |
|
||||||
onSubmit(value,type){ |
|
||||||
// console.log(type)
|
|
||||||
let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name |
|
||||||
//如果保存到已有节点
|
|
||||||
var postdata = { |
|
||||||
id: "", |
|
||||||
name: name, |
|
||||||
level: 0, |
|
||||||
order: this.itemChildNum, |
|
||||||
description: "", |
|
||||||
notes: "", |
|
||||||
weather: null, |
|
||||||
airTemperature: null, |
|
||||||
windDirection: null, |
|
||||||
windScale: null, |
|
||||||
imageNames: null, |
|
||||||
imageUrls: null, |
|
||||||
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
||||||
disasterId: this.data.disasterId, |
|
||||||
planComponentId: sessionStorage.getItem('planId') || '', |
|
||||||
companyId: this.data.siteOrbuilding == -1 ? sessionStorage.getItem('companyId') : null, |
|
||||||
sitePlanId: this.data.siteOrbuilding==-1 ? this.selectedSiteData.id : null, |
|
||||||
buildingId: this.selectedBuildingData.id || null, |
|
||||||
buildingAreaId: this.data.siteOrbuilding!=-1 ? this.selectedSiteData.id : null |
|
||||||
} |
|
||||||
if(type == 'old'){ |
|
||||||
let istrue = this.canvasData.findDisposalNode(this.nodeItem.id,name) |
|
||||||
let putdata = this.nodeItem |
|
||||||
putdata.weather = this.canvasData.selectPanelPointBaseData.weather |
|
||||||
putdata.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) |
|
||||||
putdata.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
|
|
||||||
putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
|
|
||||||
putdata.description = this.canvasData.selectPanelPointBaseData.description |
|
||||||
putdata.notes = this.canvasData.selectPanelPointBaseData.notes |
|
||||||
|
|
||||||
|
|
||||||
if(istrue){//如果该处置节点下已有同名数据节点 则只修改 2个接口
|
|
||||||
new Promise((resolve,reject)=>{ |
|
||||||
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { |
|
||||||
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") |
|
||||||
}) |
|
||||||
}).then((values)=>{ |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
// 保存平面图数据到当前节点
|
|
||||||
let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
|
|
||||||
postdata.Data = JSON.stringify(postdata.Data) |
|
||||||
this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
}) |
|
||||||
|
|
||||||
}else{//需要3个接口
|
|
||||||
new Promise((resolve,reject)=>{ |
|
||||||
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { |
|
||||||
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") |
|
||||||
}) |
|
||||||
}).then((values)=>{ |
|
||||||
// console.log(values)
|
|
||||||
postdata.level = putdata.level + 1
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
this.http.post(`/api/DisposalNodes`,postdata).subscribe(data => { |
|
||||||
resolve(data) |
|
||||||
}) |
|
||||||
}).then((data:any)=>{ |
|
||||||
// console.log(7788,data)
|
|
||||||
let objData = { |
|
||||||
id: "", |
|
||||||
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
||||||
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
||||||
disposalNodeId: data.id, |
|
||||||
planComponentId: sessionStorage.getItem("planId"), |
|
||||||
} |
|
||||||
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage('send a message');//发布一条消息
|
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
|
|
||||||
}else{//如果保存到新建节点
|
|
||||||
let dispositionNodeData //处置节点data
|
|
||||||
let order |
|
||||||
let oneLevelNum = [] |
|
||||||
//将order赋值为所有一级节点最后一个+1
|
|
||||||
this.allDisposalNode.forEach(item => { |
|
||||||
if(!item.parentId){ |
|
||||||
oneLevelNum.push(item) |
|
||||||
} |
|
||||||
}) |
|
||||||
if(oneLevelNum.length == 0){ |
|
||||||
order = 0 |
|
||||||
}else{ |
|
||||||
order = oneLevelNum[oneLevelNum.length - 1].order + 1 |
|
||||||
} |
|
||||||
|
|
||||||
if(this.nodeItem){//如果点击了下拉选择框
|
|
||||||
if(this.nodeItem.id != null){ |
|
||||||
this.allDisposalNodeChild.forEach(item => { |
|
||||||
if(item.id == this.nodeItem.id){ |
|
||||||
order = item.children.length |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
dispositionNodeData = { |
|
||||||
id: "", |
|
||||||
name: value.name, |
|
||||||
level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, |
|
||||||
order: order, |
|
||||||
description: "", |
|
||||||
notes: "", |
|
||||||
weather: null, |
|
||||||
airTemperature: 0, |
|
||||||
windDirection: 0, |
|
||||||
windScale: 0, |
|
||||||
imageNames: null, |
|
||||||
imageUrls: null, |
|
||||||
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
||||||
disasterId: this.data.disasterId, |
|
||||||
planComponentId: sessionStorage.getItem('planId') || '', |
|
||||||
companyId: null, |
|
||||||
sitePlanId: null, |
|
||||||
buildingId: null, |
|
||||||
buildingAreaId: null |
|
||||||
} |
|
||||||
|
|
||||||
dispositionNodeData.weather = this.canvasData.selectPanelPointBaseData.weather |
|
||||||
dispositionNodeData.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) |
|
||||||
dispositionNodeData.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
|
|
||||||
dispositionNodeData.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
|
|
||||||
dispositionNodeData.description = this.canvasData.selectPanelPointBaseData.description |
|
||||||
dispositionNodeData.notes = this.canvasData.selectPanelPointBaseData.notes |
|
||||||
//1.先创建一个处置节点 然后 .then 2.创建数据节点到刚创建的处置节点 3.然后拿着创建好的数据节点的id 将平面图data保存
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
this.http.post("/api/DisposalNodes",dispositionNodeData).subscribe((data:any) => { |
|
||||||
resolve(data.id) |
|
||||||
}) |
|
||||||
}).then((id) => { |
|
||||||
let dataNodeData
|
|
||||||
new Promise((resolve,reject) => { |
|
||||||
postdata.parentId = id |
|
||||||
postdata.level = dispositionNodeData.level + 1 |
|
||||||
this.http.post("/api/DisposalNodes",postdata).subscribe((data:any) => { |
|
||||||
resolve(data) |
|
||||||
}) |
|
||||||
}).then((data:any) => { |
|
||||||
// 保存平面图数据到当前节点
|
|
||||||
// console.log(6666,data)
|
|
||||||
// let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
|
|
||||||
// postdata.Data = JSON.stringify(postdata.Data)
|
|
||||||
let objData = { |
|
||||||
id: "", |
|
||||||
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
||||||
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
||||||
disposalNodeId: data.id, |
|
||||||
planComponentId: sessionStorage.getItem("planId"), |
|
||||||
} |
|
||||||
|
|
||||||
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存成功','确定',config) |
|
||||||
|
|
||||||
},err=>{ |
|
||||||
const config = new MatSnackBarConfig(); |
|
||||||
config.verticalPosition = 'top'; |
|
||||||
config.duration = 3000 |
|
||||||
this.snackBar.open('保存失败','确定',config) |
|
||||||
}) |
|
||||||
this.dialogRef.close(); |
|
||||||
this.canvasData.sendMessage("send a message") |
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
<div mat-dialog-title>处置节点保存</div> |
|
||||||
<div style="display: flex;"> |
|
||||||
<button mat-stroked-button style="margin-right: 5px;" (click)="saveType('new')">新建节点并保存</button> |
|
||||||
<button mat-stroked-button (click)="saveType('old')">保存到已有节点</button> |
|
||||||
</div> |
|
@ -1,53 +0,0 @@ |
|||||||
<div *ngIf="type == 'new'"> |
|
||||||
<div mat-dialog-title>新增节点</div> |
|
||||||
<div> |
|
||||||
<form (ngSubmit)="onSubmit(form.value,'new')" #form="ngForm" class="example-container"> |
|
||||||
|
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<input type="text" matInput ngModel |
|
||||||
required name="name" placeholder="节点名称" autocomplete="off"> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<mat-select [(value)]="allRootDisposalNode[0].name" required placeholder="父节点名称"> |
|
||||||
<mat-option *ngFor="let item of allRootDisposalNode" [value]="item.name" (click)="clickNode(item)"> |
|
||||||
{{item.name}} |
|
||||||
</mat-option> |
|
||||||
</mat-select> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-actions> |
|
||||||
<button mat-raised-button color="primary" type="submit" |
|
||||||
[disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
</form> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div *ngIf="type == 'old'"> |
|
||||||
<div mat-dialog-title>保存到已有节点</div> |
|
||||||
<div> |
|
||||||
<form (ngSubmit)="onSubmit(form.value,'old')" #form="ngForm" class="example-container"> |
|
||||||
<div mat-dialog-content> |
|
||||||
<mat-form-field> |
|
||||||
<mat-select required ngModel placeholder="父节点名称" name="nodeId"> |
|
||||||
<mat-option *ngFor="let item of allPlanDisposalNode" [value]="item.id" (click)="clickNode(item)"> |
|
||||||
{{item.name}} |
|
||||||
</mat-option> |
|
||||||
</mat-select> |
|
||||||
</mat-form-field> |
|
||||||
</div> |
|
||||||
<div mat-dialog-actions> |
|
||||||
<button mat-raised-button color="primary" type="submit" |
|
||||||
[disabled]="!form.form.valid"> |
|
||||||
确定 |
|
||||||
</button> |
|
||||||
<button mat-raised-button mat-dialog-close>取消</button> |
|
||||||
</div> |
|
||||||
</form> |
|
||||||
</div> |
|
||||||
</div> |
|
@ -1,24 +0,0 @@ |
|||||||
<div style="position: relative;width: 1400px;height: 800px;line-height: 800px;" class="swiper-container"> |
|
||||||
<div style="position: absolute;right: -2px;top: -392px;cursor: pointer;z-index: 999;width: 24px;height: 24px;" (click)="closeDialog()"> |
|
||||||
<span><mat-icon>clear</mat-icon></span> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="swiper-wrapper"> |
|
||||||
<div class="swiper-slide" style="text-align: center;" *ngFor="let img of imagesArr"> |
|
||||||
<img id="bigimg" (mousewheel)="zoomimg($event)" style=" |
|
||||||
max-width: 96%; |
|
||||||
max-height: 100%; |
|
||||||
min-width: 1px; |
|
||||||
min-height: 1px; |
|
||||||
position: absolute; |
|
||||||
top: 0; |
|
||||||
left: 0; |
|
||||||
bottom: 0; |
|
||||||
right: 0; |
|
||||||
margin: auto;" [src]="img.PropertyValue" alt=""> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<!-- 如果需要导航按钮 --> |
|
||||||
<div class="swiper-button-next"></div> |
|
||||||
<div class="swiper-button-prev"></div> |
|
||||||
</div> |
|
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 506 B |
Loading…
Reference in new issue