Browse Source

[新增] 检索灾情中添加的车辆类型与数量

master
徐振升 4 years ago
parent
commit
4578eee886
  1. 87
      src/app/canvas-share-data.service.ts

87
src/app/canvas-share-data.service.ts

@ -70,8 +70,47 @@ export class CanvasShareDataService {
[ '消防管网', '消防管网'],
[ 'DCS控制室', 'DCS控制室']
]);
types = new Array(
'水罐车',
'供水车',
'高低压泵水罐车',
'中低压泵水罐车',
'压缩空气泡沫车',
'高倍泡沫车',
'泡沫车',
'泡沫干粉联用车',
'登高车',
'屈臂式登高车',
'云梯车',
'高喷车',
'通信指挥车',
'排烟车',
'抢险救援车',
'器材车',
'干粉车',
'后援车',
'饮食保障车',
'供气车',
'供液车',
'水带敷设车',
'多功能侦检车',
'二氧化碳车',
'防化洗消车',
'照明车',
'运兵车',
'清障车',
'加油车',
'轻便车',
'核生化侦检车',
'化学抢险救援车',
'抗震救援车',
'自装卸式车',
'机场车',
'消防摩托车',
'消防艇',
'消防坦克',
'消防直升机',
);
public getLinkCarName(car: any): any[] {
const linkCar = [];
car.assetData.Pipelines.forEach(pipeline => {
@ -121,6 +160,50 @@ export class CanvasShareDataService {
return returnData;
}
}
public getCarTypesAndCount(): Map<string, number> {
let cars = new Map<string, number>();
this.planSelectData.forEach(element => {
if (element != null) {
let data = JSON.parse(element.data);
// console.log(data.DefinedIncrement);
// console.log(data.Increment);
// console.log(data.Stock);
Object.keys(data.DefinedIncrement).forEach(key => {
let name = data.DefinedIncrement[key].Name;
if (this.types.includes(name)) {
if (cars.get(name) === undefined) {
cars.set(name, 0);
} else {
cars.set(name, cars.get(name) + 1);
}
}
});
Object.keys(data.Increment).forEach(key => {
let name = data.Increment[key].Name;
if (this.types.includes(name)) {
if (cars.get(name) === undefined) {
cars.set(name, 0);
} else {
cars.set(name, cars.get(name) + 1);
}
}
});
Object.keys(data.Stock).forEach(key => {
let name = data.Stock[key].Name;
if (this.types.includes(name)) {
if (cars.get(name) === undefined) {
cars.set(name, 0);
} else {
cars.set(name, cars.get(name) + 1);
}
}
});
}
});
return cars;
}
/**
*
*/

Loading…
Cancel
Save