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