diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index bc06280..e724c8d 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/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; } diff --git a/src/app/pages/left-domain/left-domain.component.html b/src/app/pages/left-domain/left-domain.component.html index 5221beb..9eeb991 100644 --- a/src/app/pages/left-domain/left-domain.component.html +++ b/src/app/pages/left-domain/left-domain.component.html @@ -68,7 +68,7 @@
-

{{node.title}}

{{node.children.length}}

+

{{node.title}}

{{getFacilityNum(node.key)}}

diff --git a/src/app/pages/left-domain/left-domain.component.ts b/src/app/pages/left-domain/left-domain.component.ts index 80e56ad..fb855cd 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/src/app/pages/left-domain/left-domain.component.ts @@ -1,6 +1,9 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { 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'; @Component({ selector: 'app-left-domain', @@ -16,18 +19,68 @@ 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, children: [], } + let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } + primaryNode.children.push(treeNode) + this.treeData.push(primaryNode) + } else { + let primaryNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } + 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, } + 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 + } + //编辑信息 editInfo() { diff --git a/src/styles.scss b/src/styles.scss index 30d9ef7..4d7af63 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -104,6 +104,7 @@ h1 { //三维场景 #threeDimensional { + .ant-tree-node-content-wrapper:hover { background-color: transparent; } .ant-tree-node-content-wrapper { width: 100%; } //滚动条样式 ::-webkit-scrollbar {