邵佳豪 4 years ago
parent
commit
6610825590
  1. 15
      src/app/ui/collection-tools/collection-tools.component.ts

15
src/app/ui/collection-tools/collection-tools.component.ts

@ -9,7 +9,9 @@ import {FlatTreeControl} from '@angular/cdk/tree';
import {WorkingAreaComponent} from '../../working-area/working-area.component'
import {CanvasShareDataService} from '../../canvas-share-data.service' //引入服务
import Viewer from 'viewerjs';
import * as ObjectID from 'bson-objectid';
import { MaskLayerService } from 'src/app/mask-layer.service';
@Component({
selector: 'app-collection-tools',
templateUrl: './collection-tools.component.html',
@ -1419,6 +1421,15 @@ export class CollectionToolsComponent implements OnInit {
//复制图层 平面图 楼层/区域
duplicateLayer (item) {
let paramsData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData.data || {} ))
Object.keys(paramsData).forEach((key)=>{
if (key != '图例') {
let ID = ObjectID.default.generate()
paramsData[key].Id = ID
paramsData[ID] = paramsData[key]
delete paramsData[key]
}
}) //图标Id重新赋值
if (this.checkedBuildingIndex==-1) { //总平面图
item.id = ""
item.modifiedTime = new Date()
@ -1428,7 +1439,7 @@ export class CollectionToolsComponent implements OnInit {
let newData = {
version: this.canvasData.originaleveryStoreyData.version || "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
sitePlanId: data.id
}
this.http.post('/api/CompanyAccount/SitePlanData',newData).subscribe(data=>{
@ -1445,7 +1456,7 @@ export class CollectionToolsComponent implements OnInit {
let newData = {
version: this.canvasData.originaleveryStoreyData.version || "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
buildingAreaId: data.id
}
this.http.post('/api/CompanyAccount/BuildingAreaData',newData).subscribe(data=>{

Loading…
Cancel
Save