From 272ae61296ff213f8a7be87d4de3d6e8b7e4a84e Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Sat, 24 Jul 2021 14:29:33 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=A4=84=E7=90=86=E5=BB=BA?= =?UTF-8?q?=E7=AD=91=E4=BF=A1=E6=81=AF=E5=B7=AE=E5=BC=82=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wait-examineer.component.html | 4 +- .../wait-examineer.component.ts | 46 ++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.html b/src/app/plan-audit/wait-examineer/wait-examineer.component.html index 537091a..fa62fa4 100644 --- a/src/app/plan-audit/wait-examineer/wait-examineer.component.html +++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.html @@ -188,8 +188,8 @@ - - + +
{{i.displayName}} :
{{i.path[i.path.length - 2]}}-{{i.path[i.path.length - 1]}}: {{i.oldValue | differentContentTitle}} diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts index 2a443eb..a261c86 100644 --- a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts +++ b/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, path?: Array): Array { + let resultList: Array = []; + 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 = [] @@ -799,4 +828,19 @@ export class remark { } } } +} + +class DiffItem { + newValue: any + oldValue: any + childrens: Array + operation: number + displayName: string + propertyName: string +} + +class Result { + path: string[] + oldValue: any + newValue: any } \ No newline at end of file