Browse Source

[完善] 平面图 完成

develop
陈鹏飞 4 years ago
parent
commit
9e0fd88801
  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. 45
      src/app/navigation/navigation.component.scss
  5. 17
      src/app/ui/plan/collection-tools.component.ts
  6. 12
      src/app/working-area/working-area.component.ts

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>

45
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,43 +15,42 @@
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;
.routerText {
display: inline-block;
margin: 7px 15px;
width: 150px;
height: 37px;
line-height: 37px;
font-size: 20px;
text-align: center;
border-top-left-radius: 15px;
border-bottom-right-radius: 15px;
cursor:pointer;
outline: none;
border: 2px solid #999;
color: #999;
}
}
}
//路由DIV
.routerText {
display: inline-block;
margin: 7px 15px;
width: 150px;
height: 37px;
line-height: 37px;
font-size: 20px;
text-align: center;
border-top-left-radius: 15px;
border-bottom-right-radius: 15px;
cursor:pointer;
outline: none;
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);
}
//中间区域

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: "5e9964caa760a059e84512e9"}
params = {companyId: sessionStorage.getItem('companyId')}
allFireElements:any = []; //当前 单位/建筑 下的消防要素
isShowAttribute:boolean = true; //属性栏 是否显示 默认数据

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

@ -115,16 +115,16 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
isLogin () {
let 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() //调用父组件 初始化方法
})
}

Loading…
Cancel
Save