@ -29,6 +29,7 @@ import { EventManager as babylonEventManager } from 'src/app/babylon/controller/
import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manager/events/event-get-markplandata-success' ;
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 { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window' ;
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility' ;
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility' ;
import { HttpClient } from '@angular/common/http' ;
@ -39,7 +40,7 @@ import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-f
} )
} )
export class PlanComponent implements OnInit {
export class PlanComponent implements OnInit {
constructor ( private element : ElementRef , private buildingBISrv : BuildingBasicInfosService , private objectsSrv : ObjectsService , private eventManager : EventManager , private message : NzMessageService ) { }
constructor ( private element : ElementRef , private buildingBISrv : BuildingBasicInfosService , private objectsSrv : ObjectsService , private eventManager : EventManager , private message : NzMessageService , private http : HttpClient ) { }
static instance : PlanComponent ;
static instance : PlanComponent ;
public game : Game = new Game ( ) ;
public game : Game = new Game ( ) ;
@ -49,7 +50,7 @@ export class PlanComponent implements OnInit {
public userMode : boolean = ModeManager . s_isMakeMode ; //是否为 内部权限
public userMode : boolean = ModeManager . s_isMakeMode ; //是否为 内部权限
public bucketName : string = ObjectsService . getFullPath ( "文件路径" ) ; //当前桶名
public bucketName : string = ObjectsService . getFullPath ( "文件路径" ) ; //当前桶名
public isShowLoading : boolean = true ; //显隐 loading加载条
public isShowLoading : boolean = true ; //显隐 loading加载条
public companyData : any ; //当前加油站 信息
public companyData : any ; //当前加油站所属组织机构 data
ngOnInit ( ) : void {
ngOnInit ( ) : void {
PlanComponent . instance = this ;
PlanComponent . instance = this ;
@ -78,43 +79,46 @@ export class PlanComponent implements OnInit {
}
}
ngAfterViewInit ( ) : void {
ngAfterViewInit ( ) : void {
let simpleData : InsitutionDataSimple = new InsitutionDataSimple ( ) ;
this . getGasStationBaseInfo ( ) . then ( ( res : any ) = > { //获取单位 基本信息
simpleData . id = 1 ; //来自选中的单位的信息 ,测试:1
let simpleData : InsitutionDataSimple = new InsitutionDataSimple ( ) ;
simpleData . key = "ceshi" ; //正式: id.tostring(),测试:"ceshi"
simpleData . id = res . id || 6 ; //来自选中的单位的信息 ,测试:1
simpleData . name = this . companyData . displayName || "测试" ; //来自选中的单位的信息 ,测试:"测试"
simpleData . key = ` ${ res . id } ` || "ceshi" ; //测试:"ceshi"
simpleData . name = res . stationName || "测试" ; //来自选中的单位的信息 ,测试:"测试"
let has3dData = true ; //是否有三维数据,来自选中单位的信息
let loginStatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
let has3dData = res . hasBuildingInfo ; //是否有三维数据,来自选中单位的信息
if ( ModeManager . institutionDemoKey == ModeManager . c_demoKey_null ) { //无指定测试单位,则为正式启动,根据当前单位key寻找
let loginStatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
if ( has3dData ) { //如果已经有三维数据,直接进入
if ( ModeManager . institutionDemoKey == ModeManager . c_demoKey_null ) { //无指定测试单位,则为正式启动,根据当前单位key寻找
this . beforeOneSatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
if ( has3dData ) { //如果已经有三维数据,直接进入
this . beforeOneSatus . onSelectInsSuccess ( simpleData )
this . beforeOneSatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
} else { //如果没有三维数据
this . beforeOneSatus . onSelectInsSuccess ( simpleData )
if ( ModeManager . s_isMakeMode ) //内部制作模式下,询问新建
} else { //如果没有三维数据
{
if ( ModeManager . s_isMakeMode ) //内部制作模式下,询问新建
let isAdd = confirm ( '没有单位' + simpleData . key + ',是否进行初始化?' )
{
if ( isAdd ) {
let isAdd = confirm ( '没有单位:' + simpleData . name + ',是否进行初始化?' )
let name = simpleData . name ;
if ( isAdd ) {
let id = simpleData . id ; // 单位id
let name = simpleData . name ;
loginStatus . createInsitution ( simpleData . key , name , id ) ;
let id = simpleData . id ; // 单位id
loginStatus . createInsitution ( simpleData . key , name , id ) ;
}
}
else //非内部制作模式,不开启
{
console . log ( "没有单位" + simpleData . key ) ;
}
}
}
}
else //非内部制作模式,不开启
{
console . log ( "没有单位" + simpleData . key ) ;
}
}
} else {
//let find = data.find(item => { return item.key === ModeManager.institutionDemoKey })
let find = simpleData ; //测试单位
if ( find ) {
sessionStorage . setItem ( 'unitId' , find . key )
this . beforeOneSatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
this . beforeOneSatus . onSelectInsSuccess ( find )
} else {
} else {
//this.modelInit(data) //开发模式 选择单位 弹窗
//let find = data.find(item => { return item.key === ModeManager.institutionDemoKey })
let find = simpleData ; //测试单位
if ( find ) {
sessionStorage . setItem ( 'unitId' , find . key )
this . beforeOneSatus = StatusManager . getStatus < LoginSatus > ( LoginSatus ) ;
this . beforeOneSatus . onSelectInsSuccess ( find )
} else {
//this.modelInit(data) //开发模式 选择单位 弹窗
}
}
}
}
} )
}
}
ngOnDestroy ( ) : void { //组件销毁前 销毁canvas
ngOnDestroy ( ) : void { //组件销毁前 销毁canvas
@ -122,6 +126,14 @@ export class PlanComponent implements OnInit {
this . game = null ;
this . game = null ;
}
}
//获取 当前加油站基本信息
getGasStationBaseInfo() {
return new Promise ( ( resolve , reject ) = > {
let result = JSON . parse ( sessionStorage . getItem ( "3dSceneData" ) )
resolve ( result )
} )
}
//开发模式 选择单位 弹窗
//开发模式 选择单位 弹窗
modelInit ( InsList ) { }
modelInit ( InsList ) { }
@ -144,22 +156,22 @@ export class PlanComponent implements OnInit {
this . initializePlan ( )
this . initializePlan ( )
}
}
if ( type === 7 ) { //初始化 应急预案 data
if ( type === 7 ) { //初始化 应急预案 data
this . isShowChildComponent && this . leftDomain ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . isShowChildComponent && this . leftDomain ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . selectFence = type
this . selectFence = type
this . editMode ? this . isShowChildComponent = true : this . isShowChildComponent = false
this . editMode ? this . isShowChildComponent = true : this . isShowChildComponent = false
buildingWindow . changeJYZInfoModel ( fenceType , true )
buildingWindow . changeJYZInfoModel ( fenceType , true )
MarkWindow . instance ? this . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null ;
MarkWindow . instance ? this . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null ;
babylonEventManager . addListener ( Event_GetAllMarkPlanData , ( data : Event_GetAllMarkPlanData ) = > {
babylonEventManager . addListener ( Event_GetAllMarkPlanData , ( data : Event_GetAllMarkPlanData ) = > {
this . allMarkPlanData = MarkWindow . instance . allMarkPlanData
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
} )
} )
this . isShowChildComponent && this . leftDomain ? this . leftDomain . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null
this . isShowChildComponent && this . leftDomain ? this . leftDomain . allMarkPlanData = MarkWindow.instance.allMarkPlanData : null
} else {
} else {
this . isShowChildComponent && this . leftDomain && type != 4 ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . isShowChildComponent && this . leftDomain && type != 4 ? this . leftDomain . initComponent ( type ) : null ; //手动初始化子组件
this . selectFence = type
this . selectFence = type
this . isShowChildComponent = true
this . isShowChildComponent = true
buildingWindow . changeJYZInfoModel ( fenceType , true )
buildingWindow . changeJYZInfoModel ( fenceType , true )
if ( type === 0 ) { this . baseInfoMarks . forEach ( item = > { item . isShow = true } ) } //初始化基本信息 设备显隐
if ( type === 0 ) { this . baseInfoMarks . forEach ( item = > { item . isShow = true } ) } //初始化基本信息 设备显隐
}
}
} else { //取消选中
} else { //取消选中
this . selectFence = - 1
this . selectFence = - 1
@ -373,7 +385,7 @@ export class PlanComponent implements OnInit {
}
}
if ( this . selectFence === 0 && this . beforeOnePropertyData . getPropertyData ( ) && this . beforeOnePropertyData . getPropertyData ( ) . img ) { //img
if ( this . selectFence === 0 && this . beforeOnePropertyData . getPropertyData ( ) && this . beforeOnePropertyData . getPropertyData ( ) . img ) { //img
window . setTimeout ( ( ) = > {
window . setTimeout ( ( ) = > {
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' } ) ;
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' , navbar : false } ) ;
} , 0 )
} , 0 )
}
}
}
}
@ -395,7 +407,7 @@ export class PlanComponent implements OnInit {
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
this . beforeOnePropertyData . getPropertyData ( ) . img = ObjectsService . getFullPath ( path + name )
this . beforeOnePropertyData . getPropertyData ( ) . img = ObjectsService . getFullPath ( path + name )
window . setTimeout ( ( ) = > {
window . setTimeout ( ( ) = > {
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' } ) ;
this . propertyImg = new Viewer ( this . element . nativeElement . querySelector ( '#propertyImg' ) , { url : 'data-original' , navbar : false } ) ;
} , 0 )
} , 0 )
this . isShowLoading = false //关闭遮罩
this . isShowLoading = false //关闭遮罩
this . message . info ( "上传成功!" ) ;
this . message . info ( "上传成功!" ) ;
@ -424,8 +436,8 @@ 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 . initViewer ( )
@ -459,6 +471,12 @@ export class PlanComponent implements OnInit {
//更新进度条 值
//更新进度条 值
updateProgress() {
updateProgress() {
if ( this . isShowLoading ) { //当前为loading状态
window . setTimeout ( ( ) = > {
this . updateProgress ( )
} , 500 ) ;
return
}
if ( this . progressList [ this . nzCurrent ] >= 100 ) {
if ( this . progressList [ this . nzCurrent ] >= 100 ) {
this . progressList [ this . nzCurrent ] = 100
this . progressList [ this . nzCurrent ] = 100
window . clearTimeout ( this . updateTimer ) //清除定时器
window . clearTimeout ( this . updateTimer ) //清除定时器
@ -619,7 +637,7 @@ export class PlanComponent implements OnInit {
initViewer() {
initViewer() {
if ( this . beforePlanNode . texture ) {
if ( this . beforePlanNode . texture ) {
window . setTimeout ( ( ) = > {
window . setTimeout ( ( ) = > {
this . planNodeImg = new Viewer ( this . element . nativeElement . querySelector ( '#planNodeImg' ) , { url : 'data-original' } ) ;
this . planNodeImg = new Viewer ( this . element . nativeElement . querySelector ( '#planNodeImg' ) , { url : 'data-original' , navbar : false } ) ;
} , 0 )
} , 0 )
}
}
}
}
@ -635,7 +653,7 @@ export class PlanComponent implements OnInit {
}
}
this . isShowLoading = true //打开遮罩
this . isShowLoading = true //打开遮罩
let institutionKey = sessionStorage . getItem ( 'unitId' ) || "ceshi" ; //单位id
let institutionKey = sessionStorage . getItem ( 'unitId' ) || "ceshi" ; //单位id
let resType = isVideo ? ResType.Video : ResType.Texture
let resType = isVideo ? ResType.Video : ResType.Texture
let key = ` ${ ( new Date ( ) ) . getMonth ( ) + 1 } - ${ ( new Date ( ) ) . getDate ( ) } - ${ ( new Date ( ) ) . getHours ( ) } `
let key = ` ${ ( new Date ( ) ) . getMonth ( ) + 1 } - ${ ( new Date ( ) ) . getDate ( ) } - ${ ( new Date ( ) ) . getHours ( ) } `
let url = DataManager . getResPath_mark ( institutionKey , resType , key ) //url
let url = DataManager . getResPath_mark ( institutionKey , resType , key ) //url
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
ServeManager . instance . openFileSelect ( file , url , ( name : string , path : string ) = > { //上传
@ -651,6 +669,29 @@ export class PlanComponent implements OnInit {
}
}
}
}
//删除 图片/视频
deleteImgVideo ( type : number ) {
let isDelete = confirm ( "您确定要删除吗?" )
if ( isDelete ) {
if ( type === 1 ) {
this . http . delete ( ` ${ this . beforeOnePropertyData . getPropertyData ( ) . img } ` ) . subscribe ( data = > {
this . beforeOnePropertyData . getPropertyData ( ) . img = ""
this . message . info ( "删除成功!" ) ;
} )
} else if ( type === 2 ) {
this . http . delete ( ` ${ this . beforePlanNode . texture } ` ) . subscribe ( data = > {
this . beforePlanNode . texture = ""
this . message . info ( "删除成功!" ) ;
} )
} else if ( type === 3 ) {
this . http . delete ( ` ${ this . beforePlanNode . video } ` ) . subscribe ( data = > {
this . beforePlanNode . video = ""
this . message . info ( "删除成功!" ) ;
} )
}
}
}
//打开视频弹窗
//打开视频弹窗
openVideo ( src : string ) {
openVideo ( src : string ) {
this . videoDialogType . isVideo = true
this . videoDialogType . isVideo = true
@ -807,7 +848,7 @@ export class modelBuilding {
modelType : BuildingType = BuildingType . Normal ;
modelType : BuildingType = BuildingType . Normal ;
}
}
//基本信息 设备筛选
//基本信息 设备筛选
export class baseInfoMark {
export class baseInfoMark {
markerName : string ;
markerName : string ;
isShow : boolean = true ;
isShow : boolean = true ;
constructor ( markerName : string ) {
constructor ( markerName : string ) {