配置实现-打印(生成静态html)使用

来源:互联网 发布:白帽优化 编辑:程序博客网 时间:2024/06/05 23:42

l  打印(生成静态html)使用

1、   采用打印模板实现打印配置的加载和展现。调用方法:Tmp/TplDetail.aspx?n=printTest(仅xml配置的文件名,不含后缀)

2、   Htm配置文件,如printTest.htm需在配置的xml目录的Tpl目录下。(自定义标签说明见html模板自定义标签)

3、   Xml配置文件,如printTest.xml需在配置的xml目录的Query目录下

4、   以printTest.htm为例:

<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>测试问题</title>

    <metahttp-equiv="Content-Type" content="text/html;charset=utf-8" />

    <link href="../Css/print.css"rel="stylesheet" type="text/css" />

</head>

<body>

    <div class="operation">

        <input type="button"value="打 印"onclick="window.print();" />

       &nbsp;&nbsp;&nbsp;&nbsp;<inputtype="button" value="关 闭"onclick="window.top.close();" />

    </div>

    <div align="center">

        <table border="1"cellpadding="0" cellspacing="0">

            <colgroup>

                <col width="120px"/>

                <col width="210px"/>

                <col width="100px"/>

                <col />

            </colgroup>

            <tr>

                <th>

                    归属模块

                </th>

                <td>

                    #t.0.funname#

                </td>

                <th>

                    发现时间

                </th>

                <td>

                    #t.0.rdate#

                </td>

            </tr>

            <tr>

                <th>

                    问题

                </th>

                <tdcolspan="3">

                    #t.0.title#

                </td>

            </tr>

            <tr>

                <th>

                    描述

                </th>

                <tdcolspan="3">

                    #t.0.notes#

                </td>

            </tr>

             <tr>

                <th>

                    严重程度

                </th>

                <td>

                    #t.0.iclass#

                </td>

                <th>

                    当前状态

                </th>

                <td>

                    #t.0.iflag#

                </td>

            </tr>

            <tr>

                <th>

                    问题截屏

                </th>

                <tdcolspan="3">

                    <imghref="Sys/Down.aspx?f=#t.0.filename#&t=file">

                </td>

            </tr>

             <tr>

                <th>

                    人员姓名

                </th>

                <td>

                    #t.0.username#

                </td>

                <th>

                    操作时间

                </th>

                <td>

                    #t.0.optime#

                </td>

            </tr>

        </table>

    </div>

    <div class="operation">

        <input type="button"value="打 印"onclick="window.print();" />

       &nbsp;&nbsp;&nbsp;&nbsp;<inputtype="button" value="关 闭"onclick="window.top.close();" />

    </div>

</body>

</html>

5、   以printTest.xml为例:

<?xmlversion="1.0" encoding="utf-8"?>

<root>

  <myquery title="测试问题">

    <sql name="t"paranames="id">

      <![CDATA[select

      ,s_test.rdate

      ,s_test.title

      ,s_test.notes

      ,s_test.filename

      ,s_user.name as username

      ,s_test.optime

      ,case s_test.iflag when 0 then '发现' when 1 then '确认' when 2 then '解决' else '关闭' end

      ,s_fun.name as funname

      ,case s_test.iclass when 1 then '严重' when 2 then '次要' when 3 then '一般' else '新需求 end

  from s_test

  left join s_fun on s_test.funid=s_fun.id

  inner join s_user on s_user.id=s_test.userid

  where s_test.id={0}]]>

    </sql>

    <select>

      <column name="rdate"value="  年 月 日"dataformat="{0:yyyy年MM月dd日}"></column>

      <column name="optime"value="  年 月 日 时 分"dataformat="{0:yyyy年MM月dd日HH时mm分}"></column>

    </select>

  </myquery>

</root>

 

欢迎访问:http://121.18.78.216 适易查询分析、工作流、内容管理及项目管理演示平台