首页 > 代码库 > 页面和打印审批表意见署名和日期是否显示代码

页面和打印审批表意见署名和日期是否显示代码

 

1. 在jsp页面显示意见不要署名和日期

在ideaShowList下的td标签中加上class="yemian",然后在initDate()函数中加上一下方法

$(".yemian .ideaDiv").each(function(){
    var $div = $(this);
    var html = "";
    var old = $div.html();
    var index = old.indexOf("<P align=center>&nbsp;&nbsp;");
    if(0 < index){
            html = old.substring(0,old.lastIndexOf("<P align=center>&nbsp;&nbsp;"));
                        html += "</div>";
    }
      $div.html(html);
});

2. 在jsp页面显示意见需要要署名和日期

function initDate(){
        $(".yemian .ideaDiv").each(function(){
              var $div = $(this);
              var html = "";
              var old = $div.html();
            var index = old.indexOf("<P align=center>&nbsp;&nbsp;");
            if(0 < index){
                old = old.replace("</P>","");
                old = old.replace("<P align=center>&nbsp;&nbsp;","&nbsp;<span style=‘vertical-align:bottom;‘>(");
                old = old.replace("100px","30px");
                
                html = old.substring(0,old.lastIndexOf("</SPAN>")+7);
                var date = old.substring(old.lastIndexOf("</SPAN>")+7).substring(0,16);
                date = FormatDate (date)+")</span></P>";
                
                html += date;
            }
              $div.html(html);
          });
  }
      
  function FormatDate (strTime) {
       var date = new Date(strTime.replace("-","/").replace("-","/"));
       return date.getFullYear()+ "年" +(date.getMonth()+1)+ "月" +date.getDate()+"日  "+date.getHours()+":"+date.getMinutes();
  }

3. 在jsp页面隐藏意见按照格式显示署名和日期,注姓名和日期多个空格

在<div style="display: none">标签下有ideaShowList下的td标签中加上class="dayin",然后在initDate()函数中加上一下方法

$(".dayin .ideaDiv").each(function(){
    var $div = $(this);
    var html = "";
    var old = $div.html();
    var index = old.indexOf("<P align=center>&nbsp;&nbsp;");
    if(0 < index){
        old = old.replace("</P>","");
        old = old.replace("<P align=center>&nbsp;&nbsp;","&nbsp;<span style=‘vertical-align:bottom;‘>(");
        old = old.replace("100px","30px");
        html = old.substring(0,old.lastIndexOf("</SPAN>")+7);
        var date = old.substring(old.lastIndexOf("</SPAN>")+7).substring(0,16);
        date = " &nbsp;" + FormatDate (date)+")</span></P>";    
        html += date;
    }
    $div.html(html);
});

4. 在打印审批表中,图片的前缀有可能是../也有可能是域名,当打印审批表的手签意见需要显示署名和日期时,与第2点集合使用,代码如下:

if(imageUrllong!=""&&imageUrllong!=null){

    var singleIdeas=imageUrllong.split("</DIV>"); //用这个切割可以确定是每个意见
    var singleIdea = ""; //单个意见
    var isImages = -1;  //是否是否前意见
    var imageUrl = ""; //图片地址
    var path = ""; //本地图片地址
    var tmpPath = ""; //临时图片地址,用于最后替换为本地地址
    var contentLong = ""; //打印端显示效果
    for(var j=0;j <singleIdeas.length; j++){
        singleIdea = singleIdeas[j]; 
        if(singleIdea != null && singleIdea != ‘‘){
            isImages = singleIdea.indexOf("<IMG"); //判断是否有图片,有则表示是手签意见
            if(isImages > -1) //说明是手签意见
            {
                if(singleIdea.indexOf("..") > -1){
                    tmpPath = singleIdea.substring(singleIdea.indexOf(".."),singleIdea.indexOf(‘"> &nbsp;<SPAN‘));
                    imageUrl = tmpPath.replace("..",""); 
                }else if(singleIdea.indexOf("http://localhost:8080") > -1){
                    tmpPath = singleIdea.substring(singleIdea.indexOf("http://localhost:8080"),singleIdea.indexOf(‘"> &nbsp;<SPAN‘));
                    imageUrl = tmpPath.replace("http://localhost:8080","");  
                }else if(singleIdea.indexOf("实际域名地址") > -1){
                    tmpPath = singleIdea.substring(singleIdea.indexOf("实际域名地址"),singleIdea.indexOf(‘"> &nbsp;<SPAN‘));
                    imageUrl = tmpPath.replace("实际域名地址","");  
                }
                imageUrl= window.location.protocol+"//"+window.location.hostname+port+rootURL+"/"+imageUrl; // 图片下载的全路径
                var path = officeOCX.DownFilesByURLOrNameEx(imageUrl,"","",false,false); //下载图片,获取本地下载路径
                singleIdea = singleIdea.replace(tmpPath,path); //把原来图片路径,替换为本地路径
                //contentLong += singleIdea.substring(0,singleIdea.indexOf("<P align=center>&nbsp;&nbsp;")) + " " + "</DIV>"; //不显示署名和日期时使用
            }else //pc端意见
            {
                //contentLong += singleIdea.substring(0,singleIdea.indexOf("<P align=center>&nbsp;&nbsp;")) + " " + "</DIV>";//不显示署名和日期时使用
            }
            contentLong += singleIdea;
        }
    }

注意不要多写大括号

页面和打印审批表意见署名和日期是否显示代码