Browse Source

[新增]消防设施手动输入框

master
邵佳豪 3 years ago
parent
commit
9fe305765b
  1. 187
      src/app/ui/fire-fighting-device/fire-fighting-device.component.html
  2. 699
      src/app/ui/fire-fighting-device/fire-fighting-device.component.ts
  3. 1
      src/app/ui/realistic-picture/realistic-picture.component.scss

187
src/app/ui/fire-fighting-device/fire-fighting-device.component.html

@ -1,5 +1,5 @@
<div class="content"> <div class="content">
<mat-tab-group> <mat-tab-group (selectedIndexChange)="selectedChange($event)">
<!-- <mat-tab label="单位消防设施"> <!-- <mat-tab label="单位消防设施">
<div class="contentBox"> <div class="contentBox">
@ -103,8 +103,10 @@
<h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3> <h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3>
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<mat-icon title="创建" (click)='addBuildingGrouping(newItem,item)'>add_circle_outline</mat-icon> <mat-icon title="创建" (click)='addBuildingGrouping(newItem,item)'>add_circle_outline</mat-icon>
<mat-icon title="保存" style="margin-left: 25px;" (click)='editBuildingGrouping(newItem,item)'>description</mat-icon> <mat-icon title="保存" style="margin-left: 25px;" (click)='editBuildingGrouping(newItem,item)'>description
<mat-icon title="删除" style="margin-left: 25px;" (click)='deleteBuildingGrouping(newItem,item)'>delete</mat-icon> </mat-icon>
<mat-icon title="删除" style="margin-left: 25px;" (click)='deleteBuildingGrouping(newItem,item)'>delete
</mat-icon>
</div> </div>
<div> <div>
<mat-accordion multi> <mat-accordion multi>
@ -121,19 +123,169 @@
<mat-expansion-panel *ngFor="let items of item.facilityItems" disabled [expanded]=items.expanded> <mat-expansion-panel *ngFor="let items of item.facilityItems" disabled [expanded]=items.expanded>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<label class="firstContent"> <label class="firstContent">
<mat-checkbox (change)='checkedCompany($event,item,items)' [disabled]='items.isBuiltin'></mat-checkbox> <mat-checkbox (change)='checkedCompany($event,item,items)' [disabled]='items.isBuiltin'>
</mat-checkbox>
</label> </label>
<label class="textContent">{{items.name}}</label> <label class="textContent">{{items.name}}</label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewBuildingImg(newItem,items)'>查看图片</a></label> <label class="textContent"><a href="javascript:void(0)"
<label class="totalContent">{{items.total ? items.total : '总数: 0'}}</label> (click)='previewBuildingImg(newItem,items)'>查看图片</a></label>
<!-- <label class="totalContent">{{items.total ? items.total : '总数: 0'}}</label> -->
<label class="totalContent">
<span *ngIf="item.name == '消防水系统' && items.name == '供水管网'">
<input type="text" value="" [(ngModel)]="fireProtectionWaterSystem.waterSupplyNetwork.total">
</span>
<span *ngIf="item.name == '消防水系统' && items.name == '自动喷水灭火系统'">
<input type="text" value="" [(ngModel)]="fireProtectionWaterSystem.sprinklerSystem.total">
</span>
<span *ngIf="item.name == '消防灭火给水系统' && items.name == '自动喷水灭火系统'">
<input type="text" value=""
[(ngModel)]="FireExtinguishingWaterSupplySystem.sprinklerSystem.total">
</span>
<span *ngIf="item.name == '消防灭火给水系统' && items.name == '气体自动灭火系统'">
<input type="text" value=""
[(ngModel)]="FireExtinguishingWaterSupplySystem.AutomaticGasFireExtinguishingSystem.total">
</span>
<span *ngIf="item.name == '消防灭火给水系统' && items.name == '消防泵房'">
<input type="text" value="" [(ngModel)]="FireExtinguishingWaterSupplySystem.firePumpRoom.total">
</span>
<span *ngIf="item.name == '其它' && items.name == '排烟系统'">
<input type="text" value="" [(ngModel)]="other.purgingSystem.total">
</span>
<span *ngIf="item.name == '其它' && items.name == '灭火器'">
<input type="text" value="" [(ngModel)]="other.fireExtinguisher.total">
</span>
<span *ngIf="item.name == '其它' && items.name == '气体灭火'">
<input type="text" value="" [(ngModel)]="other.extinctionUsingGas.total">
</span>
<span *ngIf="item.name == '其它' && items.name == '消防通信'">
<input type="text" value="" [(ngModel)]="other.fireControlCommunication.total">
</span>
<span *ngIf="item.name == '消防设施' && items.name == '自动报警系统'">
<input type="text" value="" [(ngModel)]="fireFightingEquipment.automaticAlarmSystem.total">
</span>
<span *ngIf="item.name == '消防设施' && items.name == '消防泵'">
<input type="text" value="" [(ngModel)]="fireFightingEquipment.firePump.total">
</span>
<span *ngIf="item.name == '消火栓系统' && items.name == '灭火剂'">
<input type="text" value="" [(ngModel)]="hydrantSystem.fireExtinguishingAgent.total">
</span>
<span *ngIf="item.name == '消火栓系统' && items.name == '报警设施'">
<input type="text" value="" [(ngModel)]="hydrantSystem.AlarmFacilities.total">
</span>
<span *ngIf="item.name == '消火栓系统' && items.name == '消防管网'">
<input type="text" value="" [(ngModel)]="hydrantSystem.FireControlPipeNetwork.total">
</span>
<span *ngIf="item.name == '其它设施' && items.name == '优先广播'">
<input type="text" value="" [(ngModel)]="otherFacilities.givePriorityToBroadcast.total">
</span>
<span *ngIf="item.name == '其它设施' && items.name == 'VI检测仪'">
<input type="text" value="" [(ngModel)]="otherFacilities.VIdetector.total">
</span>
<span *ngIf="item.name == '其它设施' && items.name == '泡沫水喷雾系统'">
<input type="text" value="" [(ngModel)]="otherFacilities.foamWaterSpraySystem.total">
</span>
<span *ngIf="item.name == '自动消防设施' && items.name == '喷水灭火系统'">
<input type="text" value=""
[(ngModel)]="automaticFireProtectionFacility.fireSprinklingSystem.total">
</span>
<span *ngIf="item.name == '自动消防设施' && items.name == '自动报警系统'">
<input type="text" value=""
[(ngModel)]="automaticFireProtectionFacility.automaticAlarmSystem.total">
</span>
<span *ngIf="item.name == '自动消防设施' && items.name == '防排烟系统'">
<input type="text" value=""
[(ngModel)]="automaticFireProtectionFacility.smokeControlAndExhaustSystem.total">
</span>
<span *ngIf="item.name == '自动消防设施' && items.name == '水幕系统'">
<input type="text" value=""
[(ngModel)]="automaticFireProtectionFacility.waterCurtainSystem.total">
</span>
<span *ngIf="item.name == '自动消防设施' && items.name == '消防泵'">
<input type="text" value="" [(ngModel)]="automaticFireProtectionFacility.firePump.total">
</span>
<span *ngIf="item.name == '消防水源' && items.name == '消防水池'">
<input type="text" value="" [(ngModel)]="fireWaterSupply.firePool.total">
</span>
<span
*ngIf="!((item.name == '消防水系统' && items.name == '供水管网') || (item.name == '消防水系统' && items.name == '自动喷水灭火系统') || (item.name == '消防灭火给水系统' && items.name == '自动喷水灭火系统') || (item.name == '消防灭火给水系统' && items.name == '气体自动灭火系统') || (item.name == '消防灭火给水系统' && items.name == '消防泵房') || (item.name == '其它' && items.name == '排烟系统') || (item.name == '其它' && items.name == '灭火器') || (item.name == '其它' && items.name == '气体灭火') || (item.name == '其它' && items.name == '消防通信') || (item.name == '消防设施' && items.name == '自动报警系统') || (item.name == '消防设施' && items.name == '消防泵') || (item.name == '消火栓系统' && items.name == '灭火剂') || (item.name == '消火栓系统' && items.name == '报警设施') || (item.name == '消火栓系统' && items.name == '消防管网') || (item.name == '其它设施' && items.name == '优先广播') || (item.name == '其它设施' && items.name == 'VI检测仪') || (item.name == '其它设施' && items.name == '泡沫水喷雾系统') || (item.name == '自动消防设施' && items.name == '喷水灭火系统') || (item.name == '自动消防设施' && items.name == '自动报警系统') || (item.name == '自动消防设施' && items.name == '防排烟系统') || (item.name == '自动消防设施' && items.name == '水幕系统') || (item.name == '自动消防设施' && items.name == '消防泵') || (item.name == '消防水源' && items.name == '消防水池'))">
{{items.total ? items.total : '总数: 0'}}
</span>
</label>
<label class="lastTextContent"> <label class="lastTextContent">
<textarea maxlength="999" [(ngModel)]="items.details" style="width: 80%;"></textarea> <textarea *ngIf="item.name == '消防水系统' && items.name == '供水管网'" maxlength="250"
[(ngModel)]="fireProtectionWaterSystem.waterSupplyNetwork.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防水系统' && items.name == '自动喷水灭火系统'" maxlength="250"
[(ngModel)]="fireProtectionWaterSystem.sprinklerSystem.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防灭火给水系统' && items.name == '自动喷水灭火系统'" maxlength="250"
[(ngModel)]="FireExtinguishingWaterSupplySystem.sprinklerSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防灭火给水系统' && items.name == '气体自动灭火系统'" maxlength="250"
[(ngModel)]="FireExtinguishingWaterSupplySystem.AutomaticGasFireExtinguishingSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防灭火给水系统' && items.name == '消防泵房'" maxlength="250"
[(ngModel)]="FireExtinguishingWaterSupplySystem.firePumpRoom.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它' && items.name == '排烟系统'" maxlength="250"
[(ngModel)]="other.purgingSystem.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它' && items.name == '灭火器'" maxlength="250"
[(ngModel)]="other.fireExtinguisher.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它' && items.name == '气体灭火'" maxlength="250"
[(ngModel)]="other.extinctionUsingGas.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它' && items.name == '消防通信'" maxlength="250"
[(ngModel)]="other.fireControlCommunication.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防设施' && items.name == '自动报警系统'" maxlength="250"
[(ngModel)]="fireFightingEquipment.automaticAlarmSystem.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防设施' && items.name == '消防泵'" maxlength="250"
[(ngModel)]="fireFightingEquipment.firePump.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消火栓系统' && items.name == '灭火剂'" maxlength="250"
[(ngModel)]="hydrantSystem.fireExtinguishingAgent.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消火栓系统' && items.name == '报警设施'" maxlength="250"
[(ngModel)]="hydrantSystem.AlarmFacilities.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消火栓系统' && items.name == '消防管网'" maxlength="250"
[(ngModel)]="hydrantSystem.FireControlPipeNetwork.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它设施' && items.name == '优先广播'" maxlength="250"
[(ngModel)]="otherFacilities.givePriorityToBroadcast.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它设施' && items.name == 'VI检测仪'" maxlength="250"
[(ngModel)]="otherFacilities.VIdetector.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '其它设施' && items.name == '泡沫水喷雾系统'" maxlength="250"
[(ngModel)]="otherFacilities.foamWaterSpraySystem.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '自动消防设施' && items.name == '喷水灭火系统'" maxlength="250"
[(ngModel)]="automaticFireProtectionFacility.fireSprinklingSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '自动消防设施' && items.name == '自动报警系统'" maxlength="250"
[(ngModel)]="automaticFireProtectionFacility.automaticAlarmSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '自动消防设施' && items.name == '防排烟系统'" maxlength="250"
[(ngModel)]="automaticFireProtectionFacility.smokeControlAndExhaustSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '自动消防设施' && items.name == '水幕系统'" maxlength="250"
[(ngModel)]="automaticFireProtectionFacility.waterCurtainSystem.details"
style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '自动消防设施' && items.name == '消防泵'" maxlength="250"
[(ngModel)]="automaticFireProtectionFacility.firePump.details" style="width: 80%;"></textarea>
<textarea *ngIf="item.name == '消防水源' && items.name == '消防水池'" maxlength="250"
[(ngModel)]="fireWaterSupply.firePool.details" style="width: 80%;"></textarea>
<textarea maxlength="250" [(ngModel)]="items.details" style="width: 80%;"
*ngIf="!((item.name == '消防水系统' && items.name == '供水管网') || (item.name == '消防水系统' && items.name == '自动喷水灭火系统') || (item.name == '消防灭火给水系统' && items.name == '自动喷水灭火系统') || (item.name == '消防灭火给水系统' && items.name == '气体自动灭火系统') || (item.name == '消防灭火给水系统' && items.name == '消防泵房') || (item.name == '其它' && items.name == '排烟系统') || (item.name == '其它' && items.name == '灭火器') || (item.name == '其它' && items.name == '气体灭火') || (item.name == '其它' && items.name == '消防通信') || (item.name == '消防设施' && items.name == '自动报警系统') || (item.name == '消防设施' && items.name == '消防泵') || (item.name == '消火栓系统' && items.name == '灭火剂') || (item.name == '消火栓系统' && items.name == '报警设施') || (item.name == '消火栓系统' && items.name == '消防管网') || (item.name == '其它设施' && items.name == '优先广播') || (item.name == '其它设施' && items.name == 'VI检测仪') || (item.name == '其它设施' && items.name == '泡沫水喷雾系统') || (item.name == '自动消防设施' && items.name == '喷水灭火系统') || (item.name == '自动消防设施' && items.name == '自动报警系统') || (item.name == '自动消防设施' && items.name == '防排烟系统') || (item.name == '自动消防设施' && items.name == '水幕系统') || (item.name == '自动消防设施' && items.name == '消防泵') || (item.name == '消防水源' && items.name == '消防水池'))"></textarea>
</label> </label>
<!-- <label class="lastTextContent">
<textarea maxlength="999" [(ngModel)]="items.details" style="width: 80%;"></textarea>
</label> -->
<!-- <label><mat-icon (click)='SwitchBuildingBoard(newItem,items)' *ngIf="items.isBuiltin">keyboard_arrow_down</mat-icon></label> --> <!-- <label><mat-icon (click)='SwitchBuildingBoard(newItem,items)' *ngIf="items.isBuiltin">keyboard_arrow_down</mat-icon></label> -->
</mat-expansion-panel-header> </mat-expansion-panel-header>
<!-- <div class="overflowTable"> <!-- <div class="overflowTable">
<div class="detailsTable"> <div class="detailsTable">
<table> <table>
@ -158,7 +310,7 @@
</div> </div>
</div> --> </div> -->
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
</div> </div>
</div> </div>
@ -169,17 +321,22 @@
<mat-expansion-panel> <mat-expansion-panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3> <h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3>
<mat-icon title="保存" style="margin-left: 25px;" (click)='editBuildingOptional($event,item)'>description</mat-icon> <mat-icon title="保存" style="margin-left: 25px;" (click)='editBuildingOptional($event,item)'>description
</mat-icon>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div *ngFor="let items of item.propertyInfos" class="InputField"> <div *ngFor="let items of item.propertyInfos" class="InputField">
<label>{{items.propertyName}}:</label> <label>{{items.propertyName}}:</label>
<input type="text" *ngIf="items.propertyType!=1&&items.propertyType!=2&&items.propertyType!=4&&items.propertyType!=6" <input type="text"
[(ngModel)]="items.propertyValue" name="propertyValue"> *ngIf="(items.propertyType!=1&&items.propertyType!=2&&items.propertyType!=4&&items.propertyType!=6) || items.propertyName == '固定值班电话'"
<textarea maxlength="999" *ngIf="items.propertyType==1" [(ngModel)]="items.propertyValue" name="propertyValue"></textarea> [(ngModel)]="items.propertyValue" name="propertyValue">
<input type="number" *ngIf="items.propertyType==2 ||items.propertyType==4" [(ngModel)]="items.propertyValue" name="propertyValue"> <textarea maxlength="999" *ngIf="items.propertyType==1" [(ngModel)]="items.propertyValue"
name="propertyValue"></textarea>
<input type="number" *ngIf="(items.propertyType==2 ||items.propertyType==4) && items.propertyName != '固定值班电话'"
[(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-group *ngIf="items.propertyType==6" [(ngModel)]="items.propertyValue" name="propertyValue"> <mat-radio-group *ngIf="items.propertyType==6" [(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-button style="margin-left: 5px;" [value]='radio.value' *ngFor="let radio of singleElection">{{radio.name}}</mat-radio-button> <mat-radio-button style="margin-left: 5px;" [value]='radio.value'
*ngFor="let radio of singleElection">{{radio.name}}</mat-radio-button>
</mat-radio-group> </mat-radio-group>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>

699
src/app/ui/fire-fighting-device/fire-fighting-device.component.ts

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import {HttpClient, HttpHeaders} from '@angular/common/http' import { HttpClient, HttpHeaders } from '@angular/common/http'
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ImgsDataDetail } from './addGrouping.component' import { ImgsDataDetail } from './addGrouping.component'
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
@ -18,7 +18,7 @@ export interface Food {
}) })
export class FireFightingDeviceComponent implements OnInit { export class FireFightingDeviceComponent implements OnInit {
constructor(public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(public http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar) { }
ngOnInit(): void { ngOnInit(): void {
this.getCompanyInformation() this.getCompanyInformation()
@ -26,30 +26,31 @@ export class FireFightingDeviceComponent implements OnInit {
} }
//定义属性数据 //定义属性数据
singleElection:Food[]=[ singleElection: Food[] = [
{value:'true', name: '有'}, { value: 'true', name: '有' },
{value:'false', name: '无'}] { value: 'false', name: '无' }]
companyBuiltInGrouping:any = []; //单位消防设施内置分组 companyBuiltInGrouping: any = []; //单位消防设施内置分组
companyDetails:any = []; //单位详情 companyDetails: any = []; //单位详情
companyEachDetails:any = [] //单位每层详情 companyEachDetails: any = [] //单位每层详情
companyOptionalGrouping:any = []; //单位消防设施可选分组 companyOptionalGrouping: any = []; //单位消防设施可选分组
//获得单位基本信息 //获得单位基本信息
getCompanyInformation () { getCompanyInformation() {
this.http.get('/api/CompanyAccount/Company').subscribe((data:any)=>{ this.http.get('/api/CompanyAccount/Company').subscribe((data: any) => {
if (data.buildingTypes.length) { if (data.buildingTypes.length) {
let newData = {buildingType: data.buildingTypes[0].id} let newData = { buildingType: data.buildingTypes[0].id }
this.http.get('/api/CompanyAccount/CompanyFacilities',{params:newData}).subscribe((data:any)=>{ //获得单位的消防设施 this.http.get('/api/CompanyAccount/CompanyFacilities', { params: newData }).subscribe((data: any) => { //获得单位的消防设施
this.companyBuiltInGrouping = data[0].summary.companyFacilityGroups this.companyBuiltInGrouping = data[0].summary.companyFacilityGroups
this.companyOptionalGrouping = data[0].summary.companyOptionalGroups this.companyOptionalGrouping = data[0].summary.companyOptionalGroups
this.companyDetails = data[0].details this.companyDetails = data[0].details
this.companyEachDetails = data[0].eachDetails this.companyEachDetails = data[0].eachDetails
this.companyBuiltInGrouping.forEach(element => { //循环单位内置分组项 this.companyBuiltInGrouping.forEach(element => { //循环单位内置分组项
element.selectBuiltInGrouping = [] element.selectBuiltInGrouping = []
element.facilityItems.forEach((elements,index) => { element.facilityItems.forEach((elements, index) => {
elements.total = element.facilityCount[index] elements.total = element.facilityCount[index]
elements.expanded = false}); elements.expanded = false
});
}); });
}) //http }) //http
} //if } //if
@ -58,38 +59,241 @@ export class FireFightingDeviceComponent implements OnInit {
} }
//创建单位消防设施内置分组项 //创建单位消防设施内置分组项
addCompanyGrouping (e) { addCompanyGrouping(e) {
let data = e let data = e
let dialogRef = this.dialog.open(ImgsDataDetail,{data}); let dialogRef = this.dialog.open(ImgsDataDetail, { data });
dialogRef.afterClosed().subscribe(data=>{ dialogRef.afterClosed().subscribe(data => {
if (data) { e.facilityItems.push(data) } }); if (data) { e.facilityItems.push(data) }
});
}
//消防水系统
fireProtectionWaterSystem = {
waterSupplyNetwork: { name: '供水管网', total: '', details: '' },//供水管网
sprinklerSystem: { name: '自动喷水灭火系统', total: '', details: '' }//自动喷水灭火系统
}
//消防灭火给水系统
FireExtinguishingWaterSupplySystem = {
sprinklerSystem: { name: '自动喷水灭火系统', total: '', details: '' },//自动喷水灭火系统
AutomaticGasFireExtinguishingSystem: { name: '气体自动灭火系统', total: '', details: '' },//气体自动灭火系统
firePumpRoom: { name: '消防泵房', total: '', details: '' }//消防泵房
}
//其他
other = {
purgingSystem: { name: '排烟系统', total: '', details: '' },//排烟系统
fireExtinguisher: { name: '灭火器', total: '', details: '' },//灭火器
extinctionUsingGas: { name: '气体灭火', total: '', details: '' },//气体灭火
fireControlCommunication: { name: '消防通信', total: '', details: '' }//消防通信
}
//消防设施
fireFightingEquipment = {
automaticAlarmSystem: { name: '自动报警系统', total: '', details: '' },//自动报警系统
firePump: { name: '消防泵', total: '', details: '' }//消防泵
}
//消火栓系统
hydrantSystem = {
fireExtinguishingAgent: { name: '灭火剂', total: '', details: '' },//灭火剂
AlarmFacilities: { name: '报警设施', total: '', details: '' },//报警设施
FireControlPipeNetwork: { name: '消防管网', total: '', details: '' }//消防管网
}
//其它设施
otherFacilities = {
givePriorityToBroadcast: { name: '优先广播', total: '', details: '' },//优先广播
VIdetector: { name: 'VI检测仪', total: '', details: '' },//VI检测仪
foamWaterSpraySystem: { name: '泡沫水喷雾系统', total: '', details: '' },//泡沫水喷雾系统
}
//自动消防设施
automaticFireProtectionFacility = {
fireSprinklingSystem: { name: '喷水灭火系统', total: '', details: '' },//喷水灭火系统
automaticAlarmSystem: { name: '自动报警系统', total: '', details: '' },//自动报警系统
smokeControlAndExhaustSystem: { name: '防排烟系统', total: '', details: '' },//防排烟系统
waterCurtainSystem: { name: '水幕系统', total: '', details: '' },//水幕系统
firePump: { name: '消防泵', total: '', details: '' }//消防泵
}
//消防水源
fireWaterSupply = {
firePool: { name: '消防水池', total: '', details: '' }//消防水池
}
//获得当前建筑的手动输入值
FacilityStat: any//存放当前建筑手动输入的值
selectedChange($event) {
//获得手动输入的值
this.http.get('/api/CompanyAccount/FacilityStat', {
params: {
buildingId: this.allBuildingGrouping[$event].id
}
}).subscribe(data => {
this.FacilityStat = data
this.changeData()
})
}
//清空手动输入的值
emptyData() {
this.fireProtectionWaterSystem = {
waterSupplyNetwork: { name: '供水管网', total: '', details: '' },//供水管网
sprinklerSystem: { name: '自动喷水灭火系统', total: '', details: '' }//自动喷水灭火系统
}
this.FireExtinguishingWaterSupplySystem = {
sprinklerSystem: { name: '自动喷水灭火系统', total: '', details: '' },//自动喷水灭火系统
AutomaticGasFireExtinguishingSystem: { name: '气体自动灭火系统', total: '', details: '' },//气体自动灭火系统
firePumpRoom: { name: '消防泵房', total: '', details: '' }//消防泵房
}
this.other = {
purgingSystem: { name: '排烟系统', total: '', details: '' },//排烟系统
fireExtinguisher: { name: '灭火器', total: '', details: '' },//灭火器
extinctionUsingGas: { name: '气体灭火', total: '', details: '' },//气体灭火
fireControlCommunication: { name: '消防通信', total: '', details: '' }//消防通信
}
this.fireFightingEquipment = {
automaticAlarmSystem: { name: '自动报警系统', total: '', details: '' },//自动报警系统
firePump: { name: '消防泵', total: '', details: '' }//消防泵
}
this.hydrantSystem = {
fireExtinguishingAgent: { name: '灭火剂', total: '', details: '' },//灭火剂
AlarmFacilities: { name: '报警设施', total: '', details: '' },//报警设施
FireControlPipeNetwork: { name: '消防管网', total: '', details: '' }//消防管网
}
this.otherFacilities = {
givePriorityToBroadcast: { name: '优先广播', total: '', details: '' },//优先广播
VIdetector: { name: 'VI检测仪', total: '', details: '' },//VI检测仪
foamWaterSpraySystem: { name: '泡沫水喷雾系统', total: '', details: '' },//泡沫水喷雾系统
}
this.automaticFireProtectionFacility = {
fireSprinklingSystem: { name: '喷水灭火系统', total: '', details: '' },//喷水灭火系统
automaticAlarmSystem: { name: '自动报警系统', total: '', details: '' },//自动报警系统
smokeControlAndExhaustSystem: { name: '防排烟系统', total: '', details: '' },//防排烟系统
waterCurtainSystem: { name: '水幕系统', total: '', details: '' },//水幕系统
firePump: { name: '消防泵', total: '', details: '' }//消防泵
}
this.fireWaterSupply = {
firePool: { name: '消防水池', total: '', details: '' }//消防水池
}
}
//将数据库获取的手动输入的值变成指定形式
changeData() {
this.emptyData();
this.FacilityStat.length != 0 ?
this.FacilityStat.forEach(element => {
if (element.groupName == '消防水系统') {
if (element.facilityName == '供水管网') {
this.fireProtectionWaterSystem.waterSupplyNetwork.total = element.count
this.fireProtectionWaterSystem.waterSupplyNetwork.details = element.description
} else if (element.facilityName == '自动喷水灭火系统') {
this.fireProtectionWaterSystem.sprinklerSystem.total = element.count
this.fireProtectionWaterSystem.sprinklerSystem.details = element.description
}
} else if (element.groupName == '消防灭火给水系统') {
if (element.facilityName == '自动喷水灭火系统') {
this.FireExtinguishingWaterSupplySystem.sprinklerSystem.total = element.count
this.FireExtinguishingWaterSupplySystem.sprinklerSystem.details = element.description
} else if (element.facilityName == '气体自动灭火系统') {
this.FireExtinguishingWaterSupplySystem.AutomaticGasFireExtinguishingSystem.total = element.count
this.FireExtinguishingWaterSupplySystem.AutomaticGasFireExtinguishingSystem.details = element.description
} else if (element.facilityName == '消防泵房') {
this.FireExtinguishingWaterSupplySystem.firePumpRoom.total = element.count
this.FireExtinguishingWaterSupplySystem.firePumpRoom.details = element.description
}
} else if (element.groupName == '其它') {
if (element.facilityName == '排烟系统') {
this.other.purgingSystem.total = element.count
this.other.purgingSystem.details = element.description
} else if (element.facilityName == '灭火器') {
this.other.fireExtinguisher.total = element.count
this.other.fireExtinguisher.details = element.description
} else if (element.facilityName == '气体灭火') {
this.other.extinctionUsingGas.total = element.count
this.other.extinctionUsingGas.details = element.description
} else if (element.facilityName == '消防通信') {
this.other.fireControlCommunication.total = element.count
this.other.fireControlCommunication.details = element.description
}
} else if (element.groupName == '消防设施') {
if (element.facilityName == '自动报警系统') {
this.fireFightingEquipment.automaticAlarmSystem.total = element.count
this.fireFightingEquipment.automaticAlarmSystem.details = element.description
} else if (element.facilityName == '消防泵') {
this.fireFightingEquipment.firePump.total = element.count
this.fireFightingEquipment.firePump.details = element.description
}
} else if (element.groupName == '消火栓系统') {
if (element.facilityName == '灭火剂') {
this.hydrantSystem.fireExtinguishingAgent.total = element.count
this.hydrantSystem.fireExtinguishingAgent.details = element.description
} else if (element.facilityName == '报警设施') {
this.hydrantSystem.AlarmFacilities.total = element.count
this.hydrantSystem.AlarmFacilities.details = element.description
} else if (element.facilityName == '消防管网') {
this.hydrantSystem.FireControlPipeNetwork.total = element.count
this.hydrantSystem.FireControlPipeNetwork.details = element.description
}
} else if (element.groupName == '其它设施') {
if (element.facilityName == '优先广播') {
this.otherFacilities.givePriorityToBroadcast.total = element.count
this.otherFacilities.givePriorityToBroadcast.details = element.description
} else if (element.facilityName == 'VI检测仪') {
this.otherFacilities.VIdetector.total = element.count
this.otherFacilities.VIdetector.details = element.description
} else if (element.facilityName == '泡沫水喷雾系统') {
this.otherFacilities.foamWaterSpraySystem.total = element.count
this.otherFacilities.foamWaterSpraySystem.details = element.description
}
} else if (element.groupName == '自动消防设施') {
if (element.facilityName == '喷水灭火系统') {
this.automaticFireProtectionFacility.fireSprinklingSystem.total = element.count
this.automaticFireProtectionFacility.fireSprinklingSystem.details = element.description
} else if (element.facilityName == '自动报警系统') {
this.automaticFireProtectionFacility.automaticAlarmSystem.total = element.count
this.automaticFireProtectionFacility.automaticAlarmSystem.details = element.description
} else if (element.facilityName == '防排烟系统') {
this.automaticFireProtectionFacility.smokeControlAndExhaustSystem.total = element.count
this.automaticFireProtectionFacility.smokeControlAndExhaustSystem.details = element.description
} else if (element.facilityName == '水幕系统') {
this.automaticFireProtectionFacility.waterCurtainSystem.total = element.count
this.automaticFireProtectionFacility.waterCurtainSystem.details = element.description
} else if (element.facilityName == '消防泵') {
this.automaticFireProtectionFacility.firePump.total = element.count
this.automaticFireProtectionFacility.firePump.details = element.description
}
} else if (element.groupName == '消防水源') {
if (element.facilityName == '消防水池') {
this.fireWaterSupply.firePool.total = element.count
this.fireWaterSupply.firePool.details = element.description
}
}
}) : null
} }
//保存单位消防设施内置分组项 //保存单位消防设施内置分组项
editCompanyGrouping(e) { editCompanyGrouping(e) {
let header = {groupId:e.id} let header = { groupId: e.id }
let data = [] let data = []
e.facilityItems.forEach((element,index) => { e.facilityItems.forEach((element, index) => {
let msg = { let msg = {
isBuiltin: element.isBuiltin, isBuiltin: element.isBuiltin,
details: element.details, details: element.details,
name: element.name, name: element.name,
isEachFloor: element.isEachFloor, isEachFloor: element.isEachFloor,
order: element.order} order: element.order
}
data.push(msg) data.push(msg)
if (index==e.facilityItems.length-1) { if (index == e.facilityItems.length - 1) {
this.http.post('/api/CompanyAccount/CompanyFacilityItems/Batch',data,{params:header}).subscribe(data=>{ this.http.post('/api/CompanyAccount/CompanyFacilityItems/Batch', data, { params: header }).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('数据更新成功','确定',config); this.snackBar.open('数据更新成功', '确定', config);
}) } })
}
}); //forEach }); //forEach
} }
//checked单位消防设施内置分组项时 //checked单位消防设施内置分组项时
checkedCompany (e,item,items) { checkedCompany(e, item, items) {
if (e.checked) { if (e.checked) {
item.selectBuiltInGrouping.push(items) item.selectBuiltInGrouping.push(items)
} else { } else {
@ -98,52 +302,52 @@ export class FireFightingDeviceComponent implements OnInit {
} }
//删除消防设施内置分组项 //删除消防设施内置分组项
deleteCompanyGrouping (e) { deleteCompanyGrouping(e) {
if (e.selectBuiltInGrouping.length) { if (e.selectBuiltInGrouping.length) {
let isDelete = confirm('您确定要删除吗') let isDelete = confirm('您确定要删除吗')
if (isDelete) { if (isDelete) {
let msg:any = `?groupId=${e.id}` let msg: any = `?groupId=${e.id}`
e.selectBuiltInGrouping.forEach((element,index) => { e.selectBuiltInGrouping.forEach((element, index) => {
let data = `&name=${element.name}` let data = `&name=${element.name}`
msg = msg + data msg = msg + data
if (index === e.selectBuiltInGrouping.length-1) { if (index === e.selectBuiltInGrouping.length - 1) {
this.http.delete('/api/CompanyAccount/CompanyFacilityItems/Batch' + msg).subscribe(data=>{ this.http.delete('/api/CompanyAccount/CompanyFacilityItems/Batch' + msg).subscribe(data => {
let deleteMsg = e.selectBuiltInGrouping let deleteMsg = e.selectBuiltInGrouping
deleteMsg.forEach(deleteElement => { deleteMsg.forEach(deleteElement => {
e.facilityItems.splice(e.facilityItems.findIndex(item=>item.name==deleteElement.name),1) e.facilityItems.splice(e.facilityItems.findIndex(item => item.name == deleteElement.name), 1)
}); });
e.selectBuiltInGrouping = [] e.selectBuiltInGrouping = []
}) //http }) //http
} //if } //if
}); //forEach }); //forEach
} }
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择内置分组项','确定',config); this.snackBar.open('请选择内置分组项', '确定', config);
} }
} }
//保存单位消防设施可选分组 //保存单位消防设施可选分组
editCompanyOptional (e,item) { editCompanyOptional(e, item) {
e.stopPropagation() //阻止冒泡 e.stopPropagation() //阻止冒泡
item.propertyInfos.forEach((element,index) => { item.propertyInfos.forEach((element, index) => {
element.propertyValue = String(element.propertyValue) element.propertyValue = String(element.propertyValue)
if (index == item.propertyInfos.length-1 ) { if (index == item.propertyInfos.length - 1) {
this.http.post('/api/CompanyAccount/CompanyOptionalGroups',item).subscribe(data=>{ this.http.post('/api/CompanyAccount/CompanyOptionalGroups', item).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('数据更新成功','确定',config); this.snackBar.open('数据更新成功', '确定', config);
}) })
} //if } //if
}); });
} }
//单位消防设施切换展开面板 //单位消防设施切换展开面板
SwitchBoard (e) { SwitchBoard(e) {
e.expanded = !e.expanded e.expanded = !e.expanded
if (e.expanded) { //展开面板展开时 if (e.expanded) { //展开面板展开时
if (e.isEachFloor) { //逐层统计时 if (e.isEachFloor) { //逐层统计时
@ -151,26 +355,30 @@ export class FireFightingDeviceComponent implements OnInit {
if (data) { if (data) {
e.loopTable = [] e.loopTable = []
data.forEach(item => { data.forEach(item => {
let tableMsg = {name:item.name, header:[], body:[]} let tableMsg = { name: item.name, header: [], body: [] }
item.assets[0].propertyInfos.forEach(element => { //表头 item.assets[0].propertyInfos.forEach(element => { //表头
if (element.propertyType!=3) { if (element.propertyType != 3) {
let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
tableMsg.header.push(element.propertyName+unit)} tableMsg.header.push(element.propertyName + unit)
}
}); });
item.assets.forEach(element => { //表格内容 item.assets.forEach(element => { //表格内容
let everyBody = {} let everyBody = {}
element.propertyInfos.forEach((elements,index) => { element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 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 +')' : '' //单位 if (elements.propertyType == 6) {
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
if (elements.propertyType!=3 && elements.propertyName=='图片') { everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = [] let imgLength = []
element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) } everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); //propertyInfos }); //propertyInfos
tableMsg.body.push(everyBody) tableMsg.body.push(everyBody)
@ -181,28 +389,32 @@ export class FireFightingDeviceComponent implements OnInit {
} //data有数据时 } //data有数据时
} else { //非逐层统计时 } else { //非逐层统计时
let data = this.companyDetails[e.name] let data = this.companyDetails[e.name]
if (data) { if (data) {
e.header = [] e.header = []
e.body = [] e.body = []
data[0].propertyInfos.forEach(element => { //表头 data[0].propertyInfos.forEach(element => { //表头
if (element.propertyType!=3) { if (element.propertyType != 3) {
let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
e.header.push(element.propertyName+unit)} e.header.push(element.propertyName + unit)
}
}); });
data.forEach(element => { //表格内容 data.forEach(element => { //表格内容
let everyBody = {} let everyBody = {}
element.propertyInfos.forEach((elements,index) => { element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 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 +')' : '' //单位 if (elements.propertyType == 6) {
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
if (elements.propertyType!=3 && elements.propertyName=='图片') { everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = [] let imgLength = []
element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) } everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); });
e.body.push(everyBody) e.body.push(everyBody)
@ -218,36 +430,37 @@ export class FireFightingDeviceComponent implements OnInit {
allBuildingGrouping:any; //所有建筑的消防设施 内置分组+可选分组 allBuildingGrouping: any; //所有建筑的消防设施 内置分组+可选分组
//获取所有建筑 //获取所有建筑
getAllBuilding () { getAllBuilding() {
this.http.get('/api/CompanyAccount/Buildings').subscribe((data:any)=>{ this.http.get('/api/CompanyAccount/Buildings').subscribe((data: any) => {
this.allBuildingGrouping = data this.allBuildingGrouping = data
if (this.allBuildingGrouping.length) { if (this.allBuildingGrouping.length) {
this.getAllBuildingFacilities() this.getAllBuildingFacilities()
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无建筑数据','确定',config); this.snackBar.open('暂无建筑数据', '确定', config);
} }
}) })
} }
//获取所有建筑的消防设施 //获取所有建筑的消防设施
getAllBuildingFacilities () { getAllBuildingFacilities() {
this.allBuildingGrouping.forEach(element => { this.allBuildingGrouping.forEach(element => {
let header = {buildingId: element.id, buildingType: element.buildingTypes[0].id} let header = { buildingId: element.id, buildingType: element.buildingTypes[0].id }
this.http.get('/api/CompanyAccount/BuildingFacilities',{params:header}).subscribe(data=>{ this.http.get('/api/CompanyAccount/BuildingFacilities', { params: header }).subscribe(data => {
element.buildingFacilityGroups = data[0].summary.buildingFacilityGroups element.buildingFacilityGroups = data[0].summary.buildingFacilityGroups
element.buildingOptionalGroups = data[0].summary.buildingOptionalGroups element.buildingOptionalGroups = data[0].summary.buildingOptionalGroups
element.buildingDetails = data[0].details element.buildingDetails = data[0].details
element.buildingEachDetails = data[0].eachDetails element.buildingEachDetails = data[0].eachDetails
element.buildingFacilityGroups.forEach((elements) => { //循环每个建筑内置分组项 element.buildingFacilityGroups.forEach((elements) => { //循环每个建筑内置分组项
elements.selectBuiltInGrouping = [] elements.selectBuiltInGrouping = []
elements.facilityItems.forEach((newElement,index) => { elements.facilityItems.forEach((newElement, index) => {
newElement.total = elements.facilityCount[index] newElement.total = elements.facilityCount[index]
newElement.expanded = false }); newElement.expanded = false
});
}); });
}) })
@ -256,51 +469,114 @@ export class FireFightingDeviceComponent implements OnInit {
} }
//创建建筑消防设施内置分组项 //创建建筑消防设施内置分组项
addBuildingGrouping (e,item) { addBuildingGrouping(e, item) {
let data = {buildingId: e.id, item} let data = { buildingId: e.id, item }
let dialogRef = this.dialog.open(ImgsDataDetail,{data}); let dialogRef = this.dialog.open(ImgsDataDetail, { data });
dialogRef.afterClosed().subscribe(data=>{ dialogRef.afterClosed().subscribe(data => {
if (data) { item.facilityItems.push(data) } if (data) { item.facilityItems.push(data) }
}); });
} }
//保存建筑消防设施内置分组项 //保存建筑消防设施内置分组项
editBuildingGrouping (e,item) { editBuildingGrouping(e, item) {
function returnBody(object, groupName) {
let body = []
for (const key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
const element = object[key];
if (element.total || element.details) {
body.push({
buildingId: item.buildingId,
groupName: groupName,
facilityName: element.name,
count: element.total,
description: element.details
})
}
}
}
return body
}
let header = {buildingId:e.id, groupId:item.id} let header = {buildingId:e.id, groupId:item.id}
let data = [] let data = []
item.facilityItems.forEach((element,index) => { item.facilityItems.forEach((element, index) => {
let msg = { let msg = {
isBuiltin: element.isBuiltin, isBuiltin: element.isBuiltin,
details: element.details, details: element.details,
name: element.name, name: element.name,
isEachFloor: element.isEachFloor, isEachFloor: element.isEachFloor,
order: element.order} order: element.order
}
data.push(msg) data.push(msg)
if (index==item.facilityItems.length-1) { if (index == item.facilityItems.length - 1) {
this.http.post('/api/CompanyAccount/BuildingFacilityItems/Batch',data,{params:header}).subscribe(data=>{ this.http.post('/api/CompanyAccount/BuildingFacilityItems/Batch', data, { params: header }).subscribe(data => {
let putBody
if (item.name == '消防水源') {
putBody = returnBody(this.fireWaterSupply, '消防水源')
} else if (item.name == '消防水系统') {
putBody = returnBody(this.fireProtectionWaterSystem, '消防水系统')
} else if (item.name == '消防灭火给水系统') {
putBody = returnBody(this.FireExtinguishingWaterSupplySystem, '消防灭火给水系统')
} else if (item.name == '其它') {
putBody = returnBody(this.other, '其它')
} else if (item.name == '消防设施') {
putBody = returnBody(this.fireFightingEquipment, '消防设施')
} else if (item.name == '消火栓系统') {
putBody = returnBody(this.hydrantSystem, '消火栓系统')
} else if (item.name == '其它设施') {
putBody = returnBody(this.otherFacilities, '其它设施')
} else if (item.name == '自动消防设施') {
putBody = returnBody(this.automaticFireProtectionFacility, '自动消防设施')
}
if (putBody.length != 0) {
this.http.put('/api/CompanyAccount/FacilityStatUpdate', putBody, {
params: {
buildingId: item.buildingId
}
}).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功', '确定', config);
}, err => {
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);
}
}, err => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('数据更新成功','确定',config); this.snackBar.open('更新失败', '确定', config);
}) } })
}
}); //forEach }); //forEach
} }
//删除建筑消防设施内置分组项 //删除建筑消防设施内置分组项
deleteBuildingGrouping (e,item) { deleteBuildingGrouping(e, item) {
if (item.selectBuiltInGrouping.length) { if (item.selectBuiltInGrouping.length) {
let isDelete = confirm('您确定要删除吗') let isDelete = confirm('您确定要删除吗')
if (isDelete) { if (isDelete) {
let msg:any = `?buildingId=${e.id}&groupId=${item.id}` let msg: any = `?buildingId=${e.id}&groupId=${item.id}`
item.selectBuiltInGrouping.forEach((element,index) => { item.selectBuiltInGrouping.forEach((element, index) => {
let data = `&name=${element.name}` let data = `&name=${element.name}`
msg = msg + data msg = msg + data
if (index === item.selectBuiltInGrouping.length-1) { if (index === item.selectBuiltInGrouping.length - 1) {
this.http.delete('/api/CompanyAccount/BuildingFacilityItems/Batch'+msg).subscribe(data=>{ this.http.delete('/api/CompanyAccount/BuildingFacilityItems/Batch' + msg).subscribe(data => {
let deleteMsg = item.selectBuiltInGrouping let deleteMsg = item.selectBuiltInGrouping
deleteMsg.forEach(deleteElement => { deleteMsg.forEach(deleteElement => {
item.facilityItems.splice(item.facilityItems.findIndex(items=>items.name==deleteElement.name),1) item.facilityItems.splice(item.facilityItems.findIndex(items => items.name == deleteElement.name), 1)
}); });
item.selectBuiltInGrouping = [] item.selectBuiltInGrouping = []
@ -308,32 +584,32 @@ export class FireFightingDeviceComponent implements OnInit {
} //if } //if
}) //forEach }) //forEach
} }
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择内置分组项','确定',config); this.snackBar.open('请选择内置分组项', '确定', config);
} }
} }
//保存建筑消防设施可选分组 //保存建筑消防设施可选分组
editBuildingOptional (e,item) { editBuildingOptional(e, item) {
e.stopPropagation() //阻止冒泡 e.stopPropagation() //阻止冒泡
item.propertyInfos.forEach((element,index) => { item.propertyInfos.forEach((element, index) => {
element.propertyValue = String(element.propertyValue) element.propertyValue = String(element.propertyValue)
if (index == item.propertyInfos.length-1 ) { if (index == item.propertyInfos.length - 1) {
this.http.post('/api/CompanyAccount/BuildingOptionalGroups',item).subscribe(data=>{ this.http.post('/api/CompanyAccount/BuildingOptionalGroups', item).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('数据更新成功','确定',config); this.snackBar.open('数据更新成功', '确定', config);
}) })
} //if } //if
}); });
} }
//建筑消防设施切换展开面板 //建筑消防设施切换展开面板
SwitchBuildingBoard (item,e) { SwitchBuildingBoard(item, e) {
e.expanded = !e.expanded e.expanded = !e.expanded
if (e.expanded) { //展开面板展开时 if (e.expanded) { //展开面板展开时
if (e.isEachFloor) { //逐层统计时 if (e.isEachFloor) { //逐层统计时
@ -341,58 +617,66 @@ export class FireFightingDeviceComponent implements OnInit {
if (data) { if (data) {
e.loopTable = [] e.loopTable = []
data.forEach(item => { data.forEach(item => {
let tableMsg = {name:item.name, header:[], body:[]} let tableMsg = { name: item.name, header: [], body: [] }
item.assets[0].propertyInfos.forEach(element => { //表头 item.assets[0].propertyInfos.forEach(element => { //表头
if (element.propertyType!=3) { if (element.propertyType != 3) {
let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
tableMsg.header.push(element.propertyName+unit)} tableMsg.header.push(element.propertyName + unit)
}
}); });
item.assets.forEach(element => { //表格内容 item.assets.forEach(element => { //表格内容
let everyBody = {} let everyBody = {}
element.propertyInfos.forEach((elements,index) => { element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 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 +')' : '' //单位 if (elements.propertyType == 6) {
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
if (elements.propertyType!=3 && elements.propertyName=='图片') { everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = [] let imgLength = []
element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) } everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); //propertyInfos }); //propertyInfos
tableMsg.body.push(everyBody) tableMsg.body.push(everyBody)
}); //assets }); //assets
e.loopTable.push(tableMsg) e.loopTable.push(tableMsg)
}); });
} //data有数据时 } //data有数据时
} else { //非逐层统计时 } else { //非逐层统计时
let data = item.buildingDetails[e.name] let data = item.buildingDetails[e.name]
if (data) { if (data) {
e.header = [] e.header = []
e.body = [] e.body = []
data[0].propertyInfos.forEach(element => { //表头 data[0].propertyInfos.forEach(element => { //表头
if (element.propertyType!=3) { if (element.propertyType != 3) {
let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 let unit = element.physicalUnit ? '(' + element.physicalUnit + ')' : '' //单位
e.header.push(element.propertyName+unit)} e.header.push(element.propertyName + unit)
}
}); });
data.forEach(element => { //表格内容 data.forEach(element => { //表格内容
let everyBody = {} let everyBody = {}
element.propertyInfos.forEach((elements,index) => { element.propertyInfos.forEach((elements, index) => {
if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { if (elements.propertyType != 3 && elements.propertyName != '图片' && elements.propertyType != 6) {
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 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 +')' : '' //单位 if (elements.propertyType == 6) {
everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
if (elements.propertyType!=3 && elements.propertyName=='图片') { everyBody[elements.propertyName + unit] = elements.propertyValue == '1' ? '是' : '否'
}
if (elements.propertyType != 3 && elements.propertyName == '图片') {
let imgLength = [] let imgLength = []
element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) element.propertyInfos.find(item => { if (item.propertyType == 3) { imgLength.push(item) } })
let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 let unit = elements.physicalUnit ? '(' + elements.physicalUnit + ')' : '' //单位
everyBody[elements.propertyName+unit] = String(imgLength.length) } everyBody[elements.propertyName + unit] = String(imgLength.length)
}
}); });
e.body.push(everyBody) e.body.push(everyBody)
@ -407,124 +691,135 @@ export class FireFightingDeviceComponent implements OnInit {
} }
//单位消防设施预览图片 //单位消防设施预览图片
previewImg (e) { previewImg(e) {
if (e.isEachFloor) { //逐层统计时 if (e.isEachFloor) { //逐层统计时
let newData = this.companyEachDetails[e.name] let newData = this.companyEachDetails[e.name]
if (newData) { if (newData) {
let data = {name:e.name, images:[]} let data = { name: e.name, images: [] }
let imgName let imgName
newData.forEach(item => { newData.forEach(item => {
item.assets.forEach(element => { item.assets.forEach(element => {
element.propertyInfos.forEach( elements => { element.propertyInfos.forEach(elements => {
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType===3) { if (elements.propertyType === 3) {
elements.propertyName = imgName elements.propertyName = imgName
data.images.push(elements)} }); data.images.push(elements)
}
});
}); });
}); //newDate }); //newDate
if (data.images.length) { if (data.images.length) {
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗 let dialogRef = this.dialog.open(ImagesData, { width: '1350px', height: '700px', data }); //打开图片弹窗
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); this.snackBar.open('暂无图片数据', '确定', config);
} }
} else{ } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); } this.snackBar.open('暂无图片数据', '确定', config);
}
} else { //非逐层统计时 } else { //非逐层统计时
let newData = this.companyDetails[e.name] let newData = this.companyDetails[e.name]
let imgName let imgName
if (newData) { if (newData) {
let data = {name:e.name, images:[]} let data = { name: e.name, images: [] }
newData.forEach(element => { newData.forEach(element => {
element.propertyInfos.forEach(elements => { element.propertyInfos.forEach(elements => {
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType===3) { if (elements.propertyType === 3) {
elements.propertyName = imgName elements.propertyName = imgName
data.images.push(elements)} }); data.images.push(elements)
}
});
}); });
if (data.images.length) { if (data.images.length) {
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗 let dialogRef = this.dialog.open(ImagesData, { width: '1350px', height: '700px', data }); //打开图片弹窗
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); this.snackBar.open('暂无图片数据', '确定', config);
} }
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); } this.snackBar.open('暂无图片数据', '确定', config);
}
} }
} }
//建筑消防设施预览图片 //建筑消防设施预览图片
previewBuildingImg (item,e) { previewBuildingImg(item, e) {
if (e.isEachFloor) { //逐层统计时 if (e.isEachFloor) { //逐层统计时
let newData = item.buildingEachDetails[e.name] let newData = item.buildingEachDetails[e.name]
if (newData) { if (newData) {
let data = {name:e.name, images:[]} let data = { name: e.name, images: [] }
let imgName let imgName
newData.forEach(item => { newData.forEach(item => {
item.assets.forEach(element => { item.assets.forEach(element => {
element.propertyInfos.forEach( elements => { element.propertyInfos.forEach(elements => {
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType===3) { if (elements.propertyType === 3) {
elements.propertyName = imgName elements.propertyName = imgName
data.images.push(elements)} }); data.images.push(elements)
}
});
}); });
}); //newDate }); //newDate
if (data.images.length) { if (data.images.length) {
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗 let dialogRef = this.dialog.open(ImagesData, { width: '1350px', height: '700px', data }); //打开图片弹窗
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); this.snackBar.open('暂无图片数据', '确定', config);
} }
} else{ } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); } this.snackBar.open('暂无图片数据', '确定', config);
}
} else { //非逐层统计时 } else { //非逐层统计时
let newData = item.buildingDetails[e.name] let newData = item.buildingDetails[e.name]
let imgName let imgName
if (newData) { if (newData) {
let data = {name:e.name, images:[]} let data = { name: e.name, images: [] }
newData.forEach(element => { newData.forEach(element => {
element.propertyInfos.forEach(elements => { element.propertyInfos.forEach(elements => {
if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} if (elements.propertyName.includes('名称')) { imgName = elements.propertyValue }
if (elements.propertyType===3) { if (elements.propertyType === 3) {
elements.propertyName = imgName elements.propertyName = imgName
data.images.push(elements)} data.images.push(elements)
}); }
});
}); });
if (data.images.length) { if (data.images.length) {
let dialogRef = this.dialog.open(ImagesData,{width:'1350px',height:'700px',data}); //打开图片弹窗 let dialogRef = this.dialog.open(ImagesData, { width: '1350px', height: '700px', data }); //打开图片弹窗
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); this.snackBar.open('暂无图片数据', '确定', config);
} }
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('暂无图片数据','确定',config); } this.snackBar.open('暂无图片数据', '确定', config);
}
} }
} }

1
src/app/ui/realistic-picture/realistic-picture.component.scss

@ -50,6 +50,7 @@
.material { .material {
cursor:pointer; cursor:pointer;
height: 30px; height: 30px;
line-height: 26px;
font-size: 16px; font-size: 16px;
margin-top: 10px; margin-top: 10px;
padding-left: 15px; padding-left: 15px;

Loading…
Cancel
Save