|
|
|
/*
|
|
|
|
* @Descripttion:
|
|
|
|
* @version:
|
|
|
|
* @Author: sueRimn
|
|
|
|
* @Date: 2021-03-15 11:32:30
|
|
|
|
* @LastEditors: sueRimn
|
|
|
|
* @LastEditTime: 2021-04-28 15:33:00
|
|
|
|
*/
|
|
|
|
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
|
|
|
|
import { HttpClient } from '@angular/common/http'
|
|
|
|
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
|
|
import { FormControl } from '@angular/forms';
|
|
|
|
import { Router,ActivatedRoute } from '@angular/router'
|
|
|
|
import { PageEvent } from '@angular/material/paginator';
|
|
|
|
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
|
|
|
import { TreeService } from '../../http-interceptors/tree.service'
|
|
|
|
import { MatTableDataSource } from '@angular/material/table';
|
|
|
|
import { Viewer } from 'photo-sphere-viewer';
|
|
|
|
declare var CryptoJS
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-all-plan',
|
|
|
|
templateUrl: './all-plan.component.html',
|
|
|
|
styleUrls: ['./all-plan.component.scss']
|
|
|
|
})
|
|
|
|
export class AllPlanComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public route: ActivatedRoute,private router: Router) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.route.queryParams.subscribe(params => {
|
|
|
|
this.titlename = params['name'];
|
|
|
|
this.type = params['type'];
|
|
|
|
this.jsId=params['id']
|
|
|
|
this.tid=params.tid
|
|
|
|
});
|
|
|
|
this.getAlltabledate()
|
|
|
|
}
|
|
|
|
tid
|
|
|
|
displayedColumns: string[] = ['unitname','modifiedTime','organizationName','buildingTypes','operation'];
|
|
|
|
tabledataSource
|
|
|
|
titlename //上个页面传过来的名称
|
|
|
|
type //上个页面传过来:1重点单位 2预案
|
|
|
|
jsId //组织机构id
|
|
|
|
//分页
|
|
|
|
@ViewChild(MatPaginator, {static: true})
|
|
|
|
pageEvent: PageEvent;
|
|
|
|
paginator: MatPaginator;
|
|
|
|
length:any; //共多少条数据
|
|
|
|
pageSize:any; //每页条数
|
|
|
|
pageSizeOptions: number[] = [10] //设置每页条数
|
|
|
|
PageNumber:any; //第几页
|
|
|
|
//分页事件
|
|
|
|
changePage(e){
|
|
|
|
this.PageNumber = e.pageIndex+1
|
|
|
|
this.getAlltabledate()
|
|
|
|
}
|
|
|
|
//返回
|
|
|
|
goBack () {
|
|
|
|
sessionStorage.setItem('refresh', 'true');
|
|
|
|
history.go(-1);
|
|
|
|
//this.echartsData.statefulInspectionToggle = true
|
|
|
|
}
|
|
|
|
//获得所有预案
|
|
|
|
getAlltabledate(){
|
|
|
|
let paramtedate:any={
|
|
|
|
organizationId:this.jsId||'',
|
|
|
|
planStatus:this.tid=='pieone'?'': this.type,
|
|
|
|
PlanCategory:this.tid=='pieone'?this.type:'',
|
|
|
|
PageNumber: this.PageNumber || '1',
|
|
|
|
PageSize: this.pageSizeOptions[0]
|
|
|
|
}
|
|
|
|
this.http.get(`/api/Plans/Organizations`,{params:paramtedate}).subscribe((data:any)=>{
|
|
|
|
this.length = data.totalCount
|
|
|
|
this.tabledataSource=data.items
|
|
|
|
//console.log(this.tabledataSource)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
//查看详情
|
|
|
|
lookPlan(e){
|
|
|
|
if(e.planType == 16||e.planType == 4){
|
|
|
|
var index=e.attachmentUrls[0].indexOf("\/")
|
|
|
|
if(e.attachmentUrls[0].substr(0,index)=='psw'){
|
|
|
|
const dialogRef = this.dialog.open(PsViewer, {
|
|
|
|
width: '1500px',
|
|
|
|
height:'800px',
|
|
|
|
data: e.attachmentUrls[0]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf'
|
|
|
|
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
|
|
|
|
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
|
|
|
|
let filename:string
|
|
|
|
let fetchUrl = e.attachmentUrls[0]
|
|
|
|
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
|
|
|
|
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
|
|
|
|
let jwt = sessionStorage.getItem("token");
|
|
|
|
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
|
|
|
|
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
|
|
|
|
let identityJsonparse=JSON.parse(identityJson)
|
|
|
|
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
|
|
|
|
filename=data.fileName
|
|
|
|
let json={
|
|
|
|
doc: {
|
|
|
|
docId: docId,
|
|
|
|
title: filename,
|
|
|
|
fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
uid: identityJsonparse.sub,
|
|
|
|
nickName: identityJsonparse.name,
|
|
|
|
avatar: "",
|
|
|
|
privilege: [
|
|
|
|
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
var stringjson=JSON.stringify(json)
|
|
|
|
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
|
|
|
|
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
|
|
|
|
window.open(`http://121.5.10.84:80/apps/editor/openPreview?data=${base64}`)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if(e.planType == 4){
|
|
|
|
var index=e.attachmentUrls[0].indexOf("\/")
|
|
|
|
if(e.attachmentUrls[0].substr(0,index)=='psw'){
|
|
|
|
const dialogRef = this.dialog.open(PsViewer, {
|
|
|
|
width: '1500px',
|
|
|
|
height:'800px',
|
|
|
|
data: e.attachmentUrls[0]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} */
|
|
|
|
if(e.planType == 1){ //如果是在线编辑
|
|
|
|
let id = e.id
|
|
|
|
sessionStorage.setItem("planId",id)
|
|
|
|
sessionStorage.setItem("companyId",e.company.id)
|
|
|
|
sessionStorage.setItem("buildingTypeId",e.company.buildingTypes[0].id)
|
|
|
|
sessionStorage.setItem("editable","0")
|
|
|
|
sessionStorage.setItem("planName",e.name)
|
|
|
|
let companyId = sessionStorage.getItem("companyId")
|
|
|
|
window.open(`/keyUnit/viewunitinfoplan?id=${companyId}&orName=${this.route.snapshot.queryParams.orName}&orId=${this.route.snapshot.queryParams.orId}`);
|
|
|
|
}
|
|
|
|
if(e.planType == 2){ //如果是跳转网页
|
|
|
|
sessionStorage.setItem("url",e.url)
|
|
|
|
window.open(`/planManagement/webLook`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//全景图弹出框
|
|
|
|
@Component({
|
|
|
|
selector: 'PsViewer',
|
|
|
|
templateUrl: './Photo-Sphere-Viewer.html',
|
|
|
|
styleUrls: ['./all-plan.component.scss']
|
|
|
|
})
|
|
|
|
export class PsViewer{
|
|
|
|
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<PsViewer>,@Inject(MAT_DIALOG_DATA) public data: any) {}
|
|
|
|
ngOnInit(): void {
|
|
|
|
const viewer = new Viewer({
|
|
|
|
container: document.querySelector('#viewer'),
|
|
|
|
panorama:'/api/Objects/PlanPlatform/'+ this.data,
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|