diff --git a/src/app/ui/collection-tools/addPlaneFigure.html b/src/app/ui/collection-tools/addPlaneFigure.html index 930bf81..75e4722 100644 --- a/src/app/ui/collection-tools/addPlaneFigure.html +++ b/src/app/ui/collection-tools/addPlaneFigure.html @@ -18,7 +18,7 @@
- +
diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index a88ea02..52ec061 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -1434,12 +1434,23 @@ export class CollectionToolsComponent implements OnInit { Panel: this.beforeOneCheckedBuilding, buildingData: e, } - let dialogRef = this.dialog.open(editPlaneFigureComponent,{data}); + let dialogRef = this.dialog.open(editPlaneFigureComponent,{disableClose: true,hasBackdrop: false,position: {left:'150px',top:'200px'},data}); + dialogRef.keydownEvents().subscribe(data=>{ + if (data.key === 'Enter') { + this.canvas.refreshBackgroundImage() + } + }) dialogRef.afterClosed().subscribe(data=>{ if (data =='总平面图') { - this.renovateSitePlan() + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) } else if (data =='建筑') { - this.renovateBuilding() + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) } }) } @@ -1632,46 +1643,57 @@ export class CollectionToolsComponent implements OnInit { let file = e.target.files[0] || null //获取上传的文件 let fileSize = file.size || null //上传文件的总大小 let maxSize = 5 * 1024 * 1024 //5MB一个分片 + let tenSize = 10 * 1024 * 1024 //10MB限制 if (file && fileSize<=maxSize) { //上传文件<=5MB时 let formData = new FormData() formData.append("file",file) this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ - this.renovateBaseMap(data.objectName,item) + this.renovateBaseMap('/api/Objects/WebPlan2D/' + data.objectName,item) }) + } else if (file && fileSize>maxSize && fileSize10MB时 + let upload = this.canvasData.sectionUpload(sessionStorage.getItem('companyId'),file) + upload.then(res=>{ this.renovateBaseMap('/api/Objects/PlanPlatform/' + res,item) }) } else { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - this.snackBar.open('上传底图需小于5MB','确定',config); + this.snackBar.open('上传底图需小于10MB','确定',config); } } //封装 替换底图 function renovateBaseMap (e,item) { - item.imageUrl = '/api/Objects/WebPlan2D/' + e - if (this.checkedBuildingIndex ==-1) { //总平面图 - this.http.put(`/api/CompanyAccount/SitePlans/${item.id}`,item).subscribe(data=>{ - let isSuccess = this.renovateSitePlan() - isSuccess.then(res=>{ - this.canvas.refreshBackgroundImage() + let that = this + let img = new Image() + img.src = e + img.onload = function () { + item.imageUrl = e + item.imageWidth = img.width + item.imageHeight = img.height + if (that.checkedBuildingIndex ==-1) { //总平面图 + that.http.put(`/api/CompanyAccount/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = that.renovateSitePlan() + isSuccess.then(res=>{ + that.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + that.snackBar.open('上传底图成功','确定',config); }) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('上传底图成功','确定',config); - }) - } else { //楼层/区域 - this.http.put(`/api/CompanyAccount/BuildingAreas/${item.id}`,item).subscribe(data=>{ - let isSuccess = this.renovateBuilding() - isSuccess.then(res=>{ - this.canvas.refreshBackgroundImage() + } else { //楼层/区域 + that.http.put(`/api/CompanyAccount/BuildingAreas/${item.id}`,item).subscribe(data=>{ + let isSuccess = that.renovateBuilding() + isSuccess.then(res=>{ + that.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + that.snackBar.open('上传底图成功','确定',config); }) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('上传底图成功','确定',config); - }) + } } } diff --git a/src/app/ui/collection-tools/editPlaneFigure.html b/src/app/ui/collection-tools/editPlaneFigure.html index a0f8016..bab09da 100644 --- a/src/app/ui/collection-tools/editPlaneFigure.html +++ b/src/app/ui/collection-tools/editPlaneFigure.html @@ -19,7 +19,7 @@
- +
@@ -27,6 +27,17 @@ +
+ + + + + + + +

按Enter键可浏览图片效果

+
+