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