|
|
|
@ -21,6 +21,7 @@ import Viewer from 'viewerjs';
|
|
|
|
|
import { async } from 'rxjs/internal/scheduler/async'; |
|
|
|
|
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; |
|
|
|
|
import { adddwsurvey, addGroup } from '@src/app/ui/plan-template/plan-template.component'; |
|
|
|
|
import { zdyaddattinf } from '../../ui/plan-template/plan-template.component' |
|
|
|
|
declare var $: any |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-plan-online-five', |
|
|
|
@ -59,8 +60,12 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
blockyl = true |
|
|
|
|
zaixianDr=false |
|
|
|
|
haveNew=false |
|
|
|
|
planMode//预案类型
|
|
|
|
|
//index
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
//this.index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
this.haveNew=this.route.snapshot.queryParams.haveNew |
|
|
|
|
this.planMode=this.route.snapshot.queryParams.planMode |
|
|
|
|
console.log(this.route.snapshot.queryParams.wordChange) |
|
|
|
|
this.planLevel = this.route.snapshot.queryParams.planCategory |
|
|
|
|
if (this.route.snapshot.queryParams.pattern == 'false') { |
|
|
|
@ -446,6 +451,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
buildingsData = [] |
|
|
|
|
buildDataName |
|
|
|
|
buildZong |
|
|
|
|
basicCategoryId |
|
|
|
|
//获得所有建筑信息
|
|
|
|
|
async getAllBuildingsInfo() { |
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况') |
|
|
|
@ -466,6 +472,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
}).subscribe((buildingsData: any) => { |
|
|
|
|
//console.log(buildingsData)
|
|
|
|
|
this.buildingsData.push(buildingsData[0]) |
|
|
|
|
//this.basicCategoryId=buildingsData[0].basicCategoryId
|
|
|
|
|
resolve(this.buildingsData) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -580,8 +587,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
getTemplateData() { |
|
|
|
|
this.http.get(`/api/PlanComponents/${this.route.snapshot.queryParams.planId}/WebText`).subscribe((data: any) => { |
|
|
|
|
console.log('预案内容', data) |
|
|
|
|
if(this.route.snapshot.queryParams.haveNew!=undefined&&data.webTextData==null){ |
|
|
|
|
console.log('预案内容', data.webTextData) |
|
|
|
|
if(this.route.snapshot.queryParams.planMode==4&&data.webTextData==null){ |
|
|
|
|
this.planTemplateData=[] |
|
|
|
|
let obj = { |
|
|
|
|
completed: true, |
|
|
|
@ -1479,7 +1486,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
if(fileNum==0){ |
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].facilityItems.push({ name: '', value: '',completed:true,zdy:true}) |
|
|
|
|
}else{ |
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ propertyName: '', value: '',completed:true,zdy:true,facilityItems:[] }) |
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ name: '', value: '',completed:true,zdy:true,facilityItems:[] }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -1908,6 +1915,67 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//建筑信息和消防设施模板信息添加
|
|
|
|
|
addBuildingmb(element){ |
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况') |
|
|
|
|
console.log(element,this.buildingsData) |
|
|
|
|
const dialogRef = this.dialog.open(adddwsurveys, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '290px', |
|
|
|
|
height:'460px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:{element:element,buildingID:this.buildingsData[0].basicCategoryId,fid:this.route.snapshot.queryParams.unitTypeId} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
if(result!=undefined){ |
|
|
|
|
this.planTemplateData[index].building[this.clicki].body.forEach(item => { |
|
|
|
|
if(item.surveyName==element.surveyName){ |
|
|
|
|
element.attinf=result |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//消防设施具体属性编辑
|
|
|
|
|
fileAdd(facilityItems,filei,filename){ |
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况') |
|
|
|
|
if(facilityItems.length!=0){ |
|
|
|
|
const dialogRef = this.dialog.open(adddwsurveys, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '240px', |
|
|
|
|
height:'400px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:{facilityItems:facilityItems,filename,fid:this.route.snapshot.queryParams.unitTypeId} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
console.log(result) |
|
|
|
|
if(result!=undefined){ |
|
|
|
|
this.planTemplateData[index].building[this.clicki].body.forEach(element => { |
|
|
|
|
if(element.surveyName=='消防设施'){ |
|
|
|
|
element.attinf[filei].facilityItems=result |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//单位概况自定义
|
|
|
|
|
zdyDw(){ |
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况') |
|
|
|
|
const dialogRef = this.dialog.open(zdyaddattinf, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '340px', |
|
|
|
|
height:'200px', |
|
|
|
|
disableClose:true, |
|
|
|
|
//data:this.planTemplateData
|
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
if(result!=undefined){ |
|
|
|
|
this.planTemplateData[index].building[this.clicki].body.push({surveyName:result.groupName,completed: true,attinf:[],zdy:true}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2121,4 +2189,266 @@ export class updataHl{
|
|
|
|
|
this.dialogRef.close(result); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//建筑跟消防设施添加模板数据
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'adddwsurveys', |
|
|
|
|
templateUrl: './addattinf.html', |
|
|
|
|
styleUrls: ['./addgroup.scss'] |
|
|
|
|
}) |
|
|
|
|
export class adddwsurveys{ |
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<adddwsurveys>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
addAttinfBuild=[] |
|
|
|
|
buildnewDate=[] |
|
|
|
|
addAttinfFile//过滤消防设施外层数据
|
|
|
|
|
filenewDate=[] |
|
|
|
|
facilityItems//过滤消防设施最内层数据
|
|
|
|
|
facilityCategoryId//消防设施内容id
|
|
|
|
|
zdyData//模板传过来自定义的数据
|
|
|
|
|
ngOnInit(): void{ |
|
|
|
|
this.getinf() |
|
|
|
|
console.log(this.data) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async getinf(){ |
|
|
|
|
if(this.data.facilityItems==undefined){ |
|
|
|
|
if(this.data.element.surveyName=='建筑信息'&&this.data.element.attinf==undefined){ |
|
|
|
|
this.addAttinfBuild=[] |
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.data.buildingID |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/BasicGroups",{params:paramsdata}).subscribe((data:any)=>{ |
|
|
|
|
data.forEach(buildDate => { |
|
|
|
|
this.addAttinfBuild.push(...buildDate.propertyInfos) |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this.addAttinfBuild.forEach(element => { |
|
|
|
|
element.completed=false |
|
|
|
|
element.olddata=element.propertyValue |
|
|
|
|
}); |
|
|
|
|
console.log(this.addAttinfBuild) |
|
|
|
|
}) |
|
|
|
|
}else if(this.data.element.surveyName=='建筑信息'&&this.data.element.attinf!=undefined){ |
|
|
|
|
this.buildnewDate=[] //接受接口返回的新数据
|
|
|
|
|
this.addAttinfBuild=this.data.element.attinf.filter(item=>{ |
|
|
|
|
return item.zdy==undefined |
|
|
|
|
}) //模板传过来的非自定义数据
|
|
|
|
|
this.zdyData=this.data.element.attinf.filter(item=>{ |
|
|
|
|
return item.zdy!=undefined |
|
|
|
|
})//模板传过来自定义数据
|
|
|
|
|
this.addAttinfBuild=JSON.parse(JSON.stringify(this.addAttinfBuild)) |
|
|
|
|
console.log(this.addAttinfBuild) |
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.data.buildingID |
|
|
|
|
} |
|
|
|
|
/* 请求接口,做差异化对比 */ |
|
|
|
|
let restlt=await new Promise((resolve) => { |
|
|
|
|
this.http.get("/api/BasicGroups",{params:paramsdata}).subscribe((data:any)=>{ |
|
|
|
|
data.forEach((buildDate,buildi,buildarr) => { |
|
|
|
|
this.buildnewDate.push(...buildarr[buildi].propertyInfos) |
|
|
|
|
resolve(data) |
|
|
|
|
}); |
|
|
|
|
this.buildnewDate.forEach(element => { |
|
|
|
|
element.completed=false |
|
|
|
|
element.olddata=element.propertyValue |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
})
|
|
|
|
|
this.buildnewDate=JSON.parse(JSON.stringify(this.buildnewDate)) |
|
|
|
|
//差异化比较
|
|
|
|
|
let temp=0 |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.addAttinfBuild.forEach((addval,addi,addarr)=>{ |
|
|
|
|
temp=0 |
|
|
|
|
this.buildnewDate.forEach((buildval,buindi,buildarr)=>{ |
|
|
|
|
if(buildarr[buindi].propertyName==addarr[addi].propertyName){ |
|
|
|
|
temp++ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if(temp==0){ |
|
|
|
|
console.log(addarr[addi]) |
|
|
|
|
//模板数据多了
|
|
|
|
|
this.addAttinfBuild.splice(addi,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.addAttinfBuild.push(...this.zdyData) |
|
|
|
|
console.log(this.buildnewDate) |
|
|
|
|
console.log(this.addAttinfBuild) |
|
|
|
|
|
|
|
|
|
}else if(this.data.element.surveyName=='消防设施'&&this.data.element.attinf==undefined){ |
|
|
|
|
this.http.get("/api/BuildingTypes").subscribe((buildData:any)=>{ |
|
|
|
|
console.log(buildData) |
|
|
|
|
buildData.forEach(element => { |
|
|
|
|
if(element.id==this.data.fid){ |
|
|
|
|
this.facilityCategoryId=element.facilityCategoryId |
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.facilityCategoryId |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/FacilityGroups",{params:paramsdata}).subscribe((data:any)=>{ |
|
|
|
|
console.log(data) |
|
|
|
|
this.addAttinfFile=data |
|
|
|
|
this.addAttinfFile.forEach(element => { |
|
|
|
|
element.completed=false |
|
|
|
|
element.value='' |
|
|
|
|
}); |
|
|
|
|
console.log(this.addAttinfFile) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}else if(this.data.element.surveyName=='消防设施'&&this.data.element.attinf!=undefined){ |
|
|
|
|
this.filenewDate=[] |
|
|
|
|
this.addAttinfFile=this.data.element.attinf.filter(element => { |
|
|
|
|
return element.zdy==false |
|
|
|
|
}); |
|
|
|
|
this.zdyData=this.data.element.attinf.filter(element => { |
|
|
|
|
return element.zdy!=undefined |
|
|
|
|
}); |
|
|
|
|
//this.addAttinfFile=JSON.parse(JSON.stringify(this.addAttinfFile))
|
|
|
|
|
console.log(this.addAttinfFile,this.zdyData) |
|
|
|
|
let restlt=await new Promise((resolve) => { |
|
|
|
|
this.http.get("/api/BuildingTypes").subscribe((buildData:any)=>{ |
|
|
|
|
buildData.forEach(async element => { |
|
|
|
|
if(element.id==this.data.fid){ |
|
|
|
|
this.facilityCategoryId=element.facilityCategoryId |
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.facilityCategoryId |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/FacilityGroups",{params:paramsdata}).subscribe((data:any)=>{ |
|
|
|
|
data.forEach((buildDate,buildi,buildarr) => { |
|
|
|
|
this.filenewDate.push(buildDate) |
|
|
|
|
resolve(data) |
|
|
|
|
}); |
|
|
|
|
this.filenewDate.forEach(element => { |
|
|
|
|
element.completed=false |
|
|
|
|
//element.olddata=element.propertyValue
|
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.filenewDate=JSON.parse(JSON.stringify(this.filenewDate)) |
|
|
|
|
console.log(this.filenewDate) |
|
|
|
|
let temp=0 |
|
|
|
|
this.filenewDate.forEach((buildval,buindi,buildarr)=>{ |
|
|
|
|
temp=0 |
|
|
|
|
this.addAttinfFile.forEach((addval,addi,addarr)=>{ |
|
|
|
|
if(buildval.name==addval.name){ |
|
|
|
|
temp++ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if(temp==0){ |
|
|
|
|
//console.log(buildval)
|
|
|
|
|
this.addAttinfFile.push(buildval) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.addAttinfFile.forEach((addval,addi,addarr)=>{ |
|
|
|
|
temp=0 |
|
|
|
|
this.filenewDate.forEach((buildval,buindi,buildarr)=>{ |
|
|
|
|
if(buildval.name==addval.name){ |
|
|
|
|
temp++ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
if(temp==0){ |
|
|
|
|
this.addAttinfFile.splice(addi,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.addAttinfFile.push(...this.zdyData) |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//消防设施最里层数据
|
|
|
|
|
let apifile |
|
|
|
|
this.facilityItems=this.data.facilityItems.filter(element => { |
|
|
|
|
return element.zdy==undefined |
|
|
|
|
}); |
|
|
|
|
this.zdyData=this.data.facilityItems.filter(element => { |
|
|
|
|
return element.zdy!=undefined |
|
|
|
|
}); |
|
|
|
|
this.facilityItems=JSON.parse(JSON.stringify(this.facilityItems))
|
|
|
|
|
console.log(this.facilityItems) |
|
|
|
|
//请求接口,看数据是否有变化
|
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.data.fid |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/FacilityGroups",{params:paramsdata}).subscribe((buildData:any)=>{ |
|
|
|
|
buildData.forEach(async element => { |
|
|
|
|
if(element.id==this.data.fid){ |
|
|
|
|
this.facilityCategoryId=element.facilityCategoryId |
|
|
|
|
let paramsdata:any ={ |
|
|
|
|
categoryId:this.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) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.facilityItems.push(...this.zdyData) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//取消按钮
|
|
|
|
|
close(){ |
|
|
|
|
this.dialogRef.close(undefined); |
|
|
|
|
} |
|
|
|
|
//确定按钮
|
|
|
|
|
defineClick(){ |
|
|
|
|
this.dialogRef.close(this.data.element!=undefined&&this.data.element.surveyName=='建筑信息'? |
|
|
|
|
this.addAttinfBuild:this.data.element!=undefined&&this.data.element.surveyName=='消防设施'?this.addAttinfFile:this.facilityItems) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|