|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2021-03-15 11:32:30 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-03-15 13:51:48 |
|
|
|
|
* @LastEditTime: 2021-03-17 10:30:42 |
|
|
|
|
*/ |
|
|
|
|
import { Component, OnInit, ViewChild, Inject } from '@angular/core'; |
|
|
|
|
import { HttpClient } from '@angular/common/http' |
|
|
|
@ -18,6 +18,7 @@ import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dial
|
|
|
|
|
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({ |
|
|
|
@ -27,14 +28,15 @@ declare var CryptoJS
|
|
|
|
|
}) |
|
|
|
|
export class AllPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient,public snackBar: MatSnackBar,public route: ActivatedRoute,private router: Router) { } |
|
|
|
|
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['jsid'] |
|
|
|
|
this.jsId=params['id'] |
|
|
|
|
}); |
|
|
|
|
this.getAlltabledate() |
|
|
|
|
} |
|
|
|
|
displayedColumns: string[] = ['unitname','modifiedTime','organizationName','buildingTypes','operation']; |
|
|
|
|
tabledataSource |
|
|
|
@ -52,12 +54,113 @@ export class AllPlanComponent implements OnInit {
|
|
|
|
|
//分页事件
|
|
|
|
|
changePage(e){ |
|
|
|
|
this.PageNumber = e.pageIndex+1 |
|
|
|
|
//this.getAlltabledate()
|
|
|
|
|
this.getAlltabledate() |
|
|
|
|
} |
|
|
|
|
//返回
|
|
|
|
|
goBack () { |
|
|
|
|
history.go(-1) |
|
|
|
|
//this.echartsData.statefulInspectionToggle = true
|
|
|
|
|
} |
|
|
|
|
//获得所有预案
|
|
|
|
|
getAlltabledate(){ |
|
|
|
|
let paramtedate:any={ |
|
|
|
|
organizationId:this.jsId||'', |
|
|
|
|
PlanStatus:this.type, |
|
|
|
|
PageNumber: this.PageNumber || '1', |
|
|
|
|
PageSize: this.pageSizeOptions[0] |
|
|
|
|
} |
|
|
|
|
this.http.get(`/api/Plans/Organizations`,{params:paramtedate}).subscribe((data:any)=>{ |
|
|
|
|
this.tabledataSource=data.items |
|
|
|
|
console.log(this.tabledataSource) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查看详情
|
|
|
|
|
lookPlan(e){ |
|
|
|
|
console.log(e) |
|
|
|
|
if(e.planMode == 0){
|
|
|
|
|
console.log(e.attachmentUrls) |
|
|
|
|
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/apps/editor/openPreview?data=${base64}`) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(e.planMode == 1){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('查看导入word文件','确定',config); |
|
|
|
|
} |
|
|
|
|
if(e.planMode == 2){ //如果是在线编辑
|
|
|
|
|
let id = e.id
|
|
|
|
|
sessionStorage.setItem("planId",id) |
|
|
|
|
/* sessionStorage.setItem("companyId",this.companyId) |
|
|
|
|
sessionStorage.setItem("buildingTypeId",this.unittypeId) */ |
|
|
|
|
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.planMode == 3){ //如果是跳转网页
|
|
|
|
|
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 { |
|
|
|
|
console.log(this.data) |
|
|
|
|
const viewer = new Viewer({ |
|
|
|
|
container: document.querySelector('#viewer'), |
|
|
|
|
panorama:'/api/Objects/PlanPlatform/'+ this.data, |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |