刘向辉 3 years ago
parent
commit
7165bbf92a
  1. 12
      src/app/babylon/controller/config-manager.ts
  2. 4
      src/app/pages/left-domain/left-domain.component.html
  3. 10
      src/app/pages/left-domain/left-domain.component.scss
  4. 92
      src/app/pages/left-domain/left-domain.component.ts
  5. 3
      src/app/pages/login/login.component.ts
  6. 2
      src/styles.scss

12
src/app/babylon/controller/config-manager.ts

@ -80,7 +80,17 @@ export class ConfigManager {
case FacilityType.DWBZ: result = "点位标注"; break;
//内建
case FacilityType.XF_MHQ_PT_4: result = "4kg普通灭火器"; break;
case FacilityType.XF_MHQ_PT_8: result = "8kg普通灭火器"; break;
case FacilityType.XF_MHQ_PT_35: result = "35kg普通灭火器"; break;
case FacilityType.XF_MHQ_GF_4: result = "4kg干粉灭火器"; break;
case FacilityType.XF_MHQ_GF_8: result = "8kg干粉灭火器"; break;
case FacilityType.XF_MHQ_GF_35: result = "35kg干粉灭火器"; break;
case FacilityType.XF_MHT: result = "灭火毯"; break;
case FacilityType.XF_XFQ: result = "消防锹"; break;
case FacilityType.XF_XFT: result = "消防桶"; break;
case FacilityType.XF_XFCM: result = "消防长矛"; break;
case FacilityType.XF_XFF: result = "消防斧"; break;
case FacilityType.XF_XFS: result = "消防沙"; break;
}
return result;
}

4
src/app/pages/left-domain/left-domain.component.html

@ -66,9 +66,9 @@
<!-- 油罐设备 -->
<!-- 消防设施 -->
<div class="publicBox fireFacilities" *ngIf="beforeFence === 3">
<nz-tree [nzData]="treeData" [nzTreeTemplate]="nzTreeTemplate"></nz-tree>
<nz-tree [nzData]="treeData" [nzTreeTemplate]="nzTreeTemplate" [nzMultiple]="true" (nzClick)="nzClick($event)"></nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="treeRow"><p>{{node.title}}</p><p>{{node.children.length}}</p></div>
<div class="treeRow"><p>{{node.title}}</p><p><i nz-icon nzType="eye" nzTheme="outline" *ngIf="node.isSelected"></i>{{getFacilityNum(node.key)}}</p></div>
</ng-template>
</div>
<!-- 消防设施 -->

10
src/app/pages/left-domain/left-domain.component.scss

@ -64,13 +64,9 @@
}
}
}
.oilTank{ //油管设备
// .oilTank{ //油管设备
}
// }
.fireFacilities{ //消防设施
.ant-tree{
background-color: transparent;
color: #C4E2FC;
}
.treeRow{ width: 100%; display: flex; height: 30px; line-height: 30px; p:first-child{ flex: 1; }; p{ margin: 0; padding: 0; } }
.treeRow{ width: 100%; display: flex; height: 30px; line-height: 30px; p:first-child{ flex: 1; }; p{ margin: 0; padding: 0; .anticon{ margin-right: 5px; font-size: 16px; } } }
}

92
src/app/pages/left-domain/left-domain.component.ts

@ -1,6 +1,10 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window';
import { PlanComponent } from '../plan/plan.component';
import { FacilityInfoUIItem } from "../../babylon/view/facilityinfoinscene-window/facilityinfo-ui-item";
import { ConfigManager } from 'src/app/babylon/controller/config-manager';
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility';
@Component({
selector: 'app-left-domain',
@ -16,15 +20,73 @@ export class LeftDomainComponent implements OnInit {
}
beforeFence: number; //当前选中功能栏
FacilityList: FacilityInfoUIItem[] = []; //统计设备 list
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
treeData: NzTreeNodeOptions[] = treeData.nodes; //tree data
treeData: NzTreeNodeOptions[] = []; //tree data
//初始化组件
initComponent(type?: number) {
if (type != undefined && type != null) {
this.beforeFence = type
this.handleFacility()
} else {
this.beforeFence = PlanComponent.instance.selectFence
this.handleFacility()
}
}
//处理 设备data
handleFacility() {
let list: FacilityInfoUIItem[] = []
FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item=>{
if (this.beforeFence === 3) { //消防设施
(item.getType()).slice(0,3) === "XF_"? list.push(item) : null
}
})
this.FacilityList = list
if (this.beforeFence === 3) { //消防设施
this.handleTreeData(this.FacilityList)
}
}
//处理 treeData
handleTreeData(list: FacilityInfoUIItem[]) {
this.treeData = []
list.forEach(item=>{
let isFind = this.treeData.find(element=>{ return (item.getType()).includes(element.key) })
if (!isFind) { //不存在
if (item.getType().includes('XF_MHQ')) { //灭火器
let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, expanded: true, children: [], }
let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, selected: true, }
primaryNode.children.push(treeNode)
this.treeData.push(primaryNode)
} else {
let primaryNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, selected: true, }
this.treeData.push(primaryNode)
}
} else { //存在
if (item.getType().includes('XF_MHQ') && !isFind.children.find(elements=>{ return elements.key === item.getType() })) { //灭火器
let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, selected: true, }
isFind.children.push(treeNode)
}
}
})
}
//获取设备 数量
getFacilityNum(type: string): number {
let num = 0
this.FacilityList.forEach(item=>{
item.getType().includes(type)? num = num + 1 : null
})
return num
}
//点击tree节点
nzClick(event: NzFormatEmitEvent) {
event.node.isSelected = !event.node.isSelected
if (event.node.key != 'XF_MHQ') {
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected)
}
}
@ -43,29 +105,5 @@ export class LeftDomainComponent implements OnInit {
}
export class treeData {
static nodes: NzTreeNodeOptions[] = [
{
title: '灭火器',
key: '1',
selectable: false,
children: [
{ title: '4KG手提干粉灭火器', key: '1', selectable: false, },
{ title: '4KG手提泡沫灭火器', key: '2', selectable: false, },
{ title: '4KG手提二氧化碳灭火器', key: '3', selectable: false, },
{ title: '35KG手推灭火器', key: '4', selectable: false, },
]
},
{
title: '灭火毯',
key: '2',
selectable: false,
children: []
},
{
title: '消防锹',
key: '3',
selectable: false,
children: []
},
];
static nodes: NzTreeNodeOptions[] = []
}

3
src/app/pages/login/login.component.ts

@ -3,9 +3,9 @@ import { HttpClient } from '@angular/common/http'
import { Router, ActivatedRoute } from '@angular/router'
import { CacheTokenService } from '../../service/cache-token.service'//引入服务
import { CookieService } from 'ngx-cookie-service';//cookie插件
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
@ -28,6 +28,7 @@ export class LoginComponent implements OnInit {
errmsg: string = ''; //错误信息
//跳转注册页面
toRegister() {
this.router.navigate(['/register'])

2
src/styles.scss

@ -104,6 +104,8 @@ h1 {
//三维场景
#threeDimensional {
.ant-tree{ color: #C4E2FC; }
.ant-tree,.ant-tree-node-content-wrapper:hover,.ant-tree-node-content-wrapper.ant-tree-node-selected { background-color: transparent; }
.ant-tree-node-content-wrapper { width: 100%; }
//滚动条样式
::-webkit-scrollbar {

Loading…
Cancel
Save