Browse Source

应急预案完善

dev
陈鹏飞 3 years ago
parent
commit
4e3e8e427b
  1. 3
      src/app/pages/left-domain/left-domain.component.ts
  2. 4
      src/app/pages/plan/plan.component.html
  3. 2
      src/app/pages/plan/plan.component.scss
  4. 77
      src/app/pages/plan/plan.component.ts

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

@ -213,6 +213,7 @@ export class LeftDomainComponent implements OnInit {
if (!MarkWindow.instance.currentMarkNodeInfo) { //未选中节点 if (!MarkWindow.instance.currentMarkNodeInfo) { //未选中节点
PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforeEmergencyPlan = item
PlanComponent.instance.beforePlanNode = e PlanComponent.instance.beforePlanNode = e
PlanComponent.instance.nzCurrent = -1
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)
@ -224,6 +225,7 @@ export class LeftDomainComponent implements OnInit {
if (isTrue) { if (isTrue) {
PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforeEmergencyPlan = item
PlanComponent.instance.beforePlanNode = e PlanComponent.instance.beforePlanNode = e
PlanComponent.instance.nzCurrent = -1
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)
@ -237,6 +239,7 @@ export class LeftDomainComponent implements OnInit {
if (isTrue) { if (isTrue) {
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
this.selectPlanId = null this.selectPlanId = null
this.selectNodeId = null this.selectNodeId = null
MarkWindow.instance.selectMarkNode(null, null) MarkWindow.instance.selectMarkNode(null, null)

4
src/app/pages/plan/plan.component.html

@ -164,12 +164,12 @@
</nz-steps> </nz-steps>
<ng-template #progressTemplate let-index="index"> <ng-template #progressTemplate let-index="index">
<img src="../../../assets/images/stepIcon.png" style="margin-left: -100%;" *ngIf="index != beforeEmergencyPlan.nodes.length"> <img src="../../../assets/images/stepIcon.png" style="margin-left: -100%;" *ngIf="index != beforeEmergencyPlan.nodes.length">
<i nz-icon nzType="play-circle" nzTheme="outline" *ngIf="index === nzCurrent && index != beforeEmergencyPlan.nodes.length"></i>
</ng-template> </ng-template>
</label> </label>
<label> <label>
<i nz-icon nzType="backward" nzTheme="outline" (click)="toLast()"></i> <i nz-icon nzType="backward" nzTheme="outline" (click)="toLast()"></i>
<i nz-icon nzType="pause" nzTheme="outline" (click)="suspend()"></i> <i nz-icon nzType="pause" nzTheme="outline" (click)="suspend(true)" [hidden]="isSuspend"></i>
<i nz-icon nzType="play-circle" nzTheme="outline" (click)="suspend(false)" [hidden]="!isSuspend"></i>
<i nz-icon nzType="border" nzTheme="outline" (click)="initialize()"></i> <i nz-icon nzType="border" nzTheme="outline" (click)="initialize()"></i>
<i nz-icon nzType="forward" nzTheme="outline" (click)="toNext()"></i> <i nz-icon nzType="forward" nzTheme="outline" (click)="toNext()"></i>
</label> </label>

2
src/app/pages/plan/plan.component.scss

@ -363,7 +363,7 @@
label:nth-child(2){ label:nth-child(2){
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
.anticon{ font-size: 16px; color: #23D9FF; } //.anticon{ font-size: 16px; color: #23D9FF; }
img{ height: 35px; width: auto; vertical-align: top; } img{ height: 35px; width: auto; vertical-align: top; }
} }
label:last-child{ label:last-child{

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

@ -346,17 +346,25 @@ export class PlanComponent implements OnInit {
window.clearTimeout(this.timer) //清除定时器 window.clearTimeout(this.timer) //清除定时器
} }
//公用 切换选中节点
publicToggleNode() {
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)
}
//选中 底部一级节点 开启自动播放 //选中 底部一级节点 开启自动播放
selectChildNode(item: MarkPlanData) { selectChildNode(item: MarkPlanData) {
if (this.isShowChildComponent && this.leftDomain && this.beforeEmergencyPlan != item) { if (this.isShowChildComponent && this.leftDomain) {
if (item.nodes.length) { if (item.nodes.length) {
this.nzCurrent = 0 let isTrue = confirm("即将开始播放节点")
this.beforeEmergencyPlan = item if (isTrue) {
this.beforePlanNode = item.nodes[0] this.nzCurrent = 0
this.leftDomain.selectPlanId = item.id this.beforeEmergencyPlan = item
this.leftDomain.selectNodeId = item.nodes[0].id this.publicToggleNode()
MarkWindow.instance.selectMarkNode(item.id, item.nodes[0].id) !this.isSuspend? this.autoPlay() : null
this.autoPlay() }
} else { } else {
this.message.info('暂无数据节点'); this.message.info('暂无数据节点');
} }
@ -365,8 +373,19 @@ export class PlanComponent implements OnInit {
//自动播放-切换接点 //自动播放-切换接点
autoPlay() { autoPlay() {
let time: number if (this.nzCurrent === this.beforeEmergencyPlan.nodes.length - 1) {
console.log(time,777) this.nzCurrent = this.nzCurrent + 1
this.isSuspend = false //初始化暂停状态
window.clearTimeout(this.timer) //清除定时器
this.message.info('已播放至最后一节点');
return
}
let time: number = this.beforePlanNode.getShowTime()
this.timer = window.setTimeout(()=>{
this.nzCurrent = this.nzCurrent + 1
this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null
},time)
} }
//切换预案节点 //切换预案节点
@ -375,31 +394,49 @@ export class PlanComponent implements OnInit {
return return
} }
this.nzCurrent = event this.nzCurrent = event
this.beforePlanNode = this.beforeEmergencyPlan.nodes[event] this.publicToggleNode()
this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id
this.leftDomain.selectNodeId = this.beforePlanNode.id
MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id)
console.log(event)
} }
//切换预案节点 上一个 //切换预案节点 上一个
toLast() { toLast() {
if (this.nzCurrent === 0) {
this.message.info('目前已经是第一节点');
return
}
this.nzCurrent = this.nzCurrent - 1
this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null
} }
//切换预案节点 暂停 //切换预案节点 暂停
suspend() { suspend(isSuspend: boolean) {
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)
this.autoPlay()
}
} }
//切换预案节点 初始化 //切换预案节点 初始化
initialize() { initialize() {
this.nzCurrent = 0
this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null
} }
//切换预案节点 下一个 //切换预案节点 下一个
toNext() { toNext() {
if (this.nzCurrent === this.beforeEmergencyPlan.nodes.length - 1) {
this.message.info('目前已经是最后一个节点');
return
}
this.nzCurrent = this.nzCurrent + 1
this.publicToggleNode()
!this.isSuspend? this.autoPlay() : null
} }
//选中应急预案 设备 //选中应急预案 设备

Loading…
Cancel
Save