|
|
@ -17,7 +17,7 @@ export class leftFunctionalDomainComponentPlan implements OnInit { |
|
|
|
public dialog: MatDialog, |
|
|
|
public dialog: MatDialog, |
|
|
|
public snackBar: MatSnackBar, |
|
|
|
public snackBar: MatSnackBar, |
|
|
|
public dialogRef: MatDialogRef<any>, |
|
|
|
public dialogRef: MatDialogRef<any>, |
|
|
|
@Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
@Inject(MAT_DIALOG_DATA) public data,public canvasData: CanvasShareDataService,) { } |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ export class leftFunctionalDomainComponentPlan implements OnInit { |
|
|
|
//选择文件
|
|
|
|
//选择文件
|
|
|
|
selectFile (e) { |
|
|
|
selectFile (e) { |
|
|
|
if (e.target.files.length) { |
|
|
|
if (e.target.files.length) { |
|
|
|
let maxSize = 5*1024*1024
|
|
|
|
let maxSize = 10*1024*1024 //10MB限制
|
|
|
|
if (e.target.files[0].size <= maxSize) { |
|
|
|
if (e.target.files[0].size <= maxSize) { |
|
|
|
this.file = e.target.files[0] |
|
|
|
this.file = e.target.files[0] |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -53,41 +53,96 @@ export class leftFunctionalDomainComponentPlan implements OnInit { |
|
|
|
//提交表单创建平面图
|
|
|
|
//提交表单创建平面图
|
|
|
|
onSubmit (e) { |
|
|
|
onSubmit (e) { |
|
|
|
if (this.file) { |
|
|
|
if (this.file) { |
|
|
|
|
|
|
|
if (this.file.size<=5*1024*1024) { //小于5MB
|
|
|
|
let formData = new FormData() |
|
|
|
let formData = new FormData() |
|
|
|
formData.append("file",this.file) |
|
|
|
formData.append("file",this.file) |
|
|
|
this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ |
|
|
|
this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ |
|
|
|
let imgURL = '/api/Objects/WebPlan2D/' + data.objectName |
|
|
|
let imgURL = '/api/Objects/WebPlan2D/' + data.objectName |
|
|
|
if (!this.data.isBuilding) { //总平面图 创建平面图
|
|
|
|
let that = this |
|
|
|
|
|
|
|
let img = new Image() |
|
|
|
|
|
|
|
img.src = imgURL |
|
|
|
|
|
|
|
img.onload = function () { |
|
|
|
|
|
|
|
if (!that.data.isBuilding) { //总平面图 创建平面图
|
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
name: e.name, |
|
|
|
name: e.name, |
|
|
|
order: this.data.order, |
|
|
|
order: that.data.order, |
|
|
|
area:Number(e.area), |
|
|
|
area:Number(e.area), |
|
|
|
details:e.details, |
|
|
|
details:e.details, |
|
|
|
enabled: true, |
|
|
|
enabled: true, |
|
|
|
modifiedTime: new Date(), |
|
|
|
modifiedTime: new Date(), |
|
|
|
imageUrl: imgURL, |
|
|
|
imageUrl: imgURL, |
|
|
|
|
|
|
|
imageWidth: img.width, |
|
|
|
|
|
|
|
imageHeight: img.height |
|
|
|
} |
|
|
|
} |
|
|
|
this.http.post('/api/SitePlans',data).subscribe(data=>{ |
|
|
|
that.http.post('/api/SitePlans',data).subscribe(data=>{ |
|
|
|
this.dialogRef.close('总平面图'); |
|
|
|
that.dialogRef.close('总平面图'); |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { //建筑 创建楼层/区域
|
|
|
|
} else { //建筑 创建楼层/区域
|
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
isRefugeStorey: e.isRefugeStorey, |
|
|
|
isRefugeStorey: e.isRefugeStorey, |
|
|
|
buildingId: this.data.Panel.id, |
|
|
|
buildingId: that.data.Panel.id, |
|
|
|
name: e.name, |
|
|
|
name: e.name, |
|
|
|
order: this.data.order, |
|
|
|
order: that.data.order, |
|
|
|
area:Number(e.area), |
|
|
|
area:Number(e.area), |
|
|
|
details:e.details, |
|
|
|
details:e.details, |
|
|
|
enabled: true, |
|
|
|
enabled: true, |
|
|
|
modifiedTime: new Date(), |
|
|
|
modifiedTime: new Date(), |
|
|
|
imageUrl: imgURL, |
|
|
|
imageUrl: imgURL, |
|
|
|
|
|
|
|
imageWidth: img.width, |
|
|
|
|
|
|
|
imageHeight: img.height |
|
|
|
} |
|
|
|
} |
|
|
|
this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{ |
|
|
|
that.http.post('/api/BuildingAreas',data,{params:that.params}).subscribe(data=>{ |
|
|
|
this.dialogRef.close('建筑'); |
|
|
|
that.dialogRef.close('建筑'); |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) //post
|
|
|
|
}) //post
|
|
|
|
|
|
|
|
} else if (this.file.size>5*1024*1024 && this.file.size<=10*1024*1024) { //大于5MB
|
|
|
|
|
|
|
|
let upload = this.canvasData.sectionUpload(sessionStorage.getItem('companyId'),this.file) |
|
|
|
|
|
|
|
upload.then(res=>{
|
|
|
|
|
|
|
|
let imgURL = '/api/Objects/PlanPlatform/' + res |
|
|
|
|
|
|
|
let that = this |
|
|
|
|
|
|
|
let img = new Image() |
|
|
|
|
|
|
|
img.src = imgURL |
|
|
|
|
|
|
|
img.onload = function () { |
|
|
|
|
|
|
|
if (!that.data.isBuilding) { //总平面图 创建平面图
|
|
|
|
|
|
|
|
let data = { |
|
|
|
|
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
|
|
|
|
name: e.name, |
|
|
|
|
|
|
|
order: that.data.order, |
|
|
|
|
|
|
|
area:Number(e.area), |
|
|
|
|
|
|
|
details:e.details, |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
|
|
|
imageUrl: imgURL, |
|
|
|
|
|
|
|
imageWidth: img.width, |
|
|
|
|
|
|
|
imageHeight: img.height |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
that.http.post('/api/SitePlans',data).subscribe(data=>{ |
|
|
|
|
|
|
|
that.dialogRef.close('总平面图'); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { //建筑 创建楼层/区域
|
|
|
|
|
|
|
|
let data = { |
|
|
|
|
|
|
|
isRefugeStorey: e.isRefugeStorey, |
|
|
|
|
|
|
|
buildingId: that.data.Panel.id, |
|
|
|
|
|
|
|
name: e.name, |
|
|
|
|
|
|
|
order: that.data.order, |
|
|
|
|
|
|
|
area:Number(e.area), |
|
|
|
|
|
|
|
details:e.details, |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
|
|
|
imageUrl: imgURL, |
|
|
|
|
|
|
|
imageWidth: img.width, |
|
|
|
|
|
|
|
imageHeight: img.height |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
that.http.post('/api/BuildingAreas',data,{params:that.params}).subscribe(data=>{ |
|
|
|
|
|
|
|
that.dialogRef.close('建筑'); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.verticalPosition = 'top'; |
|
|
|