Browse Source

[完善]审批消防设施的查看

tangshan
邵佳豪 3 years ago
parent
commit
972656af46
  1. 60
      src/app/plan-audit/fire-facilities/fire-facilities.component.html
  2. 229
      src/app/plan-audit/fire-facilities/fire-facilities.component.ts

60
src/app/plan-audit/fire-facilities/fire-facilities.component.html

@ -7,7 +7,7 @@
* @LastEditTime: 2021-03-15 16:32:59
-->
<div class="content">
<p>单位消防设施</p>
<div id="firefacilities" *ngFor="let item of companyBuiltInGrouping;let key = index" style="margin-top: 10px;">
<mat-accordion class="tableContent">
<mat-expansion-panel style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
@ -61,5 +61,63 @@
</mat-expansion-panel>
</mat-accordion>
</div>
<p>建筑消防设施</p>
<div *ngFor="let element of allBuildingGrouping">
<p>建筑名:{{element.name}}</p>
<div id="firefacilities" *ngFor="let item of element.buildingFacilityGroups;let key = index"
style="margin-top: 10px;">
<mat-accordion class="tableContent">
<mat-expansion-panel style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
<mat-expansion-panel-header collapsedHeight='40px' expandedHeight='40px' class="panelhead">
<mat-panel-title style="font-size: 14px;">
{{item.name}}
</mat-panel-title>
</mat-expansion-panel-header>
<div class="column" *ngFor="let items of item.facilityItems">
<div class="up">
<div class="left">
<span style="margin-left: 25px;margin-top: 3%;white-space: nowrap;">项目:{{items.name}}</span>
</div>
<div class="centernum">
<span style="margin-left: 35px;">{{items.total ? items.total : '总数: 0'}}</span>
</div>
</div>
<div class="down">
<span style="margin-left: 25px;margin-top: 3%;">主要情况:{{items.details}}</span>
</div>
<div class="imgdown">
<span style="margin-left: 25px;color: #0080FF;"><a style="color: #0080FF;" href="javascript:void(0)"
(click)='previewImg(items)'>查看图片</a></span>
<label style="float: right;margin-right: 10%;cursor:pointer" (click)='SwitchBoard(items)'><input
style="margin-right: 5px;cursor:pointer" [(ngModel)]="items.expanded?down:open" readonly><img
[src]="items.expanded?imgsrcdown:imgsrcopen" (click)='SwitchBoard(items)'></label>
</div>
<div class="overflowTable" *ngIf="items.expanded">
<div class="detailsTable">
<table>
<tr *ngFor="let header of items.header">
<th>{{header}}</th>
<td *ngFor="let body of items.body">{{body[header]? body[header] : '暂无数据'}}</td>
</tr>
</table>
</div>
<div *ngFor="let tableMsg of items.loopTable" class="detailsTable">
<p style="text-align: center; font-size: 16px; margin: 5px 0;">楼层/区域名称: {{tableMsg.name? tableMsg.name:
'暂无名称'}}</p>
<table>
<tr *ngFor="let header of tableMsg.header">
<th>{{header}}</th>
<td *ngFor="let body of tableMsg.body">{{body[header]? body[header] : '暂无数据'}}</td>
</tr>
</table>
</div>
</div>
</div>
</mat-expansion-panel>
</mat-accordion>
</div>
</div>
</div>

229
src/app/plan-audit/fire-facilities/fire-facilities.component.ts

@ -13,6 +13,7 @@ import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dial
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
import { ImagesData2 } from './imagesdata.component'
import { Router, ActivatedRoute } from '@angular/router'
import { concatMap } from 'rxjs/operators';
export interface Food {
value: string;
name: string;
@ -56,6 +57,7 @@ export class FireFacilitiesComponent implements OnInit {
if (data.buildingTypes.length) {
let newData = { buildingType: data.buildingTypes[0].id, companyId: companyId }
this.http.get('/api/CompanyFacilities', { params: newData }).subscribe((data: any) => { //获得单位的消防设施
console.log('公司消防设施', data)
this.companyBuiltInGrouping = data[0].summary.companyFacilityGroups
this.companyOptionalGrouping = data[0].summary.companyOptionalGroups
this.companyDetails = data[0].details
@ -64,7 +66,8 @@ export class FireFacilitiesComponent implements OnInit {
element.selectBuiltInGrouping = []
element.facilityItems.forEach((elements, index) => {
elements.total = element.facilityCount[index]
elements.expanded = false});
elements.expanded = false
});
});
if (sessionStorage.getItem("tabsindex") == "4") {
this.companyBuiltInGrouping = [this.companyBuiltInGrouping[1]]
@ -79,90 +82,8 @@ export class FireFacilitiesComponent implements OnInit {
})
}
//创建单位消防设施内置分组项
addCompanyGrouping (e) {
let data = e
let dialogRef = this.dialog.open(ImagesData2,{data});
dialogRef.afterClosed().subscribe(data=>{
if (data) { e.facilityItems.push(data) } });
}
//保存单位消防设施内置分组项
editCompanyGrouping(e) {
let header = {groupId:e.id}
let data = []
e.facilityItems.forEach((element,index) => {
let msg = {
isBuiltin: element.isBuiltin,
details: element.details,
name: element.name,
isEachFloor: element.isEachFloor,
order: element.order}
data.push(msg)
if (index==e.facilityItems.length-1) {
this.http.post('/api/CompanyFacilityItems/Batch',data,{params:header}).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
}) }
}); //forEach
}
//checked单位消防设施内置分组项时
checkedCompany (e,item,items) {
if (e.checked) {
item.selectBuiltInGrouping.push(items)
} else {
item.selectBuiltInGrouping.splice(item.selectBuiltInGrouping.findIndex(oldItem => oldItem == items), 1)
}
}
//删除消防设施内置分组项
deleteCompanyGrouping (e) {
if (e.selectBuiltInGrouping.length) {
let isDelete = confirm('您确定要删除吗')
if (isDelete) {
let msg:any = `?groupId=${e.id}`
e.selectBuiltInGrouping.forEach((element,index) => {
let data = `&name=${element.name}`
msg = msg + data
if (index === e.selectBuiltInGrouping.length-1) {
this.http.delete('/api/CompanyFacilityItems/Batch' + msg).subscribe(data=>{
let deleteMsg = e.selectBuiltInGrouping
deleteMsg.forEach(deleteElement => {
e.facilityItems.splice(e.facilityItems.findIndex(item=>item.name==deleteElement.name),1)
});
e.selectBuiltInGrouping = []
}) //http
} //if
}); //forEach
}
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择内置分组项','确定',config);
}
}
//保存单位消防设施可选分组
editCompanyOptional (e,item) {
e.stopPropagation() //阻止冒泡
item.propertyInfos.forEach((element,index) => {
element.propertyValue = String(element.propertyValue)
if (index == item.propertyInfos.length-1 ) {
this.http.post('/api/CompanyOptionalGroups',item).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
})
} //if
});
}
//单位消防设施切换展开面板
SwitchBoard(e) {
@ -177,22 +98,26 @@ export class FireFacilitiesComponent implements OnInit {
item.assets[0].propertyInfos.forEach(element => { //表头
if (element.propertyType != 3) {
let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
tableMsg.header.push(element.propertyName+unit)}
tableMsg.header.push(element.propertyName + unit)
}
});
item.assets.forEach(element => { //表格内容
let everyBody = {}
element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue }
everyBody[elements.propertyName + unit] = elements.propertyValue
}
if (elements.propertyType == 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' }
everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = []
element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) }
everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); //propertyInfos
tableMsg.body.push(everyBody)
@ -209,22 +134,26 @@ export class FireFacilitiesComponent implements OnInit {
data[0].propertyInfos.forEach(element => { //表头
if (element.propertyType != 3) {
let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
e.header.push(element.propertyName+unit)}
e.header.push(element.propertyName + unit)
}
});
data.forEach(element => { //表格内容
let everyBody = {}
element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue }
everyBody[elements.propertyName + unit] = elements.propertyValue
}
if (elements.propertyType == 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' }
everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = []
element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) }
everyBody[elements.propertyName + unit] = String(imgLength.length)
}
});
e.body.push(everyBody)
@ -243,9 +172,11 @@ export class FireFacilitiesComponent implements OnInit {
//获取所有建筑
getAllBuilding() {
let companyId = this.unitId
this.http.get('/api/Buildings',{params:{
this.http.get('/api/Buildings', {
params: {
companyId: companyId
}}).subscribe((data:any)=>{
}
}).subscribe((data: any) => {
this.allBuildingGrouping = data
if (this.allBuildingGrouping.length) { this.getAllBuildingFacilities() }
})
@ -265,68 +196,28 @@ export class FireFacilitiesComponent implements OnInit {
elements.selectBuiltInGrouping = []
elements.facilityItems.forEach((newElement, index) => {
newElement.total = elements.facilityCount[index]
newElement.expanded = false });
newElement.expanded = false
});
});
if(sessionStorage.getItem("tabsindex") == "4"){
element.buildingFacilityGroups = [element.buildingFacilityGroups[1]]
element.buildingOptionalGroups = []
}
if(sessionStorage.getItem("tabsindex") == "5"){
element.buildingFacilityGroups.splice(1,1)
}
// if (sessionStorage.getItem("tabsindex") == "4") {
// element.buildingFacilityGroups = [element.buildingFacilityGroups[1]]
// element.buildingOptionalGroups = []
// }
// if (sessionStorage.getItem("tabsindex") == "5") {
// element.buildingFacilityGroups.splice(1, 1)
// }
})
});
console.log('建筑消防设施', this.allBuildingGrouping)
}
//保存建筑消防设施内置分组项
editBuildingGrouping (e,item) {
let companyId = this.unitId
let header = {companyId:companyId,buildingId:e.id, groupId:item.id}
let data = []
item.facilityItems.forEach((element,index) => {
let msg = {
isBuiltin: element.isBuiltin,
details: element.details,
name: element.name,
isEachFloor: element.isEachFloor,
order: element.order}
data.push(msg)
if (index==item.facilityItems.length-1) {
this.http.post('/api/BuildingFacilityItems/Batch',data,{params:header}).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
}) }
}); //forEach
}
//保存建筑消防设施可选分组
editBuildingOptional (e,item) {
let companyId = this.unitId
e.stopPropagation() //阻止冒泡
item.propertyInfos.forEach((element,index) => {
element.propertyValue = String(element.propertyValue)
if (index == item.propertyInfos.length-1 ) {
this.http.post('/api/BuildingOptionalGroups',item,{params:{
companyId :companyId
}}).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
})
} //if
});
}
//建筑消防设施切换展开面板
SwitchBuildingBoard(item, e) {
@ -341,22 +232,26 @@ export class FireFacilitiesComponent implements OnInit {
item.assets[0].propertyInfos.forEach(element => { //表头
if (element.propertyType != 3) {
let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
tableMsg.header.push(element.propertyName+unit)}
tableMsg.header.push(element.propertyName + unit)
}
});
item.assets.forEach(element => { //表格内容
let everyBody = {}
element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue }
everyBody[elements.propertyName + unit] = elements.propertyValue
}
if (elements.propertyType == 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' }
everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = []
element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) }
everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); //propertyInfos
tableMsg.body.push(everyBody)
@ -373,22 +268,26 @@ export class FireFacilitiesComponent implements OnInit {
data[0].propertyInfos.forEach(element => { //表头
if (element.propertyType != 3) {
let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
e.header.push(element.propertyName+unit)}
e.header.push(element.propertyName + unit)
}
});
data.forEach(element => { //表格内容
let everyBody = {}
element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue }
everyBody[elements.propertyName + unit] = elements.propertyValue
}
if (elements.propertyType == 6) {
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' }
everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = []
element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) }
everyBody[elements.propertyName + unit] = String(imgLength.length)
}
});
e.body.push(everyBody)
@ -404,6 +303,7 @@ export class FireFacilitiesComponent implements OnInit {
//单位消防设施预览图片
previewImg(e) {
console.log(e)
if (e.isEachFloor) { //逐层统计时
let newData = this.companyEachDetails[e.name]
if (newData) {
@ -415,7 +315,9 @@ export class FireFacilitiesComponent implements OnInit {
if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType === 3) {
elements.propertyName = imgName
data.images.push(elements)} });
data.images.push(elements)
}
});
});
}); //newDate
@ -432,7 +334,8 @@ export class FireFacilitiesComponent implements OnInit {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); }
this.snackBar.open('暂无图片数据', '确定', config);
}
} else { //非逐层统计时
let newData = this.companyDetails[e.name]
let imgName
@ -443,7 +346,9 @@ export class FireFacilitiesComponent implements OnInit {
if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType === 3) {
elements.propertyName = imgName
data.images.push(elements)} });
data.images.push(elements)
}
});
});
if (data.images.length) {
let dialogRef = this.dialog.open(ImagesData2, { width: '1350px', height: '700px', data }); //打开图片弹窗
@ -458,7 +363,8 @@ export class FireFacilitiesComponent implements OnInit {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); }
this.snackBar.open('暂无图片数据', '确定', config);
}
}
}
@ -476,7 +382,9 @@ export class FireFacilitiesComponent implements OnInit {
if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType === 3) {
elements.propertyName = imgName
data.images.push(elements)} });
data.images.push(elements)
}
});
});
}); //newDate
@ -493,7 +401,8 @@ export class FireFacilitiesComponent implements OnInit {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); }
this.snackBar.open('暂无图片数据', '确定', config);
}
} else { //非逐层统计时
let newData = item.buildingDetails[e.name]
let imgName
@ -504,7 +413,8 @@ export class FireFacilitiesComponent implements OnInit {
if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType === 3) {
elements.propertyName = imgName
data.images.push(elements)}
data.images.push(elements)
}
});
});
if (data.images.length) {
@ -520,7 +430,8 @@ export class FireFacilitiesComponent implements OnInit {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); }
this.snackBar.open('暂无图片数据', '确定', config);
}
}
}

Loading…
Cancel
Save