Browse Source

[完善] 对接科达页面路由参数定义完成

master
陈鹏飞 4 years ago
parent
commit
4b7f32f93b
  1. 24
      src/app/app-routing.module.ts
  2. 8
      src/app/http-interceptors/cache-token.service.ts
  3. 10
      src/app/ui/collection-tools/collection-tools.component.ts
  4. 46
      src/app/ui/plan/collection-tools.component.ts

24
src/app/app-routing.module.ts

@ -16,11 +16,9 @@ import { CollectionToolsComponent } from './ui/collection-tools/collection-tools
const routes: Routes = [
{path:'',redirectTo:'ui/plan/basicInfo',pathMatch:'full',},
{path:'',redirectTo:`/plan`,pathMatch:'full',},
{
path:'',
component:NavigationComponent,
// canActivate: [AuthGuard],//守卫验证
path:'', component:NavigationComponent, // canActivate: [AuthGuard],//守卫验证
children:[
{path:'ui',loadChildren:() => import('./ui/ui.module').then(m => m.UiModule)},
// {path:'home',loadChildren:() => import('./pages/pages.module').then(m => m.PagesModule)},
@ -28,20 +26,10 @@ const routes: Routes = [
// {path:'gis',loadChildren:() => import('./gis-management/gis-management.module').then(m => m.GISManagementModule)}
]
},
{path:'plan',
component:planComponent},
{path:'similarPlans/details',
component:CollectionToolsComponent},
{path:'planAssistance',
component:PlanAssistanceComponent},
{path:'similarPlans',
component:SimilarPlansComponent},
// {path:'getNoMToken',
// component:MTokenK1Component, canActivate: [AuthGuard],}, //K1秘钥验证失败是跳转页面
// {path:'lockscreen',
// component:LockscreenComponent,
// canActivate: [AuthGuard]}//守卫验证
{path:'plan', component:planComponent}, //平面图
{path:'similarPlans/details', component:CollectionToolsComponent}, //预案甄选
{path:'planAssistance', component:PlanAssistanceComponent}, //预案赋能
{path:'similarPlans', component:SimilarPlansComponent}, //预案甄选 表格
];
@NgModule({

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

@ -15,9 +15,9 @@ export class CacheTokenService {
login () {
return new Promise ((resolve,reject)=>{
sessionStorage.setItem("buildingTypeId",'5e7c9078a3050b1a840ed4ba'); //建筑类型
sessionStorage.setItem("planId",'5fa3820af8eb762cb03c666d'); //预案ID
sessionStorage.setItem("companyId",'5fa35d68f8eb762cb03c662e'); //单位ID
// sessionStorage.setItem("buildingTypeId",'5e7c9078a3050b1a840ed4ba'); //建筑类型
// sessionStorage.setItem("planId",'5fa3820af8eb762cb03c666d'); //预案ID
// sessionStorage.setItem("companyId",'5fa35d68f8eb762cb03c662e'); //单位ID
this.http.post('/api/Account/SignIn',this.loginData).subscribe((data:any)=>{
sessionStorage.setItem("level",data.level);
sessionStorage.setItem("token",data.token);
@ -34,7 +34,7 @@ export class CacheTokenService {
}
//登录
public timer;
public timer; //刷新token定时器
//刷新token令牌定时器
startUp = ():void=>{

10
src/app/ui/collection-tools/collection-tools.component.ts

@ -548,17 +548,17 @@ export class CollectionToolsComponent implements OnInit {
ngAfterViewInit(): void {
const token = sessionStorage.getItem('token'); // 判断 是否登录状态
if (token) {
// this.init.getAllLibrary() //获取素材库
// this.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); // 调用父组件 初始化方法
this.getSitePlan(); // 获取总平面图 数据
} else {
this.token.login().then(res => {
this.params.companyId = sessionStorage.getItem('companyId');
// this.init.getAllLibrary() //获取素材库
// this.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); // 调用父组件 初始化方法
this.getSitePlan(); //获取总平面图 数据
});
}
// 监听canvas组件选中素材事件
@ -1757,7 +1757,7 @@ export class CollectionToolsComponent implements OnInit {
})
this.http.get('/api/DisposalNodeDataList',{params:params}).subscribe(data=>{ //获取数据列表 科达用
this.canvasData.planSelectData = data
console.log('预案甄选数据列表this',this.canvasData.planSelectData)
// console.log('预案甄选数据列表this',this.canvasData.planSelectData)
})
}

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

@ -9,6 +9,8 @@ import {WorkingAreaComponent} from '../../working-area/working-area.component'
import {CanvasShareDataService,GameMode} from '../../canvas-share-data.service' //引入服务
import Viewer from 'viewerjs';
import { CacheTokenService } from 'src/app/http-interceptors/cache-token.service';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'plan',
templateUrl: './collection-tools.component.html',
@ -18,7 +20,7 @@ export class planComponent implements OnInit {
@ViewChild('canvas',{static: true}) canvas:WorkingAreaComponent; //父组件中获得子组件的引用
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private element: ElementRef,public canvasData: CanvasShareDataService,public token: CacheTokenService) { }
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private element: ElementRef,public canvasData: CanvasShareDataService,public token: CacheTokenService,public route: ActivatedRoute) { }
// tree配置
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
return {
@ -455,17 +457,21 @@ export class planComponent implements OnInit {
ngAfterViewInit(): void {
const token = sessionStorage.getItem('token'); // 判断 是否登录状态
if (token) {
// this.init.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); // 调用父组件 初始化方法
this.queryCompanyData().then(res=>{
// this.getAllLibrary() //获取素材库
// this.getAllFirePlan(); // 获取所有灾情
this.getAllBuildings(); // 获取所有建筑
this.getSitePlan(); // 获取总平面图 数据
})
} else {
this.token.login().then(res => {
this.params.companyId = sessionStorage.getItem('companyId');
// this.init.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); // 调用父组件 初始化方法
this.queryCompanyData().then(res=>{
this.params.companyId = sessionStorage.getItem('companyId');
// this.getAllLibrary() //获取素材库
// this.getAllFirePlan(); // 获取所有灾情
this.getAllBuildings(); // 获取所有建筑
this.getSitePlan(); // 获取总平面图 数据
})
});
}
// 监听canvas组件选中素材事件
@ -487,6 +493,26 @@ export class planComponent implements OnInit {
})
}
//根据科达 url地址 统一社会信用代码 查询单位信息
queryCompanyData () {
return new Promise ((resolve,reject)=>{
this.route.queryParams.subscribe(paramsData=>{
let params = {USCI: paramsData.usci || ''}
this.http.get("/api/Companies",{params:params}).subscribe((data:any)=>{
if (data.items.length) { //查询到结果时
sessionStorage.setItem("buildingTypeId",data.items[0].buildingTypes[0].id || ''); //建筑类型
sessionStorage.setItem("companyId",data.items[0].id || ''); //单位ID
resolve('success')
} else { //未查询到结果时
reject('beDefeated')
}
}) //http
}) //route
}) //Promise
}
//根据科达 url地址 统一社会信用代码 查询单位信息
copyAssetData:any //存储用于复制的素材
//复制素材
copyAsset(){

Loading…
Cancel
Save