Browse Source

[完善] 预案类型判断

master
陈鹏飞 4 years ago
parent
commit
af045b9115
  1. 6
      src/app/ui/collection-tools/collection-tools.component.html
  2. 32
      src/app/ui/collection-tools/collection-tools.component.ts

6
src/app/ui/collection-tools/collection-tools.component.html

@ -5,7 +5,7 @@
<div class="headerCenter"> <input type="text" placeholder="请输入考试要点" [(ngModel)]="examMsg.keynote"> </div> <div class="headerCenter"> <input type="text" placeholder="请输入考试要点" [(ngModel)]="examMsg.keynote"> </div>
<div class="headerRight"> <div class="headerRight">
<button style="border: 1px solid #07CDCF; border-radius: 5px; margin: 0 15px;" (click)='openFireExamination()'><mat-icon>visibility</mat-icon>消防设施考题设定</button> <button style="border: 1px solid #07CDCF; border-radius: 5px; margin: 0 15px;" (click)='openFireExamination()'><mat-icon>visibility</mat-icon>消防设施考题设定</button>
<button (click)="saveSite()"><mat-icon>description</mat-icon>保存</button> <button (click)="saveSite()" *ngIf="examType != 1"><mat-icon>description</mat-icon>保存</button>
<button (click)="openUploadQuestions()"><mat-icon>open_in_browser</mat-icon>上传</button> <button (click)="openUploadQuestions()"><mat-icon>open_in_browser</mat-icon>上传</button>
</div> </div>
</div> </div>
@ -49,7 +49,7 @@
</div> </div>
<div [hidden]="!toggleHandlePlans"> <div [hidden]="!toggleHandlePlans">
<nz-tree #nzTreeComponent [nzData]="treeData" nzBlockNode nzDraggable (nzOnDrop)="nzEvent($event)" [nzTreeTemplate]="nzTreeTemplate" [nzBeforeDrop]="beforeDrop" [nzExpandedKeys]="defaultExpandedKeys"></nz-tree> <nz-tree #nzTreeComponent [nzData]="treeData" nzBlockNode [nzTreeTemplate]="nzTreeTemplate" [nzExpandedKeys]="defaultExpandedKeys"></nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin"> <ng-template #nzTreeTemplate let-node let-origin="origin">
<div id="terrNodePublic" (click)='selectanelPoint(node.origin)' [ngClass]="{'selectanelPoint': selectDisposalNode==node.origin.id}"> <div id="terrNodePublic" (click)='selectanelPoint(node.origin)' [ngClass]="{'selectanelPoint': selectDisposalNode==node.origin.id}">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label> <label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label>
@ -67,7 +67,7 @@
<!-- 处置预案 --> <!-- 处置预案 -->
<!-- 素材库 --> <!-- 素材库 -->
<div id="materialBank"> <div id="materialBank" *ngIf="examType != 1">
<div class="planarGraphHeader" (click)='toggleMaterial()'> <div class="planarGraphHeader" (click)='toggleMaterial()'>
<mat-icon *ngIf="toggleMaterialBank">keyboard_arrow_up</mat-icon> <mat-icon *ngIf="toggleMaterialBank">keyboard_arrow_up</mat-icon>
<mat-icon *ngIf="!toggleMaterialBank">keyboard_arrow_down</mat-icon> <mat-icon *ngIf="!toggleMaterialBank">keyboard_arrow_down</mat-icon>

32
src/app/ui/collection-tools/collection-tools.component.ts

@ -1891,20 +1891,23 @@ export class CollectionToolsComponent implements OnInit {
//处置预案 //处置预案
examType = this.route.snapshot.queryParams.openType // 预案类型 1=已存在/2=自定义
allFirePlan:any = []; //所有灾情 allFirePlan:any = []; //所有灾情
selectDisposalNode:string = ''; //当前点击tree节点 css选中样式 selectDisposalNode:string = ''; //当前点击tree节点 css选中样式
//获取所有灾情 //获取所有灾情
getAllFirePlan () { getAllFirePlan () {
let api
this.examType == 1? api='/api/Disasters' : api='/api/ExamDisasters'
let params = {componentId: sessionStorage.getItem('planId')} let params = {componentId: sessionStorage.getItem('planId')}
this.http.get('/api/Disasters',{params:params}).subscribe((data:any)=>{ this.http.get(api,{params:params}).subscribe((data:any)=>{
if (!data.length) { //该 单位没有灾情时 if (!data.length) { //该 单位没有灾情时
let msg = { let msg = {
name: '灾情', name: '灾情',
modifiedTime: new Date(), modifiedTime: new Date(),
planComponentId: sessionStorage.getItem('planId') examPlanComponentId: sessionStorage.getItem('planId')
} }
this.http.post('/api/Disasters',msg).subscribe(data=>{ this.http.post('/api/ExamDisasters',msg).subscribe(data=>{
this.allFirePlan.push(data) this.allFirePlan.push(data)
this.getDisposalNode() this.getDisposalNode()
}) })
@ -1917,13 +1920,11 @@ export class CollectionToolsComponent implements OnInit {
//获取所有处置节点 //获取所有处置节点
getDisposalNode () { getDisposalNode () {
let api
this.examType == 1? api='/api/DisposalNodes' : api='/api/ExamDisposalNodes'
this.selectDisposalNode = '' this.selectDisposalNode = ''
let params = {disasterId: this.allFirePlan[0].id || ''} let params = {disasterId: this.allFirePlan[0].id || ''}
// this.http.get('/api/DisasterData/Markers',{params:params}).subscribe(data=>{ //灾情标签信息 this.http.get(api,{params:params}).subscribe(data=>{ //处置节点
// this.canvasData.allNodeMarkers = data
// this.mateFireForce()
// })
this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //处置节点
this.canvasData.allDisposalNode = data this.canvasData.allDisposalNode = data
this.handleHybridTree() this.handleHybridTree()
}) })
@ -1961,9 +1962,11 @@ export class CollectionToolsComponent implements OnInit {
//刷新 treeData 保存已展开节点 //刷新 treeData 保存已展开节点
refurbishTreeData () { refurbishTreeData () {
let api
this.examType == 1? api='/api/DisposalNodes' : api='/api/ExamDisposalNodes'
this.defaultExpandedKeys = [] this.defaultExpandedKeys = []
let params = {disasterId: this.allFirePlan[0].id || ''} let params = {disasterId: this.allFirePlan[0].id || ''}
this.http.get('/api/DisposalNodes',{params:params}).subscribe(nodeData=>{ //处置节点 this.http.get(api,{params:params}).subscribe(nodeData=>{ //处置节点
this.canvasData.allDisposalNode = nodeData this.canvasData.allDisposalNode = nodeData
let oldTreeData = this.nzTreeComponent.getExpandedNodeList() let oldTreeData = this.nzTreeComponent.getExpandedNodeList()
oldTreeData.forEach(item=>{ oldTreeData.forEach(item=>{
@ -2060,6 +2063,7 @@ export class CollectionToolsComponent implements OnInit {
//选择 考试节点 //选择 考试节点
countValue (e) { countValue (e) {
e.stopPropagation() e.stopPropagation()
if (this.canvasData.allDisposalNode.length) {
let data = {treeData: JSON.parse( JSON.stringify(this.treeData) ), oldTreeData: JSON.parse( JSON.stringify(this.canvasData.allDisposalNode) )} let data = {treeData: JSON.parse( JSON.stringify(this.treeData) ), oldTreeData: JSON.parse( JSON.stringify(this.canvasData.allDisposalNode) )}
let dialogRef = this.dialog.open(uploadDisposalNodes,{data}); let dialogRef = this.dialog.open(uploadDisposalNodes,{data});
dialogRef.afterClosed().subscribe(data=>{ dialogRef.afterClosed().subscribe(data=>{
@ -2071,6 +2075,12 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('节点保存成功','确定',config); this.snackBar.open('节点保存成功','确定',config);
} }
}) })
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无数据节点','确定',config);
}
} }
//新建 处置预案 节点 //新建 处置预案 节点
@ -2160,12 +2170,14 @@ export class CollectionToolsComponent implements OnInit {
this.selectDisposalNode = e.parentId //选中 节点 this.selectDisposalNode = e.parentId //选中 节点
if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时 if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时
let api
this.examType == 1? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData'
let params = {nodeId: e.id} let params = {nodeId: e.id}
let parameter = { //查询 节点 对应 建筑/楼层 index,id let parameter = { //查询 节点 对应 建筑/楼层 index,id
buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //总平面图/建筑 index buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //总平面图/建筑 index
storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //楼层id storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //楼层id
} }
this.http.get('/api/DisposalNodeData',{params:params}).subscribe(data=>{ this.http.get(api,{params:params}).subscribe(data=>{
this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点 this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点
this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data)
this.seekPanelPoint(parameter) this.seekPanelPoint(parameter)

Loading…
Cancel
Save