Browse Source

[修正] 复制楼层 数据混乱BUG修正

master
陈鹏飞 4 years ago
parent
commit
f1fd74cbee
  1. 17
      src/app/ui/collection-tools/collection-tools.component.ts

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

@ -3,12 +3,14 @@ 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 {leftFunctionalDomainComponent,editPlaneFigureComponent} from './leftFunctionalDomain'
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'
import {CanvasShareDataService} from '../../canvas-share-data.service' //引入服务
import Viewer from 'viewerjs';
import Swiper from 'swiper';
import * as ObjectID from 'bson-objectid';
@Component({
selector: 'app-collection-tools',
templateUrl: './collection-tools.component.html',
@ -1402,6 +1404,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()
@ -1411,7 +1422,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=>{
@ -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,
buildingAreaId: data.id
}
this.http.post('/api/CompanyAccount/BuildingAreaData',newData).subscribe(data=>{

Loading…
Cancel
Save