此文章是基于 EasyUI+Knockout实现经典表单的查看、编辑
一. 相关文件介绍
1. log.jsp:系统日志管理界面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>日志管理</title> <%@ include file="/common/head.jsp"%> </head> <body> <div class="toolbar"> <a href="#" plain="true" class="easyui-linkbutton" icon="icon-arrow_refresh" title="刷新" data-bind="click:refreshClick">刷新</a> </div> <div id="condition" class="container_12" style="position:relative;height:50px;"> <div class="clear" style="height:13px;"></div> <div class="grid_1 lbl">日志日期</div> <div class="grid_2 val"><input type="text" data-bind="value:form.logDate" class="txtBox easyui-daterange"/></div> <div class="prefix_9" style="position:absolute;top:5px;height:0;"> <a id="search" href="#" class="buttonHuge button-blue" style="margin:0 15px;" data-bind="click:searchClick">查询</a> <a id="reset" href="#" class="buttonHuge button-blue" data-bind="click:clearClick">清空</a> </div> </div> <div id="tt" class="easyui-tabs"> <div title="系统日志" > <table data-bind="datagrid:system"> <thead> <tr> <th field="fileName" align="left" width="150" >日志文件 </th> <th field="fileSize" align="left" width="100" >文件大小 </th> <th field="id" align="center" width="150" formatter="formatsys_log" >操作 </th> </tr> </thead> </table> </div> </div> <script type="text/html" id="log-view-template"> <div id="logView" style="margin:5px 0;font-size:12px;white-space:nowrap;"> </div> </script> <%@ include file="/common/foot.jsp"%> <script type="text/javascript" src="viewModel/sys/log.js"></script> <script type="text/javascript"> using(['messager', 'dialog']); ko.bindingViewModel(new viewModel()); var formatsys_log = function (value) { var html = '<a href="javascript:;" onclick=\'view("' + value + '")\'><span class="icon icon-search"> </span>[查看]</a>'; html += '<a href="'+rootPath+'/sys/log!download.do?fileName='+value+'" style="margin-left:10px"><span class="icon icon-download"> </span>[下载]</a>'; return html; }; </script> </body> </html>