Browse Source

[完善]保存考生平面图素材接口

master
邵佳豪 4 years ago
parent
commit
de7b40333d
  1. 131
      src/app/ui/collection-tools-examinee/collection-tools.component.ts

131
src/app/ui/collection-tools-examinee/collection-tools.component.ts

@ -472,6 +472,7 @@ export class CollectionToolsExamineeComponent implements OnInit {
getAllAssetLibraries(Facilitiesitem){ getAllAssetLibraries(Facilitiesitem){
this.canvasData.hiddenBasicInfoFacilities = Facilitiesitem.children this.canvasData.hiddenBasicInfoFacilities = Facilitiesitem.children
// this.canvas.processinghiddenData()
console.log(1314,this.canvasData.hiddenBasicInfoFacilities) console.log(1314,this.canvasData.hiddenBasicInfoFacilities)
this.basicAssetLibraries = [] this.basicAssetLibraries = []
this.http.get('/api/AssetLibraries').subscribe(async(data:any) => { this.http.get('/api/AssetLibraries').subscribe(async(data:any) => {
@ -572,112 +573,53 @@ export class CollectionToolsExamineeComponent implements OnInit {
//保存平面图 //保存平面图
saveNum :any = [] saveNum :any = []
saveSite(){ async saveSite(){
if (this.selectingSitePlan && this.selectingSitePlan.id) { if (this.selectingSitePlan && this.selectingSitePlan.id) {
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.examOriginaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data) SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); SitePlanData.examinationId = this.route.snapshot.queryParams.examId
CompanyData.data = JSON.stringify(CompanyData.data) SitePlanData.planComponentId = this.route.snapshot.queryParams.planComponentId
let object = this.canvasData.originalcompanyBuildingData.data //如果是单位 总平面图
let adjoinArr = [] //毗邻数组 if(this.checkedBuildingIndex==-1){
//保存平面图数据
if(this.pattern){//如果是基本信息编辑模式 SitePlanData.sitePlanId = this.selectingSitePlan.id
//如果是单位 总平面图 await new Promise((resolve,reject)=>{
if(this.checkedBuildingIndex==-1){ this.http.post("/api/ExamSitePlanData",SitePlanData,{
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
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 => {
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:{ params:{
companyId:this.params.companyId companyId:this.params.companyId
} }
}).subscribe(data => { }).subscribe(data => {
if(this.saveNum.length == 5){ console.log('保存基本素材成功')
this.canvasData.isChange = false resolve()
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{ },err=>{
let config = new MatSnackBarConfig(); console.log('保存基本素材失败')
config.verticalPosition = 'top'; resolve()
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
}) })
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
}else{ //如果是建筑
SitePlanData.buildingAreaId = this.selectingSitePlan.id
//建筑平面图数据
await new Promise((resolve,reject)=>{
this.http.post("/api/ExamBuildingAreaData",SitePlanData,{
params:{ params:{
companyId:this.params.companyId companyId:this.params.companyId
} }
}).subscribe(data => { }).subscribe(data => {
if(this.saveNum.length == 5){ console.log('保存基本素材成功')
this.canvasData.isChange = false resolve()
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{ },err=>{
let config = new MatSnackBarConfig(); console.log('保存基本素材失败')
config.verticalPosition = 'top'; resolve()
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
}) })
})
} }
return true
}else{//如果是想定作业编辑模式
console.log(this.canvasData.examOriginaleveryStoreyData) console.log(this.canvasData.examOriginaleveryStoreyData)
console.log(this.canvasData.originalcompanyBuildingData)
const dialogRef = this.dialog.open(saveOneDialogExaminee, { const dialogRef = this.dialog.open(saveOneDialogExaminee, {
data: { data: {
allDisposalNode: this.canvasData.allDisposalNode, allDisposalNode: this.canvasData.allDisposalNode,
@ -691,7 +633,7 @@ export class CollectionToolsExamineeComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed'); console.log('The dialog was closed');
}); });
}
} else { //if } else { //if
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
@ -1098,8 +1040,9 @@ export class CollectionToolsExamineeComponent implements OnInit {
examinationId : this.route.snapshot.queryParams.examId, examinationId : this.route.snapshot.queryParams.examId,
planComponentId : this.route.snapshot.queryParams.planComponentId planComponentId : this.route.snapshot.queryParams.planComponentId
} }
this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data:any)=>{ this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data2:any)=>{
this.canvasData.examOriginaleveryStoreyData = data || {} // 楼层原数据 console.log('cnm',data2)
this.canvasData.examOriginaleveryStoreyData = data2 || {} // 楼层原数据
this.canvasData.examOriginaleveryStoreyData.data? this.canvasData.examOriginaleveryStoreyData.data = JSON.parse(this.canvasData.examOriginaleveryStoreyData.data) : this.canvasData.examOriginaleveryStoreyData.data = {} this.canvasData.examOriginaleveryStoreyData.data? this.canvasData.examOriginaleveryStoreyData.data = JSON.parse(this.canvasData.examOriginaleveryStoreyData.data) : this.canvasData.examOriginaleveryStoreyData.data = {}
this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0" this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0"
this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null

Loading…
Cancel
Save