@ -1,4 +1,5 @@
import { Component , ElementRef , OnInit , ViewChild } from '@angular/core' ;
import { Component , ElementRef , OnInit , ViewChild } from '@angular/core' ;
import Viewer from 'viewerjs' ;
import { Game } from 'src/app/babylon/game' ;
import { Game } from 'src/app/babylon/game' ;
import { LoginSatus } from 'src/app/babylon/controller/status/login-status' ;
import { LoginSatus } from 'src/app/babylon/controller/status/login-status' ;
import { StatusManager } from 'src/app/babylon/controller/status/status-manager' ;
import { StatusManager } from 'src/app/babylon/controller/status/status-manager' ;
@ -23,6 +24,11 @@ import { AllMarkData } from 'src/app/babylon/model/data/mark/all-mark-data';
import { MarkData , MarkTask } from 'src/app/babylon/model/data/mark/mark-data' ;
import { MarkData , MarkTask } from 'src/app/babylon/model/data/mark/mark-data' ;
import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window' ;
import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window' ;
import { AllMarkPlanData , MarkNodeData , MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data' ;
import { AllMarkPlanData , MarkNodeData , MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data' ;
import { DataManager , ResType } from 'src/app/babylon/controller/data-manager' ;
import { EventManager as babylonEventManager } 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 { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window' ;
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility' ;
@ -41,13 +47,16 @@ export class PlanComponent implements OnInit {
public canvas : HTMLCanvasElement ; //canvas 实例
public canvas : HTMLCanvasElement ; //canvas 实例
public editMode : boolean = true ; //编辑/查看 模式
public editMode : boolean = true ; //编辑/查看 模式
public userMode : boolean = ModeManager . s_isMakeMode ; //是否为 内部权限
public userMode : boolean = ModeManager . s_isMakeMode ; //是否为 内部权限
public bucketName : string = ObjectsService . getFullPath ( "文件路径" ) ; //当前桶名
public isShowLoading : boolean = true ; //显隐 loading加载条
public isShowLoading : boolean = true ; //显隐 loading加载条
public companyData : any ; //当前加油站 信息
ngOnInit ( ) : void {
ngOnInit ( ) : void {
PlanComponent . instance = this ;
PlanComponent . instance = this ;
ServeManager . Init ( this . buildingBISrv , this . objectsSrv ) ;
ServeManager . Init ( this . buildingBISrv , this . objectsSrv ) ;
this . canvas = this . element . nativeElement . querySelector ( '#center' ) as HTMLCanvasElement ;
this . canvas = this . element . nativeElement . querySelector ( '#center' ) as HTMLCanvasElement ;
this . game . init ( this . canvas ) ;
this . game . init ( this . canvas ) ;
this . companyData = ( JSON . parse ( sessionStorage . getItem ( 'userdataOfgasstation' ) ) ) . organization || { }
let editMode = sessionStorage . getItem ( 'isGasStation' )
let editMode = sessionStorage . getItem ( 'isGasStation' )
if ( editMode == 'false' ) {
if ( editMode == 'false' ) {
this . editMode = true
this . editMode = true
@ -70,9 +79,9 @@ export class PlanComponent implements OnInit {
ngAfterViewInit ( ) : void {
ngAfterViewInit ( ) : void {
let simpleData : InsitutionDataSimple = new InsitutionDataSimple ( ) ;
let simpleData : InsitutionDataSimple = new InsitutionDataSimple ( ) ;
simpleData . id = 1 ; //来自选中的单位的信息 ,测试:1
simpleData . id = 1 ; //来自选中的单位的信息 ,测试:1
simpleData . key = "ceshi" ; //正式: id.tostring(),测试:"ceshi"
simpleData . key = "ceshi" ; //正式: id.tostring(),测试:"ceshi"
simpleData . name = "测试"; //来自选中的单位的信息 ,测试:"测试"
simpleData . name = this . companyData . displayName || "测试"; //来自选中的单位的信息 ,测试:"测试"
let has3dData = true ; //是否有三维数据,来自选中单位的信息
let has3dData = true ; //是否有三维数据,来自选中单位的信息
let loginStatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
let loginStatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
@ -85,8 +94,8 @@ export class PlanComponent implements OnInit {
{
{
let isAdd = confirm ( '没有单位' + simpleData . key + ',是否进行初始化?' )
let isAdd = confirm ( '没有单位' + simpleData . key + ',是否进行初始化?' )
if ( isAdd ) {
if ( isAdd ) {
let name = simpleData . key ;
let name = simpleData . name ;
let id = 2 ; // 单位id
let id = simpleData . id ; // 单位id
loginStatus . createInsitution ( simpleData . key , name , id ) ;
loginStatus . createInsitution ( simpleData . key , name , id ) ;
}
}
}
}
@ -117,6 +126,7 @@ export class PlanComponent implements OnInit {
modelInit ( InsList ) { }
modelInit ( InsList ) { }
allFence : string [ ] = [ "基本信息" , "加油机" , "油罐设备" , "消防设施" , "安全疏散" , "输油管线" , "油气回收" , "应急预案" ] ; //头部 功能栏
allFence : string [ ] = [ "基本信息" , "加油机" , "油罐设备" , "消防设施" , "安全疏散" , "输油管线" , "油气回收" , "应急预案" ] ; //头部 功能栏
baseInfoMarks : baseInfoMark [ ] = [ new baseInfoMark ( "毗邻" ) , new baseInfoMark ( "区域" ) , new baseInfoMark ( "图片" ) , new baseInfoMark ( "点位" ) ] //基本信息 设备筛选list
selectFence : number = - 1 ; //选中 头部功能栏
selectFence : number = - 1 ; //选中 头部功能栏
isShowChildComponent : boolean = false ; //是否 显示左侧子组件
isShowChildComponent : boolean = false ; //是否 显示左侧子组件
@ViewChild ( 'leftDomain' ) leftDomain : LeftDomainComponent ; //子组件引用
@ViewChild ( 'leftDomain' ) leftDomain : LeftDomainComponent ; //子组件引用
@ -133,10 +143,24 @@ export class PlanComponent implements OnInit {
if ( this . selectFence === 7 ) { //初始化 应急预案模块
if ( this . selectFence === 7 ) { //初始化 应急预案模块
this . initializePlan ( )
this . initializePlan ( )
}
}
this . isShowChildComponent && this . leftDomain && type != 4 ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
if ( type === 7 ) { //初始化 应急预案 data
this . selectFence = type
this . isShowChildComponent && this . leftDomain ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . isShowChildComponent = true
this . selectFence = type
buildingWindow . changeJYZInfoModel ( fenceType , true )
this . editMode ? this . isShowChildComponent = true : this . isShowChildComponent = false
buildingWindow . changeJYZInfoModel ( fenceType , true )
MarkWindow . instance ? this . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null ;
babylonEventManager . addListener ( Event_GetAllMarkPlanData , ( data : Event_GetAllMarkPlanData ) = > {
this . allMarkPlanData = MarkWindow . instance . allMarkPlanData
this . isShowChildComponent && this . leftDomain ? this . leftDomain . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null
} )
this . isShowChildComponent && this . leftDomain ? this . leftDomain . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null
} else {
this . isShowChildComponent && this . leftDomain && type != 4 ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . selectFence = type
this . isShowChildComponent = true
buildingWindow . changeJYZInfoModel ( fenceType , true )
if ( type === 0 ) { this . baseInfoMarks . forEach ( item = > { item . isShow = true } ) } //初始化基本信息 设备显隐
}
} else { //取消选中
} else { //取消选中
this . selectFence = - 1
this . selectFence = - 1
this . isShowChildComponent = false
this . isShowChildComponent = false
@ -170,6 +194,21 @@ export class PlanComponent implements OnInit {
return fenceType
return fenceType
}
}
//基本信息 设备筛选显隐
toggleBaseInfoMark ( event , item : baseInfoMark ) {
let type
if ( item . markerName === "毗邻" ) {
type = FacilityType . PL
} else if ( item . markerName === "区域" ) {
type = FacilityType . QY
} else if ( item . markerName === "图片" ) {
type = FacilityType . TPBZ
} else if ( item . markerName === "点位" ) {
type = FacilityType . DWBZ
}
FacilityInfoInSceneWindow . instance . showFacilityByType ( type , event )
}
//子组件 创建预案/保存
//子组件 创建预案/保存
noticeChildComponent ( type : boolean ) {
noticeChildComponent ( type : boolean ) {
if ( this . isShowChildComponent && this . leftDomain ) {
if ( this . isShowChildComponent && this . leftDomain ) {
@ -321,6 +360,7 @@ export class PlanComponent implements OnInit {
isShowNature : boolean = false ; //显隐设备 属性栏
isShowNature : boolean = false ; //显隐设备 属性栏
beforeOnePropertyData : FacilityInfoUIItem = null ; //当前选择 设备
beforeOnePropertyData : FacilityInfoUIItem = null ; //当前选择 设备
propertyImg : Viewer ; //设备图标Viewer 实例
naturePosition : naturePosition = new naturePosition ( ) ; //设备栏 定位位置
naturePosition : naturePosition = new naturePosition ( ) ; //设备栏 定位位置
//选中 设备
//选中 设备
@ -331,6 +371,36 @@ export class PlanComponent implements OnInit {
if ( this . isShowChildComponent && this . leftDomain ) {
if ( this . isShowChildComponent && this . leftDomain ) {
this . leftDomain . selectFacilityId = e . getID ( )
this . leftDomain . selectFacilityId = e . getID ( )
}
}
if ( this . selectFence === 0 && this . beforeOnePropertyData . getPropertyData ( ) && this . beforeOnePropertyData . getPropertyData ( ) . img ) { //img
window . setTimeout ( ( ) = > {
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' } ) ;
} , 0 )
}
}
//上传设备 图片
uploadPropertyImg ( e ) {
if ( e . target . files . length ) {
let maxSize = 30 * 1024 * 1024 //限制30MB
let file = e . target . files [ 0 ]
if ( file . size > maxSize ) { //超出限制
this . message . info ( "上传资源需小于30MB" ) ;
return
}
this . isShowLoading = true //打开遮罩
let institutionKey = sessionStorage . getItem ( 'unitId' ) || "ceshi" ; //单位id
let buildingKey = this . buildingUIItems . find ( item = > { return item . getBuildingID ( ) == this . beforeOneBuildingID } )
let facility = this . beforeOnePropertyData
let url = DataManager . getResPath_facilityProperty ( institutionKey , buildingKey . getBuildingID ( ) , facility . getType ( ) , facility . getID ( ) , null )
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
this . beforeOnePropertyData . getPropertyData ( ) . img = ObjectsService . getFullPath ( path + name )
window . setTimeout ( ( ) = > {
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' } ) ;
} , 0 )
this . isShowLoading = false //关闭遮罩
this . message . info ( "上传成功!" ) ;
} )
}
}
}
allMarkPlanData : AllMarkPlanData ; //处置预案节点 数据
allMarkPlanData : AllMarkPlanData ; //处置预案节点 数据
@ -354,10 +424,11 @@ export class PlanComponent implements OnInit {
publicToggleNode() {
publicToggleNode() {
return new Promise ( ( resolve , reject ) = > {
return new Promise ( ( resolve , reject ) = > {
this . beforePlanNode = this . beforeEmergencyPlan . nodes [ this . nzCurrent ]
this . beforePlanNode = this . beforeEmergencyPlan . nodes [ this . nzCurrent ]
this . isShowChildComponent && this . leftDomain ? this . leftDomain . selectPlanId = this . beforeEmergencyPlan.id : null
this . isShowChildComponent && this . leftDomain ? this . leftDomain . selectPlanId = this . beforeEmergencyPlan.id : null
this . isShowChildComponent && this . leftDomain ? this . leftDomain . selectNodeId = this . beforePlanNode.id : null
this . isShowChildComponent && this . leftDomain ? this . leftDomain . selectNodeId = this . beforePlanNode.id : null
MarkWindow . instance . selectMarkNode ( this . beforeEmergencyPlan . id , this . beforePlanNode . id , false , true )
MarkWindow . instance . selectMarkNode ( this . beforeEmergencyPlan . id , this . beforePlanNode . id , false , true )
this . beforePlanNode = MarkWindow . instance . currentMarkNodeInfo . nodeData
this . beforePlanNode = MarkWindow . instance . currentMarkNodeInfo . nodeData
this . initViewer ( )
this . updateProgress ( ) //更新进度条
this . updateProgress ( ) //更新进度条
resolve ( true )
resolve ( true )
} )
} )
@ -365,17 +436,15 @@ export class PlanComponent implements OnInit {
//选中 底部一级节点 开启自动播放
//选中 底部一级节点 开启自动播放
selectChildNode ( item : MarkPlanData ) {
selectChildNode ( item : MarkPlanData ) {
if ( this . isShowChildComponent && this . leftDomain ) {
if ( item . nodes . length ) {
if ( item . nodes . length ) {
this . updateTimer ? window . clearTimeout ( this . updateTimer ) : null //清除定时器
this . updateTimer ? window . clearTimeout ( this . updateTimer ) : null //清除定时器
this . nzCurrent = 0
this . nzCurrent = 0
this . beforeEmergencyPlan = item
this . beforeEmergencyPlan = item
this . updateProgressList ( ) . then ( res = > {
this . updateProgressList ( ) . then ( res = > {
this . publicToggleNode ( )
this . publicToggleNode ( )
} )
} )
} else {
} else {
this . message . info ( '暂无数据节点' ) ;
this . message . info ( '暂无数据节点' ) ;
}
}
}
}
}
@ -461,6 +530,7 @@ export class PlanComponent implements OnInit {
} else { //开启
} else { //开启
this . updateTimer ? window . clearTimeout ( this . updateTimer ) : null //清除定时器
this . updateTimer ? window . clearTimeout ( this . updateTimer ) : null //清除定时器
this . progressList . forEach ( ( item , index ) = > { index > this . nzCurrent ? this . progressList [ index ] = 0 : null } )
this . progressList . forEach ( ( item , index ) = > { index > this . nzCurrent ? this . progressList [ index ] = 0 : null } )
if ( this . progressList [ this . nzCurrent ] === 0 ) { MarkWindow . instance . selectMarkNode ( this . beforeEmergencyPlan . id , this . beforePlanNode . id , false , true ) }
this . updateProgress ( )
this . updateProgress ( )
}
}
}
}
@ -543,6 +613,49 @@ export class PlanComponent implements OnInit {
}
}
videoDialogType : videoDialog = new videoDialog ( true , null ) ; //全景图/视频 弹窗
videoDialogType : videoDialog = new videoDialog ( true , null ) ; //全景图/视频 弹窗
planNodeImg : Viewer ; //应急预案图片Viewer 实例
//初始化 Viewer图片
initViewer() {
if ( this . beforePlanNode . texture ) {
window . setTimeout ( ( ) = > {
this . planNodeImg = new Viewer ( this . element . nativeElement . querySelector ( '#planNodeImg' ) , { url : 'data-original' } ) ;
} , 0 )
}
}
//上传 图片/视频
uploadImgVideo ( e , isVideo : boolean ) {
if ( e . target . files . length ) {
let maxSize = 30 * 1024 * 1024 //限制30MB
let file = e . target . files [ 0 ]
if ( file . size > maxSize ) { //超出限制
this . message . info ( "上传资源需小于30MB" ) ;
return
}
this . isShowLoading = true //打开遮罩
let institutionKey = sessionStorage . getItem ( 'unitId' ) || "ceshi" ; //单位id
let resType = isVideo ? ResType.Video : ResType.Texture
let key = ` ${ ( new Date ( ) ) . getMonth ( ) + 1 } - ${ ( new Date ( ) ) . getDate ( ) } - ${ ( new Date ( ) ) . getHours ( ) } `
let url = DataManager . getResPath_mark ( institutionKey , resType , key ) //url
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
if ( ! isVideo ) { //img
this . beforePlanNode . texture = ObjectsService . getFullPath ( path + name )
this . initViewer ( )
} else { //video
this . beforePlanNode . video = ObjectsService . getFullPath ( path + name )
}
this . isShowLoading = false //关闭遮罩
this . message . info ( "上传成功!" ) ;
} )
}
}
//打开视频弹窗
openVideo ( src : string ) {
this . videoDialogType . isVideo = true
this . videoDialogType . url = src
}
selectRightTopFast : number = 0 ; //当前选择功能 快捷栏
selectRightTopFast : number = 0 ; //当前选择功能 快捷栏
selectAdsorb : boolean = false ; //吸附状态
selectAdsorb : boolean = false ; //吸附状态
@ -693,3 +806,11 @@ export class modelBuilding {
name : string = "" ;
name : string = "" ;
modelType : BuildingType = BuildingType . Normal ;
modelType : BuildingType = BuildingType . Normal ;
}
}
//基本信息 设备筛选
export class baseInfoMark {
markerName : string ;
isShow : boolean = true ;
constructor ( markerName : string ) {
this . markerName = markerName
}
}