|
|
|
@ -106,8 +106,8 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
//查看预案
|
|
|
|
|
lookPlan(e) { |
|
|
|
|
console.log(e) |
|
|
|
|
if (e.planType == 16 || e.planType == 4 || e.planType == 8) { |
|
|
|
|
// console.log(e.attachmentUrls)
|
|
|
|
|
var index = e.attachmentUrls[0].indexOf("\/") |
|
|
|
|
if (e.attachmentUrls[0].substr(0, index) == 'psw') { |
|
|
|
|
const dialogRef = this.dialog.open(PsViewer, { |
|
|
|
@ -121,54 +121,27 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
data: data.attachmentUrls, |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(); |
|
|
|
|
} |
|
|
|
|
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 |
|
|
|
|
} else { |
|
|
|
|
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://172.18.0.1:8000/api/Objects/PlanPlatform/` + fetchUrl, |
|
|
|
|
}, |
|
|
|
|
user: { |
|
|
|
|
uid: identityJsonparse.sub, |
|
|
|
|
nickName: identityJsonparse.name, |
|
|
|
|
avatar: "", |
|
|
|
|
privilege: e.auditStatus != '1' && e.auditStatus != '16' ? [ |
|
|
|
|
'FILE_READ', 'FILE_WRITE', 'FILE_DOWNLOAD', 'FILE_PRINT' |
|
|
|
|
] : [ |
|
|
|
|
'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://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`) |
|
|
|
|
}) |
|
|
|
|
if (fetchUrl) { |
|
|
|
|
let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase() |
|
|
|
|
if (suffix == 'docx' || suffix == 'doc') { |
|
|
|
|
let arr = fetchUrl.split('.') |
|
|
|
|
arr[arr.length - 1] = 'pdf' |
|
|
|
|
window.open(`/api/Objects/PlanPlatform/` + arr.join('.')) |
|
|
|
|
} else if (suffix == 'pdf') { |
|
|
|
|
window.open(`/api/Objects/PlanPlatform/` + fetchUrl) |
|
|
|
|
} else { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('该文件类型暂不支持在线查看', '确定', config); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* 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) |
|
|
|
@ -206,7 +179,6 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
else if (e.planType == 16) { |
|
|
|
|
if (e.attachmentUrls == null) { |
|
|
|
|
console.log(this.compantData) |
|
|
|
|
window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`) |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|