|
|
|
@ -2,303 +2,305 @@ 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' //引入服务
|
|
|
|
|
import { CanvasShareDataService, DisposalNodeData } from '../../canvas-share-data.service' //引入服务
|
|
|
|
|
// 保存想定作业第一个弹窗
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'dialog-overview-example-dialog', |
|
|
|
|
templateUrl: 'saveOne.html', |
|
|
|
|
styleUrls: ['./collection-tools.component.scss'] |
|
|
|
|
selector: 'dialog-overview-example-dialog', |
|
|
|
|
templateUrl: 'saveOne.html', |
|
|
|
|
styleUrls: ['./collection-tools.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class saveOneDialog { |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private http:HttpClient, |
|
|
|
|
public dialog: MatDialog, |
|
|
|
|
public snackBar: MatSnackBar, |
|
|
|
|
public dialogRef: MatDialogRef<saveOneDialog>, |
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) {} |
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
public dialog: MatDialog, |
|
|
|
|
public snackBar: MatSnackBar, |
|
|
|
|
public dialogRef: MatDialogRef<saveOneDialog>, |
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
|
|
|
|
|
onNoClick(): void { |
|
|
|
|
this.dialogRef.close() |
|
|
|
|
} |
|
|
|
|
allDisposalNode = this.data.allDisposalNode |
|
|
|
|
onNoClick(): void { |
|
|
|
|
this.dialogRef.close() |
|
|
|
|
} |
|
|
|
|
allDisposalNode = this.data.allDisposalNode |
|
|
|
|
|
|
|
|
|
saveType(type){ |
|
|
|
|
this.dialogRef.close() |
|
|
|
|
const dialogRef = this.dialog.open(saveTwoDialog, { |
|
|
|
|
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 => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
saveType(type) { |
|
|
|
|
this.dialogRef.close() |
|
|
|
|
const dialogRef = this.dialog.open(saveTwoDialog, { |
|
|
|
|
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'] |
|
|
|
|
selector: 'dialog-overview-example-dialog', |
|
|
|
|
templateUrl: 'saveTwo.html', |
|
|
|
|
styleUrls: ['./collection-tools.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class saveTwoDialog { |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private http:HttpClient, |
|
|
|
|
public dialogRef: MatDialogRef<saveTwoDialog>, |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
export class saveTwoDialog { |
|
|
|
|
|
|
|
|
|
//所有一级节点
|
|
|
|
|
this.allDisposalNode.forEach(item => { |
|
|
|
|
if(!item.parentId){ |
|
|
|
|
this.allRootDisposalNode.push(item) |
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
public dialogRef: MatDialogRef<saveTwoDialog>, |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
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, |
|
|
|
|
examDisasterId: this.data.disasterId, |
|
|
|
|
ExamPlanComponentId: 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, |
|
|
|
|
disposalNodeType: 0 |
|
|
|
|
} |
|
|
|
|
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 |
|
|
|
|
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/ExamDisposalNodeData`, 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/ExamDisposalNodes`, 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", |
|
|
|
|
ExamDisposalNodeId: data.id, |
|
|
|
|
ExamPlanComponentId: sessionStorage.getItem("planId"), |
|
|
|
|
} |
|
|
|
|
this.http.post(`/api/ExamDisposalNodeData`, 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 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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: "", |
|
|
|
|
if (this.nodeItem) {//如果点击了下拉选择框
|
|
|
|
|
if (this.nodeItem.id != null) { |
|
|
|
|
this.allDisposalNodeChild.forEach(item => { |
|
|
|
|
if (item.id == this.nodeItem.id) { |
|
|
|
|
order = item.children.length |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dispositionNodeData = { |
|
|
|
|
id: null, |
|
|
|
|
name: value.name, |
|
|
|
|
level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, |
|
|
|
|
order: order, |
|
|
|
|
description: null, |
|
|
|
|
notes: null, |
|
|
|
|
weather: null, |
|
|
|
|
airTemperature: null, |
|
|
|
|
windDirection: null, |
|
|
|
|
windScale: null, |
|
|
|
|
airTemperature: 0, |
|
|
|
|
windDirection: 0, |
|
|
|
|
windScale: 0, |
|
|
|
|
imageNames: null, |
|
|
|
|
imageUrls: null, |
|
|
|
|
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
|
|
|
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
|
|
|
examDisasterId: this.data.disasterId, |
|
|
|
|
ExamPlanComponentId: 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, |
|
|
|
|
disposalNodeType:0 |
|
|
|
|
companyId: null, |
|
|
|
|
sitePlanId: null, |
|
|
|
|
buildingId: null, |
|
|
|
|
buildingAreaId: null, |
|
|
|
|
disposalNodeType: 0 |
|
|
|
|
} |
|
|
|
|
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/ExamDisposalNodeData`,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/ExamDisposalNodes`,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", |
|
|
|
|
ExamDisposalNodeId: data.id, |
|
|
|
|
ExamPlanComponentId: sessionStorage.getItem("planId"), |
|
|
|
|
} |
|
|
|
|
this.http.post(`/api/ExamDisposalNodeData`,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) |
|
|
|
|
} |
|
|
|
|
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/ExamDisposalNodes", dispositionNodeData).subscribe((data: any) => { |
|
|
|
|
resolve(data.id) |
|
|
|
|
}) |
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}).then((id) => { |
|
|
|
|
let dataNodeData |
|
|
|
|
console.log("qnm", id) |
|
|
|
|
new Promise((resolve, reject) => { |
|
|
|
|
postdata.parentId = id |
|
|
|
|
postdata.level = dispositionNodeData.level + 1 |
|
|
|
|
this.http.post("/api/ExamDisposalNodes", 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)
|
|
|
|
|
console.log('处置素材', this.canvasData.selectPanelPoint.Data) |
|
|
|
|
let objData = { |
|
|
|
|
id: null, |
|
|
|
|
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
|
|
|
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
|
|
|
ExamDisposalNodeId: data.id, |
|
|
|
|
ExamPlanComponentId: sessionStorage.getItem("planId"), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dispositionNodeData = { |
|
|
|
|
id: null, |
|
|
|
|
name: value.name, |
|
|
|
|
level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, |
|
|
|
|
order: order, |
|
|
|
|
description: null, |
|
|
|
|
notes: null, |
|
|
|
|
weather: null, |
|
|
|
|
airTemperature: 0, |
|
|
|
|
windDirection: 0, |
|
|
|
|
windScale: 0, |
|
|
|
|
imageNames: null, |
|
|
|
|
imageUrls: null, |
|
|
|
|
parentId: this.nodeItem ? this.nodeItem.id : null, |
|
|
|
|
examDisasterId: this.data.disasterId, |
|
|
|
|
ExamPlanComponentId: sessionStorage.getItem('planId') || '', |
|
|
|
|
companyId: null, |
|
|
|
|
sitePlanId: null, |
|
|
|
|
buildingId: null, |
|
|
|
|
buildingAreaId: null, |
|
|
|
|
disposalNodeType:0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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/ExamDisposalNodes",dispositionNodeData).subscribe((data:any) => { |
|
|
|
|
resolve(data.id) |
|
|
|
|
}) |
|
|
|
|
}).then((id) => { |
|
|
|
|
let dataNodeData
|
|
|
|
|
console.log("qnm",id) |
|
|
|
|
new Promise((resolve,reject) => { |
|
|
|
|
postdata.parentId = id |
|
|
|
|
postdata.level = dispositionNodeData.level + 1 |
|
|
|
|
this.http.post("/api/ExamDisposalNodes",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)
|
|
|
|
|
console.log('处置素材',this.canvasData.selectPanelPoint.Data) |
|
|
|
|
let objData = { |
|
|
|
|
id: null, |
|
|
|
|
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, |
|
|
|
|
version: this.canvasData.selectPanelPoint.Version || "2.0", |
|
|
|
|
ExamDisposalNodeId: data.id, |
|
|
|
|
ExamPlanComponentId: sessionStorage.getItem("planId"), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.http.post(`/api/ExamDisposalNodeData`,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") |
|
|
|
|
this.http.post(`/api/ExamDisposalNodeData`, 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") |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |