刘向辉 3 years ago
parent
commit
a2724e9db2
  1. 2
      src/app/pages/left-domain/left-domain.component.html
  2. 37
      src/app/pages/left-domain/left-domain.component.ts

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

@ -66,7 +66,7 @@
<!-- 油罐设备 -->
<!-- 消防设施 -->
<div class="publicBox fireFacilities" *ngIf="beforeFence === 3">
<nz-tree [nzData]="treeData" [nzTreeTemplate]="nzTreeTemplate" [nzMultiple]="true" (nzClick)="nzClick($event)"></nz-tree>
<nz-tree [nzData]="treeData" [nzTreeTemplate]="nzTreeTemplate" (nzClick)="nzClick($event)"></nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<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>

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

@ -57,20 +57,36 @@ export class LeftDomainComponent implements OnInit {
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, }
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, selected: true, }
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, selected: true, }
let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, }
isFind.children.push(treeNode)
}
}
})
//编辑模式
let isFind = this.treeData.find(item=>{ return item.key === 'XF_MHQ' })
if (!isFind) {
let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, }
this.treeData.push(primaryNode)
}
for (let facility in FacilityType) {
if (facility.slice(0,3) === "XF_" && !facility.includes('XF_MHQ')) {
let isFind = this.treeData.find(item=>{ return item.key === facility })
if (!isFind) {
let primaryNode = { title: ConfigManager.getFacilityTypeName(FacilityType[facility]), key: facility, selectable: false, }
this.treeData.push(primaryNode)
}
}
}
//编辑模式
}
//获取设备 数量
@ -84,9 +100,20 @@ export class LeftDomainComponent implements OnInit {
//点击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)
event.node.isSelected = !event.node.isSelected
if (event.node.isSelected) { //显示当前, 隐藏所有
FacilityInfoInSceneWindow.instance.showFacilityByType(null, false)
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected)
} else { //显示所有
this.treeData.forEach(item=>{
if (item.key != 'XF_MHQ') {
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[item.key], true)
} else {
item.children.forEach(element=>{ FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[element.key], true) })
}
})
}
}
}

Loading…
Cancel
Save