刘向辉 3 years ago
parent
commit
18f86e8cde
  1. 12
      src/app/pages/left-domain/left-domain.component.html
  2. 58
      src/app/pages/left-domain/left-domain.component.ts
  3. 8
      src/app/pages/plan/plan.component.html
  4. 2
      src/app/pages/plan/plan.component.scss
  5. 32
      src/app/pages/plan/plan.component.ts

12
src/app/pages/left-domain/left-domain.component.html

@ -97,10 +97,10 @@
<div class="positionRightTop" *ngIf="selectFacilityId === item.getID()"></div><div class="positionRightBottom" *ngIf="selectFacilityId === item.getID()"></div>
<!-- 选中样式 -->
<p class="title"><input type="text" class="tableInput" [disabled]="!editMode" [(ngModel)]="item.getPropertyData().name"></p>
<div class="propertyImage">
<div class="propertyImage" id="pipelineViewer{{item.getID()}}">
<p class="imgTitle" style="margin-top: 0px;">设计图纸</p>
<img src="../../../assets/images/upload.png">
<a href="javascript:;" class="bottomPlanUpload uploadImgBox" *ngIf="editMode"><input type="file"><i nz-icon nzType="plus" nzTheme="outline"></i></a>
<img [hidden]="!item.getPropertyData().img" [src]="item.getPropertyData().img" [attr.data-original]="item.getPropertyData().img">
<a href="javascript:;" class="bottomPlanUpload uploadImgBox" *ngIf="editMode"><input type="file" accept="image/*" (change)='uploadLeftDomainImg($event, item)'><i nz-icon nzType="plus" nzTheme="outline"></i></a>
</div>
</div>
</div>
@ -128,10 +128,10 @@
<p><input type="text" class="tableInput" [disabled]="!editMode" [(ngModel)]="item.getPropertyData().VRUPumpType"></p>
</div>
</div>
<div class="propertyImage">
<div class="propertyImage" id="orvrViewer{{item.getID()}}">
<p class="imgTitle">设计图纸</p>
<img src="../../../assets/images/upload.png">
<a href="javascript:;" class="bottomPlanUpload uploadImgBox" *ngIf="editMode"><input type="file"><i nz-icon nzType="plus" nzTheme="outline"></i></a>
<img [hidden]="!item.getPropertyData().img" [src]="item.getPropertyData().img" [attr.data-original]="item.getPropertyData().img">
<a href="javascript:;" class="bottomPlanUpload uploadImgBox" *ngIf="editMode"><input type="file" accept="image/*" (change)='uploadLeftDomainImg($event, item)'><i nz-icon nzType="plus" nzTheme="outline"></i></a>
</div>
</div>
</div>

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

@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window';
import { PlanComponent } from '../plan/plan.component';
@ -11,6 +11,10 @@ import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/mod
import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window';
import { NzMessageService } from 'ng-zorro-antd/message';
import { ModeManager, ModeType } from 'src/app/babylon/controller/mode-manager';
import { DataManager } from 'src/app/babylon/controller/data-manager';
import { ServeManager } from 'src/app/babylon/controller/serve-manager';
import { ObjectsService } from 'src/app/service/objects.service';
import Viewer from 'viewerjs';
@Component({
selector: 'app-left-domain',
@ -19,15 +23,10 @@ import { ModeManager, ModeType } from 'src/app/babylon/controller/mode-manager';
})
export class LeftDomainComponent implements OnInit {
constructor(private message: NzMessageService) { }
constructor(private message: NzMessageService, private element: ElementRef) { }
ngOnInit(): void {
let editMode = sessionStorage.getItem('isGasStation')
if (editMode == 'false') {
this.editMode = true
} else {
this.editMode = false
}
this.editMode = PlanComponent.instance.editMode
this.initComponent()
}
@ -38,8 +37,6 @@ export class LeftDomainComponent implements OnInit {
//初始化组件
initComponent(type?: number) {
this.selectPlanId = null
this.selectNodeId = null
if (type != undefined && type != null) {
this.beforeFence = type
this.handleFacility()
@ -52,6 +49,8 @@ export class LeftDomainComponent implements OnInit {
//处理 设备data
handleFacility() {
if (this.beforeFence === 7) { //应急预案
this.selectPlanId = null
this.selectNodeId = null
if (MarkWindow.instance) {
this.allMarkPlanData = MarkWindow.instance.allMarkPlanData
}
@ -75,6 +74,15 @@ export class LeftDomainComponent implements OnInit {
this.selectFacilityId = null
if (this.beforeFence === 3) { //消防设施
this.handleTreeData(this.FacilityList)
} else if (this.beforeFence === 5 || this.beforeFence === 6) { //初始化 Viewer
let id: string = this.beforeFence === 5? "pipelineViewer" : "orvrViewer"
this.FacilityList.forEach(item=>{
if (item.getPropertyData() && item.getPropertyData().img) {
window.setTimeout(() => {
new Viewer(this.element.nativeElement.querySelector(`#${id}${item.getID()}`), { url: 'data-original' });
}, 0)
}
})
}
}
@ -89,6 +97,36 @@ export class LeftDomainComponent implements OnInit {
}
}
//上传设备 图片
uploadLeftDomainImg(e, item: FacilityInfoUIItem) {
if (e.target.files.length) {
let maxSize = 30 * 1024 * 1024 //限制30MB
let file = e.target.files[0]
if (file.size > maxSize) { //超出限制
this.message.info("上传资源需小于30MB");
return
}
PlanComponent.instance.isShowLoading = true //打开遮罩
let institutionKey = sessionStorage.getItem('unitId') || "ceshi"; //单位id
let buildingKey = PlanComponent.instance.buildingUIItems.find(item => { return item.getBuildingID() == PlanComponent.instance.beforeOneBuildingID })
let url = DataManager.getResPath_facilityProperty(institutionKey, buildingKey.getBuildingID(), item.getType(), item.getID(), null)
ServeManager.instance.openFileSelect(file, url, (name: string, path: string) => { //上传
item.getPropertyData().img = ObjectsService.getFullPath(path + name)
if (this.beforeFence === 5) {
window.setTimeout(() => {
new Viewer(this.element.nativeElement.querySelector(`#pipelineViewer${item.getID()}`), { url: 'data-original' });
}, 0)
} else if (this.beforeFence === 6) {
window.setTimeout(() => {
new Viewer(this.element.nativeElement.querySelector(`#orvrViewer${item.getID()}`), { url: 'data-original' });
}, 0)
}
PlanComponent.instance.isShowLoading = false //关闭遮罩
this.message.info("上传成功!");
})
}
}
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
treeData: NzTreeNodeOptions[] = []; //tree data

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

@ -62,12 +62,12 @@
<div class="natureHeader"><i nz-icon nzType="close-circle" nzTheme="outline" title="关闭" (click)="isShowNature = false;"></i></div>
<div class="natureContent" *ngIf="beforeOnePropertyData.getPropertyData().info != undefined">
<div class="natureTitle">详情</div>
<div><textarea [(ngModel)]="beforeOnePropertyData.getPropertyData().info"></textarea></div>
<div><textarea [(ngModel)]="beforeOnePropertyData.getPropertyData().info" [disabled]="!editMode"></textarea></div>
</div>
<div class="natureContent" *ngIf="beforeOnePropertyData.getPropertyData().img != undefined">
<div class="natureContent" *ngIf="beforeOnePropertyData.getPropertyData().img != undefined" id="propertyImg">
<div class="natureTitle">图片</div>
<div class="natureImg" *ngIf="beforeOnePropertyData.getPropertyData().img"><img [src]="beforeOnePropertyData.getPropertyData().img"></div>
<div><a href="javascript:;" class="bottomPlanUpload natureUpload"><input type="file"><i nz-icon nzType="plus" nzTheme="outline"></i></a></div>
<div class="natureImg" *ngIf="beforeOnePropertyData.getPropertyData().img"><img [src]="beforeOnePropertyData.getPropertyData().img" [attr.data-original]="beforeOnePropertyData.getPropertyData().img"></div>
<div *ngIf="editMode"><a href="javascript:;" class="bottomPlanUpload natureUpload"><input type="file" accept="image/*" (change)='uploadPropertyImg($event)'><i nz-icon nzType="plus" nzTheme="outline"></i></a></div>
</div>
</div>
<div class="nature natureLook" *ngIf="isShowNature && (selectFence === 1 || selectFence === 2) && beforeOnePropertyData" [ngStyle]="{'top': naturePosition.top,'right': naturePosition.right}">

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

@ -195,7 +195,7 @@
margin-bottom: 5px;
.natureTitle{ margin-bottom: 5px; height: 20px; line-height: 20px; }
textarea{ width: 100%; height: 75px; background: rgba(145, 204, 255, 0.41); border: 1px solid #91CCFF; padding: 0; resize: none; outline: none; }
.natureImg{ margin-bottom: 5px; img{ width: auto; height: auto; max-width: 100%; } }
.natureImg{ margin-bottom: 5px; img{ width: auto; height: auto; max-height: 120px; } }
.natureUpload{ margin: 0; text-align: center; width: 50px; height: 50px; line-height: 50px; }
}
}

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

@ -339,6 +339,7 @@ export class PlanComponent implements OnInit {
isShowNature: boolean = false; //显隐设备 属性栏
beforeOnePropertyData: FacilityInfoUIItem = null; //当前选择 设备
propertyImg: Viewer; //设备图标Viewer 实例
naturePosition: naturePosition = new naturePosition(); //设备栏 定位位置
//选中 设备
@ -349,6 +350,36 @@ export class PlanComponent implements OnInit {
if (this.isShowChildComponent && this.leftDomain) {
this.leftDomain.selectFacilityId = e.getID()
}
if (this.selectFence === 0 && this.beforeOnePropertyData.getPropertyData() && this.beforeOnePropertyData.getPropertyData().img) { //img
window.setTimeout(() => {
this.propertyImg = new Viewer(this.element.nativeElement.querySelector('#propertyImg'), { url: 'data-original' });
}, 0)
}
}
//上传设备 图片
uploadPropertyImg(e) {
if (e.target.files.length) {
let maxSize = 30 * 1024 * 1024 //限制30MB
let file = e.target.files[0]
if (file.size > maxSize) { //超出限制
this.message.info("上传资源需小于30MB");
return
}
this.isShowLoading = true //打开遮罩
let institutionKey = sessionStorage.getItem('unitId') || "ceshi"; //单位id
let buildingKey = this.buildingUIItems.find(item => { return item.getBuildingID() == this.beforeOneBuildingID })
let facility = this.beforeOnePropertyData
let url = DataManager.getResPath_facilityProperty(institutionKey, buildingKey.getBuildingID(), facility.getType(), facility.getID(), null)
ServeManager.instance.openFileSelect(file, url, (name: string, path: string) => { //上传
this.beforeOnePropertyData.getPropertyData().img = ObjectsService.getFullPath(path + name)
window.setTimeout(() => {
this.propertyImg = new Viewer(this.element.nativeElement.querySelector('#propertyImg'), { url: 'data-original' });
}, 0)
this.isShowLoading = false //关闭遮罩
this.message.info("上传成功!");
})
}
}
allMarkPlanData: AllMarkPlanData; //处置预案节点 数据
@ -480,6 +511,7 @@ export class PlanComponent implements OnInit {
} else { //开启
this.updateTimer ? window.clearTimeout(this.updateTimer) : null //清除定时器
this.progressList.forEach((item, index) => { index > this.nzCurrent ? this.progressList[index] = 0 : null })
if (this.progressList[this.nzCurrent] === 0) { MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) }
this.updateProgress()
}
}

Loading…
Cancel
Save