From 89f934e1603e26f498169a5fe684b8d818919c24 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Wed, 13 Jan 2021 15:28:52 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E6=A5=BC=E5=B1=82=20=E6=95=B0=E6=8D=AE=E6=B7=B7=E4=B9=B1BUG?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index f2eebc8..acddf07 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -9,6 +9,8 @@ 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'; + @Component({ selector: 'app-collection-tools', templateUrl: './collection-tools.component.html', @@ -1388,6 +1390,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() @@ -1397,7 +1408,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=>{ @@ -1414,7 +1425,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=>{