JRT集中打印

发布时间:2024年01月23日

之前一直在夯实基础,现在是补demo的时段了。了解过检验集中打印的人知道,集中打印的逻辑有多复杂。既要考虑普通检验报告加上换页。又要考虑微生物报告加上换页,既有A5的报告,也有A4的报告,还要考虑A4打印两个组装A5时候的Y坐标问题。实现起来是超级复杂的,而JRT在本次设计之初就决心整治打印问题,要最大程度的减少打印业务的复杂度。JRT先后提供了容错PAGE、A4Double元素、表格元素、以及封装打印元素绘制协议来解决打印复杂度问题。

集中打印作为打印的综合测试来验证JRT对打印设计的有效性,下图是效果,寥寥几行代码就完成了M时代最令人头大的集中打印效果,这是目前我实现的最强大的打印体系,只为使用JRT的系统提供支持。

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

集中打印的业务后台示例

import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.PrintDrawProtocol;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;
import JRTPrintDraw.JRTPrintDrawProtocol;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

/**
 * 作为集中打印的示例代码,把之前的打印元素测试、表格测试、模板打印报告测试整合成A4上下打印两个的集中打印,提供强悍的打印整合能力
 */
public class CenterPrintTest extends BaseHttpHandlerNoSession {
    /**
     * 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制
     *
     * @param RowID   业务主键
     * @param P1
     * @param P2
     * @param P3
     * @param P4
     * @param P5
     * @param P6
     * @param P7
     * @param P8
     * @param P9
     * @param P10
     * @param P11
     * @param P12
     * @param P13
     * @param Session
     * @param Output
     * @return
     */
    public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {
        List<PrintElement> retList = new ArrayList<>();
        //标志A4打印两个
        retList.add(PrintDrawProtocol.A4Double(false));

        //打条码最初的打印示例
        String barCodeTestJson=Helper.GetVMData("vm.test.PrintBarCodeTest","GetData",null,Session,Output);
        List<PrintElement> barCodeTestJsonList=Helper.Json2List(barCodeTestJson,PrintElement.class);
        retList.addAll(barCodeTestJsonList);
        //换页
        retList.add(PrintDrawProtocol.ChangePage());

        //打表格最初示例
        String drawGridJson=Helper.GetVMData("vm.test.DrawGrid","GetData",null,Session,Output);
        List<PrintElement> drawGridJsonList=Helper.Json2List(drawGridJson,PrintElement.class);
        retList.addAll(drawGridJsonList);
        //换页
        retList.add(PrintDrawProtocol.ChangePage());

        //用模板打印报告的示例
        String printTemplateTestJson=Helper.GetVMData("vm.test.PrintTemplateTest","GetData",null,Session,Output);
        List<PrintElement> printTemplateTestJsonList=Helper.Json2List(printTemplateTestJson,PrintElement.class);
        retList.addAll(printTemplateTestJsonList);
        //换页
        retList.add(PrintDrawProtocol.ChangePage());

        //返回整合的集中打印
        return Helper.Object2Json(retList);
    }
}

打印元素的测试业务代码

import JRT.Core.Dto.OutParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.PrintDrawProtocol;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 输出符合打印元素绘制协议的打印元素数据,来供打印执行层打印
 */
public class PrintBarCodeTest extends BaseHttpHandlerNoSession {
    /**
     * 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制
     *
     * @param RowID   业务主键
     * @param P1
     * @param P2
     * @param P3
     * @param P4
     * @param P5
     * @param P6
     * @param P7
     * @param P8
     * @param P9
     * @param P10
     * @param P11
     * @param P12
     * @param P13
     * @param Session
     * @param Output
     * @return
     */
    public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {
        List<PrintElement> retList = new ArrayList<>();
        //控制打印机
        //retList.add(PrintDrawProtocol.ControlPrinter("A5", PrintDrawProtocol.PrintLayout.Portrait,"pdf","",0,0));
        //标志A4打印两个
        //retList.add(PrintDrawProtocol.A4Double(true));
        //打印PDF文件
        //retList.add(PrintDrawProtocol.DrawFile("http://localhost:8080/JRTWeb/FileService/test.pdf"));

        retList.add(PrintDrawProtocol.DrawPDF("http://localhost:8080/JRTWeb/FileService/test.pdf"));

        //换页
        retList.add(PrintDrawProtocol.ChangePage());
        //换页
        retList.add(PrintDrawProtocol.ChangePage());
        //换页
        retList.add(PrintDrawProtocol.ChangePage());

        //页码
        retList.add(PrintDrawProtocol.DrawPageNum(720, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));

        //画logo
        retList.add(PrintDrawProtocol.DrawLabel(420, 10, "http的logn图", "宋体", 22, "", null, "", "#fda632", "0"));
        retList.add(PrintDrawProtocol.DrawGraph(420, 30, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));

        retList.add(PrintDrawProtocol.DrawLabel(420, 150, "ftp的logn图", "宋体", 12, "", null, "", "#fda632", "0"));
        //retList.add(PrintDrawProtocol.DrawGraph(420,180,64,64,"ftp://zlz:zlz@127.0.0.1:21/ftp.png",false,null));

        //画一个文本
        retList.add(PrintDrawProtocol.DrawLabel(20, 20, "zhanglianzhu", "宋体", 12, "", null, "", "#ff5252", "0"));
        //画一个条码
        retList.add(PrintDrawProtocol.DrawBarCode(20, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));
        //换一根横线
        retList.add(PrintDrawProtocol.DrawLine(20, 70, 70, 70, 1, "", ""));
        //换一根竖线
        retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawQRCode(20, 90, "jbase", 90, 90));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(20, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(20, 230, "20231118 22:49", "宋体", 12, "", null, "", "", "0"));
        //画一个点
        retList.add(PrintDrawProtocol.DrawPoint(20, 270, 10, 10, "o", ""));
        retList.add(PrintDrawProtocol.DrawPoint(100, 270, 10, 10, "[]", ""));
        retList.add(PrintDrawProtocol.DrawPoint(200, 270, 10, 10, "<>", ""));
        //画多边形
        List<Point> pointList = new ArrayList<>();
        Point p1 = new Point();
        p1.x = 10;
        p1.y = 300;
        pointList.add(p1);
        Point p2 = new Point();
        p2.x = 100;
        p2.y = 310;
        pointList.add(p2);
        Point p3 = new Point();
        p3.x = 50;
        p3.y = 360;
        pointList.add(p3);
        retList.add(PrintDrawProtocol.DrawPoly(pointList, ""));
        //画复选框
        retList.add(PrintDrawProtocol.DrawCheckBox(10, 400, true, 30, 30));
        //画单选框
        retList.add(PrintDrawProtocol.DrawRadio(60, 400, true, 30, 30));
        //画复选框
        retList.add(PrintDrawProtocol.DrawCheckBox(110, 400, false, 30, 30));
        //画单选框
        retList.add(PrintDrawProtocol.DrawRadio(160, 400, false, 30, 30));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(20, 1010, "页尾", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawLabel(20, 900, "A4纸张打印", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawLine(20, 920, 700, 920, 1, "0", ""));
        retList.add(PrintDrawProtocol.DrawLine(20, 940, 700, 940, 1, "1", ""));
        retList.add(PrintDrawProtocol.DrawLine(20, 960, 700, 960, 1, "2", ""));
        retList.add(PrintDrawProtocol.DrawLine(20, 980, 700, 980, 1, "3", ""));
        retList.add(PrintDrawProtocol.DrawLine(20, 1000, 700, 1000, 1, "4", ""));
        //换一根横线
        retList.add(PrintDrawProtocol.DrawLine(20, 1025, 700, 1025, 1, "", ""));

        //换页
        retList.add(PrintDrawProtocol.ChangePage());

        //页码
        retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));
        //画logo
        retList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));
        //画一个文本
        retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第二页", "宋体", 12, "", null, "", "", "0"));
        //画一个条码
        retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));
        //换一根横线
        retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));
        //换一根竖线
        retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));
        //画一根横线
        retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));

        //换页
        retList.add(PrintDrawProtocol.ChangePage());
        //页码
        retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));
        //画logo
        retList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));
        //画一个文本
        retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第三页", "宋体", 12, "", null, "", "", "0"));
        //画一个条码
        retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));
        //换一根横线
        retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));
        //换一根竖线
        retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));
        //画一根横线
        retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));

        //换页
        retList.add(PrintDrawProtocol.ChangePage());
        //页码
        retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));
        //画logo
        retList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));
        //画一个文本
        retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第四页", "宋体", 12, "", null, "", "", "0"));
        //画一个条码
        retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));
        //换一根横线
        retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));
        //换一根竖线
        retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));
        //绘制一个条码
        retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231206", "宋体", 12, "", null, "", "", "0"));
        retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));
        //画一根横线
        retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));
        //先包一个打印元素绘制协议数据生成的工具类来解决元素约束问题,工具类实现了调用工具类得到标签,条码,文本等
        return Helper.Object2Json(retList);
    }
}





打印表格的测试业务代码

import JRT.Core.DataGrid.*;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Metrics.DrawMetricsHandler;
import JRT.Core.Util.PrintDrawProtocol;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;

import java.awt.*;
import java.util.*;
import java.util.List;

/**
 * 画表格测试,将要实现一个自动切割和实现换页的表格个业务使用
 */
public class DrawGrid extends BaseHttpHandlerNoSession implements IGridChangePage {
    /**
     * 打印元素
     */
    private List<PrintElement> retList = new ArrayList<>();

    /**
     * 表格换页之前要执行的逻辑
     * @param gridKey
     * @param maxY
     */
    public void PreChangePageDo(String gridKey,int maxY)
    {
        retList.add(PrintDrawProtocol.DrawLabel(20, 10, "这是表格换页之前执行逻辑画的", "宋体", 12, "", null, "", "#fda632", "0"));
    }

    /**
     * 表格换页之后要执行的逻辑
     * @param gridKey
     * @param maxY
     */
    public void AfterChangePageDo(String gridKey,int maxY)
    {
        retList.add(PrintDrawProtocol.DrawLabel(400, 10, "这是表格换页之后执行逻辑画的", "宋体", 12, "", null, "", "#fda632", "0"));
    }

    /**
     * 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制
     *
     * @param RowID   业务主键
     * @param P1
     * @param P2
     * @param P3
     * @param P4
     * @param P5
     * @param P6
     * @param P7
     * @param P8
     * @param P9
     * @param P10
     * @param P11
     * @param P12
     * @param P13
     * @param Session
     * @param Output
     * @return
     */
    public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {

        //这部分由设计器维护的Json得到表格维护信息
        GridDto def = new GridDto();
        //边框宽度
        def.BoderWidth=1;
        //列数
        def.Cols=2;
        //是否左填充
        def.ColsLeftFull=0;
        //第一页控制参数
        GridPageDto page = new GridPageDto();
        //换页行数
        page.ChangePageRowNum=8;
        //顶部
        page.Top=40;
        def.PageList.add(page);

        //第2和后面的页画到500后换页
        page = new GridPageDto();
        //顶部
        page.Top=100;
        //左边
        page.Left=30;
        //换页行数
        page.ChangePageRowNum=8;
        def.PageList.add(page);
        //定义表格的列
        GridColDto col = null;
        //表格列
        for (int i = 0; i < 5; i++) {
            col = new GridColDto();
            col.DataField = "Col" + i;
            col.Width = 75;
            def.DataCol.add(col);
            col = new GridColDto();
            col.DataField = "Col" + i;
            col.Width = 75;
            col.PrintFontStyle="Bold";
            def.HeadCol.add(col);
        }
        List<Object> headDatas=new ArrayList<>();
        //定义表格的标题
        GridDataDto headData = new GridDataDto();
        headData.Col0=PrintDrawProtocol.GetMergeGridStr("合并标题头",1,3);
        headData.Col1="";
        headData.Col2="";
        headData.Col3=PrintDrawProtocol.GetMergeGridStr("合并标题头1",1,2);
        headData.Col4="";
        headDatas.add(headData);
        headData = new GridDataDto();
        headData.Col0="第一列";
        headData.Col1="第二列";
        headData.Col2="第三列";
        headData.Col3="第四列";
        headData.Col4="第五列";
        headDatas.add(headData);
        //这部分由业务打印组装数据
        List<Object> dataList = new ArrayList<>();


        //构造测试数据
        for (int i = 0; i < 21; i++) {
            GridDataDto one = new GridDataDto();
            one.Col0 = "第" + (i+1) + "个数据0列,这是比较长的内容额,会自动换行";
            //合并单元格
            if(i%4==0)
            {
                //one.Col0=PrintDrawProtocol.GetMergeGridStr(one.Col0,2,2);
            }
            one.Col1 = "第" + (i+1) + "个数据1列,这是稍微长的内容";
            one.Col2 = "第" + (i+1) + "个数据2列,this is jrtbase draw grid test for printtemplate";
            one.Col3 = "第" + (i+1) + "个数据3列";
            one.Col4 = "1.这是第一行$r$n2.这是第二行$r$n3.这是第三行";
            dataList.add(one);
        }
        //控制纸张方向
        retList.add(PrintDrawProtocol.ControlPrinter("A4", PrintDrawProtocol.PrintLayout.Portrait,"pdf","",0,0));
        //绘制表格
        int lastY = PrintDrawProtocol.DrawGrid(retList,def, headDatas, dataList,"G1",this);
        return Helper.Object2Json(retList);
    }


    /**
     * 数据实体
     */
    public static class GridDataDto {
        public String Col0;
        public String Col1;
        public String Col2;
        public String Col3;
        public String Col4;
    }
}


模板打印报告的测试业务代码

import JRT.Core.DataGrid.GridDto;
import JRT.Core.DataGrid.IGridChangePage;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.Convert;
import JRT.Core.Util.PrintDrawProtocol;
import JRT.Model.Entity.JRTPrintTemplate;
import JRT.Model.Entity.JRTPrintTemplateEle;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

/**
 * 调用模板数据来打印,这是一个模拟打印的demo,调用模板数据组装打印数据
 */
public class PrintTemplateTest extends BaseHttpHandlerNoSession implements IGridChangePage {

    /**
     * 打印元素
     */
    private List<PrintElement> retList = new ArrayList<>();

    /**
     * 打印模板数据
     */
    JRTPrintTemplateDto template =null;

    /**
     * 存打印的Data数据
     */
    Hashtable<String, String> printDataMap =null;

    /**
     * 表格换页之前要执行的逻辑
     * @param gridKey
     * @param maxY
     */
    public void PreChangePageDo(String gridKey,int maxY)
    {

    }

    /**
     * 表格换页之后要执行的逻辑
     * @param gridKey
     * @param maxY
     */
    public void AfterChangePageDo(String gridKey,int maxY)
    {
        System.out.println("换页后执行逻辑");
        //画数据元素
        PrintData(template, retList, printDataMap);
        //画标签元素
        PrintLabel(template, retList);
        //画线元素
        PrintLine(template, retList);
    }

    /**
     * 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制
     *
     * @param RowID   业务主键
     * @param P1
     * @param P2
     * @param P3
     * @param P4
     * @param P5
     * @param P6
     * @param P7
     * @param P8
     * @param P9
     * @param P10
     * @param P11
     * @param P12
     * @param P13
     * @param Session
     * @param Output
     * @return
     */
    public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {
        //查询模板数据
        template = GetOneTemplate(null, "JRTReport");
        //存打印的Data数据
        printDataMap = new Hashtable<>();
        printDataMap.put("姓名", "小乌鱼");
        printDataMap.put("性别", "男");
        printDataMap.put("年龄", "32岁");
        printDataMap.put("登记号", "0947809");
        printDataMap.put("检验号", "24011901");
        printDataMap.put("科室", "体检科");
        printDataMap.put("标本", "全血");
        printDataMap.put("床号", "");
        printDataMap.put("诊断", "体检");
        printDataMap.put("采集日期", "2024-01-19");
        printDataMap.put("采集时间", "16:00");
        printDataMap.put("医嘱备注", "体检");
        printDataMap.put("医嘱名称", "血细胞分析五分类");
        printDataMap.put("申请医生", "乌鱼");
        printDataMap.put("申请日期", "2024-01-19");
        printDataMap.put("操作者", "李四");
        printDataMap.put("审核日期", "2024-01-19");
        printDataMap.put("审核时间", "17:00");
        printDataMap.put("审核者", "张三");

        //存打印的图数据
        Hashtable<String, String> printImgMap = new Hashtable<>();
        printImgMap.put("RPC", "http://localhost:8080/JRTWeb/FileService/zlz/logo.png");

        //存项目结果数据
        List<Object> repResList = new ArrayList<>();
        RepResPrintDto oneRes = new RepResPrintDto();
        oneRes.AbFlag = "*";
        oneRes.RefRange = "12-34um/ml";
        oneRes.Result = "50";
        oneRes.Seq = "1";
        oneRes.TestCodeName = "白细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "*";
        oneRes.RefRange = "12-34um/ml";
        oneRes.Result = "50";
        oneRes.Seq = "2";
        oneRes.TestCodeName = "红细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "";
        oneRes.RefRange = "12-34um/ml";
        oneRes.Result = "33";
        oneRes.Seq = "3";
        oneRes.TestCodeName = "淋巴细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "↓";
        oneRes.RefRange = "22-34um/ml";
        oneRes.Result = "5";
        oneRes.Seq = "4";
        oneRes.TestCodeName = "单核细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "↓";
        oneRes.RefRange = "22-34um/ml";
        oneRes.Result = "5";
        oneRes.Seq = "5";
        oneRes.TestCodeName = "单核细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "↓";
        oneRes.RefRange = "22-34um/ml";
        oneRes.Result = "5";
        oneRes.Seq = "6";
        oneRes.TestCodeName = "单核细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "↓";
        oneRes.RefRange = "22-34um/ml";
        oneRes.Result = "5";
        oneRes.Seq = "7";
        oneRes.TestCodeName = "单核细胞计数";
        repResList.add(oneRes);
        oneRes = new RepResPrintDto();
        oneRes.AbFlag = "↓";
        oneRes.RefRange = "22-34um/ml";
        oneRes.Result = "5";
        oneRes.Seq = "8";
        oneRes.TestCodeName = "单核细胞计数";
        repResList.add(oneRes);
        for(int k=9;k<40;k++)
        {
            oneRes = new RepResPrintDto();
            oneRes.AbFlag = "↓";
            oneRes.RefRange = "22-34um/ml";
            oneRes.Result = "5";
            oneRes.Seq = String.valueOf(k);
            oneRes.TestCodeName = "项目"+k;
            repResList.add(oneRes);
        }

        //画图片元素
        PrintImage(template, retList, printImgMap);
        //画数据元素
        PrintData(template, retList, printDataMap);
        //画标签元素
        PrintLabel(template, retList);
        //画线元素
        PrintLine(template, retList);
        //画表格元素
        PrintDataGrid(template, retList, repResList);
        return Helper.Object2Json(retList);
    }

    /**
     * 输出报告结果
     *
     * @param template
     * @param template   模板
     * @param retList    元素列表
     * @param repResList 报告结果列表
     */
    private void PrintDataGrid(JRTPrintTemplateDto template, List<PrintElement> retList, List<Object> repResList) throws Exception {
        for (JRTPrintTemplateEle ele : template.EleList) {
            //输出表格
            if (ele.PrintType.equals("DataGrid")) {
                //得到表格定义
                GridDto defGrid = (GridDto) Helper.Json2Object(ele.PrintText, GridDto.class);
                int lastY = PrintDrawProtocol.DrawGrid(retList, defGrid, null, repResList, "ReportRes", this);
            }
        }
    }

    /**
     * 输出图片
     *
     * @param template
     * @param template     模板
     * @param retList      元素列表
     * @param printDataMap 数据哈希
     */
    private void PrintImage(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {
        for (JRTPrintTemplateEle ele : template.EleList) {
            //输出图片
            if (ele.PrintType.equals("Graph")) {
                boolean isSign = false;
                if (ele.PrintFlag.equals("D")) {
                    isSign = true;
                }
                String dataField = ele.DataField;
                if (!ele.DataField.isEmpty() && printDataMap.containsKey(ele.DataField)) {
                    dataField = printDataMap.get(ele.DataField);
                }
                PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY, ele.PrintWidth, ele.PrintHeight, dataField, isSign, false);
                retList.add(printEle);
            }
        }
    }

    /**
     * 输出数据
     *
     * @param template     模板
     * @param retList      元素列表
     * @param printDataMap 数据哈希
     */
    private void PrintData(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {
        for (JRTPrintTemplateEle ele : template.EleList) {
            //输出标签
            if (ele.PrintType.equals("Data")) {
                String dataFiled = ele.DataField;
                if (!dataFiled.isEmpty() && printDataMap.containsKey(dataFiled)) {
                    //带字的条码
                    if (ele.PrintFlag.contains("BarCode")) {
                        String BarType = ele.PrintFlag.replace("BarCode", "");
                        PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), true, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);
                        retList.add(printEle);
                    }
                    //不带字的条码
                    else if (ele.PrintFlag.contains("BarCodeN")) {
                        String BarType = ele.PrintFlag.replace("BarCodeN", "");
                        PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), false, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);
                        retList.add(printEle);
                    }
                    //画普通数据
                    else {
                        PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);
                        retList.add(printEle);
                    }
                }
            }
        }
    }

    /**
     * 输出标签
     *
     * @param template
     * @param retList
     */
    private void PrintLabel(JRTPrintTemplateDto template, List<PrintElement> retList) {
        for (JRTPrintTemplateEle ele : template.EleList) {
            //输出标签
            if (ele.PrintType.equals("Label")) {
                PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, ele.PrintText, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);
                retList.add(printEle);
            }
        }
    }

    /**
     * 输出线
     *
     * @param template
     * @param retList
     */
    private void PrintLine(JRTPrintTemplateDto template, List<PrintElement> retList) {
        for (JRTPrintTemplateEle ele : template.EleList) {
            //输出先
            if (ele.PrintType.equals("ILineN")) {
                int width = ele.PrintWidth;
                int height = ele.PrintHeight;
                int endX = ele.PrintX + width;
                int endY = ele.PrintY;
                int lineWidth = height;
                if (height > width) {
                    endX = ele.PrintX;
                    endY = ele.PrintY;
                    lineWidth = width;
                }
                PrintElement printEle = PrintDrawProtocol.DrawLine(ele.PrintX, ele.PrintY, endX, endY, lineWidth, ele.PrintFlag, ele.Color);
                retList.add(printEle);
            }
        }
    }

    /**
     * 通过模板主键或者代码得到模板数据供打印使用
     *
     * @param rowID
     * @param code
     * @return
     */
    private JRTPrintTemplateDto GetOneTemplate(Integer rowID, String code) throws Exception {
        JRTPrintTemplateDto retDto = null;
        //按主键取
        if (rowID != null) {
            retDto = EntityManager().GetById(JRTPrintTemplateDto.class, rowID);
        }
        //按代码取
        else if (code != null && !code.isEmpty()) {
            retDto = EntityManager().GetByColVal(JRTPrintTemplateDto.class, "Code", code);
        }
        if (retDto != null) {
            HashParam hs = new HashParam();
            hs.Add("PrintTemplateDR", retDto.RowID);
            retDto.EleList = EntityManager().FindAllSimple(JRTPrintTemplateEle.class, hs);
        }
        return retDto;
    }

    /**
     * 存获得的一个模板数据
     */
    public static class JRTPrintTemplateDto extends JRTPrintTemplate {
        /**
         * 模板元素
         */
        public List<JRTPrintTemplateEle> EleList;
    }

    /**
     * 打印的报告结果实体
     */
    public static class RepResPrintDto {
        /**
         * 序号
         */
        public String Seq;

        /**
         * 项目名称
         */
        public String TestCodeName;

        /**
         * 结果
         */
        public String Result;

        /**
         * 标志
         */
        public String AbFlag;

        /**
         * 参考范围
         */
        public String RefRange;
    }
}

界面代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>JRTPrintTemplateEle供拷贝代码使用</title>
    <link rel="shortcut icon" href="../../resource/common/images/favicon.ico" />
    <script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script>
    <script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        SYSPageCommonInfo.Init();
        var BasePath = '';
        var ResourcePath = '';
        var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;
        var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;
        var WorkGroupDR = SYSPageCommonInfo.Data.Sesssion.WorkGroupDR;
        var sysTheme = SYSPageCommonInfo.Data.Sesssion.Theme;
        var SessionStr = SYSPageCommonInfo.Data.SessionStr;
    </script>
    <script type="text/javascript">
        //全局变量
        var me = {
            actionUrl: '../ashx/ashJRTPrintTemplateEle.ashx'
        };

        //jquery入口
        $(function () {
            //导出Excel
            $("#btnExport").click(function () {
                var para = {};
                var tempPath = DealExportExcelTMPName("打印元素.xls");
                JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');
            });

            //导出Excel多模板
            $("#btnExport1").click(function () {
                var para = {};
                var tempPath = DealExportExcelTMPName("打印元素多模板");
                JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');
            });

            //导出Excel无模板
            $("#btnExport0").click(function () {
                var para = {};
                var tempPath = "";
                JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');
            });

            //打印预览
            $("#btnPrintPreview").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PrintPreview";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";
                JRTBasePrint(Param);
            });

            //打印表格
            $("#btnPrintPreviewGrid").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PrintOut";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.DrawGrid@GetData";
                JRTBasePrint(Param);
            });

            //打印报告
            $("#btnPrintReport").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PrintOut";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintTemplateTest@GetData";
                JRTBasePrint(Param);
            });

            //集中打印
            $("#btnCenterPrint").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PrintOut";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.CenterPrintTest@GetData";
                JRTBasePrint(Param);
            });

            //在线预览
            $("#btnPrintPreviewInline").click(function () {
                showwin("#winPrintPreview", "在线打印预览", '../../facade/form/frmJRTPrintDrawView.aspx?PrintDR=' + 1 + '&PrintClassName=vm.test.PrintBarCodeTest', 950, $(window).height() - 20, true, "10px");
            });

            //打印
            $("#btnPrint").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PrintOut";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";
                JRTBasePrint(Param);
            });

            //PDF
            $("#btnPDF").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PDF#-1";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";
                JRTBasePrint(Param);
            });

            //PDF弹窗
            $("#btnPDFSave").click(function () {
                //0:打印所有报告 1:循环打印每一份报告
                var printFlag = "0";
                var userCode = "";
                //打印参数
                var paramList = "";
                //PrintOut:打印  PrintPreview打印预览
                var printType = "PDF#0";
                var printPara = "1";
                var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";
                JRTBasePrint(Param);
            });

            //上传文件到文件服务
            $("#btnUpfile").click(function () {
                $("#file_upload").click();
            });
            //改名文件
            $("#btnRenamefile").click(function () {
                //往后台提交数据
                $.ajax({
                    type: "post",
                    dataType: "json",
                    cache: false, //
                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir
                    url: me.actionUrl + '?Method=ReNameImageFile',
                    success: function (data, status) {
                        $.messager.progress('close');
                        if (!FilterBackData(data)) {
                            return;
                        }
                        alert("成功");
                    }
                });
            });
            //删除文件
            $("#btnDeletefile").click(function () {
                //往后台提交数据
                $.ajax({
                    type: "post",
                    dataType: "json",
                    cache: false, //
                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir
                    url: me.actionUrl + '?Method=DeleteImageFile',
                    success: function (data, status) {
                        $.messager.progress('close');
                        if (!FilterBackData(data)) {
                            return;
                        }
                        alert("成功");
                    }
                });
            });

            //新增数据点击
            $("#btnAddJRTPrintTemplateEle").click(function () {
                $("#txtJRTPrintTemplateEleRowID").val(""); 
				$('#winEditJRTPrintTemplateEle').window({
                    title: TranslateDataMTHD('Add Data', '新增数据', ''),
                    modal: true
                });
            });


            //修改数据点击
            $("#btnUpdateJRTPrintTemplateEle").click(function () {
				UpdateJRTPrintTemplateEle();
            });

			//修改数据
			function UpdateJRTPrintTemplateEle(row)
			{
                var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");
                if(row!=null)
                {
                	selectRow=row;
                }
                if (selectRow == null) {
                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');
                    return;
                }
				$("#formJRTPrintTemplateEle").form('load', selectRow);
				$('#winEditJRTPrintTemplateEle').window({
                    title: TranslateDataMTHD('Update Data', '修改数据', ''),
                    modal: true
                });
			}



            //删除数据点击
            $("#btnDeleteJRTPrintTemplateEle").click(function () {
                var checkRow = $('#dgJRTPrintTemplateEle').datagrid("getChecked");
                var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");
                if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {
                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');
                    return;
                }
                if ((checkRow == null || checkRow.length == 0)) {
                    checkRow=[selectRow];
                }
                var RowIDS = "";
                for (var i = 0; i < checkRow.length; i++) {
                    if (i == 0) {
                        RowIDS = checkRow[i].RowID;
                    }
                    else {
                        RowIDS += "^" + checkRow[i].RowID;
                    }
                }
                $.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {
                    if (r) {
                		//开启等待
                		$.messager.progress({ text: TranslateDataMTHD("Deleting data","正在删除数据", ""), interval: 500 });
                		setTimeout(function () {
                    		$.messager.progress('close');
                		}, 8000);
                		//往后台提交数据
                		$.ajax({
                    		type: "post",
                    		dataType: "json",
                    		cache: false, //
                    		async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir
                    		url: me.actionUrl + '?Method=DeleteJRTPrintTemplateEle',
                    		data: { RowIDS: RowIDS },
                    		success: function (data, status) {
                        		$.messager.progress('close');
                        		if (!FilterBackData(data)) {
                            		return;
                        		}
                        		if (!data.IsOk) {
                            		$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);
                        		}
                        		else {
                            		QryJRTPrintTemplateEle();
                            		$.messager.show({
                                		title: TranslateDataMTHD("Info", "提示", ""),
                               		 	msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),
                                		timeout: 500,
                                		showType: 'slide'
                            		});
                        		}
                    		}
                		});
                    }
                });
            });


            //保存数据
            $("#btnSaveJRTPrintTemplateEle").click(function () {
                var saveData = jQuery.parseJSON($("#formJRTPrintTemplateEle").serializeObject());
                //开启等待
                $.messager.progress({ text: TranslateDataMTHD("Saving data","正在保存数据", ""), interval: 500 });
                setTimeout(function () {
                    $.messager.progress('close');
                }, 8000);
                //往后台提交数据
                $.ajax({
                    type: "post",
                    dataType: "json",
                    cache: false, //
                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir
                    url: me.actionUrl + '?Method=SaveJRTPrintTemplateEle',
                    data: saveData,
                    success: function (data, status) {
                        $.messager.progress('close');
                        if (!FilterBackData(data)) {
                            return;
                        }
                        if (!data.IsOk) {
                            $.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);
                        }
                        else {
                            QryJRTPrintTemplateEle();
                            $.messager.show({
                                title: TranslateDataMTHD("Info", "提示", ""),
                                msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),
                                timeout: 500,
                                showType: 'slide'
                            });
                            $('#winEditJRTPrintTemplateEle').window("close");
                        }
                    }
                });
            });


            //关闭窗口
            $("#btnCloseJRTPrintTemplateEle").click(function () {
				$('#winEditJRTPrintTemplateEle').window("close");
            });


            //构造查询事件
            $("#txtFilterJRTPrintTemplateEle").searchbox({
                searcher: function (value, name) {
                    QryJRTPrintTemplateEle();
                },
                prompt: TranslateDataMTHD('Enter query', '回车查询', '')
            });



            //模板下拉表格渲染
            $('#txtJRTPrintTemplateElePrintTemplateDR').combogrid({
                panelWidth: 350,
                idField: 'RowID',
                width: 205,
                textField: 'CName',
                url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: "JRTPrintTemplate", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] }),
                columns: [[
                    { field: 'RowID', title: '主键', width: 60 },
                    { field: 'CName', title: '名称', width: 260 }
                ]]
            });
            $('#txtJRTPrintTemplateElePrintTemplateDR').combogrid("showSelectWin");

            //JRTPrintTemplateEle表格
            $('#dgJRTPrintTemplateEle').datagrid({
                remoteSort:false,
                singleSelect: true,
                toolbar: "#dgJRTPrintTemplateEleToolBar",
                fit: true,
                onSelect: function (index, row) {
                    //方便拷贝到子表查询用
                	var selectJRTPrintTemplateEle=$('#dgJRTPrintTemplateEle').datagrid("getSelected");
                },
                onDblClickRow: function (index, row) {
                    UpdateJRTPrintTemplateEle(row);
                },

                columns: [[
                    { field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },
                    { field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150, sortable: true },
                    { field: 'PrintTemplateDRName', title: TranslateDataMTHD('PrintTemplateDRName', '模板', '') , width: 150, sortable: true },
                    { field: 'PrintType', title: TranslateDataMTHD('PrintType', '元素类型', '') , width: 150, sortable: true },
                    { field: 'PrintX', title: TranslateDataMTHD('PrintX', 'X坐标', '') , width: 150, sortable: true },
                    { field: 'PrintY', title: TranslateDataMTHD('PrintY', 'Y坐标', '') , width: 150, sortable: true },
                    { field: 'PrintFont', title: TranslateDataMTHD('PrintFont', '打印字体', '') , width: 150, sortable: true },
                    { field: 'PrintFontSize', title: TranslateDataMTHD('PrintFontSize', '打印字体大小', '') , width: 150, sortable: true },
                    { field: 'PrintFontStyle', title: TranslateDataMTHD('PrintFontStyle', '打印字体样式', '') , width: 150, sortable: true },
                    { field: 'PrintLength', title: TranslateDataMTHD('PrintLength', '打印长度', '') , width: 150, sortable: true },
                    { field: 'PrintWidth', title: TranslateDataMTHD('PrintWidth', '元素宽度', '') , width: 150, sortable: true },
                    { field: 'PrintHeight', title: TranslateDataMTHD('PrintHeight', '元素高度', '') , width: 150, sortable: true },
                    { field: 'PrintText', title: TranslateDataMTHD('PrintText', '元素文本', '') , width: 150, sortable: true },
                    { field: 'DataField', title: TranslateDataMTHD('DataField', '绑定属性', '') , width: 150, sortable: true },
                    { field: 'PrintFlag', title: TranslateDataMTHD('PrintFlag', '特殊标志', '') , width: 150, sortable: true },
                    { field: 'PrintAlignment', title: TranslateDataMTHD('PrintAlignment', '停靠方向', '') , width: 150, sortable: true },
                    { field: 'LayOut', title: TranslateDataMTHD('LayOut', '布局方式', '') , width: 150, sortable: true },
                    { field: 'Angle', title: TranslateDataMTHD('Angle', '旋转角度', '') , width: 150, sortable: true },
                    { field: 'IsVShow', title: TranslateDataMTHD('IsVShow', '是否垂直显示', '') , width: 150, sortable: true },
                    { field: 'Color', title: TranslateDataMTHD('Color', '颜色', '') , width: 150, sortable: true },
                    { field: 'FixedReport', title: TranslateDataMTHD('FixedReport', '固定元素', '') , width: 150, sortable: true }
                ]]
            });


            //查询JRTPrintTemplateEle
            function QryJRTPrintTemplateEle() {
                var Filter = $("#txtFilterJRTPrintTemplateEle").searchbox("getValue");
                //开启等待,默认注释,在单击事件调用的逻辑启用等待会冲掉双击事件,按需要开启
                //$.messager.progress({ text: TranslateDataMTHD("Querying data","正在查询数据", ""), interval: 500 });
                //setTimeout(function () {
                    //$.messager.progress('close');
                //}, 8000);
                $.ajax({
                    type: "post",
                    dataType: "json",
                    cache: false, //
                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir
                    url: me.actionUrl + '?Method=QryJRTPrintTemplateEle',
                    data: { Filter: Filter },
                    success: function (data, status) {
                        //结束等待
                        //$.messager.progress('close');
                        if (!FilterBackData(data)) {
                           return;
                        }
                        $('#dgJRTPrintTemplateEle').datagrid("loadData", data);
                    }
                });
            };


            //执行查询数据
            QryJRTPrintTemplateEle();


		});
    </script>
</head>
<body>
    <div class="easyui-layout" fit="true" style="border: none;">
        <div data-options="region:'center',title:''" style="border: none;">
            <div id="dgJRTPrintTemplateEleToolBar" style="padding: 3px 0px 3px 10px;">
                <a id="btnAddJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a>
                <a id="btnUpdateJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a>
                <a id="btnDeleteJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a>
                <input id="txtFilterJRTPrintTemplateEle" style="margin-left: 14px; width: 240px;"></input>
                <a id="btnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出</a>
                <a id="btnExport1" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出多模板</a>
                <a id="btnExport0" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出无模板</a>
                <a id="btnPrintPreview" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">打印预览</a>
                <a id="btnPrintPreviewInline" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">在线预览</a>
                <a id="btnPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~Print">打印</a>
                <a id="btnPDF" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF</a>
                <a id="btnPDFSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF弹</a>
                <a id="btnPrintPreviewGrid" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintGrid">打表格</a>
                <a id="btnPrintReport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintReport">打报告</a>
                <a id="btnCenterPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~CenterPrint">集中打印</a>
                <a id="btnUpfile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">上传文件</a>
                <a id="btnRenamefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">改名</a>
                <a id="btnDeletefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">删除</a>
            </div>
            <table id="dgJRTPrintTemplateEle" title="" iconcls="icon-paper" listranslate="title~JRTPrintTemplateEle"></table>
        </div>
        <div id="winEditJRTPrintTemplateEle" style="padding: 10px 0px 0px 10px;width:1140px;height:366.6666666666666667px;display: none;">
            <form id="formJRTPrintTemplateEle" name="edit_form" method="post">
                <input type="hidden" id="txtJRTPrintTemplateEleRowID" name="RowID" value="0" />
                <table>
                    <tr>
                        <td class="lisar" jrttranslate="html~PrintTemplateDR">模板</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintTemplateDR" type="text" name="PrintTemplateDR" style="width:200px;"/></td>
                        <td class="lisar" jrttranslate="html~PrintType">元素类型</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintType" type="text" name="PrintType" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td>
                        <td class="lisar" jrttranslate="html~PrintX">X坐标</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintX" type="text" name="PrintX" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~PrintY">Y坐标</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintY" type="text" name="PrintY" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~PrintFont">打印字体</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintFont" type="text" name="PrintFont" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td>
                        <td class="lisar" jrttranslate="html~PrintFontSize">打印字体大小</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintFontSize" type="text" name="PrintFontSize" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~PrintFontStyle">打印字体样式</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintFontStyle" type="text" name="PrintFontStyle" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td>
                        <td class="lisar" jrttranslate="html~PrintLength">打印长度</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintLength" type="text" name="PrintLength" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~PrintWidth">元素宽度</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintWidth" type="text" name="PrintWidth" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~PrintHeight">元素高度</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintHeight" type="text" name="PrintHeight" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~PrintText">元素文本</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintText" type="text" name="PrintText" style="width:200px;" class="easyui-validatebox"  maxlength="2000"/></td>
                        <td class="lisar" jrttranslate="html~DataField">绑定属性</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleDataField" type="text" name="DataField" style="width:200px;" class="easyui-validatebox"  maxlength="500"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~PrintFlag">特殊标志</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintFlag" type="text" name="PrintFlag" style="width:200px;" class="easyui-validatebox"  maxlength="50"/></td>
                        <td class="lisar" jrttranslate="html~PrintAlignment">停靠方向</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateElePrintAlignment" type="text" name="PrintAlignment" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~LayOut">布局方式</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleLayOut" type="text" name="LayOut" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~Angle">旋转角度</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleAngle" type="text" name="Angle" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~IsVShow">是否垂直显示</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleIsVShow" type="text" name="IsVShow" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~Color">颜色</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleColor" type="text" name="Color" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~FixedReport">固定元素</td>
                        <td class="lisal"><input id="txtJRTPrintTemplateEleFixedReport" type="text" name="FixedReport" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                </table>
                <div region="south" border="fale" style="text-align: center; padding: 5px 0 0;">
                    <a id="btnSaveJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Save">保存</a>
                    <span class="sp6"></span>
                    <a id="btnCloseJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Cancel">取消</a>
                </div>
            </form>
        </div>
        <div id="winPrintPreview" style="padding: 10px 0px 0px 10px; width: 1140px; height: 786px; display: none;">
        </div>
</body>
</html>


通过最近的实践发现逻辑强悍还是赶不上设计强悍,想想以前用M写打印怪考验逻辑的

文章来源:https://blog.csdn.net/zhanglianzhu_91/article/details/135788750
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。