From c04265bf3ccdde1d18173d2c94a58766148931f8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Fri, 28 Aug 2020 16:06:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 318 ++++++++++++++++++++++++++- 1 file changed, 312 insertions(+), 6 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 3d83db6..f93b7fb 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -7,14 +7,320 @@ export class CanvasShareDataService { constructor() { } - isChange:boolean = false; //数据 是否改动 - - selectStorey:any = {area: '', details: ''}; //选择当前 楼层 数据 - selectTemplateData:any; //选择当前 模板数据 + isChange = false; // 数据 是否改动 - originalcompanyBuildingData:any; // 单位/建筑 数据 - originaleveryStoreyData:any; // 总平面图/楼层/区域 楼层数据 + selectStorey: any = {area: '', details: ''}; // 选择当前 楼层 数据 + selectTemplateData: any; // 选择当前 模板数据 + originalcompanyBuildingData: any; // 单位/建筑 数据 + originaleveryStoreyData: any; // 总平面图/楼层/区域 楼层数据 + facilityAssetsName = new Map([ + [ '消防水池', '消防水池'], + [ '疏散楼梯', '疏散楼梯'], + [ '消防电梯', '消防电梯'], + [ '避难区域', '避难区域'], + [ '安全出口', '安全出口'], + [ '地上消火栓', '室外消火栓' ], + [ '地下消火栓', '室外消火栓' ], + [ '室内消火栓', '室内消火栓' ], + [ '供水管网', '供水管网'], + [ '湿式自动喷淋系统', '湿式自动喷淋系统'], + [ '水幕系统', '水幕系统' ], + [ '消防泵房', '消防泵房'], + [ '水泵接合器(地上)', '水泵接合器'], + [ '水泵接合器(地下)', '水泵接合器'], + [ '水泵接合器(墙壁)', '水泵接合器'], + [ '消防水泵房', '消防水泵房'], + [ '箱式消火栓', '箱式消火栓'], + [ '固定水炮', '消防水炮' ], + [ '消防水罐', '储水罐'], + [ '消防水罐2', '储水罐'], + [ '卧式水罐', '储水罐'], + [ '消防泵', '水泵' ], + [ '泡沫泵', '水泵' ], + [ '泡沫泵房', '泡沫站'], + [ '泡沫栓', '泡沫栓' ], + [ '泡沫枪', '泡沫枪'], + [ '泡沫发生器', '泡沫发生器' ], + [ '消防管网', '消防管网'], + [ 'DCS控制室', 'DCS控制室'] + ]); + /** + * 获取单位毗邻信息 + */ + public getCompanyAdjoinInfo(): CompanyAdjoinInfo[] { + const list: CompanyAdjoinInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (item.Name === '毗邻') { + const adjoin = new CompanyAdjoinInfo(); + adjoin.AssetId = item.Id; + adjoin.CompanyId = sessionStorage.getItem('companyId'); + item.PropertyInfos.forEach(element => { + if (element.PropertyName === '方向') { + adjoin.Direction = element.PropertyValue; + } else if (element.PropertyName === '名称/编号') { + adjoin.Name = element.PropertyValue; + } else if (element.PropertyType === PropertyType.Image) { + adjoin.ImageUrls.push(element.PropertyValue); + } + }); + list.push(adjoin); + } + }); + return list; + } + /** + * 获取建筑毗邻信息 + */ + public getBuildingAdjoinInfo(): BuildingAdjoinInfo[] { + const list: BuildingAdjoinInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (item.Name === '毗邻') { + const adjoin = new BuildingAdjoinInfo(); + adjoin.AssetId = item.Id; + adjoin.BuildingId = this.selectStorey.buildingId; + item.PropertyInfos.forEach(element => { + if (element.PropertyName === '方向') { + adjoin.Direction = element.PropertyValue; + } else if (element.PropertyName === '名称/编号') { + adjoin.Name = element.PropertyValue; + } else if (element.PropertyType === PropertyType.Image) { + adjoin.ImageUrls.push(element.PropertyValue); + } + }); + list.push(adjoin); + } + }); + return list; + } + /** + * 获取单位重点部位 + */ + public getCompanyImportantLocations(): CompanyImportantLocationInfo[] { + const list: CompanyImportantLocationInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (item.Name === '重点部位') { + const important = new CompanyImportantLocationInfo(); + important.Id = item.Id; + important.CompanyId = sessionStorage.getItem('companyId'); + item.PropertyInfos.forEach(element => { + if (element.PropertyName === '名称/编号') { + important.Name = element.PropertyValue; + } else if (element.PropertyType === PropertyType.Image) { + important.ImageUrls.push(element.PropertyValue); + } else if (element.PropertyName === '主要危险性') { + important.Hazards = element.PropertyValue; + } else if (element.PropertyName === '使用性质') { + important.Nature = element.PropertyValue; + } else if (element.PropertyName === '所在位置') { + important.Position = element.PropertyValue; + } else if (element.PropertyName === '建筑结构') { + important.Structure = element.PropertyValue; + } + }); + list.push(important); + } + }); + return list; + } + /** + * 获取建筑重点部位 + */ + public getBuildingImportantLocations(): BuildingImportantLocationInfo[] { + const list: BuildingImportantLocationInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (item.Name === '重点部位') { + const important = new BuildingImportantLocationInfo(); + important.Id = item.Id; + important.BuildingId = this.selectStorey.buildingId; + item.PropertyInfos.forEach(element => { + if (element.PropertyName === '名称/编号') { + important.Name = element.PropertyValue; + } else if (element.PropertyType === PropertyType.Image) { + important.ImageUrls.push(element.PropertyValue); + } else if (element.PropertyName === '主要危险性') { + important.Hazards = element.PropertyValue; + } else if (element.PropertyName === '使用性质') { + important.Nature = element.PropertyValue; + } else if (element.PropertyName === '所在位置') { + important.Position = element.PropertyValue; + } else if (element.PropertyName === '建筑结构') { + important.Structure = element.PropertyValue; + } + }); + list.push(important); + } + }); + return list; + } + /** + * 获取单位消防设施 + */ + public getAllCompanyFacilityAssetInfo(): CompanyFacilityAssetInfo[] { + const list: CompanyFacilityAssetInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (this.facilityAssetsName.has(item.Name)) { + const facility = new CompanyFacilityAssetInfo(); + facility.CompanyId = sessionStorage.getItem('companyId'); + facility.AssetId = item.Id; + facility.Id = ''; + facility.Name = this.facilityAssetsName[item.Name]; + facility.AssetName = item.Name; + facility.PropertyInfos = item.PropertyInfos; + facility.SitePlanId = item.FloorId; + list.push(facility); + } + }); + return list; + } + /** + * 获取建筑消防设施 + */ + public getAllBuildingFacilityAssetInfo(): BuildingFacilityAssetInfo[] { + const list: BuildingFacilityAssetInfo[] = []; + Object.keys(this.originalcompanyBuildingData.data).forEach((key) => { + const item = this.originalcompanyBuildingData.data[key]; + if (this.facilityAssetsName.has(item.Name)) { + const facility = new BuildingFacilityAssetInfo(); + facility.BuildingId = this.selectStorey.buildingId; + facility.AssetId = item.Id; + facility.Id = ''; + facility.Name = this.facilityAssetsName[item.Name]; + facility.AssetName = item.Name; + facility.PropertyInfos = item.PropertyInfos; + facility.BuildingAreaId = item.FloorId; + list.push(facility); + } + }); + return list; + } +} +/** + * 单位毗邻 + */ +export class CompanyAdjoinInfo { + public CompanyId: string; + public Id: string; + public Name: string; + public Direction: number; + public ImageUrls: string[] = []; + public AssetId: string; +} +/** + * 建筑毗邻 + */ +export class BuildingAdjoinInfo { + public BuildingId: string; + public Id: string; + public Name: string; + public Direction: number; + public ImageUrls: string[]; + public AssetId: string; +} +/** + * 建筑重点部位 + */ +export class BuildingImportantLocationInfo { + public BuildingId: string; + public Id: string; + public Name: string; + public Position: string; + public Structure: string; + public Nature: string; + public Hazards: string; + public ImageUrls: string[]; +} +/** + * 单位重点部位 + */ +export class CompanyImportantLocationInfo { + public CompanyId: string; + public Id: string; + public Name: string; + public Position: string; + public Structure: string; + public Nature: string; + public Hazards: string; + public ImageUrls: string[]; +} +/** + * 单位消防素材信息 + */ +export class CompanyFacilityAssetInfo { + public Id: string; + public Name: string; + public AssetName: string; + public PropertyInfos: string; + public AssetId: string; + public CompanyId: string; + public SitePlanId: string; +} +/** + * 建筑消防素材信息 + */ +export class BuildingFacilityAssetInfo { + public Id: string; + public Name: string; + public AssetName: string; + public PropertyInfos: string; + public AssetId: string; + public BuildingId: string; + public BuildingAreaId: string; +} +/** + * 属性 + */ +export class PropertyInfo { + // 标记位 + public Tag: string; + // 属性书序 + public Order: number; + // 是否启用 + public Enabled: boolean; + // 是否可见 + public Visible: boolean; + // 必填 + public Required: boolean; + // 验证规则名称 + public RuleName: string; + // 验证规则值 + public RuleValue: string; + // 物理单位 + public PhysicalUnit: string; + // 属性名称 + public PropertyName: string; + // 属性类型 + public PropertyType: PropertyType; + // 属性值 + public PropertyValue: string; +} +/** + * 属性类型。 + */ +export enum PropertyType { + // 单行文本。 + SingleText, + // 多行文本。 + MultipleText, + // 数值。 + Numeric, + // 图片。 + Image, + // 图片数值,专用于描述图片数量。 + ImageNumeric, + // 方向 + Direction, + // 布尔类型。 + Boolean, + // 供给区域 + SupplyArea, + // 供给类型 + SupplyType }