|
|
|
@ -2,6 +2,8 @@ import { Component, OnInit, Inject } from '@angular/core';
|
|
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
import { CanvasShareDataService } from 'src/app/canvas-share-data.service'; |
|
|
|
|
import { EventManager } from '@angular/platform-browser'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-leftFunctionalDomain', |
|
|
|
@ -25,7 +27,7 @@ export class leftFunctionalDomainComponent implements OnInit {
|
|
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
|
name: e.name, |
|
|
|
|
order: this.data.order, |
|
|
|
|
area:e.area, |
|
|
|
|
area:Number(e.area), |
|
|
|
|
details:e.details, |
|
|
|
|
enabled: true, |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
@ -39,7 +41,7 @@ export class leftFunctionalDomainComponent implements OnInit {
|
|
|
|
|
buildingId: this.data.Panel.id, |
|
|
|
|
name: e.name, |
|
|
|
|
order: this.data.order, |
|
|
|
|
area:e.area, |
|
|
|
|
area:Number(e.area), |
|
|
|
|
details:e.details, |
|
|
|
|
enabled: true, |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
@ -62,13 +64,22 @@ export class leftFunctionalDomainComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
export class editPlaneFigureComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<any>,@Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<any>,@Inject(MAT_DIALOG_DATA) public data,public canvasData: CanvasShareDataService,private eventManager: EventManager,) { } |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.name = this.data.buildingData.name || '' |
|
|
|
|
this.checked = this.data.buildingData.isRefugeStorey || false |
|
|
|
|
this.area = this.data.buildingData.area || 0 |
|
|
|
|
this.details = this.data.buildingData.details || '' |
|
|
|
|
this.imgWidth = this.data.buildingData.imageWidth || 0 |
|
|
|
|
this.imgHeight = this.data.buildingData.imageHeight || 0 |
|
|
|
|
this.imgScale = Number((this.imgWidth/this.imgHeight)) |
|
|
|
|
|
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { |
|
|
|
|
if (event.keyCode === 13) { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
name:any; //name
|
|
|
|
@ -76,6 +87,34 @@ export class editPlaneFigureComponent implements OnInit {
|
|
|
|
|
area:number; //面积
|
|
|
|
|
details:string; //详情
|
|
|
|
|
|
|
|
|
|
imgWidth:number; //图片宽度
|
|
|
|
|
imgHeight:number; //图片高度
|
|
|
|
|
isItEqual:boolean = true; //是否等比
|
|
|
|
|
imgScale:number; //图片 宽高比例
|
|
|
|
|
|
|
|
|
|
//图片 宽高变化时
|
|
|
|
|
inputChange (e) { |
|
|
|
|
if (this.isItEqual) { |
|
|
|
|
if (e == 0) { //需要改高度
|
|
|
|
|
this.imgHeight = Math.round(this.imgWidth / this.imgScale) |
|
|
|
|
this.canvasData.selectStorey.imageWidth = this.imgWidth |
|
|
|
|
this.canvasData.selectStorey.imageHeight = this.imgHeight |
|
|
|
|
} else { //需要改宽度
|
|
|
|
|
this.imgWidth = Math.round(this.imgHeight * this.imgScale) |
|
|
|
|
this.canvasData.selectStorey.imageWidth = this.imgWidth |
|
|
|
|
this.canvasData.selectStorey.imageHeight = this.imgHeight |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.canvasData.selectStorey.imageWidth = this.imgWidth |
|
|
|
|
this.canvasData.selectStorey.imageHeight = this.imgHeight |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//重新计算 宽高比例
|
|
|
|
|
setImgScale (e) { |
|
|
|
|
e.checked? this.imgScale = Number((this.imgWidth/this.imgHeight)) : null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//提交表单修改平面图
|
|
|
|
|
onSubmit (e) { |
|
|
|
|
if (!this.data.isBuilding) { //总平面图 修改平面图
|
|
|
|
@ -85,6 +124,8 @@ export class editPlaneFigureComponent implements OnInit {
|
|
|
|
|
name: e.name, |
|
|
|
|
cadUrl: this.data.buildingData.cadUrl, |
|
|
|
|
imageUrl: this.data.buildingData.imageUrl, |
|
|
|
|
imageWidth: this.imgWidth, |
|
|
|
|
imageHeight: this.imgHeight, |
|
|
|
|
imageAngle: this.data.buildingData.imageAngle, |
|
|
|
|
order: this.data.buildingData.order, |
|
|
|
|
area:e.area, |
|
|
|
@ -103,6 +144,8 @@ export class editPlaneFigureComponent implements OnInit {
|
|
|
|
|
name: e.name, |
|
|
|
|
cadUrl: this.data.buildingData.cadUrl, |
|
|
|
|
imageUrl: this.data.buildingData.imageUrl, |
|
|
|
|
imageWidth: this.imgWidth, |
|
|
|
|
imageHeight: this.imgHeight, |
|
|
|
|
imageAngle: this.data.buildingData.imageAngle, |
|
|
|
|
order: this.data.buildingData.order, |
|
|
|
|
area:e.area, |
|
|
|
|