@ -5,6 +5,11 @@ 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' ;
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility' ;
import { EventManager } from 'src/app/babylon/controller/event-manager/event-manager' ;
import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manager/events/event-get-markplandata-success' ;
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' ;
@Component ( {
selector : 'app-left-domain' ,
@ -13,7 +18,7 @@ import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-f
} )
export class LeftDomainComponent implements OnInit {
constructor ( ) { }
constructor ( private message : NzMessageService ) { }
ngOnInit ( ) : void {
this . initComponent ( )
@ -23,8 +28,6 @@ export class LeftDomainComponent implements OnInit {
beforeFence : number ; //当前选中功能栏
FacilityList : FacilityInfoUIItem [ ] = [ ] ; //统计设备 list
selectFacilityId : string = null ; //选中设备 ID
@ViewChild ( 'nzTreeComponent' , { static : false } ) nzTreeComponent ! : NzTreeComponent ;
treeData : NzTreeNodeOptions [ ] = [ ] ; //tree data
//初始化组件
initComponent ( type ? : number ) {
@ -39,6 +42,13 @@ 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 ) = > {
this . allMarkPlanData = data . data
} )
return
}
let list : FacilityInfoUIItem [ ] = [ ]
FacilityInfoInSceneWindow . instance . facilityInfoUIItemes . forEach ( item = > {
if ( this . beforeFence === 1 ) { //加油机
@ -67,6 +77,9 @@ export class LeftDomainComponent implements OnInit {
}
}
@ViewChild ( 'nzTreeComponent' , { static : false } ) nzTreeComponent ! : NzTreeComponent ;
treeData : NzTreeNodeOptions [ ] = [ ] ; //tree data
//处理 treeData
handleTreeData ( list : FacilityInfoUIItem [ ] ) {
this . treeData = [ ]
@ -137,6 +150,123 @@ export class LeftDomainComponent implements OnInit {
}
}
allMarkPlanData : AllMarkPlanData ; //处置预案节点数据
selectPlanId : number ;
selectNodeId : number ;
addDisposalPop : boolean = false ; //显示/隐藏 创建预案 弹窗
addNodePop : number = null ; //显示/隐藏 创建节点 父节点ID
//创建预案/节点
addDisposal ( e ) {
if ( this . addDisposalPop ) { //创建预案
MarkWindow . instance . createMarkPlaneData ( e . name )
this . addDisposalPop = false
} else { //创建节点
MarkWindow . instance . createMarkNodeData ( this . addNodePop , e . name )
this . addNodePop = null
}
}
//删除预案/节点
deleteDisposal ( item : MarkPlanData , e? : MarkNodeData ) {
let isTrue = confirm ( '您确定要删除吗' )
if ( isTrue ) {
if ( ! e ) {
MarkWindow . instance . deleteMarkPlaneData ( item . id )
} else {
MarkWindow . instance . deleteMarkNodeData ( item . id , e . id )
}
}
}
//选中 数据节点
selectNode ( item : MarkPlanData , e : MarkNodeData ) {
if ( this . selectPlanId != item . id || this . selectNodeId != e . id ) { //选中
if ( ! MarkWindow . instance . currentMarkNodeInfo ) { //未选中节点
this . selectPlanId = item . id
this . selectNodeId = e . id
MarkWindow . instance . selectMarkNode ( item . id , e . id )
} else { //已选中节点
let isTrue = confirm ( '切换节点后,没保存的信息将会丢失!' )
if ( isTrue ) {
this . selectPlanId = item . id
this . selectNodeId = e . id
MarkWindow . instance . selectMarkNode ( item . id , e . id )
}
}
} else if ( this . selectPlanId === item . id && this . selectNodeId === e . id ) { //取消选中
let isTrue = confirm ( '切换节点后,没保存的信息将会丢失!' )
if ( isTrue ) {
this . selectPlanId = null
this . selectNodeId = null
MarkWindow . instance . selectMarkNode ( null , null )
}
}
}
saveDisposalDialog : boolean = false ; //整体保存预案 弹窗
saveType : number = null ; //新建保存/保存到已有 弹窗
allNodeList : any [ ] = [ ] ; //所有根节点/节点
//保存-1
saveDisposal ( markPlanId : number = null , nodeId : number = null ) {
if ( ! MarkWindow . instance . currentMarkNodeInfo ) { //未选中节点
this . message . info ( '还没有进行标绘,无法保存' ) ;
return
}
if ( markPlanId === null && nodeId === null ) { // 整体弹窗保存
this . saveDisposalDialog = true
} else {
if ( this . selectPlanId === markPlanId && this . selectNodeId === nodeId ) {
MarkWindow . instance . saveToOldNode ( markPlanId , nodeId )
} else {
let isTrue = confirm ( '是否覆盖要保存的节点?' )
isTrue ? MarkWindow . instance . saveToOldNode ( markPlanId , nodeId ) : null
}
}
}
//保存-2
saveNode ( isNew : boolean ) {
this . saveDisposalDialog = false
if ( isNew ) { //新建节点并保存
this . saveType = 1
this . allNodeList = MarkWindow . instance . allMarkPlanData . datas
} else { //保存到已有节点
this . saveType = 2
this . allNodeList = [ ]
MarkWindow . instance . allMarkPlanData . datas . forEach ( item = > {
item . nodes . forEach ( element = > {
let node = {
id : element.id ,
parrentId : item.id ,
name : element.name ,
}
this . allNodeList . push ( node )
} )
} ) ;
}
}
//保存-3
saveDisposalNode ( e ) {
if ( this . saveType === 1 ) { //新建节点并保存
if ( ! e . name || ! e . root ) {
this . message . info ( '请完善表单' )
return
}
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 )
this . saveType = null
}
}
//编辑信息
editInfo() {