|
|
|
@ -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(){ |
|
|
|
|