Browse Source

[新增] 同步数据筛选

develop
徐振升 4 years ago
parent
commit
c04265bf3c
  1. 318
      src/app/canvas-share-data.service.ts

318
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<string, string>([
[ '消防水池', '消防水池'],
[ '疏散楼梯', '疏散楼梯'],
[ '消防电梯', '消防电梯'],
[ '避难区域', '避难区域'],
[ '安全出口', '安全出口'],
[ '地上消火栓', '室外消火栓' ],
[ '地下消火栓', '室外消火栓' ],
[ '室内消火栓', '室内消火栓' ],
[ '供水管网', '供水管网'],
[ '湿式自动喷淋系统', '湿式自动喷淋系统'],
[ '水幕系统', '水幕系统' ],
[ '消防泵房', '消防泵房'],
[ '水泵接合器(地上)', '水泵接合器'],
[ '水泵接合器(地下)', '水泵接合器'],
[ '水泵接合器(墙壁)', '水泵接合器'],
[ '消防水泵房', '消防水泵房'],
[ '箱式消火栓', '箱式消火栓'],
[ '固定水炮', '消防水炮' ],
[ '消防水罐', '储水罐'],
[ '消防水罐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
}

Loading…
Cancel
Save