您好:请问您现在的需要是否在这表单中显示流程历史,希望在流程历史中显示时,有某列标记流程的操作时正常提交的,还是回退或者回撤的么?如果是您可以在函数库中写函数实现具体代码类似于:- function testhis(){
- var message="<table cellSpacing='0' cellPadding='1' width='100%' align='center' style='border:solid #cccccc;border-width:2px 0px 0px 2px;'><tbody><tr style='line-height:22px;'><td width=25%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >办理人(部门)</td><td width='40%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >办理意见</td><td width='25%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >办理时间</td><td width='40%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >流程操作</td></tr>";
- var applicationId=getApplication();//获取应用id
- var docid=getId();//获取文档id
- var doc=getCurrentDocument();//获取当前文档对象
- var flowStateId=doc.getStateid();//当前流程实例ID
- var hisProcess = new Packages.cn.myapps.core.workflow.storage.runtime.ejb.RelationHISProcessBean(applicationId); //流程历史处理类
- var hisList = hisProcess.doAllQueryByDocIdAndFlowStateId(docid, flowStateId);//根据文档id与流程实例id返回对应的流程历史集合
- for(var iter = hisList.iterator();hisList!=null && iter.hasNext();){
- var relHis = iter.next();
- if (relHis.getActorhiss().size() > 0) {
- for (var iterator = relHis.getActorhiss().iterator(); iterator.hasNext();) {
- var actorHis = iterator.next();
-
- //流程处理人部门信息
- var depprocess=getDepartmentProcess();//部门处理类
- var userid = actorHis.getActorid();//用户id
- var user = getUserById(userid);//用户对象
- var dname ="";
- if(user!= null ){
- var depart = depprocess.doView(user.defaultDepartment);//部门对象
- if(depart != null){
- dname = depart.getName();//部门名称
- }
- }
- // 流程处理人
- var agname="";
- if(actorHis.getAgentname()!=null && actorHis.getAgentname().trim().length()>0){
- agname=actorHis.getAgentname()+"("+actorHis.getName()+")"+"("+dname+")";
- }else{
- agname=actorHis.getName()+"("+dname+")";
- }
- // 审批意见
- var attitude = "";
- if (actorHis.getAttitude() != null&& actorHis.getAttitude().length() > 0) {
- attitude = actorHis.getAttitude();
- }else{
- attitude=" ";
- }
- // 审批时间
- var pocesstime = "";
- var dateutil=new Packages.cn.myapps.util.DateUtil();
- if (actorHis.getProcesstime() != null) {
- pocesstime = dateutil.getDateTimeStr(actorHis.getProcesstime());
- } else {
- pocesstime = dateutil.getDateTimeStr(relHis.getActiontime());
-
- }
-
- }
- //流程标记
- var flowoperation ="";
- if(relHis.getFlowOperation()!=null && relHis.getFlowOperation().length()>0){
- flowoperation =relHis.getFlowOperation();
- }else{
- flowoperation=" ";
- }
- message += "<tr style='line-height:22px;'><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+agname+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+attitude+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+pocesstime+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+flowoperation+"</td></tbody></tr>";
- } else {
-
- message += "<tr style='line-height:22px;'><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+relHis.getAuditor()+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+relHis.getAttitude()+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+relHis.getActiontime()+"</td><td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+relHis.getFlowOperation()+"</td></tbody></tr>";
- }
-
- }
- return message;
- }
复制代码 然后在表单使用计算脚本调用该函数,具体代码如下:- #include "flowHis";//flowHis函数库名称
- testhis();
复制代码 前台显示效果:
PS:这里流程历史记录流程操作为81的就表示是回退的操作。 |