diff --git a/src/app/babylon/controller/event-manager/events/event-loading-change.ts b/src/app/babylon/controller/event-manager/events/event-loading-change.ts new file mode 100644 index 0000000..48a6788 --- /dev/null +++ b/src/app/babylon/controller/event-manager/events/event-loading-change.ts @@ -0,0 +1,29 @@ +import { Event_Base } from "../event-base"; +import { EventManager } from "../event-manager"; + +/** + * 加载状态 发生变化 (loading遮罩) + */ +export class Event_LoadingChange extends Event_Base { + + /** + * 当前是否loading中 + */ + static isLoading: boolean = false; + + /** + * 显示loading条 + */ + showLoading: boolean; + + /** + * 派发事件 + * @param showLoading 显示loading条 + */ + static dispatch(showLoading: boolean) { + let eventData = new Event_LoadingChange(); + eventData.showLoading = showLoading; + EventManager.dispatch(Event_LoadingChange, eventData); + Event_LoadingChange.isLoading = showLoading; + } +} \ No newline at end of file diff --git a/src/app/babylon/controller/mode-manager.ts b/src/app/babylon/controller/mode-manager.ts index 5038bc5..49ab662 100644 --- a/src/app/babylon/controller/mode-manager.ts +++ b/src/app/babylon/controller/mode-manager.ts @@ -23,7 +23,7 @@ export class ModeManager { /** * 制作模式代表内部编辑人员,可新增单位、上传模型,查看模式代表交付的模式 */ - public static s_isMakeMode = false; + public static s_isMakeMode = true; /** * 调试模式 @@ -53,6 +53,7 @@ export class ModeManager { /** * 获取当前模式的类型(查看或编辑,用户权限有关) + * 编辑模式可放置毗邻、图片标注等, 以及所有输入文本类, 和应急处置的修改 */ static get currentMode(): ModeType { return ModeManager.s_currentMode; diff --git a/src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts b/src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts index d9775ef..bb89bb9 100644 --- a/src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts +++ b/src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts @@ -16,7 +16,8 @@ export class tableRow { export class PropertyData_PL extends PropertyData_Base { direction: number = 0; //毗邻所属方向 0,1,2,3 --- 东南西北 - info: string = ""; + textDirection: string = "";//用户手输的方向 + info: string = ""; //用户输入的内容 tableData: tableData[] = []; constructor(key: string, direction: number, info: string, tableData: tableData[]) { super(key, FacilityType.PL); @@ -27,6 +28,7 @@ export class PropertyData_PL extends PropertyData_Base { clone(key: string) { let result = new PropertyData_PL(key, this.direction, this.info, this.tableData); + result.textDirection = this.textDirection; return result; } diff --git a/src/app/babylon/model/info/mark/mark-plan-info.ts b/src/app/babylon/model/info/mark/mark-plan-info.ts index 398e134..101c71c 100644 --- a/src/app/babylon/model/info/mark/mark-plan-info.ts +++ b/src/app/babylon/model/info/mark/mark-plan-info.ts @@ -1,5 +1,6 @@ import { TsTool } from "src/app/babylon/tool/ts-tool"; +import { MarkWindow } from "src/app/babylon/view/mark-window/mark-window"; import { MarkTagPos, MarkType } from "../../data/mark/mark-data"; import { MarkNodeData, MarkPlanData } from "../../data/mark/mark-plan-data"; import { ModelInfo_mark } from "./model-info-mark"; @@ -99,6 +100,16 @@ export class MarkNodeInfo { return this.currentMarkDataIndex; } + /** + * 阅读当前节点描述 + */ + readDescribe() { + if (this.nodeData != null) { + MarkWindow.instance.readDescribe(this.nodeData.describe); + } + + } + /** diff --git a/src/app/babylon/model/info/model/model-info-facility.ts b/src/app/babylon/model/info/model/model-info-facility.ts index a89bbd2..207b1a9 100644 --- a/src/app/babylon/model/info/model/model-info-facility.ts +++ b/src/app/babylon/model/info/model/model-info-facility.ts @@ -4,7 +4,6 @@ import { ConfigManager } from "src/app/babylon/controller/config-manager"; import { SceneManager } from "src/app/babylon/controller/scene-manager"; import { UIManager } from "src/app/babylon/controller/ui-manager"; import { BabylonUIStyleTool } from "src/app/babylon/tool/babylon-ui-style-tool"; -import { SpeakingTool } from "src/app/babylon/tool/speaking-tool"; import { TsTool } from "src/app/babylon/tool/ts-tool"; import { FacilityWindow } from "src/app/babylon/view/facility-window/facility-window"; import { FacilityInfoInSceneWindow } from "src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window"; diff --git a/src/app/babylon/tool/babylon-tool.ts b/src/app/babylon/tool/babylon-tool.ts index 7ae6949..334fb1b 100644 --- a/src/app/babylon/tool/babylon-tool.ts +++ b/src/app/babylon/tool/babylon-tool.ts @@ -10,11 +10,9 @@ import { ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, Mesh, - MeshBuilder, NodeMaterial, PBRMaterial, QuadraticEase, - Quaternion, Scene, SceneLoader, Skeleton, @@ -22,7 +20,6 @@ import { } from '@babylonjs/core'; import { - AdvancedDynamicTexture, Button, Container, Control, diff --git a/src/app/babylon/tool/load-tool.ts b/src/app/babylon/tool/load-tool.ts index a92efea..12f267b 100644 --- a/src/app/babylon/tool/load-tool.ts +++ b/src/app/babylon/tool/load-tool.ts @@ -1,4 +1,5 @@ import { PlanComponent } from "src/app/pages/plan/plan.component"; +import { Event_LoadingChange } from "../controller/event-manager/events/event-loading-change"; /** * 加载管理器 @@ -52,6 +53,7 @@ export class LoadTool { static onStart() { // console.log("开始加载"); PlanComponent.instance.showLoading(true); + Event_LoadingChange.dispatch(true); } /** @@ -60,6 +62,7 @@ export class LoadTool { static onEnd() { // console.log("结束加载"); PlanComponent.instance.showLoading(false); + Event_LoadingChange.dispatch(false); } } \ No newline at end of file diff --git a/src/app/babylon/tool/speaking-tool.ts b/src/app/babylon/tool/speaking-tool.ts index 2516888..9784ed9 100644 --- a/src/app/babylon/tool/speaking-tool.ts +++ b/src/app/babylon/tool/speaking-tool.ts @@ -1,3 +1,5 @@ +import { EventManager } from "../controller/event-manager/event-manager"; +import { Event_LoadingChange } from "../controller/event-manager/events/event-loading-change"; /** * 语音工具 @@ -10,9 +12,25 @@ export class SpeakingTool { if (SpeakingTool.instance == null) { SpeakingTool.instance = new SpeakingTool(); } + EventManager.addListener(Event_LoadingChange, (eventInfo) => { + SpeakingTool.instance.onChangeLoading(eventInfo); + }); return SpeakingTool.instance; } + /** + * loading状态改变时 + * @param eventInfo + */ + onChangeLoading(eventInfo: Event_LoadingChange) { + if (eventInfo.showLoading) { + this.pause(); + } + else { + this.resume(); + } + } + /** * 阅读一段文字 @@ -34,6 +52,10 @@ export class SpeakingTool { speakMsg.pitch = 1.5; window.speechSynthesis.speak(speakMsg); + if (Event_LoadingChange.isLoading) { + this.pause(); + } + return speakMsg; } } @@ -73,4 +95,7 @@ export class SpeakingTool { return false; } -} \ No newline at end of file +} + + + diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index ffbb7c3..01a900e 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -1,5 +1,5 @@ -import { AbstractMesh, GizmoManager, Material, Mesh, PBRMaterial, Texture } from "@babylonjs/core"; +import { AbstractMesh, Material, Mesh, PBRMaterial, Texture } from "@babylonjs/core"; import { PlanComponent } from "src/app/pages/plan/plan.component"; import { ConfigManager } from "../../controller/config-manager"; import { DataManager } from "../../controller/data-manager"; diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts index 8c2e292..dd07b7c 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts @@ -87,6 +87,7 @@ export class FacilityInfoUIItem { } onSelect(select: boolean) { + this.isSelect = select; this.modelInfo.setSelectEnable(select); if (select) { @@ -112,6 +113,7 @@ export class FacilityInfoUIItem { */ lookAt() { + if (!this.canLookAt()) { return; } diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index e7b6907..03bca52 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -7,9 +7,9 @@ import { DataManager } from "../../controller/data-manager"; import { EventManager } from "../../controller/event-manager/event-manager"; import { Event_GetAllMarkPlanData } from "../../controller/event-manager/events/event-get-markplandata-success"; import { Event_KeyboardInput } from "../../controller/event-manager/events/event-keyboard-input"; +import { Event_LoadingChange } from "../../controller/event-manager/events/event-loading-change"; import { Event_MarkInfoChange, MarkInfoChangeType } from "../../controller/event-manager/events/event-mark-info-change"; import { InputController } from "../../controller/inputController"; -import { ModeManager } from "../../controller/mode-manager"; import { SceneManager } from "../../controller/scene-manager"; import { BuildingStatus } from "../../controller/status/building-status"; import { IndoorStatus } from "../../controller/status/indoor-status"; @@ -237,7 +237,7 @@ export class MarkWindow extends UIBase { * @param markPlanId 方案id,一级节点ID * @param nodeId 节点id,二级节点id */ - saveToOldNode(markPlanId: number, nodeId: number) { + saveToOldNode(markPlanId: number, nodeId: number, newName?: string) { let markPlaneData = DataManager.allMarkPlanData.getMarkPlanById(markPlanId); if (markPlaneData == null) { console.error("没找到标绘方案:" + markPlanId) @@ -248,7 +248,10 @@ export class MarkWindow extends UIBase { let copyNodeData = classToClass(this.currentMarkNodeDataCopy);//覆盖数据 copyNodeData.id = oldNodeData.id; copyNodeData.index = oldNodeData.index; - copyNodeData.name = oldNodeData.name; + if (newName != null) { + copyNodeData.name = newName; + } + // copyNodeData.name = oldNodeData.name; markPlaneData.setNodeData(nodeId, copyNodeData);//覆盖数据 this.saveAllMarkPlanData(); @@ -261,7 +264,7 @@ export class MarkWindow extends UIBase { */ createNewNodeAndSave(markPlanId: number, name: string) { let newNode = this.createMarkNodeData(markPlanId, name); - this.saveToOldNode(markPlanId, newNode.id); + this.saveToOldNode(markPlanId, newNode.id, name); } diff --git a/src/app/pages/left-domain/left-domain.component.html b/src/app/pages/left-domain/left-domain.component.html index e98e9ae..ff2a673 100644 --- a/src/app/pages/left-domain/left-domain.component.html +++ b/src/app/pages/left-domain/left-domain.component.html @@ -2,17 +2,46 @@
-
+
-

北京市第十九加油站

-

北京市朝阳区朝外大街关东店33号

-

山东省淄博市

-

2020.7.26开业

-

4车道

+

{{baseInfo.stationName || '暂无数据'}}

+

{{baseInfo.address || '暂无数据'}}

+

{{baseInfo.locationName || '暂无数据'}}

+

{{baseInfo.openTime | date:"yyyy/MM/dd HH:mm:ss" || '0:00:00'}} 开业

+

{{baseInfo.laneCount || '0'}} 车道

-
+
+

辖区派出所

+

{{baseInfo.govUnitDetail.policeStation.name || '暂无数据'}}

+

{{baseInfo.govUnitDetail.policeStation.address || '暂无数据'}}

+

{{baseInfo.govUnitDetail.policeStation.contactInformation || '暂无数据'}}

+

{{baseInfo.govUnitDetail.policeStation.distance || '0公里'}}

+
+
+

辖区医院

+

{{baseInfo.govUnitDetail.hospital.name || '暂无数据'}}

+

{{baseInfo.govUnitDetail.hospital.address || '暂无数据'}}

+

{{baseInfo.govUnitDetail.hospital.contactInformation || '暂无数据'}}

+

{{baseInfo.govUnitDetail.hospital.distance || '0公里'}}

+
+
+

辖区消防队

+

{{baseInfo.govUnitDetail.fireBrigade.name || '暂无数据'}}

+

{{baseInfo.govUnitDetail.fireBrigade.address || '暂无数据'}}

+

{{baseInfo.govUnitDetail.fireBrigade.contactInformation || '暂无数据'}}

+

{{baseInfo.govUnitDetail.fireBrigade.distance || '0公里'}}

+
+

营业执照

-

+

+
+
+

危险化学品经营许可证

+

+
+
+

成品油零售经营许可证

+

@@ -97,10 +126,10 @@

-
+

设计图纸

- - + +
@@ -128,10 +157,10 @@

-
+

设计图纸

- - + +
diff --git a/src/app/pages/left-domain/left-domain.component.scss b/src/app/pages/left-domain/left-domain.component.scss index b536e03..07efc39 100644 --- a/src/app/pages/left-domain/left-domain.component.scss +++ b/src/app/pages/left-domain/left-domain.component.scss @@ -45,7 +45,8 @@ } .baseInfo{ //基本信息 - .interval{ margin-top: 10px; border-bottom: 1px solid rgb(197, 226, 245); } //分隔div + .interval{ margin-top: 10px; border-bottom: 1px solid rgb(107, 117, 122); } //分隔div + .baseInfoImg{ border: none; } p{ height: 20px; line-height: 20px; } .titleBotton{ background: #2399FF; border-radius: 3px; height: 20px; line-height: 20px; font-size: 12px; margin-left: 5px; padding: 0 5px; border: none; outline: none; } .text{ font-size: 14px; margin-bottom: 15px; } diff --git a/src/app/pages/left-domain/left-domain.component.ts b/src/app/pages/left-domain/left-domain.component.ts index e263429..f162dbf 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/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,11 @@ 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'; +import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-left-domain', @@ -19,15 +24,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, private http: HttpClient) { } ngOnInit(): void { - let editMode = sessionStorage.getItem('isGasStation') - if (editMode == 'false') { - this.editMode = true - } else { - this.editMode = false - } + this.editMode = PlanComponent.instance.editMode this.initComponent() } @@ -35,6 +35,7 @@ export class LeftDomainComponent implements OnInit { beforeFence: number; //当前选中功能栏 FacilityList: FacilityInfoUIItem[] = []; //统计设备 list selectFacilityId: string = null; //选中设备 ID + baseInfo: any; //基本信息 //初始化组件 initComponent(type?: number) { @@ -49,13 +50,22 @@ export class LeftDomainComponent implements OnInit { //处理 设备data handleFacility() { + if (this.beforeFence === 0) { //基本信息 + if (!this.baseInfo) { + let params = { organizationUnitId: PlanComponent.instance.companyData.id } + this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any)=>{ + data.result.govUnitDetail? data.result.govUnitDetail = JSON.parse(data.result.govUnitDetail) : null + this.baseInfo = data.result + }) + } + return + } if (this.beforeFence === 7) { //应急预案 - MarkWindow.instance ? this.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null - EventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData) => { - this.allMarkPlanData = data.data - PlanComponent.instance.allMarkPlanData = this.allMarkPlanData - }) - PlanComponent.instance.allMarkPlanData = this.allMarkPlanData + this.selectPlanId = null + this.selectNodeId = null + if (MarkWindow.instance) { + this.allMarkPlanData = MarkWindow.instance.allMarkPlanData + } return } let list: FacilityInfoUIItem[] = [] @@ -76,6 +86,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) + } + }) } } @@ -90,6 +109,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 @@ -210,31 +259,33 @@ export class LeftDomainComponent implements OnInit { //选中 数据节点 selectNode(item: MarkPlanData, e: MarkNodeData, index: number) { if (this.selectPlanId != item.id || this.selectNodeId != e.id) { //选中 + this.selectPlanId = item.id + this.selectNodeId = e.id + PlanComponent.instance.beforeEmergencyPlan = item + PlanComponent.instance.beforePlanNode = e if (PlanComponent.instance.progressList.length != item.nodes.length) { PlanComponent.instance.updateProgressList() } this.updateFatherData(index) //更新/初始化父组件 数据 - this.selectPlanId = item.id - this.selectNodeId = e.id + PlanComponent.instance.initViewer() MarkWindow.instance.selectMarkNode(item.id, e.id) - PlanComponent.instance.beforeEmergencyPlan = item PlanComponent.instance.beforePlanNode = MarkWindow.instance.currentMarkNodeInfo.nodeData } else if (this.selectPlanId === item.id && this.selectNodeId === e.id) { //取消选中 + this.selectPlanId = null + this.selectNodeId = null PlanComponent.instance.beforeEmergencyPlan = new MarkPlanData(-99, "请选择节点") PlanComponent.instance.beforePlanNode = new MarkNodeData(-99, "请选择节点") this.updateFatherData(index) //更新/初始化父组件 数据 - this.selectPlanId = null - this.selectNodeId = null MarkWindow.instance.selectMarkNode(null, null) } } //更新/初始化父组件 数据 updateFatherData(index) { + PlanComponent.instance.updateTimer? window.clearTimeout(PlanComponent.instance.updateTimer) : null //清除定时器 PlanComponent.instance.progressList.forEach((item,key)=>{ key >= index? PlanComponent.instance.progressList[key] = 0 : PlanComponent.instance.progressList[key] = 100 }) PlanComponent.instance.nzCurrent = index PlanComponent.instance.isSuspend = true //暂停 - PlanComponent.instance.updateTimer? window.clearTimeout(PlanComponent.instance.updateTimer) : null //清除定时器 } saveDisposalDialog: boolean = false; //整体保存预案 弹窗 diff --git a/src/app/pages/plan/plan.component.html b/src/app/pages/plan/plan.component.html index a182b17..8769b30 100644 --- a/src/app/pages/plan/plan.component.html +++ b/src/app/pages/plan/plan.component.html @@ -7,10 +7,7 @@
@@ -26,7 +23,7 @@ -
+
{{allFence[selectFence]}}
@@ -62,12 +59,12 @@
详情
-
+
-
+
图片
-
-
+
+
@@ -146,8 +143,16 @@

-
-
+
+ + + +
+
+ + + +
@@ -235,7 +240,7 @@ - + diff --git a/src/app/pages/plan/plan.component.scss b/src/app/pages/plan/plan.component.scss index 12e7da1..bec982c 100644 --- a/src/app/pages/plan/plan.component.scss +++ b/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; } } } @@ -335,8 +335,10 @@ input{ border: none; outline: none; background-color: transparent; width: 100%; height: 100%; } textarea{ width: 100%; height: 50px; background: rgba(145, 204, 255, 0.41); border: 1px solid #91CCFF; padding: 0; resize: none; outline: none; } } - .planHeaderImg{ width: 100px; height: 100%; text-align: center; } - .planHeaderVideo{ width: 120px; height: 100%; text-align: center; } + .planHeaderImg{ width: 140px; height: 100%; text-align: center; line-height: 80px; .imgSrc{ width: 100px; height: auto; max-height: 100%; } } + .uploadImage{ width: 20px; height: 20px; line-height: 20px; float: right; margin-top: 30px; } + .planHeaderVideo{ width: 180px; height: 100%; text-align: center; line-height: 80px; video{ width: 120px; height: auto; max-height: 100%; } } + .uploadVideo{ width: 30px; height: 30px; line-height: 30px; float: right; margin-top: 25px; } } .bottomPlanCenter{ height: 35px; diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index d3e4195..48c179c 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -1,4 +1,5 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import Viewer from 'viewerjs'; import { Game } from 'src/app/babylon/game'; import { LoginSatus } from 'src/app/babylon/controller/status/login-status'; import { StatusManager } from 'src/app/babylon/controller/status/status-manager'; @@ -23,6 +24,11 @@ import { AllMarkData } from 'src/app/babylon/model/data/mark/all-mark-data'; import { MarkData, MarkTask } from 'src/app/babylon/model/data/mark/mark-data'; import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window'; import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data'; +import { DataManager, ResType } from 'src/app/babylon/controller/data-manager'; +import { EventManager as babylonEventManager } from 'src/app/babylon/controller/event-manager/event-manager'; +import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manager/events/event-get-markplandata-success'; +import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window'; +import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility'; @@ -41,13 +47,16 @@ export class PlanComponent implements OnInit { public canvas: HTMLCanvasElement; //canvas 实例 public editMode: boolean = true; //编辑/查看 模式 public userMode: boolean = ModeManager.s_isMakeMode; //是否为 内部权限 + public bucketName: string = ObjectsService.getFullPath("文件路径"); //当前桶名 public isShowLoading: boolean = true; //显隐 loading加载条 + public companyData: any; //当前加油站 信息 ngOnInit(): void { PlanComponent.instance = this; ServeManager.Init(this.buildingBISrv, this.objectsSrv); this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement; this.game.init(this.canvas); + this.companyData = (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization || {} let editMode = sessionStorage.getItem('isGasStation') if (editMode == 'false') { this.editMode = true @@ -70,9 +79,9 @@ export class PlanComponent implements OnInit { ngAfterViewInit(): void { let simpleData: InsitutionDataSimple = new InsitutionDataSimple(); - simpleData.id = 1; //来自选中的单位的信息 ,测试:1 - simpleData.key = "ceshi"; //正式: id.tostring(),测试:"ceshi" - simpleData.name = "测试"; //来自选中的单位的信息 ,测试:"测试" + simpleData.id = 1; //来自选中的单位的信息 ,测试:1 + simpleData.key = "ceshi"; //正式: id.tostring(),测试:"ceshi" + simpleData.name = this.companyData.displayName || "测试"; //来自选中的单位的信息 ,测试:"测试" let has3dData = true;//是否有三维数据,来自选中单位的信息 let loginStatus = StatusManager.getStatus(LoginSatus); @@ -85,8 +94,8 @@ export class PlanComponent implements OnInit { { let isAdd = confirm('没有单位' + simpleData.key + ',是否进行初始化?') if (isAdd) { - let name = simpleData.key; - let id = 2;// 单位id + let name = simpleData.name; + let id = simpleData.id;// 单位id loginStatus.createInsitution(simpleData.key, name, id); } } @@ -117,6 +126,7 @@ export class PlanComponent implements OnInit { modelInit(InsList) { } allFence: string[] = ["基本信息", "加油机", "油罐设备", "消防设施", "安全疏散", "输油管线", "油气回收", "应急预案"]; //头部 功能栏 + baseInfoMarks: baseInfoMark[] = [new baseInfoMark("毗邻"), new baseInfoMark("区域"), new baseInfoMark("图片"), new baseInfoMark("点位")] //基本信息 设备筛选list selectFence: number = -1; //选中 头部功能栏 isShowChildComponent: boolean = false; //是否 显示左侧子组件 @ViewChild('leftDomain') leftDomain: LeftDomainComponent; //子组件引用 @@ -133,10 +143,24 @@ export class PlanComponent implements OnInit { if (this.selectFence === 7) { //初始化 应急预案模块 this.initializePlan() } - this.isShowChildComponent && this.leftDomain && type != 4 ? this.leftDomain.initComponent(type) : null; //手动初始化子组件 - this.selectFence = type - this.isShowChildComponent = true - buildingWindow.changeJYZInfoModel(fenceType, true) + if (type === 7) { //初始化 应急预案 data + this.isShowChildComponent && this.leftDomain? this.leftDomain.initComponent(type) : null; //手动初始化子组件 + this.selectFence = type + this.editMode? this.isShowChildComponent = true : this.isShowChildComponent = false + buildingWindow.changeJYZInfoModel(fenceType, true) + MarkWindow.instance ? this.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null; + babylonEventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData) => { + this.allMarkPlanData = MarkWindow.instance.allMarkPlanData + this.isShowChildComponent && this.leftDomain? this.leftDomain.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null + }) + this.isShowChildComponent && this.leftDomain? this.leftDomain.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null + } else { + this.isShowChildComponent && this.leftDomain && type != 4 ? this.leftDomain.initComponent(type) : null; //手动初始化子组件 + this.selectFence = type + this.isShowChildComponent = true + buildingWindow.changeJYZInfoModel(fenceType, true) + if (type === 0) { this.baseInfoMarks.forEach(item=>{ item.isShow = true }) } //初始化基本信息 设备显隐 + } } else { //取消选中 this.selectFence = -1 this.isShowChildComponent = false @@ -170,6 +194,21 @@ export class PlanComponent implements OnInit { return fenceType } + //基本信息 设备筛选显隐 + toggleBaseInfoMark(event, item: baseInfoMark) { + let type + if (item.markerName === "毗邻") { + type = FacilityType.PL + } else if (item.markerName === "区域") { + type = FacilityType.QY + } else if (item.markerName === "图片") { + type = FacilityType.TPBZ + } else if (item.markerName === "点位") { + type = FacilityType.DWBZ + } + FacilityInfoInSceneWindow.instance.showFacilityByType(type, event) + } + //子组件 创建预案/保存 noticeChildComponent(type: boolean) { if (this.isShowChildComponent && this.leftDomain) { @@ -321,6 +360,7 @@ export class PlanComponent implements OnInit { isShowNature: boolean = false; //显隐设备 属性栏 beforeOnePropertyData: FacilityInfoUIItem = null; //当前选择 设备 + propertyImg: Viewer; //设备图标Viewer 实例 naturePosition: naturePosition = new naturePosition(); //设备栏 定位位置 //选中 设备 @@ -331,6 +371,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; //处置预案节点 数据 @@ -354,10 +424,11 @@ export class PlanComponent implements OnInit { publicToggleNode() { return new Promise((resolve, reject) => { this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent] - this.isShowChildComponent && this.leftDomain ? this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id : null - this.isShowChildComponent && this.leftDomain ? this.leftDomain.selectNodeId = this.beforePlanNode.id : null + this.isShowChildComponent && this.leftDomain? this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id : null + this.isShowChildComponent && this.leftDomain? this.leftDomain.selectNodeId = this.beforePlanNode.id : null MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) this.beforePlanNode = MarkWindow.instance.currentMarkNodeInfo.nodeData + this.initViewer() this.updateProgress() //更新进度条 resolve(true) }) @@ -365,17 +436,15 @@ export class PlanComponent implements OnInit { //选中 底部一级节点 开启自动播放 selectChildNode(item: MarkPlanData) { - if (this.isShowChildComponent && this.leftDomain) { - if (item.nodes.length) { - this.updateTimer ? window.clearTimeout(this.updateTimer) : null //清除定时器 - this.nzCurrent = 0 - this.beforeEmergencyPlan = item - this.updateProgressList().then(res => { - this.publicToggleNode() - }) - } else { - this.message.info('暂无数据节点'); - } + if (item.nodes.length) { + this.updateTimer ? window.clearTimeout(this.updateTimer) : null //清除定时器 + this.nzCurrent = 0 + this.beforeEmergencyPlan = item + this.updateProgressList().then(res => { + this.publicToggleNode() + }) + } else { + this.message.info('暂无数据节点'); } } @@ -461,6 +530,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() } } @@ -543,6 +613,49 @@ export class PlanComponent implements OnInit { } videoDialogType: videoDialog = new videoDialog(true, null); //全景图/视频 弹窗 + planNodeImg: Viewer; //应急预案图片Viewer 实例 + + //初始化 Viewer图片 + initViewer() { + if (this.beforePlanNode.texture) { + window.setTimeout(() => { + this.planNodeImg = new Viewer(this.element.nativeElement.querySelector('#planNodeImg'), { url: 'data-original' }); + }, 0) + } + } + + //上传 图片/视频 + uploadImgVideo(e, isVideo: boolean) { + 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 resType = isVideo? ResType.Video : ResType.Texture + let key = `${(new Date()).getMonth() + 1}-${(new Date()).getDate()}-${(new Date()).getHours()}` + let url = DataManager.getResPath_mark(institutionKey, resType, key) //url + ServeManager.instance.openFileSelect(file, url, (name: string, path: string) => { //上传 + if (!isVideo) { //img + this.beforePlanNode.texture = ObjectsService.getFullPath(path + name) + this.initViewer() + } else { //video + this.beforePlanNode.video = ObjectsService.getFullPath(path + name) + } + this.isShowLoading = false //关闭遮罩 + this.message.info("上传成功!"); + }) + } + } + + //打开视频弹窗 + openVideo(src: string) { + this.videoDialogType.isVideo = true + this.videoDialogType.url = src + } selectRightTopFast: number = 0; //当前选择功能 快捷栏 selectAdsorb: boolean = false; //吸附状态 @@ -693,3 +806,11 @@ export class modelBuilding { name: string = ""; modelType: BuildingType = BuildingType.Normal; } +//基本信息 设备筛选 +export class baseInfoMark{ + markerName: string; + isShow: boolean = true; + constructor(markerName: string) { + this.markerName = markerName + } +} diff --git a/src/app/pages/plan/publicPop.scss b/src/app/pages/plan/publicPop.scss index f658838..a221c9b 100644 --- a/src/app/pages/plan/publicPop.scss +++ b/src/app/pages/plan/publicPop.scss @@ -26,7 +26,15 @@ overflow: hidden; display: inline-block; } -.uploadBackGround input,.bottomPlanUpload input { +.imgAndVideoUpload{ + position: relative; + cursor: pointer; + background: rgba(145, 204, 255, 0.41); + border: 1px dashed #91CCFF; + overflow: hidden; + display: inline-block; +} +.uploadBackGround input,.bottomPlanUpload input,.imgAndVideoUpload input { position: absolute; width: 100%; height: 100%; diff --git a/src/app/service/objects.service.ts b/src/app/service/objects.service.ts index c983d62..c1a2de2 100644 --- a/src/app/service/objects.service.ts +++ b/src/app/service/objects.service.ts @@ -68,6 +68,7 @@ export class ObjectsService { * 获取桶名 */ getBucketName() { + return this.obsRootByEnv.get(ObjectsService.currentEnvironmentType); } diff --git a/tsconfig.json b/tsconfig.json index e869761..e5e0592 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,8 +31,9 @@ "strictInjectionParameters": true, "enableIvy": false }, - // "include": [ - // "src/**/*.d.ts", - // "typings.d.ts" - // ] + "include": [ + "src/**/*.d.ts", + "src/**/*.ts", + "typings.d.ts" + ] }