增加流程阅览流程手册下载
This commit is contained in:
parent
6911f659ae
commit
ab47b1ed82
@ -2486,6 +2486,21 @@ public class CoEPALController {
|
||||
public String COEPALOUTPUTREPORTOutputProcessPreview(UserContext me, String taskId) {
|
||||
return PALRepositoryQueryAPIManager.getInstance().outputReportPreview(me, taskId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程阅览 流程手册下载
|
||||
* @param me
|
||||
* @param taskId
|
||||
* @return
|
||||
* by zhaolei
|
||||
*/
|
||||
@Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_download")
|
||||
public String COEPALOUTPUTREPORTOutputProcessDownload(UserContext me, String taskId) {
|
||||
return PALRepositoryQueryAPIManager.getInstance().outputReportDownload(me, taskId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询导出组织模型等结构
|
||||
|
||||
@ -2588,6 +2588,50 @@ public class PALRepositoryQueryAPIManager {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程手册下载
|
||||
* @param _uc
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
public String outputReportDownload(UserContext _uc, String taskId) {
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
ResponseObject result = ResponseObject.newOkResponse();
|
||||
if (model != null) {
|
||||
try {
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId());
|
||||
if (file.exists()) {
|
||||
File[] fileList = file.listFiles();
|
||||
if (fileList.length > 0) {
|
||||
File docFile = null;
|
||||
for (File file2 : fileList) {
|
||||
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
docFile = file2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (docFile == null) {
|
||||
return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal.output.pr";
|
||||
String filename = docFile.getName();
|
||||
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename);
|
||||
|
||||
String downUrl=SDK.getConfAPI().getPortalUrl() + "/r/" + sourceDc.getDownloadURL().replace("./", "");
|
||||
result.put("url",downUrl);
|
||||
}
|
||||
}else{
|
||||
result = ResponseObject.newErrResponse("没有可预览文件");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseObject.newErrResponse().toString();
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布流程访问量+1
|
||||
*/
|
||||
|
||||
@ -618,7 +618,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
/* var output = initOutputFileLink();
|
||||
/*var output = initOutputFileLink();
|
||||
if (output != 0) {
|
||||
output = 40;
|
||||
} else {
|
||||
@ -643,16 +643,14 @@
|
||||
|
||||
});
|
||||
|
||||
//渲染评论内容
|
||||
function initPl() {
|
||||
|
||||
$(".message-detial-reply").empty();
|
||||
$(".message-detial-reply").append("<div class='reply-title'>"+"写下你的看法"+"</div><div class='reply-box'></div><div class='reply-list'></div>");
|
||||
var addreplystr="";
|
||||
addreplystr+="<div class='reply-panel'><textarea class='txt emotion replycontent' id='replycontent' maxlength='5000'></textarea>";
|
||||
//addreplystr+="<span title='"+"选择表情"+"' style='background:url(../apps/com.actionsoft.apps.cms/img/system/face_emotion.png);background-size:22px 22px;display: inline-block;width: 22px;height: 22px;margin-left: 5px;' id='showemotion'></span><input type='button' class='button blue reply-add-btn' onclick=addReply('"+ruuid+"'); value='"+"提交"+"'/>";
|
||||
addreplystr+="<input type='button' class='button blue reply-add-btn' onclick=addReply('"+ruuid+"'); value='"+"提交"+"'/>";
|
||||
|
||||
|
||||
addreplystr+="</div>";
|
||||
$(".reply-box").append(addreplystr);
|
||||
//$('#showemotion').SinaEmotion($('.emotion'));
|
||||
@ -664,146 +662,8 @@
|
||||
|
||||
}
|
||||
|
||||
function initOutputFileLink() {
|
||||
if(taskId != "") {
|
||||
var html = '';
|
||||
// 只包含手册的链接
|
||||
html += '<a style="margin-left:30px;font-size:15px;" awsui-qtip="text:\''+ outputFileName +'\',position:\'top\'" taskId="' + taskId + '" href="javascript:void(0);" onclick="openOutputFile(\''+ taskId +'\');"><img class="mainattachment-header-icon" src="../apps/com.actionsoft.apps.coe.pal/img/icon_form_attachment.png" width="20" height="20"><u>' + outputFileName +'</u></a>';
|
||||
// 包含手册及文件附件,节点附件的压缩包链接
|
||||
html += '<a style="margin-left:30px;font-size:15px;" awsui-qtip="text:\''+ taskName +'\',position:\'top\'" href="javascript:void(0);" onclick="downloadReport(\'' + taskId + '\', \'' + taskProfile + '\')"><i style="color:#555" class="awsui-iconfont"></i> <u>' + taskName +'</u></a>';
|
||||
$('#outputFile').append(html);
|
||||
$('#outputFile').show();
|
||||
return 1;
|
||||
}else {
|
||||
//三员管理模式兼容
|
||||
if(isHighSecurity && methodId.indexOf("process")>=0 && methodId != "process.evc"){
|
||||
var html = '';
|
||||
// 只包含手册的链接
|
||||
html += '<a style="margin-left:30px;font-size:15px;" awsui-qtip="text:\''+ fileName +'.doc\',position:\'top\'" href="javascript:void(0);" onclick="secOpenOutputFile(\'' + ruuid + '\');"><img class="mainattachment-header-icon" src="../apps/com.actionsoft.apps.coe.pal/img/icon_form_attachment.png" width="20" height="20"><u>' + fileName +'.doc</u></a>';
|
||||
// 包含手册及文件附件,节点附件的压缩包链接
|
||||
html += '<a style="margin-left:30px;font-size:15px;" awsui-qtip="text:\' 步骤横表.zip \',position:\'top\'" href="javascript:void(0);" onclick="secDownloadReport(\'' + ruuid + '\', \'\')"><i style="color:#555" class="awsui-iconfont"></i> <u>步骤横表.zip </u></a>';
|
||||
$('#outputFile').append(html);
|
||||
$('#outputFile').show();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//三员模式文件预览
|
||||
function secOpenOutputFile(id) {
|
||||
if (taskId !="<#taskId>"){
|
||||
openOutputFile(taskId);
|
||||
}else{
|
||||
var ids = [id];
|
||||
//生成手册
|
||||
var param = {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create",
|
||||
teamId: teamId,
|
||||
wsId: wsId,
|
||||
uuids: JSON.stringify(ids)
|
||||
}
|
||||
$.ajax({
|
||||
url : "./jd",
|
||||
type : "POST",
|
||||
dataType : "JSON",
|
||||
async : false,
|
||||
data : param,
|
||||
success : function(r) {
|
||||
if (r.result == 'ok') {
|
||||
taskId = r.data.data[id]
|
||||
//预览文档
|
||||
openOutputFile(taskId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function openOutputFile(taskId) {
|
||||
// 打开流程手册
|
||||
$.simpleAlert('正在打开', 'loading');
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "./jd?sid=" + sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_preview",
|
||||
data : {
|
||||
taskId : taskId
|
||||
},
|
||||
success : function(msg) {
|
||||
if (msg.result == "ok") {
|
||||
$.simpleAlert("close");
|
||||
if (msg['data']) {
|
||||
var url = msg['data']['url'];
|
||||
window.open(url);
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert(msg['msg'], 'info');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//三员模式下zip下载
|
||||
function secDownloadReport(id, appId) {
|
||||
//三员管理
|
||||
if (isHighSecurity){
|
||||
var ids = [id];
|
||||
if (appId ==""){
|
||||
appId = "com.actionsoft.apps.coe.pal.output.pr";
|
||||
}
|
||||
|
||||
if (taskId !="<#taskId>"){
|
||||
//已经生成过手册
|
||||
downloadReport(taskId,appId);
|
||||
return;
|
||||
}
|
||||
//生成手册
|
||||
var param = {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create",
|
||||
teamId: teamId,
|
||||
wsId: wsId,
|
||||
uuids: JSON.stringify(ids)
|
||||
}
|
||||
$.ajax({
|
||||
url : "./jd",
|
||||
type : "POST",
|
||||
dataType : "JSON",
|
||||
async : false,
|
||||
data : param,
|
||||
success : function(r) {
|
||||
if (r.result == 'ok') {
|
||||
taskId = r.data.data[id]
|
||||
//下载zip
|
||||
downloadReport(taskId,appId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 下载压缩的流程报告手册
|
||||
function downloadReport(id, appId) {
|
||||
var cmd = appId + "_downloadreport";
|
||||
var url = "./jd?sid=" + encodeURIComponent(sid) + "&cmd=" + cmd;
|
||||
var params = {
|
||||
id : id
|
||||
};
|
||||
$.ajax({
|
||||
url : url,
|
||||
async : false,
|
||||
data : params,
|
||||
type : "post",
|
||||
success : function(msg) {
|
||||
if (msg.result == "ok") {
|
||||
window.location.href = msg.data.url;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 操作tab页打开关闭
|
||||
function tabOperate(type) {
|
||||
if (type=='open') {//打开tab
|
||||
|
||||
@ -1574,13 +1574,31 @@ function ProcessManual() {
|
||||
t += '<table class="awsui-table">';
|
||||
t += '<tr><td>';
|
||||
t += '<div class="filetableHeader"><i class="awsui-iconfont" style="color: #999999;margin-top: 2px;"></i> 流程手册:</div>';
|
||||
t += '<div class="tableContent"><a href="javascript:void(0);" onclick="openOutputFile(\''+ ruuid +'\')">'+ fileName +'</a></div>';
|
||||
t += '<div class="tableContent"><a href="javascript:void(0);" onclick="downloadProcessFile(\''+ taskId +'\')">'+ fileName +'</a></div>';
|
||||
t += '</td></tr>';
|
||||
t += '</table>';
|
||||
$('#processFileDock').append(t);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function downloadProcessFile(taskId) {
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "./jd?sid=" + sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_download",
|
||||
data : {
|
||||
taskId : taskId
|
||||
},
|
||||
success : function(msg) {
|
||||
debugger;
|
||||
if (msg.result == "ok") {
|
||||
window.location.href = msg.data.url;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化上传附件
|
||||
function initUpfileData(obj) {
|
||||
$('#alertMessage').remove();
|
||||
@ -1598,13 +1616,6 @@ function initUpfileData(obj) {
|
||||
}
|
||||
t += '</td></tr></table>';
|
||||
}
|
||||
/*//流程手册附件展示
|
||||
t += '<table class="awsui-table">';
|
||||
t += '<tr><td>';
|
||||
t += '<div class="filetableHeader"><i class="awsui-iconfont" style="color: #999999;margin-top: 2px;"></i> 流程手册:</div>';
|
||||
t += '<div class="tableContent"><a href="javascript:void(0);" onclick="openOutputFile(\''+ ruuid +'\')">'+ fileName +'</a></div>';
|
||||
t += '</td></tr>';
|
||||
t += '</table>'*/;
|
||||
|
||||
var elements = Model.define.elements;
|
||||
for(var e in elements) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user