From e5017fbc3d7a605baf2fbd97dbff7a035870acc1 Mon Sep 17 00:00:00 2001
From: cpf <1105965053@qq.com>
Date: Mon, 8 Feb 2021 10:24:15 +0800
Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E5=BA=95=E5=9B=BE10MB=E9=99=90=E5=88=B6,=20=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E5=BA=95=E5=9B=BE=E5=AE=BD=E9=AB=98=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ui/collection-tools/addPlaneFigure.html | 2 +-
.../collection-tools.component.ts | 74 ++++++++++++-------
.../ui/collection-tools/editPlaneFigure.html | 13 +++-
.../collection-tools/leftFunctionalDomain.ts | 49 +++++++++++-
src/app/ui/collection-tools/panel.scss | 11 ++-
5 files changed, 116 insertions(+), 33 deletions(-)
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键可浏览图片效果
+
+