页面解析JSON并显示
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
<%@ taglib uri="/WEB-INF/sino-tags.tld" prefix="sino"%>
<%@ page import="com.sinosoft.util.tool.*"%>
<%
String css = ParamUtils.getSession(session,"userStyle");//CSS信息
String userid = ParamUtils.getSession(session,"userID");
String module=request.getParameter("module");
String sql="select gzid, gzmc, gzsql from edu_switch where gzlx='1'";
%>
<html>
<head>
<title>领导审核规则</title>
<link href="<%=request.getContextPath()%>/css/<%=css%>/module_new.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.2.6.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/edui.js"></script>
<script type="text/javascript">
function initTable(){
j.ajax({
type:"POST",
url:"deal.jsp",
data:"dealtype=queryTab",
async: false,
success:function(data){
if(null!=data) {
j("#varSel").append(data);
}
}
});
}
function insertVar(){
var varSel = j("select[@name=varSel] option[@selected]").val();
j("#gzsql").val(j("#gzsql").val()+varSel);
}
function insertVal(){
var varVal = j("select[@name=dicSel] option[@selected]").val();
j("#gzsql").val(j("#gzsql").val()+varVal);
}
function insertLogic(){
var varLogic = j("select[@name=dicLogic] option[@selected]").val();
j("#gzsql").val(j("#gzsql").val()+varLogic);
}
//单击每行时,将该行数据设置到表单中
function trClick(gzid,gzmc,gzsql){
j("#gzmc").val(gzmc);
j("#gzsql").val(gzsql);
j("#gzid").val(gzid);
j("#gzidval").val(gzid);
}
//清除表单值
function clearVal(){
j("#gzmc").val("");
j("#gzsql").val("");
j("#gzid").val("");
j("#gzidval").val("");
}
var j = jQuery.noConflict();
j(document).ready(function(){
initTable();
j(".ListTdTitle,.ListTdTitle1").click(function(){
//alert(j(this).html());
var gzmc=j(this).find("#tabGzmc").val();
var gzsql=j(this).find("#tabGzsql").val();
var gzid=j(this).find("#tabGzid").val();
j("#gzmc").val(gzmc);
j("#gzsql").val(gzsql);
j("#gzid").val(gzid);
j("#gzidval").val(gzid);
});
//根据字段获取是否有码表配置
j("#varSel").change(function(){
j.ajax({
type:"POST",
url:"deal.jsp",
data:"dealtype=getDic&ziduan="+j("#varSel").val(),
async: false,
success:function(data){
j("#dicSel").html(data);
}
});
});
//增加一行
j("#btn_save").click(function(){
//取相关值
var gzsql = j("#gzsql").val();
var gzmc = j("#gzmc").val();
var gzid = j("#gzid").val();
j("#gzmc").val("");
j("#gzsql").val("");
var orderTab = j("#orderTable");
gzid=j("#gzidval").val();
gzsql=encodeURI(encodeURI(gzsql));
//alert("<%=request.getContextPath()%>/audit/eduSwitchAction.do?method=save&type=1&gzsql="+gzsql+"&gzmc="+gzmc+"&gzid="+gzid);
//执行保存操作
j.ajax({
type: "POST",
//async: false,
url: "<%=request.getContextPath()%>/audit/eduSwitchAction.do?method=save&type=1&gzsql="+gzsql+"&gzmc="+gzmc+"&gzid="+gzid,
success: function(msg){
//alert(msg);
msg=eval("("+msg+")");
fillTable(msg);
clearVal();
}
});
j("#gzidval").val("");
});
});
//刷新列表,传入返回的列表json对象
function fillTable(json){
//清除原来所有行
//j("#orderTable tr:not(:first)").empty();
var firstTr=j("