邵佳豪 5 years ago
parent
commit
8daf63b9f1
  1. 2
      src/app/navigation/navigation.component.html
  2. 2
      src/app/navigation/navigation.component.scss
  3. 1
      src/app/ui/fire-fighting-device/addGrouping.component.ts
  4. 52
      src/app/ui/fire-fighting-device/fire-fighting-device.component.html
  5. 68
      src/app/ui/fire-fighting-device/fire-fighting-device.component.scss
  6. 230
      src/app/ui/fire-fighting-device/fire-fighting-device.component.ts
  7. 9
      src/app/ui/fire-fighting-device/imagesdata.component.html
  8. 59
      src/app/ui/fire-fighting-device/imagesdata.component.ts
  9. 17
      src/app/ui/fire-fighting-device/previewImg.html
  10. 4
      src/app/ui/ui.module.ts

2
src/app/navigation/navigation.component.html

@ -13,7 +13,7 @@
<!-- allaround -->
<li [routerLink]="['/datacollection/allaround']" routerLinkActive="router-link-active">四周毗邻</li>
<!-- fire-fighting-device -->
<!-- <li [routerLink]="['/datacollection/fire-fighting-device']" routerLinkActive="router-link-active">消防设施</li> -->
<li [routerLink]="['/datacollection/fire-fighting-device']" routerLinkActive="router-link-active">消防设施</li>
<!-- key-site -->
<li [routerLink]="['/datacollection/key-site']" routerLinkActive="router-link-active">重点部位</li>
<!-- function-division -->

2
src/app/navigation/navigation.component.scss

@ -144,5 +144,5 @@ mat-sidenav{
}
.example-sidenav-content{
height: 100%;
overflow-y: hidden;
overflow: hidden;
}

1
src/app/ui/fire-fighting-device/addGrouping.component.ts

@ -2,7 +2,6 @@ import { Component, OnInit, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import Swiper from 'swiper';

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

@ -28,15 +28,37 @@
<mat-checkbox (change)='checkedCompany($event,item,items)' [disabled]='items.isBuiltin'></mat-checkbox>
</label>
<label class="textContent">{{items.name}}</label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewImg()'>查看图片</a></label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewImg(items)'>查看图片</a></label>
<label class="lastTextContent" *ngIf="items.isBuiltin">{{items.details}}</label>
<label class="lastTextContent" *ngIf="!items.isBuiltin">
<input type="text" [(ngModel)]="items.details" style="width: 80%;">
</label>
<label><mat-icon title="切换" (click)='SwitchBoard(items)' *ngIf="items.isBuiltin">radio_button_checked</mat-icon></label>
<label><mat-icon (click)='SwitchBoard(items)' *ngIf="items.isBuiltin">keyboard_arrow_down</mat-icon></label>
</mat-expansion-panel-header>
<div class="detailsTable">
<table>
<tr>
<th *ngFor="let header of items.header">{{header}}</th>
</tr>
<tr *ngFor="let body of items.body">
<td *ngFor="let header of items.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}}</p>
<table>
<tr>
<th *ngFor="let header of tableMsg.header">{{header}}</th>
</tr>
<tr *ngFor="let body of tableMsg.body">
<td *ngFor="let header of tableMsg.header">{{body[header]}}</td>
</tr>
</table>
</div>
</mat-expansion-panel>
</mat-accordion>
@ -97,15 +119,37 @@
<mat-checkbox (change)='checkedCompany($event,item,items)' [disabled]='items.isBuiltin'></mat-checkbox>
</label>
<label class="textContent">{{items.name}}</label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewImg()'>查看图片</a></label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewBuildingImg(newItem,items)'>查看图片</a></label>
<label class="lastTextContent" *ngIf="items.isBuiltin">{{items.details}}</label>
<label class="lastTextContent" *ngIf="!items.isBuiltin">
<input type="text" [(ngModel)]="items.details" style="width: 80%;">
</label>
<label><mat-icon title="切换" (click)='SwitchBoard(items)' *ngIf="items.isBuiltin">radio_button_checked</mat-icon></label>
<label><mat-icon (click)='SwitchBuildingBoard(newItem,items)' *ngIf="items.isBuiltin">keyboard_arrow_down</mat-icon></label>
</mat-expansion-panel-header>
<div class="detailsTable">
<table>
<tr>
<th *ngFor="let header of items.header">{{header}}</th>
</tr>
<tr *ngFor="let body of items.body">
<td *ngFor="let header of items.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}}</p>
<table>
<tr>
<th *ngFor="let header of tableMsg.header">{{header}}</th>
</tr>
<tr *ngFor="let body of tableMsg.body">
<td *ngFor="let header of tableMsg.header">{{body[header]}}</td>
</tr>
</table>
</div>
</mat-expansion-panel>
</mat-accordion>

68
src/app/ui/fire-fighting-device/fire-fighting-device.component.scss

@ -7,9 +7,11 @@
width: 75%;
height: 100%;
margin: 0 auto;
overflow-y: auto;
}
}
.mat-icon {
color: black;
cursor:pointer;
}
@ -38,11 +40,17 @@ input {
padding-left: 5px;
border-radius: 3px;
}
a {
color: #0000ff;
}
//bottom用户输入框
.InputField {
display: inline-block;
margin: 10px 20px;
width: 40%;
text-align: right;
margin: 10px 25px;
input {width: 300px;}
label {margin-right: 10px;}
}
textarea {
@ -52,4 +60,60 @@ textarea {
width: 300px;
height: 36px;
resize: none;
}
}
//表格样式
.detailsTable {
width: 95%;
margin: 0 auto 10px;
max-height: 300px;
overflow-y: auto;
table {
width: 100%;
text-align: center;
border-collapse:collapse;
th {
height: 35px;
border: 1px solid #999;}
td {
height: 35px;
border: 1px solid #999;}
}
}
//滚动条样式
::-webkit-scrollbar{
width: 8px;
background-color: white;
}
::-webkit-scrollbar-thumb{
background-color: #999;
}
//img图片列表页面
.imageList {
width: 100%;
height: 100%;
overflow-y: auto;
.imageListBox {
width: 100%;
height: 90%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
.imagesBox {
width: 300px;
height: 200px;
margin: 0 11px 0 11px;
display: inline-block;
img {
border: 1px solid #999;
width: auto;
height: auto;
max-width: 100%;
height: 170px;
cursor:pointer;
}
}
}
}

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

@ -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); }
}
}

9
src/app/ui/fire-fighting-device/imagesdata.component.html

@ -0,0 +1,9 @@
<div class="imageList">
<div mat-dialog-title *ngIf="data">{{data.name}}</div>
<div class="imageListBox">
<div class="imagesBox" *ngFor="let item of data.images;let key = index">
<img [src]='item.newImageUrl' (click)='seeImage(key)'>
<label style="display: inline-block;width: 100%;text-align: center;">{{item.propertyName}}</label>
</div>
</div>
</div>

59
src/app/ui/fire-fighting-device/imagesdata.component.ts

@ -1,6 +1,7 @@
import { Component, OnInit, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import Swiper from 'swiper';
@ -14,10 +15,68 @@ export class ImagesData {
constructor(private http: HttpClient,public dialogRef: MatDialogRef<ImagesData>,@Inject(MAT_DIALOG_DATA) public data,public dialog: MatDialog) {}
ngOnInit(): void {
this.data.images.forEach(element => {
element.newImageUrl = `${element.propertyValue}?x-oss-process=image/resize,m_fill,h_170,w_299`
});
}
//查看大图
seeImage (index) {
let data = {
allImages:this.data.images,
imgIndex: index}
let dialogRef = this.dialog.open(previewBigImg,
{width: '1600px',
height:'900px',data});
}
}
@Component({
selector: 'previewBigImg',
templateUrl: './previewImg.html',
styleUrls: ['../realistic-picture/realistic-picture.component.scss']
})
export class previewBigImg {
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<previewBigImg>,
@Inject(MAT_DIALOG_DATA) public data) { }
testSwiper: Swiper;
ngOnInit(): void {
this.allImages = this.data.allImages
this.allImages.forEach(element => {
element.previewImageUrl = `${element.propertyValue}?x-oss-process=image/auto-orient,1` //处理图片URL地址
});
}
ngAfterViewInit() {
this.testSwiper = new Swiper('.swiper-container', {
lazy: true,
initialSlide: this.data.imgIndex,
direction: 'horizontal',
loop: false,
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
}
allImages:any; //展示所有的图片
rotationAngle:number=0; //旋转角度
//旋转图片
rotate () {
this.rotationAngle = this.rotationAngle+90
if (this.rotationAngle === 360) {this.rotationAngle = 0}
}
}

17
src/app/ui/fire-fighting-device/previewImg.html

@ -0,0 +1,17 @@
<div mat-dialog-title>图片详情</div>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide previewImgBox" *ngFor="let item of allImages">
<img [attr.data-src]="item.previewImageUrl" class="swiper-lazy" [ngClass]="{'rotateA':rotationAngle==90,'rotateB':rotationAngle==180,'rotateC':rotationAngle==270}">
<div class="swiper-lazy-preloader"></div>
</div>
</div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<div class="previewImgBottom">
<button type="button" mat-icon-button (click)='rotate()'><mat-icon>refresh</mat-icon></button>
</div>

4
src/app/ui/ui.module.ts

@ -90,14 +90,14 @@ import { RealisticPictureComponent,previewImg,addRealPicture,editRealPicture } f
import { UploadingCADComponent,readFile,editFile } from './uploading-cad/uploading-cad.component';
import { AddHouseInfo } from './basicinfo/addhouseinfo.component';
import { ImgDetails } from './allaround/imgdetails.component';
import { ImagesData } from './fire-fighting-device/imagesdata.component';
import { ImagesData,previewBigImg } from './fire-fighting-device/imagesdata.component';
import { ImgsDataDetail } from './fire-fighting-device/addGrouping.component';
import { KeySiteImgs } from './key-site/keysiteimgs.component';
import { KeyImgDetail } from './key-site/keyimgdetail.component';
import { LookMaster } from './basicinfo/lookmaster.component';
@NgModule({
declarations: [UiComponent, CardComponent, StepperComponent, TabgroupComponent, ProgressComponent, SnackbarComponent,PersonaldataComponent, UserdataComponent, ChangepasswordComponent, OrganizationComponent, UnittypeComponent, AuthorityComponent, RoleComponent, UsermanagementComponent,IsnoPipe,ConfirmpswDirective,DialogOverviewExampleDialog,CreateAuthority,CreateRole,EditRole,TimePipe,CreateNewUser,EditNewUser,allRoles,SharePower,CreateOrganization,EditOrganization,seeInformation,EditUser,editorialUnit,FireProtectionElementsComponent,Establish,EditingFireControl,FireFightingTemplateComponent, NavmenusComponent,CreateMenus,EditMenus,NewFireFighting,EditFireClassification, MaterialBankComponent, UnitInformationComponent,AddMatLibrary,EditMatLibrary,attributeComponent,AddOriginalCopy,addAttributeComponent,editAttribute,EditOriginalCopy,SelectOriginalCopy,EditUnitInfo,AddUnitInfo,AddGroups,EditGroup, BasicinfoComponent, PlanComponent, AllaroundComponent, FireFightingDeviceComponent, KeySiteComponent, FunctionDivisionComponent, RealisticPictureComponent, UploadingCADComponent,AddHouseInfo,ImgDetails,ImagesData,ImgsDataDetail,KeySiteImgs,KeyImgDetail,addPartition,addPartitionAttribute,previewImg,addRealPicture,editRealPicture,readFile,editFile,LookMaster
declarations: [UiComponent, CardComponent, StepperComponent, TabgroupComponent, ProgressComponent, SnackbarComponent,PersonaldataComponent, UserdataComponent, ChangepasswordComponent, OrganizationComponent, UnittypeComponent, AuthorityComponent, RoleComponent, UsermanagementComponent,IsnoPipe,ConfirmpswDirective,DialogOverviewExampleDialog,CreateAuthority,CreateRole,EditRole,TimePipe,CreateNewUser,EditNewUser,allRoles,SharePower,CreateOrganization,EditOrganization,seeInformation,EditUser,editorialUnit,FireProtectionElementsComponent,Establish,EditingFireControl,FireFightingTemplateComponent, NavmenusComponent,CreateMenus,EditMenus,NewFireFighting,EditFireClassification, MaterialBankComponent, UnitInformationComponent,AddMatLibrary,EditMatLibrary,attributeComponent,AddOriginalCopy,addAttributeComponent,editAttribute,EditOriginalCopy,SelectOriginalCopy,EditUnitInfo,AddUnitInfo,AddGroups,EditGroup, BasicinfoComponent, PlanComponent, AllaroundComponent, FireFightingDeviceComponent, KeySiteComponent, FunctionDivisionComponent, RealisticPictureComponent, UploadingCADComponent,AddHouseInfo,ImgDetails,ImagesData,ImgsDataDetail,KeySiteImgs,KeyImgDetail,addPartition,addPartitionAttribute,previewImg,addRealPicture,editRealPicture,readFile,editFile,LookMaster,previewBigImg
],
imports: [

Loading…
Cancel
Save