diff --git a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts index c79a28e..d57d5c4 100644 --- a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts +++ b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts @@ -62,8 +62,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit { if (this.route.snapshot.queryParams.pattern == 'false') { this.pattern = 'look' this.blockyl = false - this.clickTitleItem('单位概况') + this.selectedItem='单位概况' + //this.clickTitleItem(this.planTemplateData[1]) } else { + this.selectedItem='封面' this.pattern = 'edit' } this.getUnitData() @@ -609,8 +611,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit { element.attribute = [{ name: '特别警示', content: '' }] } } - if(element.groupName=='三位概况'){ - this.clickTitleItem('单位概况') + if(element.groupName=='单位概况'){ + this.clickTitleItem(this.planTemplateData[1]) } }); if(this.planLevel=='4'){ diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.html b/src/app/plan-management/entry-plan-look/entry-plan-look.component.html index 9afe20c..4be31bc 100644 --- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.html +++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.html @@ -7,6 +7,9 @@ * @LastEditTime: 2021-08-24 14:01:03 --> +
+ +
@@ -81,7 +84,7 @@ 操作 改名 - 转在线导入 + 转在线导入 编辑 查看 @@ -110,4 +113,4 @@
-
\ No newline at end of file + diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.scss b/src/app/plan-management/entry-plan-look/entry-plan-look.component.scss index 2826925..8cd793d 100644 --- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.scss +++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.scss @@ -171,4 +171,17 @@ } } +} +.shadow{ + height: 100%; + width: 100%; + + z-index:998; + background-color:#FFFFFF; + opacity:0.3; + mat-spinner{ + position: relative; + top: 40%; + left: 40%; + } } \ No newline at end of file diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts index 3ee04c3..84c567d 100644 --- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts +++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts @@ -14,6 +14,7 @@ import { async } from '@angular/core/testing'; import { Viewer } from 'photo-sphere-viewer'; import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper'; import Swiper from 'swiper'; +import { resolve } from 'dns'; declare var CryptoJS @Component({ selector: 'app-entry-plan-look', @@ -559,34 +560,71 @@ export class EntryPlanLookComponent implements OnInit { ); } //上传word转在线编制 + spinner=false//圈圈是否存在 async upzhuanMb(element){ - console.log(element) + this.spinner=true const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 + let objectName//预案文件名称 let formData = new FormData() + //模板导入接口传参 let type=this.unitdata.unittype=='高层建筑'?1:this.unitdata.unittype=='居民小区'?2:this.unitdata.unittype=='厂房'?3 :(this.unitdata.unittype=='商市场'||this.unitdata.unittype=='医院'||this.unitdata.unittype=='学校' ||this.unitdata.unittype=='宾馆'||this.unitdata.unittype=='娱乐场所'||this.unitdata.unittype=='餐饮业' ||this.unitdata.unittype=='影剧院'||this.unitdata.unittype=='展览建筑'||this.unitdata.unittype=='养老院' ||this.unitdata.unittype=='会议中心')?4:this.unitdata.unittype=='储罐类'?'StorageTankFivePlan':this.unitdata.unittype=='化工生产'?'ChemicalProductionFivePlan':'' - let file=[] - let fileResult=await new Promise((resolve, reject) => { - this.http.get(`/api/Objects/PlanPlatform/${element}?x-oss-process=image/auto-orient,1`, { responseType: 'blob' }).subscribe((data: any) => { - resolve(data) + let blob=[] + /* + 调用下载接口获取文件流,并赋值给blob + */ + let fileRuquest=await new Promise((resolve,reject)=>{ + this.http.get(`/api/ObjectMetadata/PlanPlatform/`+element.attachmentUrls[0]).subscribe((obdata: any) => { + objectName=obdata.objectName + this.http.get(`/api/Objects/PlanPlatform/${objectName}`, { responseType: 'blob' },).subscribe(blobdata => { + resolve(blobdata) + }) }) - }) - //file.push(fileResult) - console.log(file) - //formData.append('file',file) - /* this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{ - console.log(data) - if(data==null){ + }) + blob.push(fileRuquest)//接收返回的blob类型数据 + let file=new File(blob,objectName)//转化为file类型 + formData.append('file',file) + let pData//接受返回的模板信息数据 + /* + 调用模板导入接口,获取在线编制的json,并赋值给pData + */ + let pRequest=await new Promise((resolve,rejest)=>{ + this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{ + resolve(data) + },err=>{ + this.spinner=false this.snackBar.open('解析失败,请确定好格式再重新上传!', '确定', config); - }else{ - console.log(data) - } - }) */ + }) + }) + pData=pRequest + /* 调用新建预案接口,新建一条新的预案,并跳转新建在线编制页面 */ + let body={ + name:(element.planCategory==3?'Ⅲ级':element.planCategory==4?'Ⅳ级':element.planCategory==5?'Ⅴ级':'')+ element.name+'转在线编制', + planType: element.planType, + planMode: 2, + planLevel: element.planLevel, + planCategory:element.planCategory, + webTextData:JSON.stringify(pData) + } + let planData + let newyuan=await new Promise((resolve,reject)=>{ + this.http.post('/api/PlanComponents', body, { + params: { + companyId: this.route.snapshot.queryParams.unitId + } + }).subscribe(plandata => { + resolve(plandata) + }) + }) + planData=newyuan + window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.route.snapshot.queryParams.unitId}&planName=${planData.name}&unitName=${this.unitdata.unitname}&planCategory=${planData.planCategory}&planId=${planData.id}`) + this.getAllPlanComponents() + this.spinner=false } } @@ -1182,13 +1220,6 @@ export class AddPlanone { } - - - - - - - //下载文件弹出框 @Component({ selector: 'downloadfile', diff --git a/src/app/ui/plan-template/plan-template.component.html b/src/app/ui/plan-template/plan-template.component.html index 813f4ef..99bd492 100644 --- a/src/app/ui/plan-template/plan-template.component.html +++ b/src/app/ui/plan-template/plan-template.component.html @@ -175,7 +175,7 @@ (click)='delattAndfileOne(item.groupName,element.surveyName,i)'> 删除 diff --git a/src/app/ui/plan-template/plan-template.component.ts b/src/app/ui/plan-template/plan-template.component.ts index f9396b5..bbb6d1f 100644 --- a/src/app/ui/plan-template/plan-template.component.ts +++ b/src/app/ui/plan-template/plan-template.component.ts @@ -529,13 +529,13 @@ export class PlanTemplateComponent implements OnInit { console.log(this.newleftTabledata) } //消防设施表格具体属性编辑 - fileAdd(facilityItems,filei){ + fileAdd(facilityItems,filei,filename){ if(facilityItems.length!=0){ const dialogRef = this.dialog.open(addattinf, {//调用open方法打开对话框并且携带参数过去 width: '240px', height:'400px', disableClose:true, - data:{facilityItems:facilityItems} + data:{facilityItems:facilityItems,filename,newleftTabledata:this.newleftTabledata,leftclicki:this.leftclicki} }); dialogRef.afterClosed().subscribe(result => { console.log(result) @@ -549,7 +549,7 @@ export class PlanTemplateComponent implements OnInit { }); } }) - this.group=this.newleftTabledata[this,this.leftclicki].data + this.group=this.newleftTabledata[this.leftclicki].data } console.log(this.newleftTabledata) }); @@ -1744,7 +1744,7 @@ async getattinf(){ }); this.filenewDate.forEach(element => { element.completed=false - element.olddata=element.propertyValue + //element.olddata=element.propertyValue }); }) }) @@ -1752,26 +1752,26 @@ async getattinf(){ let temp=0 this.filenewDate.forEach((buildval,buindi,buildarr)=>{ temp=0 - this.filenewDate.forEach((addval,addi,addarr)=>{ - if(buildval.propertyName==addval.propertyName){ + this.addAttinfFile.forEach((addval,addi,addarr)=>{ + if(buildval.name==addval.name){ temp++ } }) if(temp==0){ console.log(buildval) - this.filenewDate.push(buildval) + this.addAttinfFile.push(buildval) } }) - this.filenewDate.forEach((addval,addi,addarr)=>{ + this.addAttinfFile.forEach((addval,addi,addarr)=>{ temp=0 this.filenewDate.forEach((buildval,buindi,buildarr)=>{ - if(buildarr[buindi].propertyName==addarr[addi].propertyName){ + if(buildarr[buindi].name==addarr[addi].name){ temp++ } }) if(temp==0){ console.log(addarr[addi]) - this.filenewDate.splice(addi,1) + this.addAttinfFile.splice(addi,1) } }) } @@ -1779,11 +1779,52 @@ async getattinf(){ } }); }else{ + //消防设施最里层数据 + let apifile this.facilityItems=JSON.parse(JSON.stringify(this.data.facilityItems)) console.log(this.facilityItems) - /* this.facilityItems.forEach(element => { - element.completed=false - }); */ + //请求接口,看数据是否有变化 + let paramsdata:any ={ + categoryId:this.data.newleftTabledata[this.data.leftclicki].facilityCategoryId + } + let fileResult=await new Promise((resolve) => { + this.http.get("/api/FacilityGroups",{params:paramsdata}).subscribe((data:any)=>{ + resolve(data) + }) + }) + apifile=fileResult + let apifileData//消防设施最内层数据 + apifile.forEach(element => { + if(element.name==this.data.filename){ + apifileData=element.facilityItems + } + }); + console.log(apifileData) + let temp=0 + apifileData.forEach((buildval,buindi,buildarr)=>{ + temp=0 + this.facilityItems.forEach((addval,addi,addarr)=>{ + if(buildval.name==addval.name){ + temp++ + } + }) + if(temp==0){ + console.log(buildval) + this.facilityItems.push(buildval) + } + }) + this.facilityItems.forEach((addval,addi,addarr)=>{ + temp=0 + apifileData.forEach((buildval,buindi,buildarr)=>{ + if(buildarr[buindi].name==addarr[addi].name){ + temp++ + } + }) + if(temp==0){ + console.log(addarr[addi]) + this.facilityItems.splice(addi,1) + } + }) } }