Browse Source

[完善]处理建筑信息差异对比

tangshan
邵佳豪 4 years ago
parent
commit
272ae61296
  1. 4
      src/app/plan-audit/wait-examineer/wait-examineer.component.html
  2. 46
      src/app/plan-audit/wait-examineer/wait-examineer.component.ts

4
src/app/plan-audit/wait-examineer/wait-examineer.component.html

@ -188,8 +188,8 @@
</mat-panel-title>
</mat-expansion-panel-header>
<table>
<tr *ngFor="let i of item.childrens">
<th>{{i.displayName}} </th>
<tr *ngFor="let i of item.difData">
<th>{{i.path[i.path.length - 2]}}-{{i.path[i.path.length - 1]}}</th>
<td>
<span class="spantext"></span>
<span class="spantext buleColor">{{i.oldValue | differentContentTitle}}</span>

46
src/app/plan-audit/wait-examineer/wait-examineer.component.ts

@ -62,6 +62,9 @@ export class WaitExamineerComponent implements OnInit {
}
this.getAlltabledate()
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
}
planTypeIndex //平面图类型 选择是总平面图还是层平面图
@ -174,6 +177,10 @@ export class WaitExamineerComponent implements OnInit {
let differentContent = JSON.parse(this.selectedItem.differentContent)
console.log('差异信息', differentContent)
// 单位信息
this.differentContentOfUnitInfo = differentContent.filter(item => item.propertyName == 'basicInfo')
// 实景图
@ -183,9 +190,31 @@ export class WaitExamineerComponent implements OnInit {
if (differentContent.filter(item => item.propertyName == 'buildings').length != 0) {
//建筑信息
this.differentContentOfBuildingsInfo = JSON.parse(JSON.stringify(differentContent.filter(item => item.propertyName == 'buildings')[0]))
function resolveDiff(list: Array<DiffItem>, path?: Array<string>): Array<Result> {
let resultList: Array<Result> = [];
for (let i = 0; i < list.length; i++) {
if (path == null) path = [];
let item = list[i];
//递归最底层
if (!item.childrens.length) {
let res = new Result();
res.path = path.concat([item.displayName]);
res.oldValue = item.oldValue;
res.newValue = item.newValue;
resultList.push(res);
} else {
!!item.displayName && path.push(item.displayName);
let deepList = resolveDiff(item.childrens, path)
resultList = resultList.concat(deepList);
}
}
return resultList;
}
this.differentContentOfBuildingsInfo.childrens.forEach(element => {
element.childrens = element.childrens.filter(item => item.isObj == false)
element.difData = resolveDiff(element.childrens)
});
// console.log('建筑信息', this.differentContentOfBuildingsInfo
//功能分区
let differentContentOfFunction = JSON.parse(JSON.stringify(differentContent.filter(item => item.propertyName == 'buildings')[0]))
this.differentContentOfFunction = []
@ -800,3 +829,18 @@ export class remark {
}
}
}
class DiffItem {
newValue: any
oldValue: any
childrens: Array<DiffItem>
operation: number
displayName: string
propertyName: string
}
class Result {
path: string[]
oldValue: any
newValue: any
}
Loading…
Cancel
Save