From 74a8367284b71907fbcc849788a5fad892dbfb6c Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Thu, 11 Nov 2021 14:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=98=B2=E8=AE=BE=E6=96=BD=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-domain/left-domain.component.html | 2 +- .../left-domain/left-domain.component.ts | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/app/pages/left-domain/left-domain.component.html b/src/app/pages/left-domain/left-domain.component.html index 5a91b33..2b3196f 100644 --- a/src/app/pages/left-domain/left-domain.component.html +++ b/src/app/pages/left-domain/left-domain.component.html @@ -66,7 +66,7 @@
- +

{{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 dfdfc08..dca4e69 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/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,8 +100,9 @@ export class LeftDomainComponent implements OnInit { //点击tree节点 nzClick(event: NzFormatEmitEvent) { - event.node.isSelected = !event.node.isSelected if (event.node.key != 'XF_MHQ') { + event.node.isSelected = !event.node.isSelected + FacilityInfoInSceneWindow.instance.showFacilityByType(null, !event.node.isSelected) FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected) } }