Browse Source

合并代码

dev
陈鹏飞 3 years ago
parent
commit
5de992611c
  1. 5
      src/app/babylon/controller/inputController.ts
  2. 6
      src/app/babylon/controller/mode-manager.ts
  3. 11
      src/app/babylon/controller/scene-manager.ts
  4. 2
      src/app/babylon/controller/serve-manager.ts
  5. 5
      src/app/babylon/controller/status/status-manager.ts
  6. 1
      src/app/babylon/game.ts
  7. 6
      src/app/babylon/tool/gizmo-tool.ts
  8. 9
      src/app/babylon/tool/load-tool.ts
  9. 3
      src/app/babylon/view/building-window/building-ui-item.ts
  10. 9
      src/app/babylon/view/building-window/building-window.ts
  11. 59
      src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts
  12. 1
      src/app/babylon/view/mark-window/mark-window.ts
  13. 68
      src/app/pages/left-domain/left-domain.component.ts
  14. 15
      src/app/pages/plan/plan.component.ts
  15. 13
      src/app/service/babylon/building-basic-infos.service.ts

5
src/app/babylon/controller/inputController.ts

@ -1304,8 +1304,11 @@ export class Keyboard {
private constructor() { private constructor() {
// 添加快捷键 // 添加快捷键
document.addEventListener('keydown', (e: KeyboardEvent) => { document.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.key == null) {
return;
}
let key = e.key.toLocaleLowerCase(); let key = e.key.toLocaleLowerCase();
console.log(key); // console.log(key);
if (key == "w" && e.shiftKey) { if (key == "w" && e.shiftKey) {
this.W = true; this.W = true;
} else if (key == "w") { } else if (key == "w") {

6
src/app/babylon/controller/mode-manager.ts

@ -23,12 +23,12 @@ export class ModeManager {
/** /**
* *
*/ */
public static s_isMakeMode = true; public static s_isMakeMode = false;
/** /**
* *
*/ */
public static isDebug = true; public static isDebug = false;
@ -63,7 +63,7 @@ export class ModeManager {
*/ */
static set currentMode(modeType: ModeType) { static set currentMode(modeType: ModeType) {
ModeManager.s_currentMode = modeType; ModeManager.s_currentMode = modeType;
ModeManager.log("currentMode" + modeType);
} }
//封装打印 //封装打印

11
src/app/babylon/controller/scene-manager.ts

@ -58,6 +58,7 @@ import { MarkData_multiArrow_CT, MarkData_multiArrow_JG } from '../model/data/ma
import { ModelInfo_mark_multiArrow } from '../model/info/mark/other/mark-plan-multi-arrow'; import { ModelInfo_mark_multiArrow } from '../model/info/mark/other/mark-plan-multi-arrow';
import { ModelInfo_mark_particle } from '../model/info/mark/other/mark-plan-particle-info'; import { ModelInfo_mark_particle } from '../model/info/mark/other/mark-plan-particle-info';
import { FacilityPosType, ModelData_facility } from '../model/data/model-data/model-data-facility'; import { FacilityPosType, ModelData_facility } from '../model/data/model-data/model-data-facility';
import { LoadTool } from '../tool/load-tool';
//场景管理器 //场景管理器
export class SceneManager { export class SceneManager {
@ -556,7 +557,7 @@ export class SceneManager {
} }
SceneManager.endLoadMesh(modelData.resPath, modelData.resName); SceneManager.endLoadMesh(modelData.resPath, modelData.resName);
let box = SceneManager.importMeshSuccess(newMeshes, particleSystems, skeletons, animationGroups, modelInfo, needBox, modelData); let box = SceneManager.importMeshSuccess(newMeshes, particleSystems, skeletons, animationGroups, modelInfo, needBox, modelData);
console.log("加载模型完成", modelData.resName); //console.log("加载模型完成", modelData.resName);
onSuccess(newMeshes, box, modelInfo); onSuccess(newMeshes, box, modelInfo);
}, null, }, null,
function (scene: Scene, message: string, exception?: any) { function (scene: Scene, message: string, exception?: any) {
@ -568,14 +569,14 @@ export class SceneManager {
SceneManager.createModel(modelType, modelData, needBox, isNew, tag, onSuccess, onError, l_index); SceneManager.createModel(modelType, modelData, needBox, isNew, tag, onSuccess, onError, l_index);
console.log("重新开始加载" + l_index, modelData); //console.log("重新开始加载" + l_index, modelData);
console.log(exception); console.log(exception);
} }
else { else {
modelInfo.dispose(); modelInfo.dispose();
console.log(message); LoadTool.remove(modelData.resPath + modelData.resName);
console.log(exception); console.log(message, exception);
// alert("模型加载失败: " + message + "==" + exception); alert("模型加载失败,请刷新页面重试: " + message + "==" + exception);
// alert(exception); // alert(exception);
if (onError) { if (onError) {
onError(message) onError(message)

2
src/app/babylon/controller/serve-manager.ts

@ -53,7 +53,7 @@ export class ServeManager {
let l_data = classToPlain(institutionData); let l_data = classToPlain(institutionData);
console.log("保存单位", l_data); console.log("保存单位", l_data);
this.buildingBISrv.postBuildingBasicInfos(key, l_data) this.buildingBISrv.postBuildingBasicInfos(key, 1, l_data)
.subscribe(data => { .subscribe(data => {
console.log("保存单位成功:" + key, l_data); console.log("保存单位成功:" + key, l_data);
if (onSuccess) { if (onSuccess) {

5
src/app/babylon/controller/status/status-manager.ts

@ -54,6 +54,11 @@ export class StatusManager {
newStatus.onEnter(); newStatus.onEnter();
return newStatus; return newStatus;
} }
static dispose() {
StatusManager.s_allStatus = [];
StatusManager.s_currentStatus = null;
}
} }

1
src/app/babylon/game.ts

@ -54,6 +54,7 @@ export class Game {
dispose() { dispose() {
SceneManager.Instance.dispose(); SceneManager.Instance.dispose();
StatusManager.dispose();
this.scene.dispose() this.scene.dispose()
this.scene = null; this.scene = null;
this.engine.dispose(); this.engine.dispose();

6
src/app/babylon/tool/gizmo-tool.ts

@ -83,6 +83,10 @@ export class GizmoTool {
GizmoTool.onTransformUITypeChange(TransformUIType.Hide); GizmoTool.onTransformUITypeChange(TransformUIType.Hide);
} }
static dispose() {
}
static onBeforeRender( static onBeforeRender(
eventData: Scene, eventData: Scene,
eventState: EventState eventState: EventState
@ -195,7 +199,6 @@ export class GizmoTool {
//改变Gizmo目标 //改变Gizmo目标
static changeGizmoAim(mesh: AbstractMesh, x: boolean = true, y = true, z = true) { static changeGizmoAim(mesh: AbstractMesh, x: boolean = true, y = true, z = true) {
GizmoTool.s_nowPickAim_mesh = mesh; GizmoTool.s_nowPickAim_mesh = mesh;
GizmoTool.s_gizmoManager.attachToMesh(mesh); GizmoTool.s_gizmoManager.attachToMesh(mesh);
GizmoTool.s_gizmoManager.gizmos.positionGizmo.xGizmo.isEnabled = x; GizmoTool.s_gizmoManager.gizmos.positionGizmo.xGizmo.isEnabled = x;
@ -427,6 +430,7 @@ export class GizmoTool {
if (uiType == TransformUIType.Hide || !ModeManager.s_isMakeMode) { //隐藏选中框 if (uiType == TransformUIType.Hide || !ModeManager.s_isMakeMode) { //隐藏选中框
GizmoTool.s_boundingBoxGizmo.attachedMesh = null; GizmoTool.s_boundingBoxGizmo.attachedMesh = null;
} }
} }

9
src/app/babylon/tool/load-tool.ts

@ -1,3 +1,4 @@
import { PlanComponent } from "src/app/pages/plan/plan.component";
/** /**
* *
@ -49,16 +50,16 @@ export class LoadTool {
* *
*/ */
static onStart() { static onStart() {
console.log("开始加载"); // console.log("开始加载");
//ThreeDimensionalHomeComponent.instance.maskLayerService.sendMessage(true) PlanComponent.instance.showLoading(true);
} }
/** /**
* *
*/ */
static onEnd() { static onEnd() {
console.log("结束加载"); // console.log("结束加载");
//ThreeDimensionalHomeComponent.instance.maskLayerService.sendMessage(false) PlanComponent.instance.showLoading(false);
} }
} }

3
src/app/babylon/view/building-window/building-ui-item.ts

@ -3,6 +3,7 @@
import { AbstractMesh, Mesh, TransformNode } from "@babylonjs/core"; import { AbstractMesh, Mesh, TransformNode } from "@babylonjs/core";
import { ConfigManager } from "../../controller/config-manager"; import { ConfigManager } from "../../controller/config-manager";
import { InfoManager } from "../../controller/info-manager"; import { InfoManager } from "../../controller/info-manager";
import { ModeManager, ModeType } from "../../controller/mode-manager";
import { SceneManager } from "../../controller/scene-manager"; import { SceneManager } from "../../controller/scene-manager";
import { IndoorStatus } from "../../controller/status/indoor-status"; import { IndoorStatus } from "../../controller/status/indoor-status";
import { StatusManager } from "../../controller/status/status-manager"; import { StatusManager } from "../../controller/status/status-manager";
@ -161,7 +162,7 @@ export class BuildingUIItem {
*/ */
onSelect(select: boolean, animMove = true) { onSelect(select: boolean, animMove = true) {
if (select) { if (select) {
if (this.buildingInfo.ModelInfo != null && this.buildingInfo.ModelInfo.modelBox != null) { if (this.buildingInfo.ModelInfo != null && this.buildingInfo.ModelInfo.modelBox != null && ModeManager.currentMode == ModeType.Edit) {
GizmoTool.onPickMeshInfoObservable.notifyObservers(this.buildingInfo.ModelInfo); GizmoTool.onPickMeshInfoObservable.notifyObservers(this.buildingInfo.ModelInfo);
//BabylonTool.changeCameraTarget(SceneManager.Instance.defaultCamera, this.buildingInfo.ModelInfo.modelBox, animMove); //BabylonTool.changeCameraTarget(SceneManager.Instance.defaultCamera, this.buildingInfo.ModelInfo.modelBox, animMove);
} }

9
src/app/babylon/view/building-window/building-window.ts

@ -128,7 +128,7 @@ export class BuildingWindow extends UIBase {
file.push(manifestFile); //临时关闭缓存文件 file.push(manifestFile); //临时关闭缓存文件
} }
PlanComponent.instance.showLoading(true);
ServeManager.instance.uploadFile(0, file, resPath_out, (name: string, path: string, currentfile) => { ServeManager.instance.uploadFile(0, file, resPath_out, (name: string, path: string, currentfile) => {
if (TsTool.stringContain(name, ".gltf")) { if (TsTool.stringContain(name, ".gltf")) {
if (TsTool.stringContain(name, ".gltf.manifest")) { if (TsTool.stringContain(name, ".gltf.manifest")) {
@ -150,6 +150,7 @@ export class BuildingWindow extends UIBase {
} }
} }
, () => { , () => {
PlanComponent.instance.showLoading(false);
let buildingInfo = buildingWindow.getBuildingInfo(buildingData.normalData.key); let buildingInfo = buildingWindow.getBuildingInfo(buildingData.normalData.key);
buildingWindow.updateBuildingModel(buildingInfo, true); buildingWindow.updateBuildingModel(buildingInfo, true);
// buildingWindow.three = ThreeDimensionalHomeComponent.instance; // buildingWindow.three = ThreeDimensionalHomeComponent.instance;
@ -372,7 +373,7 @@ export class BuildingWindow extends UIBase {
} }
} }
console.log("选中建筑", modelInfo); // console.log("选中建筑", modelInfo);
this.showJYZModules(JYZInfoMoudleType.AQSS, false); this.showJYZModules(JYZInfoMoudleType.AQSS, false);
this.showJYZModules(JYZInfoMoudleType.YQHSGX, false); this.showJYZModules(JYZInfoMoudleType.YQHSGX, false);
this.showJYZModules(JYZInfoMoudleType.YQHSGX, false); this.showJYZModules(JYZInfoMoudleType.YQHSGX, false);
@ -506,7 +507,7 @@ export class BuildingWindow extends UIBase {
if (firstType == BuildingType.Environment) { if (firstType == BuildingType.Environment) {
instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => { instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => {
instance.onChangeCurrentBuildingItem(uiItem, false); instance.onChangeCurrentBuildingItem(uiItem, false);
uiItem.lookAt(false); // uiItem.lookAt(false);
if (buildingDatas_Environment.length > 1) { if (buildingDatas_Environment.length > 1) {
instance.addBuildings(BuildingType.Environment, 1); instance.addBuildings(BuildingType.Environment, 1);
} }
@ -519,7 +520,7 @@ export class BuildingWindow extends UIBase {
else { else {
instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => { instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => {
instance.onChangeCurrentBuildingItem(uiItem, false); instance.onChangeCurrentBuildingItem(uiItem, false);
uiItem.lookAt(false); // uiItem.lookAt(false);
if (buildingDatas_mormal.length > 1) { if (buildingDatas_mormal.length > 1) {
instance.addBuildings(BuildingType.Normal, 1); instance.addBuildings(BuildingType.Normal, 1);
} }

59
src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts

@ -178,31 +178,31 @@ export class FacilityInfoInSceneWindow extends UIBase {
*/ */
showFacilityByType(facilityType: FacilityType, show: boolean) { showFacilityByType(facilityType: FacilityType, show: boolean) {
if (ModeManager.currentMode == ModeType.Look) { // if (ModeManager.currentMode == ModeType.Look) {
for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { // for (let i = 0; i < this.facilityInfoUIItemes.length; i++) {
let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; // let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility;
if (facilityType == null || facilityType == l_facilityData.facilityType) { // if (facilityType == null || facilityType == l_facilityData.facilityType) {
this.facilityInfoUIItemes[i].modelInfo.setEnable(show); // this.facilityInfoUIItemes[i].modelInfo.setEnable(show);
} // }
else if (show) { // else if (show) {
this.facilityInfoUIItemes[i].modelInfo.setEnable(false); // this.facilityInfoUIItemes[i].modelInfo.setEnable(false);
} // }
} // }
// for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { // // for (let i = 0; i < this.facilityInfoUIItemes.length; i++) {
// let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; // // let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility;
// if (facilityType == null || facilityType == l_facilityData.facilityType) { // // if (facilityType == null || facilityType == l_facilityData.facilityType) {
// this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show); // // this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show);
// } // // }
// } // // }
} // }
else { // else {
for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { for (let i = 0; i < this.facilityInfoUIItemes.length; i++) {
let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility;
if (facilityType == null || facilityType == l_facilityData.facilityType) { if (facilityType == null || facilityType == l_facilityData.facilityType) {
this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show); this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show);
}
} }
} }
// }
} }
@ -483,7 +483,6 @@ export class FacilityInfoInSceneWindow extends UIBase {
if (this.currentSelectJYJInfo != null) { if (this.currentSelectJYJInfo != null) {
let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(this.currentSelectJYJInfo); let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(this.currentSelectJYJInfo);
facilityItem.onSelect(false); facilityItem.onSelect(false);
// this.playJYJSelectEffect(false, this.currentSelectJYJInfo);
this.currentSelectJYJInfo = null; this.currentSelectJYJInfo = null;
} }
@ -496,8 +495,6 @@ export class FacilityInfoInSceneWindow extends UIBase {
try { try {
let facilityInfosByType = BuildingWindow.instance.currentBuidngItem.buildingInfo.ModelInfo.facilityInfos; let facilityInfosByType = BuildingWindow.instance.currentBuidngItem.buildingInfo.ModelInfo.facilityInfos;
for (let i = 0; i < facilityInfosByType.length; i++) { for (let i = 0; i < facilityInfosByType.length; i++) {
if ((currentMoudle == null || currentMoudle == JYZInfoMoudleType.JYJ) && facilityInfosByType[i].type == FacilityType.JY_JYJ || if ((currentMoudle == null || currentMoudle == JYZInfoMoudleType.JYJ) && facilityInfosByType[i].type == FacilityType.JY_JYJ ||
(currentMoudle == null || currentMoudle == JYZInfoMoudleType.YG) && facilityInfosByType[i].type == FacilityType.JY_YG) { (currentMoudle == null || currentMoudle == JYZInfoMoudleType.YG) && facilityInfosByType[i].type == FacilityType.JY_YG) {
@ -519,28 +516,18 @@ export class FacilityInfoInSceneWindow extends UIBase {
for (let j = 0; j < childMesh.length; j++) { for (let j = 0; j < childMesh.length; j++) {
if (pickInfo.pickedMesh == childMesh[j]) { if (pickInfo.pickedMesh == childMesh[j]) {
result = allJYJInfo[i]; result = allJYJInfo[i];
console.log("通过点击,找到加油机了");
break; break;
} }
} }
} }
if (result != null) { if (result != null) {
//this.playJYJSelectEffect(true, result);
if ((result.modelData as ModelData_facility).facilityType == FacilityType.JY_JYJ && currentMoudle == null) { if ((result.modelData as ModelData_facility).facilityType == FacilityType.JY_JYJ && currentMoudle == null) {
PlanComponent.instance.toggleHeaderFence(1);//在空状态下,点击加油机,跳转到加油机页签 PlanComponent.instance.toggleHeaderFence(1);//在空状态下,点击加油机,跳转到加油机页签
} }
let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(result); let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(result);
console.log("场景中选中设备", facilityItem); //通知前端
this.selectFacilityItem(facilityItem); this.selectFacilityItem(facilityItem);
// facilityItem.onSelect(true);
//FacilityInfoInSceneWindow.instance.selectFacilityItemToThree([facilityItem], true);
//console.log(facilityItem.getHeadUIPos());
} }
} }

1
src/app/babylon/view/mark-window/mark-window.ts

@ -189,6 +189,7 @@ export class MarkWindow extends UIBase {
* *
*/ */
static openWindow(): MarkWindow { static openWindow(): MarkWindow {
console.log("进入沙盘");
if (MarkWindow.instance == null) { if (MarkWindow.instance == null) {
SceneManager.s_markWindow = UIManager.open(MarkWindow); SceneManager.s_markWindow = UIManager.open(MarkWindow);
} }

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

@ -10,11 +10,12 @@ import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manag
import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data'; import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data';
import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window'; import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
import { ModeManager, ModeType } from 'src/app/babylon/controller/mode-manager';
@Component({ @Component({
selector: 'app-left-domain', selector: 'app-left-domain',
templateUrl: './left-domain.component.html', templateUrl: './left-domain.component.html',
styleUrls: ['./left-domain.component.scss','../plan/publicPop.scss'] styleUrls: ['./left-domain.component.scss', '../plan/publicPop.scss']
}) })
export class LeftDomainComponent implements OnInit { export class LeftDomainComponent implements OnInit {
@ -49,24 +50,24 @@ export class LeftDomainComponent implements OnInit {
//处理 设备data //处理 设备data
handleFacility() { handleFacility() {
if (this.beforeFence === 7) { //应急预案 if (this.beforeFence === 7) { //应急预案
MarkWindow.instance? this.allMarkPlanData= MarkWindow.instance.allMarkPlanData : null MarkWindow.instance ? this.allMarkPlanData = MarkWindow.instance.allMarkPlanData : null
EventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData)=>{ EventManager.addListener(Event_GetAllMarkPlanData, (data: Event_GetAllMarkPlanData) => {
this.allMarkPlanData = data.data this.allMarkPlanData = data.data
}) })
return return
} }
let list: FacilityInfoUIItem[] = [] let list: FacilityInfoUIItem[] = []
FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item=>{ FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item => {
if (this.beforeFence === 1) { //加油机 if (this.beforeFence === 1) { //加油机
item.getType() === "JY_JYJ"? list.push(item) : null item.getType() === "JY_JYJ" ? list.push(item) : null
} else if (this.beforeFence === 2) { //油罐设备 } else if (this.beforeFence === 2) { //油罐设备
item.getType() === "JY_YG"? list.push(item) : null item.getType() === "JY_YG" ? list.push(item) : null
} else if (this.beforeFence === 3) { //消防设施 } else if (this.beforeFence === 3) { //消防设施
(item.getType()).slice(0,3) === "XF_"? list.push(item) : null (item.getType()).slice(0, 3) === "XF_" ? list.push(item) : null
} else if (this.beforeFence === 5) { //输油管线 } else if (this.beforeFence === 5) { //输油管线
item.getType() === "JY_SYGX"? list.push(item) : null item.getType() === "JY_SYGX" ? list.push(item) : null
}else if (this.beforeFence === 6) { //油气回收 } else if (this.beforeFence === 6) { //油气回收
item.getType() === "JY_YQHSGX"? list.push(item) : null item.getType() === "JY_YQHSGX" ? list.push(item) : null
} }
}) })
this.FacilityList = list this.FacilityList = list
@ -93,8 +94,8 @@ export class LeftDomainComponent implements OnInit {
//处理 treeData //处理 treeData
handleTreeData(list: FacilityInfoUIItem[]) { handleTreeData(list: FacilityInfoUIItem[]) {
this.treeData = [] this.treeData = []
list.forEach(item=>{ list.forEach(item => {
let isFind = this.treeData.find(element=>{ return (item.getType()).includes(element.key) }) let isFind = this.treeData.find(element => { return (item.getType()).includes(element.key) })
if (!isFind) { //不存在 if (!isFind) { //不存在
if (item.getType().includes('XF_MHQ')) { //灭火器 if (item.getType().includes('XF_MHQ')) { //灭火器
let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, expanded: true, children: [], } let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, expanded: true, children: [], }
@ -106,7 +107,7 @@ export class LeftDomainComponent implements OnInit {
this.treeData.push(primaryNode) this.treeData.push(primaryNode)
} }
} else { //存在 } else { //存在
if (item.getType().includes('XF_MHQ') && !isFind.children.find(elements=>{ return elements.key === item.getType() })) { //灭火器 if (item.getType().includes('XF_MHQ') && !isFind.children.find(elements => { return elements.key === item.getType() })) { //灭火器
let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, }
isFind.children.push(treeNode) isFind.children.push(treeNode)
} }
@ -120,8 +121,8 @@ export class LeftDomainComponent implements OnInit {
this.treeData.push(primaryNode) this.treeData.push(primaryNode)
} }
for (let facility in FacilityType) { for (let facility in FacilityType) {
if (facility.slice(0,3) === "XF_" && !facility.includes('XF_MHQ')) { if (facility.slice(0, 3) === "XF_" && !facility.includes('XF_MHQ')) {
let isFind = this.treeData.find(item=>{ return item.key === facility }) let isFind = this.treeData.find(item => { return item.key === facility })
if (!isFind) { if (!isFind) {
let primaryNode = { title: ConfigManager.getFacilityTypeName(FacilityType[facility]), key: facility, selectable: false, } let primaryNode = { title: ConfigManager.getFacilityTypeName(FacilityType[facility]), key: facility, selectable: false, }
this.treeData.push(primaryNode) this.treeData.push(primaryNode)
@ -135,8 +136,8 @@ export class LeftDomainComponent implements OnInit {
//获取设备 数量 //获取设备 数量
getFacilityNum(type: string): number { getFacilityNum(type: string): number {
let num = 0 let num = 0
this.FacilityList.forEach(item=>{ this.FacilityList.forEach(item => {
item.getType().includes(type)? num = num + 1 : null item.getType().includes(type) ? num = num + 1 : null
}) })
return num return num
} }
@ -149,11 +150,11 @@ export class LeftDomainComponent implements OnInit {
FacilityInfoInSceneWindow.instance.showFacilityByType(null, false) FacilityInfoInSceneWindow.instance.showFacilityByType(null, false)
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected) FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected)
} else { //显示所有 } else { //显示所有
this.treeData.forEach(item=>{ this.treeData.forEach(item => {
if (item.key != 'XF_MHQ') { if (item.key != 'XF_MHQ') {
FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[item.key], true) FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[item.key], true)
} else { } else {
item.children.forEach(element=>{ FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[element.key], true) }) item.children.forEach(element => { FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[element.key], true) })
} }
}) })
} }
@ -172,7 +173,7 @@ export class LeftDomainComponent implements OnInit {
MarkWindow.instance.createMarkPlaneData(e.name) MarkWindow.instance.createMarkPlaneData(e.name)
this.addDisposalPop = false this.addDisposalPop = false
} else { //创建节点 } else { //创建节点
MarkWindow.instance.createMarkNodeData(this.addNodePop,e.name) MarkWindow.instance.createMarkNodeData(this.addNodePop, e.name)
this.addNodePop = null this.addNodePop = null
} }
} }
@ -195,21 +196,28 @@ export class LeftDomainComponent implements OnInit {
if (!MarkWindow.instance.currentMarkNodeInfo) { //未选中节点 if (!MarkWindow.instance.currentMarkNodeInfo) { //未选中节点
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)
} else { //已选中节点 } else { //已选中节点
let isTrue = confirm('切换节点后,没保存的信息将会丢失!') let isTrue = true;
if (ModeManager.currentMode == ModeType.Edit) {
isTrue = confirm('切换节点后,没保存的信息将会丢失!')
}
if (isTrue) { if (isTrue) {
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)
} }
} }
} else if (this.selectPlanId === item.id && this.selectNodeId === e.id) { //取消选中 } else if (this.selectPlanId === item.id && this.selectNodeId === e.id) { //取消选中
let isTrue = confirm('切换节点后,没保存的信息将会丢失!') let isTrue = true;
if (ModeManager.currentMode == ModeType.Edit) {
isTrue = confirm('切换节点后,没保存的信息将会丢失!')
}
if (isTrue) { if (isTrue) {
this.selectPlanId = null this.selectPlanId = null
this.selectNodeId = null this.selectNodeId = null
MarkWindow.instance.selectMarkNode(null,null) MarkWindow.instance.selectMarkNode(null, null)
} }
} }
} }
@ -228,10 +236,10 @@ export class LeftDomainComponent implements OnInit {
this.saveDisposalDialog = true this.saveDisposalDialog = true
} else { } else {
if (this.selectPlanId === markPlanId && this.selectNodeId === nodeId) { if (this.selectPlanId === markPlanId && this.selectNodeId === nodeId) {
MarkWindow.instance.saveToOldNode(markPlanId,nodeId) MarkWindow.instance.saveToOldNode(markPlanId, nodeId)
} else { } else {
let isTrue = confirm('是否覆盖要保存的节点?') let isTrue = confirm('是否覆盖要保存的节点?')
isTrue? MarkWindow.instance.saveToOldNode(markPlanId,nodeId) : null isTrue ? MarkWindow.instance.saveToOldNode(markPlanId, nodeId) : null
} }
} }
} }
@ -246,7 +254,7 @@ export class LeftDomainComponent implements OnInit {
this.saveType = 2 this.saveType = 2
this.allNodeList = [] this.allNodeList = []
MarkWindow.instance.allMarkPlanData.datas.forEach(item => { MarkWindow.instance.allMarkPlanData.datas.forEach(item => {
item.nodes.forEach(element=>{ item.nodes.forEach(element => {
let node = { let node = {
id: element.id, id: element.id,
parrentId: item.id, parrentId: item.id,
@ -265,14 +273,14 @@ export class LeftDomainComponent implements OnInit {
this.message.info('请完善表单') this.message.info('请完善表单')
return return
} }
MarkWindow.instance.createNewNodeAndSave(e.root.id,e.name) MarkWindow.instance.createNewNodeAndSave(e.root.id, e.name)
this.saveType = null this.saveType = null
} else { //保存到已有节点 } else { //保存到已有节点
if (!e.node) { if (!e.node) {
this.message.info('请完善表单') this.message.info('请完善表单')
return return
} }
MarkWindow.instance.saveToOldNode(e.node.parrentId,e.node.id) MarkWindow.instance.saveToOldNode(e.node.parrentId, e.node.id)
this.saveType = null this.saveType = null
} }
} }

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

@ -77,9 +77,9 @@ export class PlanComponent implements OnInit {
this.beforeOneSatus = StatusManager.getStatus<LoginSatus>(LoginSatus); this.beforeOneSatus = StatusManager.getStatus<LoginSatus>(LoginSatus);
this.beforeOneSatus.onSelectInsSuccess(find) this.beforeOneSatus.onSelectInsSuccess(find)
} else { //如果没有找到对应的单位key,则调用新建单位 } else { //如果没有找到对应的单位key,则调用新建单位
let isAdd = confirm('没有单位name,是否进行初始化?') let isAdd = confirm('没有单位' + key + ',是否进行初始化?')
if (isAdd) { if (isAdd) {
let name = 'ceshi'; let name = key;
loginStatus.createInsitution(key, name); loginStatus.createInsitution(key, name);
} }
} }
@ -375,14 +375,21 @@ export class PlanComponent implements OnInit {
this.message.info(title); this.message.info(title);
} }
/**
*
* @param show
*/
showLoading(show: boolean) {
this.isShowLoading = show;
}
} }
// 处置预案 所有图标 // 处置预案 所有图标
export class planIcons { export class planIcons {
iconsName: string[] = ["灾情","内部力量","外部力量","其他"] iconsName: string[] = ["灾情", "内部力量", "外部力量", "其他"]
icons: MarkData[][] = [AllMarkData.CreateAllMarkData().marks_Disaster,AllMarkData.CreateAllMarkData().marks_Inside,AllMarkData.CreateAllMarkData().marks_Outside,AllMarkData.CreateAllMarkData().marks_Other,] icons: MarkData[][] = [AllMarkData.CreateAllMarkData().marks_Disaster, AllMarkData.CreateAllMarkData().marks_Inside, AllMarkData.CreateAllMarkData().marks_Outside, AllMarkData.CreateAllMarkData().marks_Other,]
} }
//创建/编辑 建筑dataType //创建/编辑 建筑dataType
export class modelBuilding { export class modelBuilding {

13
src/app/service/babylon/building-basic-infos.service.ts

@ -35,8 +35,8 @@ export class BuildingBasicInfosService {
* @param name * @param name
* @param data * @param data
*/ */
postBuildingBasicInfos(name: string, data: object): Observable<any> { postBuildingBasicInfos(name: string, gasstationId: number, data: object): Observable<any> {
return this.postInfos(this.api_buildingInfo, name, data); return this.postInfos(this.api_buildingInfo, data, { name: name, gasstationId: gasstationId });
} }
/** /**
@ -53,7 +53,7 @@ export class BuildingBasicInfosService {
* @param data * @param data
*/ */
postMarkData(name: string, data: object): Observable<any> { postMarkData(name: string, data: object): Observable<any> {
return this.postInfos(this.api_sandBox, name, data); return this.postInfos(this.api_sandBox, data, { name: name });
} }
@ -92,14 +92,11 @@ export class BuildingBasicInfosService {
* @param name * @param name
* @param data * @param data
*/ */
postInfos(api: string, name: string, data: object) { postInfos(api: string, body: object, params = {}) {
let params = {
name: name,
};
let headers = this.headers; let headers = this.headers;
return this.http.post<any>(api + this.c_post, `'${JSON.stringify(data)}'`, { headers, params }) return this.http.post<any>(api + this.c_post, `'${JSON.stringify(body)}'`, { headers, params })
.pipe( .pipe(
catchError((err) => this.handleError(err)) catchError((err) => this.handleError(err))
); );

Loading…
Cancel
Save