Browse Source

[修改]消防设施最里层数据跟接口比较

tangshan
陈敬瑜 3 years ago
parent
commit
cdc82bcf11
  1. 8
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts
  2. 5
      src/app/plan-management/entry-plan-look/entry-plan-look.component.html
  3. 13
      src/app/plan-management/entry-plan-look/entry-plan-look.component.scss
  4. 73
      src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
  5. 2
      src/app/ui/plan-template/plan-template.component.html
  6. 67
      src/app/ui/plan-template/plan-template.component.ts

8
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') { if (this.route.snapshot.queryParams.pattern == 'false') {
this.pattern = 'look' this.pattern = 'look'
this.blockyl = false this.blockyl = false
this.clickTitleItem('单位概况') this.selectedItem='单位概况'
//this.clickTitleItem(this.planTemplateData[1])
} else { } else {
this.selectedItem='封面'
this.pattern = 'edit' this.pattern = 'edit'
} }
this.getUnitData() this.getUnitData()
@ -609,8 +611,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
element.attribute = [{ name: '特别警示', content: '' }] element.attribute = [{ name: '特别警示', content: '' }]
} }
} }
if(element.groupName=='位概况'){ if(element.groupName=='位概况'){
this.clickTitleItem('单位概况') this.clickTitleItem(this.planTemplateData[1])
} }
}); });
if(this.planLevel=='4'){ if(this.planLevel=='4'){

5
src/app/plan-management/entry-plan-look/entry-plan-look.component.html

@ -7,6 +7,9 @@
* @LastEditTime: 2021-08-24 14:01:03 * @LastEditTime: 2021-08-24 14:01:03
--> -->
<!-- <p>录入预案</p> --> <!-- <p>录入预案</p> -->
<div class="shadow" *ngIf="spinner==true">
<mat-spinner></mat-spinner>
</div>
<div style="overflow: auto;height: 100%;"> <div style="overflow: auto;height: 100%;">
<div class="header" style="position: relative;"> <div class="header" style="position: relative;">
<div> <div>
@ -81,7 +84,7 @@
<th mat-header-cell *matHeaderCellDef>操作</th> <th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span> <span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span>
<span (click)="upzhuanMb(element)">转在线导入</span> <span (click)="upzhuanMb(element)" *ngIf="element.planMode==1&&element.planType==16">转在线导入</span>
<span (click)="editPlan(element)" <span (click)="editPlan(element)"
[ngClass]="{'grey': !(element.auditStatus!='16' && element.auditStatus != '1')}">编辑</span> [ngClass]="{'grey': !(element.auditStatus!='16' && element.auditStatus != '1')}">编辑</span>
<span (click)="lookPlan(element)" *ngIf="element.planType == 2 || element.planType == 16">查看</span> <span (click)="lookPlan(element)" *ngIf="element.planType == 2 || element.planType == 16">查看</span>

13
src/app/plan-management/entry-plan-look/entry-plan-look.component.scss

@ -172,3 +172,16 @@
} }
} }
.shadow{
height: 100%;
width: 100%;
z-index:998;
background-color:#FFFFFF;
opacity:0.3;
mat-spinner{
position: relative;
top: 40%;
left: 40%;
}
}

73
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 { Viewer } from 'photo-sphere-viewer';
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper'; import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
import Swiper from 'swiper'; import Swiper from 'swiper';
import { resolve } from 'dns';
declare var CryptoJS declare var CryptoJS
@Component({ @Component({
selector: 'app-entry-plan-look', selector: 'app-entry-plan-look',
@ -559,34 +560,71 @@ export class EntryPlanLookComponent implements OnInit {
); );
} }
//上传word转在线编制 //上传word转在线编制
spinner=false//圈圈是否存在
async upzhuanMb(element){ async upzhuanMb(element){
console.log(element) this.spinner=true
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
let objectName//预案文件名称
let formData = new FormData() let formData = new FormData()
//模板导入接口传参
let type=this.unitdata.unittype=='高层建筑'?1:this.unitdata.unittype=='居民小区'?2:this.unitdata.unittype=='厂房'?3 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=='宾馆'||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':'' ||this.unitdata.unittype=='会议中心')?4:this.unitdata.unittype=='储罐类'?'StorageTankFivePlan':this.unitdata.unittype=='化工生产'?'ChemicalProductionFivePlan':''
let file=[] let blob=[]
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) => { ,blob
resolve(data) */
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) blob.push(fileRuquest)//接收返回的blob类型数据
//formData.append('file',file) let file=new File(blob,objectName)//转化为file类型
/* this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{ formData.append('file',file)
console.log(data) let pData//接受返回的模板信息数据
if(data==null){ /*
线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); 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({ @Component({
selector: 'downloadfile', selector: 'downloadfile',

2
src/app/ui/plan-template/plan-template.component.html

@ -175,7 +175,7 @@
(click)='delattAndfileOne(item.groupName,element.surveyName,i)'><img (click)='delattAndfileOne(item.groupName,element.surveyName,i)'><img
src="../../../assets/images/deletehui.png"> 删除</button> src="../../../assets/images/deletehui.png"> 删除</button>
<button mat-raised-button color="primary" style="margin-right: 10px;" <button mat-raised-button color="primary" style="margin-right: 10px;"
(click)='fileAdd(attinf.facilityItems,i)'><img src="../../../assets/images/updatabai.png"> (click)='fileAdd(attinf.facilityItems,i,attinf.name)'><img src="../../../assets/images/updatabai.png">
编辑</button> 编辑</button>
<img src="../../../assets/images/downpaixu.png" alt="" style="height: 15px;margin-right: 8px;float: right;position: relative;top: 17px;" (click)='threeDown(zi,suri,i)'> <img src="../../../assets/images/downpaixu.png" alt="" style="height: 15px;margin-right: 8px;float: right;position: relative;top: 17px;" (click)='threeDown(zi,suri,i)'>
<img src="../../../assets/images/toppaixu.png" alt="" style="height: 15px;float: right;position: relative;top: 17px;" (click)='threeTop(zi,suri,i)'> <img src="../../../assets/images/toppaixu.png" alt="" style="height: 15px;float: right;position: relative;top: 17px;" (click)='threeTop(zi,suri,i)'>

67
src/app/ui/plan-template/plan-template.component.ts

@ -529,13 +529,13 @@ export class PlanTemplateComponent implements OnInit {
console.log(this.newleftTabledata) console.log(this.newleftTabledata)
} }
//消防设施表格具体属性编辑 //消防设施表格具体属性编辑
fileAdd(facilityItems,filei){ fileAdd(facilityItems,filei,filename){
if(facilityItems.length!=0){ if(facilityItems.length!=0){
const dialogRef = this.dialog.open(addattinf, {//调用open方法打开对话框并且携带参数过去 const dialogRef = this.dialog.open(addattinf, {//调用open方法打开对话框并且携带参数过去
width: '240px', width: '240px',
height:'400px', height:'400px',
disableClose:true, disableClose:true,
data:{facilityItems:facilityItems} data:{facilityItems:facilityItems,filename,newleftTabledata:this.newleftTabledata,leftclicki:this.leftclicki}
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
console.log(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) console.log(this.newleftTabledata)
}); });
@ -1744,7 +1744,7 @@ async getattinf(){
}); });
this.filenewDate.forEach(element => { this.filenewDate.forEach(element => {
element.completed=false element.completed=false
element.olddata=element.propertyValue //element.olddata=element.propertyValue
}); });
}) })
}) })
@ -1752,26 +1752,26 @@ async getattinf(){
let temp=0 let temp=0
this.filenewDate.forEach((buildval,buindi,buildarr)=>{ this.filenewDate.forEach((buildval,buindi,buildarr)=>{
temp=0 temp=0
this.filenewDate.forEach((addval,addi,addarr)=>{ this.addAttinfFile.forEach((addval,addi,addarr)=>{
if(buildval.propertyName==addval.propertyName){ if(buildval.name==addval.name){
temp++ temp++
} }
}) })
if(temp==0){ if(temp==0){
console.log(buildval) 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 temp=0
this.filenewDate.forEach((buildval,buindi,buildarr)=>{ this.filenewDate.forEach((buildval,buindi,buildarr)=>{
if(buildarr[buindi].propertyName==addarr[addi].propertyName){ if(buildarr[buindi].name==addarr[addi].name){
temp++ temp++
} }
}) })
if(temp==0){ if(temp==0){
console.log(addarr[addi]) console.log(addarr[addi])
this.filenewDate.splice(addi,1) this.addAttinfFile.splice(addi,1)
} }
}) })
} }
@ -1779,11 +1779,52 @@ async getattinf(){
} }
}); });
}else{ }else{
//消防设施最里层数据
let apifile
this.facilityItems=JSON.parse(JSON.stringify(this.data.facilityItems)) this.facilityItems=JSON.parse(JSON.stringify(this.data.facilityItems))
console.log(this.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)
}
})
} }
} }

Loading…
Cancel
Save