|
|
|
@ -10,11 +10,12 @@ import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manag
|
|
|
|
|
import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data'; |
|
|
|
|
import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window'; |
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { ModeManager, ModeType } from 'src/app/babylon/controller/mode-manager'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-left-domain', |
|
|
|
|
templateUrl: './left-domain.component.html', |
|
|
|
|
styleUrls: ['./left-domain.component.scss','../plan/publicPop.scss'] |
|
|
|
|
styleUrls: ['./left-domain.component.scss', '../plan/publicPop.scss'] |
|
|
|
|
}) |
|
|
|
|
export class LeftDomainComponent implements OnInit { |
|
|
|
|
|
|
|
|
@ -49,24 +50,24 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
//处理 设备data
|
|
|
|
|
handleFacility() { |
|
|
|
|
if (this.beforeFence === 7) { //应急预案
|
|
|
|
|
MarkWindow.instance? this.allMarkPlanData= MarkWindow.instance.allMarkPlanData : null |
|
|
|
|
EventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData)=>{ |
|
|
|
|
MarkWindow.instance ? this.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null |
|
|
|
|
EventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData) => { |
|
|
|
|
this.allMarkPlanData = data.data |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
let list: FacilityInfoUIItem[] = [] |
|
|
|
|
FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item=>{ |
|
|
|
|
FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item => { |
|
|
|
|
if (this.beforeFence === 1) { //加油机
|
|
|
|
|
item.getType() === "JY_JYJ"? list.push(item) : null |
|
|
|
|
item.getType() === "JY_JYJ" ? list.push(item) : null |
|
|
|
|
} else if (this.beforeFence === 2) { //油罐设备
|
|
|
|
|
item.getType() === "JY_YG"? list.push(item) : null |
|
|
|
|
item.getType() === "JY_YG" ? list.push(item) : null |
|
|
|
|
} else if (this.beforeFence === 3) { //消防设施
|
|
|
|
|
(item.getType()).slice(0,3) === "XF_"? list.push(item) : null |
|
|
|
|
(item.getType()).slice(0, 3) === "XF_" ? list.push(item) : null |
|
|
|
|
} else if (this.beforeFence === 5) { //输油管线
|
|
|
|
|
item.getType() === "JY_SYGX"? list.push(item) : null |
|
|
|
|
}else if (this.beforeFence === 6) { //油气回收
|
|
|
|
|
item.getType() === "JY_YQHSGX"? list.push(item) : null |
|
|
|
|
item.getType() === "JY_SYGX" ? list.push(item) : null |
|
|
|
|
} else if (this.beforeFence === 6) { //油气回收
|
|
|
|
|
item.getType() === "JY_YQHSGX" ? list.push(item) : null |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.FacilityList = list |
|
|
|
@ -93,8 +94,8 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
//处理 treeData
|
|
|
|
|
handleTreeData(list: FacilityInfoUIItem[]) { |
|
|
|
|
this.treeData = [] |
|
|
|
|
list.forEach(item=>{ |
|
|
|
|
let isFind = this.treeData.find(element=>{ return (item.getType()).includes(element.key) }) |
|
|
|
|
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: [], } |
|
|
|
@ -106,7 +107,7 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
this.treeData.push(primaryNode) |
|
|
|
|
} |
|
|
|
|
} else { //存在
|
|
|
|
|
if (item.getType().includes('XF_MHQ') && !isFind.children.find(elements=>{ return elements.key === item.getType() })) { //灭火器
|
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
@ -120,8 +121,8 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
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 (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) |
|
|
|
@ -135,8 +136,8 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
//获取设备 数量
|
|
|
|
|
getFacilityNum(type: string): number { |
|
|
|
|
let num = 0 |
|
|
|
|
this.FacilityList.forEach(item=>{ |
|
|
|
|
item.getType().includes(type)? num = num + 1 : null |
|
|
|
|
this.FacilityList.forEach(item => { |
|
|
|
|
item.getType().includes(type) ? num = num + 1 : null |
|
|
|
|
}) |
|
|
|
|
return num |
|
|
|
|
} |
|
|
|
@ -149,11 +150,11 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
FacilityInfoInSceneWindow.instance.showFacilityByType(null, false) |
|
|
|
|
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected) |
|
|
|
|
} else { //显示所有
|
|
|
|
|
this.treeData.forEach(item=>{ |
|
|
|
|
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) }) |
|
|
|
|
item.children.forEach(element => { FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[element.key], true) }) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -172,7 +173,7 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
MarkWindow.instance.createMarkPlaneData(e.name) |
|
|
|
|
this.addDisposalPop = false |
|
|
|
|
} else { //创建节点
|
|
|
|
|
MarkWindow.instance.createMarkNodeData(this.addNodePop,e.name) |
|
|
|
|
MarkWindow.instance.createMarkNodeData(this.addNodePop, e.name) |
|
|
|
|
this.addNodePop = null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -195,21 +196,28 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
if (!MarkWindow.instance.currentMarkNodeInfo) { //未选中节点
|
|
|
|
|
this.selectPlanId = item.id |
|
|
|
|
this.selectNodeId = e.id |
|
|
|
|
MarkWindow.instance.selectMarkNode(item.id,e.id) |
|
|
|
|
MarkWindow.instance.selectMarkNode(item.id, e.id) |
|
|
|
|
} else { //已选中节点
|
|
|
|
|
let isTrue = confirm('切换节点后,没保存的信息将会丢失!') |
|
|
|
|
let isTrue = true; |
|
|
|
|
if (ModeManager.currentMode == ModeType.Edit) { |
|
|
|
|
isTrue = confirm('切换节点后,没保存的信息将会丢失!') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isTrue) { |
|
|
|
|
this.selectPlanId = item.id |
|
|
|
|
this.selectNodeId = e.id |
|
|
|
|
MarkWindow.instance.selectMarkNode(item.id,e.id) |
|
|
|
|
MarkWindow.instance.selectMarkNode(item.id, e.id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (this.selectPlanId === item.id && this.selectNodeId === e.id) { //取消选中
|
|
|
|
|
let isTrue = confirm('切换节点后,没保存的信息将会丢失!') |
|
|
|
|
let isTrue = true; |
|
|
|
|
if (ModeManager.currentMode == ModeType.Edit) { |
|
|
|
|
isTrue = confirm('切换节点后,没保存的信息将会丢失!') |
|
|
|
|
} |
|
|
|
|
if (isTrue) { |
|
|
|
|
this.selectPlanId = null |
|
|
|
|
this.selectNodeId = null |
|
|
|
|
MarkWindow.instance.selectMarkNode(null,null) |
|
|
|
|
MarkWindow.instance.selectMarkNode(null, null) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -228,10 +236,10 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
this.saveDisposalDialog = true |
|
|
|
|
} else { |
|
|
|
|
if (this.selectPlanId === markPlanId && this.selectNodeId === nodeId) { |
|
|
|
|
MarkWindow.instance.saveToOldNode(markPlanId,nodeId) |
|
|
|
|
MarkWindow.instance.saveToOldNode(markPlanId, nodeId) |
|
|
|
|
} else { |
|
|
|
|
let isTrue = confirm('是否覆盖要保存的节点?') |
|
|
|
|
isTrue? MarkWindow.instance.saveToOldNode(markPlanId,nodeId) : null |
|
|
|
|
isTrue ? MarkWindow.instance.saveToOldNode(markPlanId, nodeId) : null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -246,7 +254,7 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
this.saveType = 2 |
|
|
|
|
this.allNodeList = [] |
|
|
|
|
MarkWindow.instance.allMarkPlanData.datas.forEach(item => { |
|
|
|
|
item.nodes.forEach(element=>{ |
|
|
|
|
item.nodes.forEach(element => { |
|
|
|
|
let node = { |
|
|
|
|
id: element.id, |
|
|
|
|
parrentId: item.id, |
|
|
|
@ -265,14 +273,14 @@ export class LeftDomainComponent implements OnInit {
|
|
|
|
|
this.message.info('请完善表单') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
MarkWindow.instance.createNewNodeAndSave(e.root.id,e.name) |
|
|
|
|
MarkWindow.instance.createNewNodeAndSave(e.root.id, e.name) |
|
|
|
|
this.saveType = null |
|
|
|
|
} else { //保存到已有节点
|
|
|
|
|
if (!e.node) { |
|
|
|
|
this.message.info('请完善表单') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
MarkWindow.instance.saveToOldNode(e.node.parrentId,e.node.id) |
|
|
|
|
MarkWindow.instance.saveToOldNode(e.node.parrentId, e.node.id) |
|
|
|
|
this.saveType = null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|