Browse Source

[完善]完善保存处置节点接口

master
邵佳豪 4 years ago
parent
commit
beaa0f7b57
  1. 4
      src/app/examiner/create-test-score/create-test-score.component.ts
  2. 242
      src/app/ui/collection-tools/collection-tools.component.ts
  3. 24
      src/app/ui/collection-tools/save.ts

4
src/app/examiner/create-test-score/create-test-score.component.ts

@ -1220,7 +1220,7 @@ export class AddPlanTwoDialog {
sessionStorage.setItem('planId',this.selectedRadioData.id)
sessionStorage.setItem('buildingTypeId',this.data.companyData.companyData.buildingTypes[0].id)
sessionStorage.setItem('companyId',this.data.companyData.companyData.id)
window.open('/canvasTool?openType=2')
window.open('/canvasTool?openType=1')
}else{
if(this.dataSource.length == 0){
this.dialogRef.close();
@ -1254,7 +1254,7 @@ export class AddPlanTwoDialog {
sessionStorage.setItem("companyId",this.data.companyData.companyData.id)
sessionStorage.setItem("buildingTypeId",this.data.companyData.companyData.buildingTypes[0].id)
sessionStorage.setItem("editable","1")
window.open('/canvasTool?openType=1')
window.open('/canvasTool?openType=2')
})
}
}

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

@ -739,247 +739,11 @@ export class CollectionToolsComponent implements OnInit {
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => {
if(element.PropertyName == "方向"){
adjoinArr.push(element.PropertyValue)
}
});
}
}
if((new Set(adjoinArr)).size != adjoinArr.length){
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
return false
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//保存建筑数据
this.http.post("/api/CompanyData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
})
}else{ //如果是建筑
//建筑平面图数据
this.http.post("/api/BuildingAreaData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存建筑毗邻
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo()
this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
})
//批量保存建筑重点部位
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations()
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
})
//批量保存建筑消防设施素材
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo()
this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
})
}
}
return true
}else{//如果是想定作业编辑模式
const dialogRef = this.dialog.open(saveOneDialog, {
data: {allDisposalNode: this.canvasData.allDisposalNode,
data: {
allDisposalNode: this.canvasData.allDisposalNode,
selectedBuildingData:this.beforeOneCheckedBuilding,
selectedSiteData:this.selectingSitePlan,
siteOrbuilding:this.checkedBuildingIndex,

24
src/app/ui/collection-tools/save.ts

@ -82,7 +82,7 @@ export class saveOneDialog {
}
})
})
// console.log(this.nodeItem.id)
}
onNoClick(): void {
this.dialogRef.close();
@ -139,15 +139,15 @@ export class saveOneDialog {
if(istrue){//如果该处置节点下已有同名数据节点 则只修改 2个接口
new Promise((resolve,reject)=>{
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => {
// this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => {
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点")
})
// })
}).then((values)=>{
this.canvasData.sendMessage('send a message');//发布一条消息
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 => {
this.http.post(`/api/ExamDisposalNodeData`,postdata).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -164,14 +164,14 @@ export class saveOneDialog {
}else{//需要3个接口
new Promise((resolve,reject)=>{
this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => {
// 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 => {
this.http.post(`/api/ExamDisposalNodes`,postdata).subscribe(data => {
resolve(data)
})
}).then((data:any)=>{
@ -183,7 +183,7 @@ export class saveOneDialog {
disposalNodeId: data.id,
planComponentId: sessionStorage.getItem("planId"),
}
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => {
this.http.post(`/api/ExamDisposalNodeData`,objData).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -255,7 +255,7 @@ export class saveOneDialog {
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) => {
this.http.post("/api/ExamDisposalNodes",dispositionNodeData).subscribe((data:any) => {
resolve(data.id)
})
}).then((id) => {
@ -264,7 +264,7 @@ export class saveOneDialog {
new Promise((resolve,reject) => {
postdata.parentId = id
postdata.level = dispositionNodeData.level + 1
this.http.post("/api/DisposalNodes",postdata).subscribe((data:any) => {
this.http.post("/api/ExamDisposalNodes",postdata).subscribe((data:any) => {
resolve(data)
})
}).then((data:any) => {
@ -280,7 +280,7 @@ export class saveOneDialog {
planComponentId: sessionStorage.getItem("planId"),
}
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => {
this.http.post(`/api/ExamDisposalNodeData`,objData).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000

Loading…
Cancel
Save