You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.3 KiB
157 lines
5.3 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
|
<%@ include file="/common/ctx.jsp" %>
|
|
|
|
<html>
|
|
<head>
|
|
|
|
<title>My JSP 'gnpz.jsp' starting page</title>
|
|
|
|
<meta http-equiv="pragma" content="no-cache">
|
|
<meta http-equiv="cache-control" content="no-cache">
|
|
<meta http-equiv="expires" content="0">
|
|
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
|
|
<meta http-equiv="description" content="This is my page">
|
|
<!--
|
|
<link rel="stylesheet" type="text/css" href="styles.css">
|
|
-->
|
|
|
|
<%--弹框--%>
|
|
<script type="text/javascript" src="${ctx}/js/jquery-1.8.2.min.js"></script>
|
|
<script src="${ctx}/js/layer/layer.js"></script>
|
|
<%--表单工具--%>
|
|
<script src="${ctx}/js/common/cjy_form.js"></script>
|
|
<script src="${ctx}/js/common/cjy_common.js"></script>
|
|
<%--json工具--%>
|
|
<script type="text/javascript" src="${ctx}/js/common/json_form.js"></script>
|
|
<!-- 字体图标 -->
|
|
<link href="${ctx}/assets/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
|
|
<link href="${ctx}/assets/ionicon/css/ionicons.min.css" rel="stylesheet"/>
|
|
<link href="${ctx}/css/material-design-iconic-font.min.css" rel="stylesheet">
|
|
<!-- 自定义样式 -->
|
|
<link href="${ctx}/hbcyjc/resourceNew/css/cjy_style.css" rel="stylesheet"/>
|
|
<link href="${ctx}/hbcyjc/resourceNew/css/cjy_style2.css" rel="stylesheet"/>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="${ctx}/js/JQuery zTree v3.4/css/demo.css" type="text/css">
|
|
<link rel="stylesheet" href="${ctx}/js/JQuery zTree v3.4/css/zTreeStyle/zTreeStyle.css" type="text/css">
|
|
<script type="text/javascript" src="${ctx}/js/JQuery zTree v3.4/js/jquery.ztree.core-3.4.js"></script>
|
|
<script type="text/javascript" src="${ctx}/js/JQuery zTree v3.4/js/jquery.ztree.excheck-3.4.js"></script>
|
|
|
|
<SCRIPT type="text/javascript">
|
|
|
|
var setting = {
|
|
check : {
|
|
enable : true
|
|
},
|
|
data : {
|
|
simpleData : {
|
|
enable : true
|
|
}
|
|
}
|
|
};
|
|
|
|
// var zNodes = [
|
|
// {id : 1,pId : 0,name : "随意勾选 1",open : true},
|
|
// {id : 11,pId : 1,name : "随意勾选 1-1",open : true},
|
|
// {id : 111,pId : 11,name : "随意勾选 1-1-1"},
|
|
// {id : 112,pId : 11,name : "随意勾选 1-1-2"},
|
|
// {id : 12,pId : 1,name : "随意勾选 1-2",open : true},
|
|
// {id : 121,pId : 12,name : "随意勾选 1-2-1"},
|
|
// {id : 122,pId : 12,name : "随意勾选 1-2-2"},
|
|
// {id : 2,pId : 0,name : "随意勾选 2",checked : true,open : true},
|
|
// {id : 21,pId : 2,name : "随意勾选 2-1"},
|
|
// {id : 22,pId : 2,name : "随意勾选 2-2",open : true,checked : true}, //checked:true ---默认选中
|
|
// {id : 221,pId : 22,name : "随意勾选 2-2-1",checked : true},
|
|
// {id : 222,pId : 22,name : "随意勾选 2-2-2",checked : true},
|
|
// {id : 23,pId : 2,name : "随意勾选 2-3"}
|
|
// ];
|
|
|
|
var zNodes = [{id : 1,pId : 0,name : "程序出错请联系管理员",open : true},];
|
|
|
|
zNodes = ${diclist};
|
|
var code;
|
|
|
|
//级联选中,当选中子叶后,他的父级对应选中
|
|
function setCheck() {
|
|
var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
|
|
type = {
|
|
"Y" : 'ps',
|
|
"N" : 'ps'
|
|
};
|
|
zTree.setting.check.chkboxType = type;
|
|
showCode('setting.check.chkboxType = { "Y" : "' + type.Y + '", "N" : "' + type.N + '" };');
|
|
}
|
|
|
|
function showCode(str) {
|
|
if (!code)
|
|
code = $("#code");
|
|
code.empty();
|
|
code.append("<li>" + str + "</li>");
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
|
setCheck();
|
|
});
|
|
|
|
//保存配置
|
|
function save(){
|
|
var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
|
|
var nodes = treeObj.getCheckedNodes(true); //获得选中的值
|
|
var result = JSON.stringify(nodes);
|
|
$.ajax({
|
|
url : "${ctx}/hbcyjclogin/saveChoiceztree.do", //后台处理程序
|
|
type : "post", //数据发送方式
|
|
dataType : "json", //接受数据格式
|
|
data : {"nodes":result},
|
|
success : function(result) {
|
|
var choseid = result.id;
|
|
var chosename = result.name;
|
|
if(choseid!=null && choseid != ''){
|
|
parent.$("#ztreechoseid").val(choseid); //将选中的id值赋值到父页面
|
|
parent.$("#ztreechosename").val(chosename); //将选中的菜单名称值赋值到父页面
|
|
}else{
|
|
parent.$("#ztreechoseid").val(""); //将选中的id值赋值到父页面
|
|
parent.$("#ztreechosename").val(""); //将选中的菜单名称值赋值到父页面
|
|
}
|
|
//关闭窗口
|
|
my_cancel();
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function my_cancel() {
|
|
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
|
parent.layer.close(index) //关闭弹出框
|
|
}
|
|
|
|
|
|
</SCRIPT>
|
|
<style>
|
|
ul.ztree{width:580px}
|
|
.form-control{background:#04489D; color: #fff;
|
|
border: 1px solid #04489D;
|
|
padding: 10px;}
|
|
div.content_wrap div.left {
|
|
float: left;
|
|
width: 590px;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<div class="xingk_nr"></div>
|
|
<div class="content_wrap">
|
|
<div class="zTreeDemoBackground left">
|
|
<ul id="treeDemo" class="ztree"></ul>
|
|
<div style="text-align: center;padding: 10px;"><button type="button" class="form-control" onclick="save()"><i class="fa fa-save"></i>保存</button></div>
|
|
</div>
|
|
</div>
|
|
</html>
|
|
|