天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 926|回复: 0

[常见问题] 流程历史表,列可以自己定义该如何设置?

[复制链接]
lingling17 发表于 2021-1-15 18:30:52 | 显示全部楼层 |阅读模式
【myApps/OBPM版本号】:4.4stable sp21
【浏览器类型】:Chrome
【技术QQ群】:182378297
【场景】:流程历史表,列可以自己定义该如何设置?

【解决方法】:
在计算脚本里面输入代码
  1. #include"deptFunction1";
  2. (function testhis(){
  3.    var flsg=IsWeixin();
  4.    if(!flsg){
  5.         var curDoc = getCurrentDocument();
  6.         var message="<table id='flowhistory' cellSpacing='0' cellPadding='1' width='90%' align='center' style='table-layout:fixed;border:solid #cccccc;border-width:1px 0px 0px 1px;'><tbody><tr style='line-height:22px;'><td style='width:10%;align:center;font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;background-color:#EFF0F1;width=10%;' >审批人</td><td style='width:20%;font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;background-color:#EFF0F1;width=20%' >审批时间</td><td style='width:30%;align:center;font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;background-color:#EFF0F1;width=30%' >备注</td><td style='width:10%;align:center;font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;background-color:#EFF0F1;width=10%' >动作</td><td style='font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;background-color:#EFF0F1;'  >流程状态</td></tr>";
  7.         var txtNo = curDoc.getId();
  8.   
  9.         var sql="select acthis.nodehis_id,acthis.name,acthis.attitude,acthis.processtime,relhis.startNodename, relhis.flowoperation from (select * from T_Actorhis where doc_id = '"+txtNo+"') acthis,(select * from t_relationhis where docid = '"+txtNo+"') relhis where acthis.nodehis_id=relhis.ID and relhis.startNodename='部门审批中1' and acthis.processtime=(select max(acthis.processtime) as processtime from (select * from T_Actorhis where doc_id = '"+txtNo+"') acthis,(select * from t_relationhis where docid = '"+txtNo+"') relhis where acthis.nodehis_id=relhis.ID and relhis.startNodename='部门审批中1')";
  10.         var datas  = queryByDSName("cunhuoBusiness",sql);
  11.         var count = 0;
  12.         if(datas!=null&&datas.size()>0){
  13.                 for(var iter = datas.iterator();iter.hasNext();){
  14.                         count = count + 1;
  15.                         var doc = iter.next();
  16.                         var name = doc.get("name");
  17.                         var namebak = name;
  18.                         if ("admin".equalsIgnoreCase(name)) {
  19.                                 name = "系统管理员";
  20.                         }
  21.                         var time1 = doc.get("processtime");   
  22.                                         var time =format(time1,"yyyy-MM-dd HH:mm:ss");            
  23.                                     
  24.                                    // var time= parseDate(time2,"yyyy-MM-dd HH:mm:ss");  
  25.   
  26.                         var id = doc.get("nodehis_id");
  27.                         var nodeName = "";
  28.                         var status = "";
  29.                         nodeName = doc.get("startNodename");
  30.                         var statusNum = doc.get("flowoperation")-0;
  31.                         var attitude = "";
  32.                         var att = doc.get("attitude");
  33.                         if(att!=null&&att.trim().length()>0){
  34.                                 if("提交备注".equals(att)||"说点什么吧...".equals(att)){
  35.                                         attitude = "";
  36.                                 }else{
  37.                                         attitude = att;
  38.                                 }
  39.                         }
  40.                         if (statusNum == 80) {
  41.                                 if (name.indexOf("[")>=0 || name.indexOf("]")>=0) {
  42.                                         status = "代理审批";
  43.                                 } else {
  44.                                         status = "流转";
  45.                                 }
  46.                         } else if (statusNum == 81) {
  47.                                 status = "回退";
  48.                         } else if (statusNum == 7) {
  49.                                 status = "完成";
  50.                         } else if (statusNum == 87) {
  51.                                 status = "自动审批";
  52.                         } else if (statusNum == 85) {
  53.                                 status = "回撤";
  54.                         } else if (statusNum == 86) {
  55.                                 status = "流程监控";
  56.                         }  else if (statusNum == 100) {
  57.                                 status = "提交至回退人";
  58.                         }
  59.                          
  60.                         if(count>0){
  61.                                 message += "<tr style='line-height:22px;'><td style='font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;align:center;'>"+name+"</td><td style='align:center;font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;'>"+time+"</td><td style='font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;align:center;'><font style='font-weight:bold;'>"+attitude+"</font></td><td style='font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;'>"+status+"</td><td style='font-size:12px;font-family: Arial;border:solid #cccccc;border-width:0px 1px 1px 0px;word-wrap:break-word; white-space: pre-wrap;'>"+nodeName+" </td></tr>";
  62.                         }
  63.                 }
  64.         }
  65.         message += "</tbody></table>";
  66.         return message;
  67.    }
  68. })();
复制代码

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 06:39

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表