|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { Component, OnInit, ViewChild, Inject } from '@angular/core'; |
|
|
|
|
import {HttpClient, HttpHeaders} from '@angular/common/http' |
|
|
|
|
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
|
|
import { ImgsDataDetail } from './addGrouping.component' |
|
|
|
|
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; |
|
|
|
|
import { ImagesData } from './imagesdata.component' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -31,6 +31,8 @@ export class FireFightingDeviceComponent implements OnInit {
|
|
|
|
|
{value:'false', name: '无'}] |
|
|
|
|
|
|
|
|
|
companyBuiltInGrouping:any = []; //单位消防设施内置分组
|
|
|
|
|
companyDetails:any = []; //单位详情
|
|
|
|
|
companyEachDetails:any = [] //单位每层详情
|
|
|
|
|
companyOptionalGrouping:any = []; //单位消防设施可选分组
|
|
|
|
|
|
|
|
|
|
//获得单位基本信息
|
|
|
|
@ -41,6 +43,8 @@ export class FireFightingDeviceComponent implements OnInit {
|
|
|
|
|
this.http.get('/api/CompanyAccount/CompanyFacilities',{params:newData}).subscribe((data:any)=>{ //获得单位的消防设施
|
|
|
|
|
this.companyBuiltInGrouping = data[0].summary.companyFacilityGroups |
|
|
|
|
this.companyOptionalGrouping = data[0].summary.companyOptionalGroups |
|
|
|
|
this.companyDetails = data[0].details |
|
|
|
|
this.companyEachDetails = data[0].eachDetails |
|
|
|
|
this.companyBuiltInGrouping.forEach(element => { //循环单位内置分组项
|
|
|
|
|
element.selectBuiltInGrouping = [] |
|
|
|
|
element.facilityItems.forEach(elements => { |
|
|
|
@ -139,16 +143,58 @@ export class FireFightingDeviceComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//切换展开面板
|
|
|
|
|
//单位消防设施切换展开面板
|
|
|
|
|
SwitchBoard (e) { |
|
|
|
|
e.expanded = !e.expanded |
|
|
|
|
} |
|
|
|
|
if (e.expanded) { //展开面板展开时
|
|
|
|
|
if (e.isEachFloor) { //逐层统计时
|
|
|
|
|
let data = this.companyEachDetails[e.name] |
|
|
|
|
if (data) { |
|
|
|
|
e.loopTable = [] |
|
|
|
|
for (let key in data) { |
|
|
|
|
let tableMsg = {name:data[key][0].sitePlanName, header:[], body:[]} |
|
|
|
|
data[key][0].propertyInfos.forEach(element => { //表头
|
|
|
|
|
if (element.propertyType!=3) {tableMsg.header.push(element.propertyName)} |
|
|
|
|
}); |
|
|
|
|
data[key].forEach(element => { //表格内容
|
|
|
|
|
let everyBody = {} |
|
|
|
|
element.propertyInfos.forEach((elements,index) => { |
|
|
|
|
if (elements.propertyType!=3 && elements.propertyType!=6) { everyBody[elements.propertyName] = elements.propertyValue+elements.physicalUnit } |
|
|
|
|
if (elements.propertyType==6) { everyBody[elements.propertyName] = elements.propertyValue=='1'?'是':'否' } |
|
|
|
|
}); |
|
|
|
|
tableMsg.body.push(everyBody) |
|
|
|
|
}); |
|
|
|
|
e.loopTable.push(tableMsg) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} //有对应信息时
|
|
|
|
|
} else { //非逐层统计时
|
|
|
|
|
let data = this.companyDetails[e.name] |
|
|
|
|
if (data) {
|
|
|
|
|
e.header = [] |
|
|
|
|
e.body = [] |
|
|
|
|
data[0].propertyInfos.forEach(element => { //表头
|
|
|
|
|
if (element.propertyType!=3) {e.header.push(element.propertyName)} |
|
|
|
|
}); |
|
|
|
|
data.forEach(element => { //表格内容
|
|
|
|
|
let everyBody = {} |
|
|
|
|
element.propertyInfos.forEach((elements,index) => { |
|
|
|
|
if (elements.propertyType!=3 && elements.propertyType!=6) { everyBody[elements.propertyName] = elements.propertyValue+elements.physicalUnit } |
|
|
|
|
if (elements.propertyType==6) { everyBody[elements.propertyName] = elements.propertyValue=='1'?'是':'否' } |
|
|
|
|
}); |
|
|
|
|
e.body.push(everyBody) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} //非逐层统计时
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//预览图片
|
|
|
|
|
previewImg () { |
|
|
|
|
console.log('IMG') |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allBuildingGrouping:any; //所有建筑的消防设施 内置分组+可选分组
|
|
|
|
|
//获取所有建筑
|
|
|
|
|
getAllBuilding () { |
|
|
|
@ -165,11 +211,14 @@ export class FireFightingDeviceComponent implements OnInit {
|
|
|
|
|
this.http.get('/api/CompanyAccount/BuildingFacilities',{params:header}).subscribe(data=>{ |
|
|
|
|
element.buildingFacilityGroups = data[0].summary.buildingFacilityGroups |
|
|
|
|
element.buildingOptionalGroups = data[0].summary.buildingOptionalGroups |
|
|
|
|
element.buildingDetails = data[0].details |
|
|
|
|
element.buildingEachDetails = data[0].eachDetails |
|
|
|
|
element.buildingFacilityGroups.forEach(elements => { //循环每个建筑内置分组项
|
|
|
|
|
elements.selectBuiltInGrouping = [] |
|
|
|
|
elements.facilityItems.forEach(newElement => { newElement.expanded = false }); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -253,6 +302,175 @@ export class FireFightingDeviceComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//建筑消防设施切换展开面板
|
|
|
|
|
SwitchBuildingBoard (item,e) { |
|
|
|
|
e.expanded = !e.expanded |
|
|
|
|
if (e.expanded) { //展开面板展开时
|
|
|
|
|
if (e.isEachFloor) { //逐层统计时
|
|
|
|
|
let data = item.buildingEachDetails[e.name] |
|
|
|
|
if (data) { |
|
|
|
|
e.loopTable = [] |
|
|
|
|
for (let key in data) { |
|
|
|
|
let tableMsg = {name:data[key][0].buildingAreaName, header:[], body:[]} |
|
|
|
|
data[key][0].propertyInfos.forEach(element => { //表头
|
|
|
|
|
if (element.propertyType!=3) {tableMsg.header.push(element.propertyName)} |
|
|
|
|
}); |
|
|
|
|
data[key].forEach(element => { //表格内容
|
|
|
|
|
let everyBody = {} |
|
|
|
|
element.propertyInfos.forEach((elements,index) => { |
|
|
|
|
if (elements.propertyType!=3 && elements.propertyType!=6) { everyBody[elements.propertyName] = elements.propertyValue+elements.physicalUnit } |
|
|
|
|
if (elements.propertyType==6) { everyBody[elements.propertyName] = elements.propertyValue=='1'?'是':'否' } |
|
|
|
|
}); |
|
|
|
|
tableMsg.body.push(everyBody) |
|
|
|
|
}); |
|
|
|
|
e.loopTable.push(tableMsg) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} //有对应信息时
|
|
|
|
|
} else { //非逐层统计时
|
|
|
|
|
let data = item.buildingDetails[e.name] |
|
|
|
|
if (data) {
|
|
|
|
|
e.header = [] |
|
|
|
|
e.body = [] |
|
|
|
|
data[0].propertyInfos.forEach(element => { //表头
|
|
|
|
|
if (element.propertyType!=3) {e.header.push(element.propertyName)} |
|
|
|
|
}); |
|
|
|
|
data.forEach(element => { //表格内容
|
|
|
|
|
let everyBody = {} |
|
|
|
|
element.propertyInfos.forEach((elements,index) => { |
|
|
|
|
if (elements.propertyType!=3 && elements.propertyType!=6) { everyBody[elements.propertyName] = elements.propertyValue+elements.physicalUnit } |
|
|
|
|
if (elements.propertyType==6) { everyBody[elements.propertyName] = elements.propertyValue=='1'?'是':'否' } |
|
|
|
|
}); |
|
|
|
|
e.body.push(everyBody) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} //非逐层统计时
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//单位消防设施预览图片
|
|
|
|
|
previewImg (e) { |
|
|
|
|
if (e.isEachFloor) { //逐层统计时
|
|
|
|
|
let newData = this.companyEachDetails[e.name] |
|
|
|
|
if (newData) { |
|
|
|
|
let data = {name:e.name, images:[]} |
|
|
|
|
let imgName
|
|
|
|
|
for (let key in newData) { |
|
|
|
|
newData[key].forEach(element => { |
|
|
|
|
element.propertyInfos.forEach( elements => {
|
|
|
|
|
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} |
|
|
|
|
if (elements.propertyType==3) { |
|
|
|
|
elements.propertyName = imgName |
|
|
|
|
data.images.push(elements)} }); |
|
|
|
|
}); |
|
|
|
|
} //for
|
|
|
|
|
if (data.images.length) { |
|
|
|
|
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); } |
|
|
|
|
} else { //非逐层统计时
|
|
|
|
|
let newData = this.companyDetails[e.name] |
|
|
|
|
let imgName
|
|
|
|
|
if (newData) { |
|
|
|
|
let data = {name:e.name, images:[]} |
|
|
|
|
newData.forEach(element => { |
|
|
|
|
element.propertyInfos.forEach(elements => {
|
|
|
|
|
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} |
|
|
|
|
if (elements.propertyType==3) { |
|
|
|
|
elements.propertyName = imgName |
|
|
|
|
data.images.push(elements)} }); |
|
|
|
|
}); |
|
|
|
|
if (data.images.length) { |
|
|
|
|
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//建筑消防设施预览图片
|
|
|
|
|
previewBuildingImg (item,e) { |
|
|
|
|
if (e.isEachFloor) { //逐层统计时
|
|
|
|
|
let newData = item.buildingEachDetails[e.name] |
|
|
|
|
if (newData) { |
|
|
|
|
let data = {name:e.name, images:[]} |
|
|
|
|
let imgName
|
|
|
|
|
for (let key in newData) { |
|
|
|
|
newData[key].forEach(element => { |
|
|
|
|
element.propertyInfos.forEach(elements => {
|
|
|
|
|
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} |
|
|
|
|
if (elements.propertyType==3) { |
|
|
|
|
elements.propertyName = imgName |
|
|
|
|
data.images.push(elements)} }); |
|
|
|
|
}); |
|
|
|
|
} //for
|
|
|
|
|
if (data.images.length) { |
|
|
|
|
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); } |
|
|
|
|
} else { //非逐层统计时
|
|
|
|
|
let newData = item.buildingDetails[e.name] |
|
|
|
|
let imgName
|
|
|
|
|
if (newData) { |
|
|
|
|
let data = {name:e.name, images:[]} |
|
|
|
|
newData.forEach(element => { |
|
|
|
|
element.propertyInfos.forEach(elements => {
|
|
|
|
|
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} |
|
|
|
|
if (elements.propertyType==3)
|
|
|
|
|
elements.propertyName = imgName |
|
|
|
|
{data.images.push(elements)} }); |
|
|
|
|
}); |
|
|
|
|
if (data.images.length) { |
|
|
|
|
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无图片数据','确定',config); } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|