Browse Source

应急预案逻辑完善

dev
陈鹏飞 3 years ago
parent
commit
a5942d87b3
  1. 3
      src/app/pages/left-domain/left-domain.component.ts
  2. 36
      src/app/pages/plan/plan.component.ts

3
src/app/pages/left-domain/left-domain.component.ts

@ -214,6 +214,7 @@ export class LeftDomainComponent implements OnInit {
PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforeEmergencyPlan = item
PlanComponent.instance.beforePlanNode = e PlanComponent.instance.beforePlanNode = e
PlanComponent.instance.nzCurrent = -1 PlanComponent.instance.nzCurrent = -1
PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器
this.selectPlanId = item.id this.selectPlanId = item.id
this.selectNodeId = e.id this.selectNodeId = e.id
MarkWindow.instance.selectMarkNode(item.id, e.id) MarkWindow.instance.selectMarkNode(item.id, e.id)
@ -226,6 +227,7 @@ export class LeftDomainComponent implements OnInit {
PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforeEmergencyPlan = item
PlanComponent.instance.beforePlanNode = e PlanComponent.instance.beforePlanNode = e
PlanComponent.instance.nzCurrent = -1 PlanComponent.instance.nzCurrent = -1
PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器
this.selectPlanId = item.id this.selectPlanId = item.id
this.selectNodeId = e.id this.selectNodeId = e.id
MarkWindow.instance.selectMarkNode(item.id, e.id) MarkWindow.instance.selectMarkNode(item.id, e.id)
@ -240,6 +242,7 @@ export class LeftDomainComponent implements OnInit {
PlanComponent.instance.beforeEmergencyPlan = new MarkPlanData(-99, "请选择节点") PlanComponent.instance.beforeEmergencyPlan = new MarkPlanData(-99, "请选择节点")
PlanComponent.instance.beforePlanNode = new MarkNodeData(-99, "请选择节点") PlanComponent.instance.beforePlanNode = new MarkNodeData(-99, "请选择节点")
PlanComponent.instance.nzCurrent = -1 PlanComponent.instance.nzCurrent = -1
PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器
this.selectPlanId = null this.selectPlanId = null
this.selectNodeId = null this.selectNodeId = null
MarkWindow.instance.selectMarkNode(null, null) MarkWindow.instance.selectMarkNode(null, null)

36
src/app/pages/plan/plan.component.ts

@ -69,14 +69,12 @@ 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 = "测试"; //来自选中的单位的信息 ,测试:"测试"
let has3dData = true;//是否有三维数据,来自选中单位的信息 let has3dData = true;//是否有三维数据,来自选中单位的信息
let loginStatus = StatusManager.getStatus<LoginSatus>(LoginSatus); let loginStatus = StatusManager.getStatus<LoginSatus>(LoginSatus);
if (ModeManager.institutionDemoKey == ModeManager.c_demoKey_null) { //无指定测试单位,则为正式启动,根据当前单位key寻找 if (ModeManager.institutionDemoKey == ModeManager.c_demoKey_null) { //无指定测试单位,则为正式启动,根据当前单位key寻找
if (has3dData) { //如果已经有三维数据,直接进入 if (has3dData) { //如果已经有三维数据,直接进入
@ -355,7 +353,7 @@ export class PlanComponent implements OnInit {
this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent] this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent]
this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id
this.leftDomain.selectNodeId = this.beforePlanNode.id this.leftDomain.selectNodeId = this.beforePlanNode.id
MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id) MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true)
} }
//选中 底部一级节点 开启自动播放 //选中 底部一级节点 开启自动播放
@ -364,6 +362,7 @@ export class PlanComponent implements OnInit {
if (item.nodes.length) { if (item.nodes.length) {
let isTrue = confirm("即将开始播放节点") let isTrue = confirm("即将开始播放节点")
if (isTrue) { if (isTrue) {
this.timer? window.clearTimeout(this.timer) : null //清除定时器
this.nzCurrent = 0 this.nzCurrent = 0
this.beforeEmergencyPlan = item this.beforeEmergencyPlan = item
this.publicToggleNode() this.publicToggleNode()
@ -377,7 +376,7 @@ export class PlanComponent implements OnInit {
//自动播放-切换接点 //自动播放-切换接点
autoPlay() { autoPlay() {
if (this.nzCurrent === this.beforeEmergencyPlan.nodes.length - 1) { if (this.nzCurrent >= this.beforeEmergencyPlan.nodes.length - 1) {
this.nzCurrent = this.nzCurrent + 1 this.nzCurrent = this.nzCurrent + 1
this.isSuspend = false //初始化暂停状态 this.isSuspend = false //初始化暂停状态
window.clearTimeout(this.timer) //清除定时器 window.clearTimeout(this.timer) //清除定时器
@ -385,11 +384,12 @@ export class PlanComponent implements OnInit {
return return
} }
let time: number = this.beforePlanNode.getShowTime() let time: number = this.beforePlanNode.getShowTime()
console.log(`所需${time}s`)
this.timer = window.setTimeout(()=>{ this.timer = window.setTimeout(()=>{
this.nzCurrent = this.nzCurrent + 1 this.nzCurrent = this.nzCurrent + 1
this.publicToggleNode() this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null !this.isSuspend? this.autoPlay() : null
},time) },time * 1000)
} }
//切换预案节点 //切换预案节点
@ -397,16 +397,22 @@ export class PlanComponent implements OnInit {
if (event === this.beforeEmergencyPlan.nodes.length) { if (event === this.beforeEmergencyPlan.nodes.length) {
return return
} }
this.timer? window.clearTimeout(this.timer) : null //清除定时器
this.nzCurrent = event this.nzCurrent = event
this.publicToggleNode() this.publicToggleNode()
} }
//切换预案节点 上一个 //切换预案节点 上一个
toLast() { toLast() {
if (this.nzCurrent === 0) { if (this.beforeEmergencyPlan.id === -99 || this.beforePlanNode.id === -99) {
this.message.info('请选择节点');
return
}
if (this.nzCurrent <= 0) {
this.message.info('目前已经是第一节点'); this.message.info('目前已经是第一节点');
return return
} }
this.timer? window.clearTimeout(this.timer) : null //清除定时器
this.nzCurrent = this.nzCurrent - 1 this.nzCurrent = this.nzCurrent - 1
this.publicToggleNode() this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null !this.isSuspend? this.autoPlay() : null
@ -414,19 +420,28 @@ export class PlanComponent implements OnInit {
//切换预案节点 暂停 //切换预案节点 暂停
suspend(isSuspend: boolean) { suspend(isSuspend: boolean) {
if (this.beforeEmergencyPlan.id === -99 || this.beforePlanNode.id === -99) {
this.message.info('请选择节点');
return
}
this.isSuspend = isSuspend this.isSuspend = isSuspend
let msg: string = this.isSuspend? "目前已暂停" : "目前已开始播放" let msg: string = this.isSuspend? "目前已暂停" : "目前已开始播放"
this.message.info(msg); this.message.info(msg);
if (this.isSuspend) { //暂停 if (this.isSuspend) { //暂停
window.clearTimeout(this.timer) //清除定时器 window.clearTimeout(this.timer) //清除定时器
} else { //开启 } else { //开启
MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id) MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true)
this.autoPlay() this.autoPlay()
} }
} }
//切换预案节点 初始化 //切换预案节点 初始化
initialize() { initialize() {
if (this.beforeEmergencyPlan.id === -99 || this.beforePlanNode.id === -99) {
this.message.info('请选择节点');
return
}
this.timer? window.clearTimeout(this.timer) : null //清除定时器
this.nzCurrent = 0 this.nzCurrent = 0
this.publicToggleNode() this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null !this.isSuspend? this.autoPlay() : null
@ -434,10 +449,15 @@ export class PlanComponent implements OnInit {
//切换预案节点 下一个 //切换预案节点 下一个
toNext() { toNext() {
if (this.nzCurrent === this.beforeEmergencyPlan.nodes.length - 1) { if (this.beforeEmergencyPlan.id === -99 || this.beforePlanNode.id === -99) {
this.message.info('请选择节点');
return
}
if (this.nzCurrent >= this.beforeEmergencyPlan.nodes.length - 1) {
this.message.info('目前已经是最后一个节点'); this.message.info('目前已经是最后一个节点');
return return
} }
this.timer? window.clearTimeout(this.timer) : null //清除定时器
this.nzCurrent = this.nzCurrent + 1 this.nzCurrent = this.nzCurrent + 1
this.publicToggleNode() this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null !this.isSuspend? this.autoPlay() : null

Loading…
Cancel
Save