|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { Component, OnInit, Inject } from '@angular/core'; |
|
|
|
|
import { Component, OnInit, Inject, ViewChild } 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'; |
|
|
|
@ -6,6 +6,7 @@ import {leftFunctionalDomainComponent,editPlaneFigureComponent} from './leftFunc
|
|
|
|
|
import Swiper from 'swiper'; |
|
|
|
|
import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; |
|
|
|
|
import {FlatTreeControl} from '@angular/cdk/tree'; |
|
|
|
|
import {WorkingAreaComponent} from '../../working-area/working-area.component' |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-collection-tools', |
|
|
|
@ -14,6 +15,7 @@ import {FlatTreeControl} from '@angular/cdk/tree';
|
|
|
|
|
}) |
|
|
|
|
export class CollectionToolsComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
@ViewChild('canvas') canvas:WorkingAreaComponent; //父组件中获得子组件的引用
|
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
// tree配置
|
|
|
|
@ -630,6 +632,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//陈鹏飞↓↓↓
|
|
|
|
|
//陈鹏飞↓↓↓
|
|
|
|
|
//陈鹏飞↓↓↓
|
|
|
|
@ -637,6 +640,9 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
companyBuildingData:any; // 单位/建筑 数据 ←消防要素/canvas使用
|
|
|
|
|
everyStoreyData:any; // 总平面图/楼层/区域 楼层数据 ←消防要素/canvas使用
|
|
|
|
|
|
|
|
|
|
originalcompanyBuildingData:any; // 原始数据 单位/建筑 数据
|
|
|
|
|
originaleveryStoreyData:any; // 原始数据 总平面图/楼层/区域
|
|
|
|
|
|
|
|
|
|
toggleExpandPanel:boolean = false; //可展开面板展开或关闭
|
|
|
|
|
togglePlane:boolean = true; //可展开面板平面图 显隐
|
|
|
|
|
toggleMaterialBank:boolean = false; //可展开面板素材库 显隐
|
|
|
|
@ -697,6 +703,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//获取 单位 数据
|
|
|
|
|
getSitePlanCompanyData () { |
|
|
|
|
this.http.get('/api/CompanyAccount/CompanyData').subscribe((data:any)=>{ |
|
|
|
|
this.originalcompanyBuildingData = JSON.parse(JSON.stringify(data || {})) //深拷贝一份 单位原数据
|
|
|
|
|
if (data) { |
|
|
|
|
this.companyBuildingData = JSON.parse(data.data) |
|
|
|
|
} else { |
|
|
|
@ -709,6 +716,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
getSitePlanStorey (e) { |
|
|
|
|
let params = {sitePlanId: e.id} |
|
|
|
|
this.http.get(`/api/CompanyAccount/SitePlanData`,{params}).subscribe((data:any)=>{ |
|
|
|
|
this.originaleveryStoreyData = JSON.parse(JSON.stringify(data || {})) //深拷贝一份 楼层原数据
|
|
|
|
|
if (data && data.data && this.companyBuildingData) { |
|
|
|
|
data.data = JSON.parse(data.data) |
|
|
|
|
for(let key in this.companyBuildingData){ |
|
|
|
@ -729,6 +737,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//获取 建筑 数据
|
|
|
|
|
getBuildingData (e) { |
|
|
|
|
this.http.get(`/api/CompanyAccount/BuildingData`,{params:e}).subscribe((data:any)=>{ |
|
|
|
|
this.originalcompanyBuildingData = JSON.parse(JSON.stringify(data || {})) //深拷贝一份 建筑原数据
|
|
|
|
|
if (data) { |
|
|
|
|
this.companyBuildingData = JSON.parse(data.data) |
|
|
|
|
} else { |
|
|
|
@ -741,6 +750,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
getBuildingStorey (e) { |
|
|
|
|
let params = {buildingAreaId: e.id} |
|
|
|
|
this.http.get(`/api/CompanyAccount/BuildingAreaData`,{params}).subscribe((data:any)=>{ |
|
|
|
|
this.originaleveryStoreyData = JSON.parse(JSON.stringify(data || {})) //深拷贝一份 楼层原数据
|
|
|
|
|
if (data && data.data && this.companyBuildingData) { |
|
|
|
|
data.data = JSON.parse(data.data) |
|
|
|
|
for(let key in this.companyBuildingData){ |
|
|
|
@ -888,7 +898,41 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//复制图层 平面图 楼层/区域
|
|
|
|
|
duplicateLayer (item) { |
|
|
|
|
console.log('复制',item) |
|
|
|
|
if (this.checkedBuildingIndex==-1) { //总平面图
|
|
|
|
|
item.id = "" |
|
|
|
|
item.modifiedTime = new Date() |
|
|
|
|
item.name = item.name + '(副本)' |
|
|
|
|
item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 |
|
|
|
|
this.http.post('/api/CompanyAccount/SitePlans',item).subscribe((data:any)=>{ |
|
|
|
|
let newData = { |
|
|
|
|
version: this.originaleveryStoreyData.version || "1.0", |
|
|
|
|
id: "", |
|
|
|
|
data: this.originaleveryStoreyData.data || null, |
|
|
|
|
sitePlanId: data.id |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/CompanyAccount/SitePlanData',newData).subscribe(data=>{ |
|
|
|
|
this.renovateSitePlan() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} else { //楼层/区域
|
|
|
|
|
item.id = "" |
|
|
|
|
item.modifiedTime = new Date() |
|
|
|
|
item.name = item.name + '(副本)' |
|
|
|
|
item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 |
|
|
|
|
this.http.post('/api/CompanyAccount/BuildingAreas',item).subscribe((data:any)=>{ |
|
|
|
|
let newData = { |
|
|
|
|
version: this.originaleveryStoreyData.version || "1.0", |
|
|
|
|
id: "", |
|
|
|
|
data: this.originaleveryStoreyData.data || null, |
|
|
|
|
buildingAreaId: data.id |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/CompanyAccount/BuildingAreaData',newData).subscribe(data=>{ |
|
|
|
|
this.renovateBuilding() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//平面图 楼层/区域 替换底图
|
|
|
|
@ -995,6 +1039,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.selectLibrary = item.name |
|
|
|
|
this.selectImage = items |
|
|
|
|
this.selectImageIndex = index |
|
|
|
|
this.canvas.beginPaintSinglePointIcon(items.imageUrl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|