diff --git a/src/app/ui/plan-template/plan-template.component.ts b/src/app/ui/plan-template/plan-template.component.ts index 783bbb0..0e80b77 100644 --- a/src/app/ui/plan-template/plan-template.component.ts +++ b/src/app/ui/plan-template/plan-template.component.ts @@ -1557,6 +1557,7 @@ export class addattinf{ /* {propertyName:'单位照片',completed:false,propertyType:0,value:''} *///,default:'-',must:'是',danwei:'-' ] addAttinfBuild=[] +buildnewDate=[] addAttinfFile facilityItems ngOnInit(): void{ @@ -1564,14 +1565,14 @@ ngOnInit(): void{ this.getattinf() } //获取弹窗信息 -getattinf(){ +async getattinf(){ //this.data.newleftTabledata=JSON.parse(JSON.stringify(this.data.newleftTabledata)) if(this.data.facilityItems==undefined){ this.data.newleftTabledata=JSON.parse(JSON.stringify(this.data.newleftTabledata)) this.data.newleftTabledata[this.data.leftclicki].data.forEach(element => { if(element.groupName=='单位概况'&&element.attribute!=undefined){ - element.attribute.forEach(value => { + element.attribute.forEach(async value => { if(value.surveyName=='单位基本信息'&&value.attinf!=undefined){ //this.addAttinf=value.attinf value.attinf.forEach((datavalue,index,dataarr) => { @@ -1606,32 +1607,53 @@ getattinf(){ //console.log(this.addAttinfBuild) }) }else if(value.surveyName=='建筑信息'&&value.attinf!=undefined){ - + this.buildnewDate=[] this.addAttinfBuild=value.attinf this.addAttinfBuild=JSON.parse(JSON.stringify(this.addAttinfBuild)) - - value.attinf.forEach((elattinf,fi,farr) => { + let paramsdata:any ={ + categoryId:this.data.newleftTabledata[this.data.leftclicki].basicCategoryId + } + let restlt=await new Promise((resolve) => { + this.http.get("/api/BasicGroups",{params:paramsdata}).subscribe((data:any)=>{ + data.forEach((buildDate,buildi,buildarr) => { + //this.addAttinfBuild.push(...buildarr[buildi].propertyInfos) + this.buildnewDate.push(...buildarr[buildi].propertyInfos) + resolve(data) + }); + this.buildnewDate.forEach(element => { + element.completed=false + element.olddata=element.propertyValue + }); + }) + }) + /* value.attinf.forEach((elattinf,fi,farr) => { this.addAttinfBuild.forEach((element,ei,earr) => { if(farr[fi].propertyName==earr[ei].propertyName){ if(farr[fi].completed==true&&earr[ei].completed==false){ farr[fi].completed=earr[ei].completed } - } }); - element.olddata=element.propertyValue - }); + }); */ + let temp=0 + this.buildnewDate=JSON.parse(JSON.stringify(this.buildnewDate)) + this.buildnewDate.forEach((buildval,buindi,buildarr)=>{ + temp=0 + this.addAttinfBuild.forEach((addval,addi,addarr)=>{ + + if(buildval.propertyName==addval.propertyName){ + temp++ + } + }) + if(temp==0){ + console.log(buildval) + this.addAttinfBuild.push(buildval) + } + }) + console.log(this.buildnewDate) console.log(this.addAttinfBuild) - /* let paramsdata:any ={ - categoryId:this.data.newleftTabledata[this.data.leftclicki].basicCategoryId - } - this.http.get("/api/BasicGroups",{params:paramsdata}).subscribe((data:any)=>{ - data.forEach((buildDate,buildi,buildarr) => { - this.addAttinfBuild.push(...buildarr[buildi].propertyInfos) - }); - - }) */ + }else if(value.surveyName=='消防设施'&&value.attinf==undefined){ let paramsdata:any ={ categoryId:this.data.newleftTabledata[this.data.leftclicki].facilityCategoryId