|
|
|
@ -66,7 +66,9 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
if (element.companyId === this.route.snapshot.queryParams.unitId) { |
|
|
|
|
this.compantData = element.company |
|
|
|
|
return } }); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// console.log(123,this.compantData)
|
|
|
|
|
this.unitdata.unitname = this.compantData.name |
|
|
|
|
this.unitdata.organizationName = this.compantData.organizationName |
|
|
|
@ -104,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, { |
|
|
|
@ -113,60 +115,31 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
height: '800px', |
|
|
|
|
data: e.attachmentUrls[0] |
|
|
|
|
}); |
|
|
|
|
}else if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='png'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='jpeg'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='jpg'){ |
|
|
|
|
} else if (e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'JPG' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'png' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'peg' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'jpg') { |
|
|
|
|
let data = e |
|
|
|
|
const dialogRef = this.dialog.open(ImgDetails, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
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://39.106.78.171: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://121.5.10.84:80/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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* 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) |
|
|
|
@ -201,11 +174,6 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
else if (e.planType == 16) { |
|
|
|
|
this.lookPlan(e) |
|
|
|
|
// let body={
|
|
|
|
|
// // id:e.planId,
|
|
|
|
|
// // resetAudit:true
|
|
|
|
|
// ""
|
|
|
|
|
// }
|
|
|
|
|
let body = JSON.stringify(""); |
|
|
|
|
let resetAudit = true |
|
|
|
|
let headers = new HttpHeaders({ |
|
|
|
@ -449,7 +417,8 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
let result = await new Promise((result, reject) => { |
|
|
|
|
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { headers: { 'range': `bytes= ${start}-${end}` }, responseType: 'blob' }).subscribe(data => { |
|
|
|
|
result(data) })
|
|
|
|
|
result(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
allFile.push(result) |
|
|
|
|
this.downloadProgress = Number((i / allSlice).toFixed(2)) * 100 |
|
|
|
@ -651,9 +620,11 @@ export class AddPlanone {
|
|
|
|
|
planCategory: Number(this.selectedPLanLevel), |
|
|
|
|
url: "", |
|
|
|
|
attachmentUrls: [`${this.objectName}`] |
|
|
|
|
},{params:{ |
|
|
|
|
}, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
@ -693,7 +664,8 @@ export class AddPlanone {
|
|
|
|
|
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { |
|
|
|
|
let msg = { |
|
|
|
|
"partNumber": data.partNumber || null, |
|
|
|
|
"eTag": data.eTag || null} |
|
|
|
|
"eTag": data.eTag || null |
|
|
|
|
} |
|
|
|
|
resolve(msg) // 调用 promise 内置方法处理成功
|
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
@ -702,7 +674,8 @@ export class AddPlanone {
|
|
|
|
|
|
|
|
|
|
if (this.PartNumberETag.length === allSlice) { |
|
|
|
|
this.uploadProgress = 100 |
|
|
|
|
this.endUploading(planType)} |
|
|
|
|
this.endUploading(planType) |
|
|
|
|
} |
|
|
|
|
}//for循环
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -751,9 +724,11 @@ export class AddPlanone {
|
|
|
|
|
planCategory: Number(this.selectedPLanLevel), |
|
|
|
|
url: "", |
|
|
|
|
attachmentUrls: [`${this.objectName}`] |
|
|
|
|
},{params:{ |
|
|
|
|
}, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
@ -915,9 +890,11 @@ export class AddPlanone {
|
|
|
|
|
attachmentUrls: null |
|
|
|
|
} |
|
|
|
|
//console.log(body)
|
|
|
|
|
this.http.post("/api/PlanComponents",body,{params:{ |
|
|
|
|
this.http.post("/api/PlanComponents", body, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
// console.log("创建成功")
|
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
@ -965,9 +942,11 @@ export class AddPlanone {
|
|
|
|
|
url: "", |
|
|
|
|
attachmentUrls: null |
|
|
|
|
} |
|
|
|
|
this.http.post("/api/PlanComponents2D",body,{params:{ |
|
|
|
|
this.http.post("/api/PlanComponents2D", body, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
// console.log("创建成功")
|
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
@ -993,9 +972,11 @@ export class AddPlanone {
|
|
|
|
|
attachmentUrls: null |
|
|
|
|
} |
|
|
|
|
//console.log(body)
|
|
|
|
|
this.http.post("/api/PlanComponents2D",body,{params:{ |
|
|
|
|
this.http.post("/api/PlanComponents2D", body, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
// console.log("创建成功")
|
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
|