From a5942d87b3420447852ad5b9089f19e1d1a02142 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Wed, 24 Nov 2021 11:38:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E6=80=A5=E9=A2=84=E6=A1=88=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-domain/left-domain.component.ts | 3 ++ src/app/pages/plan/plan.component.ts | 36 ++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/app/pages/left-domain/left-domain.component.ts b/src/app/pages/left-domain/left-domain.component.ts index 8da1893..0de4d11 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/src/app/pages/left-domain/left-domain.component.ts @@ -214,6 +214,7 @@ export class LeftDomainComponent implements OnInit { PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforePlanNode = e PlanComponent.instance.nzCurrent = -1 + PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器 this.selectPlanId = item.id this.selectNodeId = e.id MarkWindow.instance.selectMarkNode(item.id, e.id) @@ -226,6 +227,7 @@ export class LeftDomainComponent implements OnInit { PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforePlanNode = e PlanComponent.instance.nzCurrent = -1 + PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器 this.selectPlanId = item.id this.selectNodeId = 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.beforePlanNode = new MarkNodeData(-99, "请选择节点") PlanComponent.instance.nzCurrent = -1 + PlanComponent.instance.timer? window.clearTimeout(PlanComponent.instance.timer) : null //清除定时器 this.selectPlanId = null this.selectNodeId = null MarkWindow.instance.selectMarkNode(null, null) diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 1b591ad..73877d9 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -69,14 +69,12 @@ export class PlanComponent implements OnInit { } ngAfterViewInit(): void { - let simpleData: InsitutionDataSimple = new InsitutionDataSimple(); simpleData.id = 1; //来自选中的单位的信息 ,测试:1 simpleData.key = "ceshi"; //正式: id.tostring(),测试:"ceshi" simpleData.name = "测试"; //来自选中的单位的信息 ,测试:"测试" let has3dData = true;//是否有三维数据,来自选中单位的信息 - let loginStatus = StatusManager.getStatus(LoginSatus); if (ModeManager.institutionDemoKey == ModeManager.c_demoKey_null) { //无指定测试单位,则为正式启动,根据当前单位key寻找 if (has3dData) { //如果已经有三维数据,直接进入 @@ -355,7 +353,7 @@ export class PlanComponent implements OnInit { this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent] this.leftDomain.selectPlanId = this.beforeEmergencyPlan.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) { let isTrue = confirm("即将开始播放节点") if (isTrue) { + this.timer? window.clearTimeout(this.timer) : null //清除定时器 this.nzCurrent = 0 this.beforeEmergencyPlan = item this.publicToggleNode() @@ -377,7 +376,7 @@ export class PlanComponent implements OnInit { //自动播放-切换接点 autoPlay() { - if (this.nzCurrent === this.beforeEmergencyPlan.nodes.length - 1) { + if (this.nzCurrent >= this.beforeEmergencyPlan.nodes.length - 1) { this.nzCurrent = this.nzCurrent + 1 this.isSuspend = false //初始化暂停状态 window.clearTimeout(this.timer) //清除定时器 @@ -385,11 +384,12 @@ export class PlanComponent implements OnInit { return } let time: number = this.beforePlanNode.getShowTime() + console.log(`所需${time}s`) this.timer = window.setTimeout(()=>{ this.nzCurrent = this.nzCurrent + 1 this.publicToggleNode() !this.isSuspend? this.autoPlay() : null - },time) + },time * 1000) } //切换预案节点 @@ -397,16 +397,22 @@ export class PlanComponent implements OnInit { if (event === this.beforeEmergencyPlan.nodes.length) { return } + this.timer? window.clearTimeout(this.timer) : null //清除定时器 this.nzCurrent = event this.publicToggleNode() } //切换预案节点 上一个 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('目前已经是第一节点'); return } + this.timer? window.clearTimeout(this.timer) : null //清除定时器 this.nzCurrent = this.nzCurrent - 1 this.publicToggleNode() !this.isSuspend? this.autoPlay() : null @@ -414,19 +420,28 @@ export class PlanComponent implements OnInit { //切换预案节点 暂停 suspend(isSuspend: boolean) { + if (this.beforeEmergencyPlan.id === -99 || this.beforePlanNode.id === -99) { + this.message.info('请选择节点'); + return + } this.isSuspend = isSuspend let msg: string = this.isSuspend? "目前已暂停" : "目前已开始播放" this.message.info(msg); if (this.isSuspend) { //暂停 window.clearTimeout(this.timer) //清除定时器 } else { //开启 - MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id) + MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) this.autoPlay() } } //切换预案节点 初始化 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.publicToggleNode() !this.isSuspend? this.autoPlay() : null @@ -434,10 +449,15 @@ export class PlanComponent implements OnInit { //切换预案节点 下一个 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('目前已经是最后一个节点'); return } + this.timer? window.clearTimeout(this.timer) : null //清除定时器 this.nzCurrent = this.nzCurrent + 1 this.publicToggleNode() !this.isSuspend? this.autoPlay() : null