diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java index ad8a0ac7..9bd883c6 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java @@ -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); + } + + /** * 查询导出组织模型等结构 diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java index 09483c8c..dee8d981 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java @@ -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 */ diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html index 5f375cea..ecf40954 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html @@ -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("
"+"写下你的看法"+"
"); var addreplystr=""; addreplystr+="
"; //addreplystr+=""; addreplystr+=""; - - addreplystr+="
"; $(".reply-box").append(addreplystr); //$('#showemotion').SinaEmotion($('.emotion')); @@ -664,146 +662,8 @@ } - function initOutputFileLink() { - if(taskId != "") { - var html = ''; - // 只包含手册的链接 - html += '' + outputFileName +''; - // 包含手册及文件附件,节点附件的压缩包链接 - html += ' ' + taskName +''; - $('#outputFile').append(html); - $('#outputFile').show(); - return 1; - }else { - //三员管理模式兼容 - if(isHighSecurity && methodId.indexOf("process")>=0 && methodId != "process.evc"){ - var html = ''; - // 只包含手册的链接 - html += '' + fileName +'.doc'; - // 包含手册及文件附件,节点附件的压缩包链接 - html += ' 步骤横表.zip '; - $('#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 diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js index b0522fd8..87012337 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js @@ -1574,13 +1574,31 @@ function ProcessManual() { t += ''; t += ''; t += '
'; t += '
流程手册:
'; - t += ''; + t += ''; t += '
'; $('#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 += ''; } - /*//流程手册附件展示 - t += ''; - t += ''; - t += '
'; - t += '
流程手册:
'; - t += ''; - t += '
'*/; var elements = Model.define.elements; for(var e in elements) {