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

Loading…
Cancel
Save