|
|
|
@ -9,6 +9,7 @@ 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 { Viewer } from 'photo-sphere-viewer'; |
|
|
|
|
declare var CryptoJS |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-pass-plan', |
|
|
|
@ -292,45 +293,91 @@ export class PassPlanComponent implements OnInit {
|
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
//跳转查看预案页面 审核通过预案
|
|
|
|
|
routerTo(element){ |
|
|
|
|
if(element.attachmentUrls[0].substr(element.attachmentUrls[0].length-4,element.attachmentUrls[0].length-1)=='docx'||element.attachmentUrls[0].substr(element.attachmentUrls[0].length-3,element.attachmentUrls[0].length)=='pdf' |
|
|
|
|
||element.attachmentUrls[0].substr(element.attachmentUrls[0].length-3,element.attachmentUrls[0].length)=='doc'||element.attachmentUrls[0].substr(element.attachmentUrls[0].length-3,element.attachmentUrls[0].length)=='DOC' |
|
|
|
|
||element.attachmentUrls[0].substr(element.attachmentUrls[0].length-3,element.attachmentUrls[0].length)=='txt'){ |
|
|
|
|
let filename:string |
|
|
|
|
let fetchUrl=element.attachmentUrls[0] |
|
|
|
|
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ |
|
|
|
|
routerTo(e){ |
|
|
|
|
console.log(e) |
|
|
|
|
if(e.planMode == 0||e.planMode == 1){
|
|
|
|
|
//console.log(e.attachmentUrls)
|
|
|
|
|
var index=e.attachmentUrls[0].indexOf("\/") |
|
|
|
|
if(e.attachmentUrls[0].substr(0,index)=='psw'){ |
|
|
|
|
const dialogRef = this.dialog.open(GkPsViewer, { |
|
|
|
|
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: element.id,
|
|
|
|
|
doc: { |
|
|
|
|
docId: docId, |
|
|
|
|
title: filename, |
|
|
|
|
//title: filename,
|
|
|
|
|
fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl |
|
|
|
|
}, |
|
|
|
|
user: { |
|
|
|
|
uid: "test", |
|
|
|
|
nickName: "test", |
|
|
|
|
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'
|
|
|
|
|
'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
|
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
var stringjson=JSON.stringify(json) |
|
|
|
|
var wordArray = CryptoJS.enc.Utf8.parse(stringjson); |
|
|
|
|
var base64 = CryptoJS.enc.Base64.stringify(wordArray); |
|
|
|
|
|
|
|
|
|
//let base64Date=this.BASE64.encode(stringjson)
|
|
|
|
|
//let filedata= CryptoJS.enc.Base64.stringify(json)
|
|
|
|
|
console.log(base64) |
|
|
|
|
window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`) |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
sessionStorage.setItem("companyName",element.companyName) |
|
|
|
|
window.open(`/planAudit/planpass?id=${element.companyId}&companyName=${element.companyName}&auditPlanId=${element.id}&auditStatus=${element.auditStatus}&type=6&planType=1`); |
|
|
|
|
} |
|
|
|
|
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 == 2){ //如果是在线编辑
|
|
|
|
|
let id = e.id
|
|
|
|
|
sessionStorage.setItem("planId",id) |
|
|
|
|
sessionStorage.setItem("companyId",e.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}`); |
|
|
|
|
} |
|
|
|
|
if(e.planMode == 3){ //如果是跳转网页
|
|
|
|
|
sessionStorage.setItem("url",e.url) |
|
|
|
|
window.open(`/planManagement/webLook`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//预案公开
|
|
|
|
|
openReserve (e) { |
|
|
|
|
this.http.put(`/api/PlanAudits/${e.id}/Public`,[]).subscribe(data=>{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('预案已公开','确定',config); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//预案取消公开
|
|
|
|
|
closeReserve (e) { |
|
|
|
|
this.http.put(`/api/PlanAudits/${e.id}/Unpublic`,[]).subscribe(data=>{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('预案已取消公开','确定',config); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//分页事件
|
|
|
|
|
chagePage(e){ |
|
|
|
|
this.PageNumber = e.pageIndex+1 |
|
|
|
@ -390,3 +437,20 @@ export class PassPlanComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'PsViewer', |
|
|
|
|
templateUrl: './PsvShow.html', |
|
|
|
|
styleUrls: ['./pass-plan.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class GkPsViewer{ |
|
|
|
|
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<GkPsViewer>,@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, |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|