邵佳豪 4 years ago
parent
commit
9ca403272b
  1. 1
      src/app/http-interceptors/base-interceptor.ts
  2. 6
      src/app/http-interceptors/cache-token.service.ts
  3. 2
      src/app/navigation/navigation.component.html
  4. 23
      src/app/navigation/navigation.component.scss
  5. 2
      src/app/ui/plan-assistance/plan-assistance.component.html
  6. 1367
      src/app/ui/plan-assistance/plan-assistance.component.ts
  7. 17
      src/app/ui/plan/collection-tools.component.ts
  8. 123
      src/app/working-area/working-area.component.ts
  9. BIN
      src/assets/images/enterPaintButton.jpg
  10. BIN
      src/assets/images/enterPaintButton.png
  11. BIN
      src/assets/images/固定水泡.png
  12. BIN
      src/assets/images/地上消火栓.png
  13. BIN
      src/assets/images/泡沫栓.png

1
src/app/http-interceptors/base-interceptor.ts

@ -47,6 +47,7 @@ export class BaseInterceptor implements HttpInterceptor {
this.token.delete()
sessionStorage.clear()
window.localStorage.clear()
this.router.navigate(['ui/plan'])
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000

6
src/app/http-interceptors/cache-token.service.ts

@ -15,9 +15,9 @@ export class CacheTokenService {
login () {
return new Promise ((resolve,reject)=>{
sessionStorage.setItem("buildingTypeId",'5e7c9027a3050b1a840ed4b8'); //建筑类型
sessionStorage.setItem("planId",'5f52fd529e91f4410005eac5'); //预案ID
sessionStorage.setItem("companyId",'5e9964caa760a059e84512e9'); //单位ID
sessionStorage.setItem("buildingTypeId",'5e7c9078a3050b1a840ed4ba'); //建筑类型
sessionStorage.setItem("planId",''); //预案ID
sessionStorage.setItem("companyId",'5f67042b9e91f4410005f55c'); //单位ID
this.http.post('/api/Account/SignIn',this.loginData).subscribe((data:any)=>{
sessionStorage.setItem("level",data.level);
sessionStorage.setItem("token",data.token);

2
src/app/navigation/navigation.component.html

@ -1,7 +1,7 @@
<div id="content">
<header>
<div class="title">着火单位: 高科技创业园</div>
<div class="title">着火单位: 贵港油库</div>
<div class="router">
<div class="routerText" *ngFor="let item of routers" routerLink= {{item.url}} routerLinkActive="routerLinkActive">{{item.name}}</div>
</div>

23
src/app/navigation/navigation.component.scss

@ -5,7 +5,7 @@
-moz-background-size:100% 100%;
background-size:100% 100%;
box-sizing: border-box;
padding: 5px 25px;
padding: 10px 38px 28px;
overflow: hidden;
display: flex;
flex-direction: column;
@ -15,21 +15,22 @@
header {
width: 100%;
height: 80px;
border: 1px solid #30bbec;
border-top: none;;
border-bottom: 1px solid #30bbec;
overflow: hidden;
.title {
width: 100%;
height: 25px;
line-height: 25px;
text-align: center;
font-size: 18px;
font-size: 20px;
font-weight: 550;
color: red;
}
.router{
width: 100%;
height: 55px;
outline: none;
}
}
//路由DIV
.routerText {
display: inline-block;
margin: 7px 15px;
@ -42,16 +43,14 @@ header {
border-bottom-right-radius: 15px;
cursor:pointer;
outline: none;
border: 2px solid #999;
color: #999;
}
}
border: 2px solid #fff;
color: #fff;
}
//路由选中样式
.routerLinkActive {
background-color: rgba(240,136,14,0.3);
outline: none;
border: 2px solid rgb(248, 161, 62);
background-color: rgba(240,136,14,0.65);
}
//中间区域

2
src/app/ui/plan-assistance/plan-assistance.component.html

@ -1 +1 @@
<p>plan-assistance works!</p>
<app-working-area #workingArea></app-working-area>

1367
src/app/ui/plan-assistance/plan-assistance.component.ts

File diff suppressed because it is too large Load Diff

17
src/app/ui/plan/collection-tools.component.ts

@ -639,24 +639,21 @@ export class planComponent implements OnInit {
//计算 可视区域内宽度, 是否缩放背景图
backGroundScale () {
let that = this
let dad = document.querySelector('.functionalDomainContent').clientWidth
let dadHeight = document.querySelector('.functionalDomainContent').clientHeight
let left = document.querySelector('.functionalDomainLeft').clientWidth
let right = document.querySelector('.functionalDomainRight').clientWidth
let imgWidth = dad - left - right//可视区域内 宽度
let dadWidth = document.querySelector('.canvas').clientWidth
let dadHeight = document.querySelector('.canvas').clientHeight
let img = new Image()
img.src = this.selectingSitePlan.imageUrl;
img.onload = function(){
if (img.height > dadHeight && img.width > imgWidth) {
let width = imgWidth/img.width
if (img.height > dadHeight && img.width > dadWidth) {
let width = dadWidth/img.width
let height = dadHeight/img.height
that.canvas.setBackgroundScale((width>height? height : width)-0.005)
return
} else if (img.height > dadHeight) {
that.canvas.setBackgroundScale((dadHeight/img.height)-0.005)
return
} else if (img.width > imgWidth) {
that.canvas.setBackgroundScale((imgWidth/img.width)-0.005)
} else if (img.width > dadWidth) {
that.canvas.setBackgroundScale((dadWidth/img.width)-0.005)
return
}
};
@ -695,7 +692,7 @@ export class planComponent implements OnInit {
//陈鹏飞↓↓↓
//陈鹏飞↓↓↓
//陈鹏飞↓↓↓
params = {companyId: "5eaa261766f97891845a6caa"}
params = {companyId: sessionStorage.getItem('companyId')}
allFireElements:any = []; //当前 单位/建筑 下的消防要素
isShowAttribute:boolean = true; //属性栏 是否显示 默认数据

123
src/app/working-area/working-area.component.ts

@ -4,7 +4,7 @@ import { EventEmitter } from 'events';
import { EventManager } from '@angular/platform-browser';
import { OutlineFilter } from 'pixi-filters';
import { CanvasShareDataService, GameMode } from '../canvas-share-data.service';
import {CacheTokenService} from '../http-interceptors/cache-token.service' //引入自动登录 获取token服务
import {CacheTokenService} from '../http-interceptors/cache-token.service'; // 引入自动登录 获取token服务
import * as ObjectID from 'bson-objectid';
import { Router } from '@angular/router';
@ -90,7 +90,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/**
*
*/
private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.jpg');
private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.png');
/**
*
*/
@ -111,20 +111,20 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
// 根据ID 找到数据
// 是否登录
public verificationURL = '/ui/plan' //验证url地址是否为验证页面
public verificationURL = '/ui/plan'; // 验证url地址是否为验证页面
isLogin() {
let token = sessionStorage.getItem('token') // 判断 是否登录状态
const token = sessionStorage.getItem('token'); // 判断 是否登录状态
if (token) {
this.init.getAllLibrary()
this.init.getAllBuildings()
this.init.getAllFirePlan()
// this.init.getAllLibrary() //获取素材库
this.init.getAllBuildings() //获取所有建筑
this.init.getAllFirePlan() //获取所有灾情
this.init.getSitePlan() //调用父组件 初始化方法
} else {
this.token.login().then(res=>{
this.init.params.companyId = sessionStorage.getItem('companyId')
this.init.getAllLibrary()
this.init.getAllBuildings()
this.init.getAllFirePlan()
// this.init.getAllLibrary() //获取素材库
this.init.getAllBuildings() //获取所有建筑
this.init.getAllFirePlan() //获取所有灾情
this.init.getSitePlan() //调用父组件 初始化方法
})
}
@ -168,14 +168,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.eventManager.addGlobalEventListener('window', 'keypress', (event: any) => {
});
setTimeout(() => {
this.createCanvas();
this.loadDemoScene();
}, 0);
// setTimeout(() => {
// this.createCanvas();
// }, 0);
}
ngAfterViewInit(): void {
this.createCanvas();
}
/**
*
@ -230,8 +229,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
backgroundColor: 0xE9FAFF
});
this.content.nativeElement.appendChild(this.app.view);
let url = this.router.url
url == this.verificationURL? this.isLogin() : null
const url = this.router.url;
// tslint:disable-next-line: no-unused-expression
url === this.verificationURL ? this.isLogin() : null;
this.createBackgroundImage();
// this.createPreviewSinglePointIcon();
@ -257,6 +257,22 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
obj.filters = [];
}
});
this.on('backgroundScale', scale => {
this.backgroundImage.children.forEach(item => {
if (item instanceof SinglePointIcon) {
if (item.assetData.FixedSize) {
const data = 1 / scale;
item.scale.set(data);
}
} else if (item instanceof MultipointIcon) {
const data = 1 / scale;
item.text.scale.set(scale);
} else if (item instanceof PolygonIcon) {
const data = 1 / scale;
item.text.scale.set(scale);
}
});
});
this.app.ticker.add((delta) => {
this.mousePosition = this.app.renderer.plugins.interaction.mouse.global;
@ -381,37 +397,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/**
*
*/
public loadDemoScene() {
public loadDemoScene(list: any[]) {
this.backgroundImage.texture = PIXI.Texture.from('./assets/images/demo.jpg');
setTimeout(() => {
const assetData = {
TemplateId: null,
FloorId: null,
Angle: 0,
Color: 0,
Enabled: true,
FillMode: 0,
FireElementId: 0,
FixedSize: true,
Height: 32,
Width: 32,
Id: ObjectID.default.generate(),
ImageUrl: './assets/images/泡沫消防车.png',
InteractiveMode: 0,
MultiPoint: null,
Point: new PIXI.Point(5295 - (this.backgroundImage.texture.width / 2), 4067 - (this.backgroundImage.texture.height / 2)),
Name: '',
PropertyInfos: null,
Border: null,
DrawMode: null,
Thickness: 0,
IsFromBuilding: false,
GameMode: 0
};
const single = new SinglePointIcon(assetData, this);
}, 100);
// this.backgroundImage.anchor.set(0);
list.forEach(element => {
const single = new SinglePointIcon(element, this);
});
this.setNameVisible(false, GameMode.BasicInformation);
this.allowEdit = false;
}
/**
*
@ -993,6 +985,7 @@ export class SinglePointIcon extends PIXI.Container {
this.image.interactive = true;
this.image
.on('mousedown', event => {
console.log(this.assetData.Name);
event.stopPropagation();
this.workingArea.selection.selectOne(this);
if (this.workingArea.allowEdit) {
@ -1031,12 +1024,12 @@ export class SinglePointIcon extends PIXI.Container {
});
this.workingArea.on('backgroundScale', data => {
if (this.assetData.FixedSize) {
const scale = 1 / data;
this.scale.set(scale);
}
});
// this.workingArea.on('backgroundScale', data => {
// if (this.assetData.FixedSize) {
// const scale = 1 / data;
// this.scale.set(scale);
// }
// });
this.text.x = this.image.x;
this.text.y = this.image.y - this.image.height / 2;
@ -1087,7 +1080,7 @@ export class MultipointIcon extends PIXI.Container {
wordWrapWidth: 100,
});
private text = new PIXI.Text(this.assetData.Name
public text = new PIXI.Text(this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style);
/**
@ -1230,11 +1223,11 @@ export class MultipointIcon extends PIXI.Container {
});
});
// 缩放
this.workingArea.on('backgroundScale', data => {
const scale = 1 / data;
this.text.scale.set(scale);
});
// // 缩放
// this.workingArea.on('backgroundScale', data => {
// const scale = 1 / data;
// this.text.scale.set(scale);
// });
// 添加选中事件
this.iconsTilingSprite.forEach((item, index, array) => {
item.interactive = true;
@ -1327,7 +1320,7 @@ export class PolygonIcon extends PIXI.Container {
wordWrapWidth: 100,
});
private text = new PIXI.Text(this.assetData.Name
public text = new PIXI.Text(this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style);
/**
@ -1468,11 +1461,11 @@ export class PolygonIcon extends PIXI.Container {
.on('rightclick', event => {
// this.workingArea.selection.deselectAll();
});
// 缩放
this.workingArea.on('backgroundScale', data => {
const scale = 1 / data;
this.text.scale.set(scale);
});
// // 缩放
// this.workingArea.on('backgroundScale', data => {
// const scale = 1 / data;
// this.text.scale.set(scale);
// });
}
/**
*

BIN
src/assets/images/enterPaintButton.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

BIN
src/assets/images/enterPaintButton.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
src/assets/images/固定水泡.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/assets/images/地上消火栓.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
src/assets/images/泡沫栓.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Loading…
Cancel
Save