Browse Source

[修改]修改处置预案页面从路由获取信息

master
邵佳豪 4 years ago
parent
commit
4d471c5e3a
  1. 4
      src/app/app-routing.module.ts
  2. 51
      src/app/ui/collection-tools/collection-tools.component.ts
  3. BIN
      src/assets/images/处置预案.png

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

@ -27,9 +27,9 @@ const routes: Routes = [
]
},
{path:'plan', component:planComponent}, //平面图
{path:'similarPlans/details', component:CollectionToolsComponent}, //预案甄选
{path:'similarPlans', component:CollectionToolsComponent}, //预案甄选
{path:'planAssistance', component:PlanAssistanceComponent}, //预案赋能
{path:'similarPlans', component:SimilarPlansComponent}, //预案甄选 表格
// {path:'similarPlans', component:SimilarPlansComponent}, //预案甄选 表格
];
@NgModule({

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

@ -11,6 +11,7 @@ import {CanvasShareDataService,GameMode} from '../../canvas-share-data.service'
import {CacheTokenService} from '../../http-interceptors/cache-token.service'
import Viewer from 'viewerjs';
import { saveOneDialog } from './save';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-collection-tools',
templateUrl: './collection-tools.component.html',
@ -20,7 +21,7 @@ export class CollectionToolsComponent 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 {
@ -520,6 +521,26 @@ export class CollectionToolsComponent 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
sessionStorage.setItem("planId",paramsData.planId || ''); //建筑类型
resolve('success')
} else { //未查询到结果时
reject('beDefeated')
}
}) //http
}) //route
}) //Promise
}
//右侧属性和消防要素切换
isProperty = true
rightSwitch(type){
@ -548,17 +569,21 @@ export class CollectionToolsComponent implements OnInit {
ngAfterViewInit(): void {
const token = sessionStorage.getItem('token'); // 判断 是否登录状态
if (token) {
// this.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); // 获取总平面图 数据
} else {
this.token.login().then(res => {
this.params.companyId = sessionStorage.getItem('companyId');
this.queryCompanyData().then(res=>{
// this.getAllLibrary() //获取素材库
this.getAllBuildings(); // 获取所有建筑
this.getAllFirePlan(); // 获取所有灾情
this.getSitePlan(); //获取总平面图 数据
this.getAllBuildings(); // 获取所有建筑
this.getSitePlan(); // 获取总平面图 数据
})
} else {
this.token.login().then(res => {
this.queryCompanyData().then(res=>{
this.params.companyId = sessionStorage.getItem('companyId');
// this.getAllLibrary() //获取素材库
this.getAllFirePlan(); // 获取所有灾情
this.getAllBuildings(); // 获取所有建筑
this.getSitePlan(); // 获取总平面图 数据
})
});
}
// 监听canvas组件选中素材事件
@ -2030,14 +2055,14 @@ export class CollectionToolsComponent implements OnInit {
})
export class CreateBuilding {
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<CreateBuilding>,@Inject(MAT_DIALOG_DATA) public data) { }
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<CreateBuilding>,@Inject(MAT_DIALOG_DATA) public data,public route: ActivatedRoute) { }
allBuildingType:any//所有的建筑类型
selected:any; //选中的建筑
ngOnInit(): void {
this.getAllBuildingType()
}
//获得所有单位类型
getAllBuildingType(){
this.http.get("/api/BuildingTypes/Simple").subscribe(data=>{
@ -2090,7 +2115,7 @@ export class EditBuilding {
allBuildingType:any//所有的建筑类型
ngOnInit(): void {
this.getAllBuildingType()
// this.getAllBuildingType()
}
getAllBuildingType(){

BIN
src/assets/images/处置预案.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Loading…
Cancel
Save