From de7b40333d3dc0c0b7d7c00d5e07c4ae8eb024fe Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 16:21:04 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=BF=9D=E5=AD=98=E8=80=83?= =?UTF-8?q?=E7=94=9F=E5=B9=B3=E9=9D=A2=E5=9B=BE=E7=B4=A0=E6=9D=90=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.ts | 131 +++++------------- 1 file changed, 37 insertions(+), 94 deletions(-) diff --git a/src/app/ui/collection-tools-examinee/collection-tools.component.ts b/src/app/ui/collection-tools-examinee/collection-tools.component.ts index 0bebc6e..6110f20 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/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