Commit 297b19f6 by liuyongshuai

改版ztree;增加ztree查询功能;修改内蒙特殊单位问题;修复浏览器记录用户历史输入的bug;调整用户修改功能,跳转新的页面

parent 5a7cf2e2
......@@ -528,14 +528,13 @@
from sys_role r join sys_user_role u on r.id=u.role_id where u.scbz='0' and r.scbz='0' GROUP BY u.user_id) tt
on t.id=tt.user_id
where scbz='0'
<if test="countycode !=null"> and UNITCODE like '%'||#{countycode}||'%'</if>
<if test="countycode !=null"> and REGEXP_LIKE (UNITCODE, '^'||#{countycode})</if>
<if test="roleName !=null"> and ROLENAME like '%'||#{roleName}||'%'</if>
<if test="username !=null"> and USERNAME like '%'||#{username}||'%'</if>
<if test="trueName !=null"> and true_name like '%'||#{trueName}||'%'</if>
<if test="identitycard !=null"> and IDENTITYCARD like '%'||#{identitycard}||'%'</if>
<if test="policemanid !=null"> and policemanid like '%'||#{policemanid}||'%'</if>
<if test="unitcode !=null"> and unitcode like '%'||#{unitcode}||'%'</if>
<if test="sex !=null"> and sex = #sex#</if>
<if test="unitcode !=null"> and UNITCODE like '%'||#{unitcode}||'%'</if>
<if test="openFlag !=null"> and OPEN_FLAG =#{openFlag,jdbcType=VARCHAR}</if>
) t where ROWNUM <![CDATA[<=]]>
${limit*page}
......@@ -551,14 +550,13 @@
from sys_role r join sys_user_role u on r.id=u.role_id where u.scbz='0' and r.scbz='0' GROUP BY u.user_id) tt
on t.id=tt.user_id
where scbz='0'
<if test="countycode !=null"> and UNITCODE like '%'||#{countycode}||'%'</if>
<if test="countycode !=null"> and REGEXP_LIKE (UNITCODE, '^'||#{countycode})</if>
<if test="roleName !=null"> and ROLENAME like '%'||#{roleName}||'%'</if>
<if test="username !=null"> and USERNAME like '%'||#{username}||'%'</if>
<if test="trueName !=null"> and true_name like '%'||#{trueName}||'%'</if>
<if test="identitycard !=null"> and IDENTITYCARD like '%'||#{identitycard}||'%'</if>
<if test="policemanid !=null"> and policemanid like '%'||#{policemanid}||'%'</if>
<if test="unitcode !=null"> and unitcode like '%'||#{unitcode}||'%'</if>
<if test="sex !=null"> and sex = #sex#</if>
<if test="openFlag !=null"> and OPEN_FLAG =#{openFlag,jdbcType=VARCHAR}</if>
</select>
......@@ -576,14 +574,13 @@
from sys_role r join sys_user_role u on r.id=u.role_id where u.scbz='0' and r.scbz='0' GROUP BY u.user_id) tt
on t.id=tt.user_id
where scbz='0'
<if test="countycode !=null"> and UNITCODE like '%'||#{countycode}||'%'</if>
<if test="countycode !=null"> and REGEXP_LIKE (UNITCODE, '^'||#{countycode})</if>
<if test="roleName !=null"> and ROLENAME like '%'||#{roleName}||'%'</if>
<if test="username !=null"> and USERNAME like '%'||#{username}||'%'</if>
<if test="trueName !=null"> and true_name like '%'||#{trueName}||'%'</if>
<if test="identitycard !=null"> and IDENTITYCARD like '%'||#{identitycard}||'%'</if>
<if test="policemanid !=null"> and policemanid like '%'||#{policemanid}||'%'</if>
<if test="unitcode !=null"> and unitcode like '%'||#{unitcode}||'%'</if>
<if test="sex !=null"> and sex = #sex#</if>
<if test="openFlag !=null"> and OPEN_FLAG =#{openFlag,jdbcType=VARCHAR}</if>
) t where ROWNUM <![CDATA[<=]]>
${limit*page}
......@@ -599,14 +596,13 @@
from sys_role r join sys_user_role u on r.id=u.role_id where u.scbz='0' and r.scbz='0' GROUP BY u.user_id) tt
on t.id=tt.user_id
where scbz='0'
<if test="countycode !=null"> and UNITCODE like '%'||#{countycode}||'%'</if>
<if test="countycode !=null"> and REGEXP_LIKE (UNITCODE, '^'||#{countycode})</if>
<if test="roleName !=null"> and ROLENAME like '%'||#{roleName}||'%'</if>
<if test="username !=null"> and USERNAME like '%'||#{username}||'%'</if>
<if test="trueName !=null"> and true_name like '%'||#{trueName}||'%'</if>
<if test="identitycard !=null"> and IDENTITYCARD like '%'||#{identitycard}||'%'</if>
<if test="policemanid !=null"> and policemanid like '%'||#{policemanid}||'%'</if>
<if test="unitcode !=null"> and unitcode like '%'||#{unitcode}||'%'</if>
<if test="sex !=null"> and sex = #sex#</if>
<if test="openFlag !=null"> and OPEN_FLAG =#{openFlag,jdbcType=VARCHAR}</if>
</select>
<!--批量添加用户角色信息-->
......
......@@ -122,9 +122,14 @@
<div class="layui-input-block">
<input type="text" name="pidName" id="pidName"
class="layui-input code-icon" autocomplete="off" onclick="checkTree('mytree');">
<input type="text" id="pid" Name="pid" style="display: none;">
<input type="text" id="pid" Name="pid" autocomplete="off" style="display: none;">
<%--<span class="layui-btn" id="checkPer" onclick="checkTree('mytree');" style="">选择父级</span>--%>
<div id="mytree" style="display: none;">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="tree" class="ztree"></ul>
</div>
</div>
......@@ -134,9 +139,14 @@
<div class="layui-input-block">
<input type="text" name="roleName" id="roleName"
class="layui-input code-icon" autocomplete="off" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" Name="roleId" style="display: none;">
<input type="text" id="roleId" autocomplete="off" Name="roleId" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');" style="">选择角色</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......
......@@ -7,6 +7,7 @@
<script src="${pageContext.request.contextPath}/resources/jquery-3.1.0.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.core.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.excheck.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.exhide.js"></script>
<script src="${pageContext.request.contextPath}/resources/common/common.js"></script>
<style>
body {
......
......@@ -131,10 +131,15 @@
<label class="layui-form-label">父级权限</label>
<div class="layui-input-block">
<input type="text" name="pidName" id="pidName"
class="layui-input code-icon" onclick="checkTree('mytree');">
<input type="text" id="pid" Name="pid" style="display: none;">
class="layui-input code-icon" autocomplete="off" onclick="checkTree('mytree');">
<input type="text" id="pid" autocomplete="off" Name="pid" style="display: none;">
<%--<span class="layui-btn" id="checkPer" onclick="checkTree('mytree');" style="">选择父级</span>--%>
<div id="mytree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="tree" class="ztree"></ul>
</div>
</div>
......@@ -143,10 +148,15 @@
<label class="layui-form-label">关联角色</label>
<div class="layui-input-block">
<input type="text" name="roleName" id="roleName"
class="layui-input code-icon" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" Name="roleId" style="display: none;">
class="layui-input code-icon" autocomplete="off" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" autocomplete="off" Name="roleId" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');" style="">选择角色</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......
......@@ -75,9 +75,14 @@
<div class="layui-input-block">
<input type="text" name="pidName" id="pidName"
class="layui-input code-icon" autocomplete="off" lay-verify="required" onclick="checkTree('myRoleTree');">
<input type="text" id="pid" Name="pid" style="display: none;">
<input type="text" id="pid" autocomplete="off" Name="pid" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');">选择父级</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......@@ -87,9 +92,14 @@
<div class="layui-input-block">
<input type="text" name="permissionName" id="permissionName" autocomplete="off" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myPermissionTree');">
<input type="text" id="permissionId" Name="permissionId" style="display: none;">
<input type="text" id="permissionId" autocomplete="off" Name="permissionId" style="display: none;">
<%--<span class="layui-btn" id="checkPer" onclick="checkTree('myPermissionTree');">选择权限</span>--%>
<div id="myPermissionTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="permissionTree" class="ztree"></ul>
</div>
</div>
......
......@@ -7,6 +7,7 @@
<script src="${pageContext.request.contextPath}/resources/jquery-3.1.0.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.core.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.excheck.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.exhide.js"></script>
<script src="${pageContext.request.contextPath}/resources/common/common.js"></script>
<style>
body {
......
......@@ -77,10 +77,15 @@
<label class="layui-form-label">父级角色</label>
<div class="layui-input-block">
<input type="text" name="pidName" id="pidName"
class="layui-input code-icon" onclick="checkTree('myRoleTree');">
<input type="text" id="pid" Name="pid" style="display: none;">
class="layui-input code-icon" autocomplete="off" onclick="checkTree('myRoleTree');">
<input type="text" id="pid" autocomplete="off" Name="pid" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');">选择父级</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......@@ -88,11 +93,16 @@
<div class="layui-form-item btx" id="hasPermission">
<label class="layui-form-label">拥有权限</label>
<div class="layui-input-block">
<input type="text" name="permissionName" id="permissionName" lay-verify="required"
<input type="text" name="permissionName" autocomplete="off" id="permissionName" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myPermissionTree');">
<input type="text" id="permissionId" Name="permissionId" style="display: none;">
<input type="text" id="permissionId" autocomplete="off" Name="permissionId" style="display: none;">
<%--<span class="layui-btn" id="checkPer" onclick="checkTree('myPermissionTree');">选择权限</span>--%>
<div id="myPermissionTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="permissionTree" class="ztree"></ul>
</div>
</div>
......
......@@ -134,9 +134,14 @@
<div class="layui-input-block">
<input type="text" name="unitname" autocomplete="off" id="unitname" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myUnitTree');">
<input type="text" id="unitcode" Name="unitcode" style="display: none;">
<input type="text" id="unitcode" autocomplete="off" Name="unitcode" style="display: none;">
<%--<span class="layui-btn" id="checkPer" >选择单位</span>--%>
<div id="myUnitTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="unit" class="ztree"></ul>
</div>
</div>
......@@ -147,9 +152,14 @@
<div class="layui-input-block">
<input type="text" name="roleName" id="roleName" autocomplete="off" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" Name="roleId" style="display: none;">
<input type="text" id="roleId" autocomplete="off" Name="roleId" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');">选择角色</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......
......@@ -8,6 +8,7 @@
<script src="${pageContext.request.contextPath}/resources/jquery-3.1.0.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.core.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.excheck.js"></script>
<script src="${pageContext.request.contextPath}/resources/ztree/ztree/jquery.ztree.exhide.js"></script>
<script src="${pageContext.request.contextPath}/resources/common/common.js"></script>
<script src="${pageContext.request.contextPath}/resources/layui/laydate/laydate.js"></script>
<style>
......
......@@ -86,11 +86,16 @@
<div class="layui-form-mid">
<label class="layui-form-label">所属单位</label>
<div class="layui-input-block">
<input type="text" name="unitname" id="unitname" lay-verify="required"
<input type="text" name="unitname" autocomplete="off" id="unitname" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myUnitTree');">
<input type="text" id="unitcode" Name="unitcode" style="display: none;">
<%--<span class="layui-btn" id="checkPer" onclick="checkTree('myUnitTree');">选择单位</span>--%>
<div id="myUnitTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="unit" class="ztree"></ul>
</div>
</div>
......@@ -98,11 +103,16 @@
<div class="layui-form-mid">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<input type="text" name="roleName" id="roleName" lay-verify="required"
<input type="text" name="roleName" autocomplete="off" id="roleName" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" Name="roleId" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');">选择角色</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......@@ -171,7 +181,8 @@
table.on('tool(user)', function (obj) {
var data = obj.data;
if (obj.event === 'update') {
window.location.href = '${pageContext.request.contextPath}/admin/user/update/' + data.id;
var url = '${pageContext.request.contextPath}/admin/user/update/' + data.id;
window.open(url,'_blank');
}
//此处需要完善
if (obj.event === 'delete') {
......
......@@ -133,11 +133,16 @@
<div class="layui-form-item btx">
<label class="layui-form-label">所属单位</label>
<div class="layui-input-block">
<input type="text" name="unitname" id="unitname" lay-verify="required"
<input type="text" name="unitname" autocomplete="off" id="unitname" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myUnitTree');">
<input type="text" id="unitcode" Name="unitcode" style="display: none;">
<input type="text" id="unitcode" autocomplete="off" Name="unitcode" style="display: none;">
<%-- <span class="layui-btn" id="checkPer" onclick="checkTree('myUnitTree');">选择单位</span>--%>
<div id="myUnitTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="unit" class="ztree"></ul>
</div>
</div>
......@@ -146,11 +151,16 @@
<div class="layui-form-item btx">
<label class="layui-form-label">用户角色</label>
<div class="layui-input-block">
<input type="text" name="roleName" id="roleName" lay-verify="required"
<input type="text" name="roleName" id="roleName" autocomplete="off" lay-verify="required"
class="layui-input code-icon" onclick="checkTree('myRoleTree');">
<input type="text" id="roleId" Name="roleId" style="display: none;">
<input type="text" id="roleId" autocomplete="off" Name="roleId" style="display: none;">
<%--<span class="layui-btn" id="checkRolePid" onclick="checkTree('myRoleTree');">选择角色</span>--%>
<div id="myRoleTree" style="display: none">
<div class="ISearch">
<input type="text" autocomplete="off">
<span class="layui-btn layui-btn-normal inpSearch">搜索</span>
<span class="layui-btn layui-btn-normal clearSer">清空</span>
</div>
<ul id="roleTree" class="ztree"></ul>
</div>
</div>
......@@ -257,7 +267,15 @@
//监听提交
form.on('submit(rulesSubmit)', function (data) {
layer.confirm('返回用户列表', {icon: 3, title:'提示'}, function(index){
window.opener=null;
window.open('','_self');
window.close();
//return false;
});
//提交表单
});
//弹出层
var msg=$("#msg").text();
......
......@@ -107,14 +107,151 @@ function setTree(data,treeId,type,kid,vid,glcs) {
}
$(document).ready(function () {
$.fn.zTree.init($("#"+treeId), setting, data);
fuzzySearch(treeId,false,true,setting,data,kid,vid); //初始化模糊搜索方法
});
}
function fuzzySearch(zTreeId,isHighLight, isExpand,setting,data,kid,vid){
var zTreeObj = $.fn.zTree.getZTreeObj(zTreeId);//获取树对象
if(!zTreeObj){
layer.msg("获取树对象失败");
}
var nameKey = zTreeObj.setting.data.key.name; //获取name属性的key
isHighLight = isHighLight===false?false:true;//除直接输入false的情况外,都默认为高亮
isExpand = isExpand?true:false;
zTreeObj.setting.view.nameIsHTML = isHighLight;//允许在节点名称中使用html,用于处理高亮
var metaChar = '[\\[\\]\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; //js正则表达式元字符集
var rexMeta = new RegExp(metaChar, 'gi');//匹配元字符的正则表达式
// 过滤ztree显示数据
function ztreeFilter(zTreeObj,_keywords,callBackFunc) {
if(!_keywords){
_keywords =''; //如果为空,赋值空字符串
}
// 查找符合条件的叶子节点
function filterFunc(node) {
if(node && node.oldname && node.oldname.length>0){
node[nameKey] = node.oldname; //如果存在原始名称则恢复原始名称
}
//node.highlight = false; //取消高亮
zTreeObj.updateNode(node); //更新节点让之前对节点所做的修改生效
if (_keywords.length == 0) {
//如果关键字为空,返回true,表示每个节点都显示
zTreeObj.showNode(node);
zTreeObj.expandNode(node,isExpand); //关键字为空时是否展开节点
return true;
}
//节点名称和关键字都用toLowerCase()做小写处理
if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase())!=-1) {
/*if(isHighLight){ //如果高亮,对文字进行高亮处理
//创建一个新变量newKeywords,不影响_keywords在下一个节点使用
//对_keywords中的元字符进行处理,否则无法在replace中使用RegExp
var newKeywords = _keywords.replace(rexMeta,function(matchStr){
//对元字符做转义处理
return '\\' + matchStr;
});
node.oldname = node[nameKey]; //缓存原有名称用于恢复
//为处理过元字符的_keywords创建正则表达式,全局且不分大小写
var rexGlobal = new RegExp(newKeywords, 'gi');//'g'代表全局匹配,'i'代表不区分大小写
//无法直接使用replace(/substr/g,replacement)方法,所以使用RegExp
node[nameKey] = node.oldname.replace(rexGlobal, function(originalText){
//将所有匹配的子串加上高亮效果
var highLightText =
'<span style="color: whitesmoke;background-color: #1E9FFF;">'
+ originalText
+'</span>';
return highLightText;
});
zTreeObj.updateNode(node); //update让更名和高亮生效
}*/
zTreeObj.showNode(node);//显示符合条件的节点
return true; //带有关键字的节点不隐藏
}
zTreeObj.hideNode(node); // 隐藏不符合要求的节点
return false; //不符合返回false
}
var nodesShow = zTreeObj.getNodesByFilter(filterFunc); //获取匹配关键字的节点
processShowNodes(nodesShow, _keywords);//对获取的节点进行二次处理
}
/**
* 对符合条件的节点做二次处理
*/
function processShowNodes(nodesShow,_keywords){
if(nodesShow && nodesShow.length>0){
//关键字不为空时对关键字节点的祖先节点进行二次处理
if(_keywords.length>0){
$.each(nodesShow, function(n,obj){
var pathOfOne = obj.getPath();//向上追溯,获取节点的所有祖先节点(包括自己)
if(pathOfOne && pathOfOne.length>0){
// i < pathOfOne.length-1, 对节点本身不再操作
for(var i=0;i<pathOfOne.length-1;i++){
zTreeObj.showNode(pathOfOne[i]); //显示节点
zTreeObj.expandNode(pathOfOne[i],true); //展开节点
}
}
});
}else{ //关键字为空则显示所有节点, 此时展开根节点
var rootNodes = zTreeObj.getNodesByParam('level','0');//获得所有根节点
$.each(rootNodes,function(n,obj){
zTreeObj.expandNode(obj,false); //展开所有根节点
});
}
}
}
/* //监听关键字input输入框文字变化事件
$(searchField).bind('input propertychange', function() {
var _keywords = $(this).val();
searchNodeLazy(_keywords); //调用延时处理
});*/
$("#"+zTreeId).prev(".ISearch").find(".inpSearch").click(function () {
ISearch()
});
$("#"+zTreeId).prev(".ISearch").find(".clearSer").click(function () {
$("#"+zTreeId).prev(".ISearch").find("input").val("");
$.fn.zTree.init($("#"+zTreeId), setting, data);
$("#"+kid).val("");
$("#"+vid).val("");
});
function ISearch() {
var _keywords = $("#"+zTreeId).prev(".ISearch").find("input").val();
if(_keywords==""){
$.fn.zTree.init($("#"+zTreeId), setting, data);
}else{
ztreeFilter(zTreeObj,_keywords);
}
}
$("#"+zTreeId).prev(".ISearch").find("input").keydown(function(e) {
if (e.keyCode == 13) {
ISearch();
}
});
/* var timeoutId = null;
//有输入后定时执行一次,如果上次的输入还没有被执行,那么就取消上一次的执行
function searchNodeLazy(_keywords) {
if (timeoutId) { //如果不为空,结束任务
clearTimeout(timeoutId);
}
timeoutId = setTimeout(function() {
ztreeFilter(zTreeObj,_keywords); //延时执行筛选方法
$(searchField).focus();//输入框重新获取焦点
}, 50);
}*/
}
/**
*
* @param treeId 所需要展现树的div的id
*/
function checkTree(treeId){
layer.open({
type: 1,
area:['400px', '430px'],
......
......@@ -33,6 +33,4 @@
.layui-layer-dialog>.layui-layer-content{
color: black;
}
.layui-layer-msg{
background: rgba(235, 235, 235, 0.82);
}
......@@ -249,4 +249,10 @@ body .layui-layer-btn1{color:#666 !important;}
.mp-name{width:100px;}
.flowChart{width: 538px;margin-left: 60px;}
}
.ISearch>span{
color:#fff!important;
height: 30px;
padding: 0 12px;
line-height: 2;
}
......@@ -9,7 +9,7 @@ website: http://code.google.com/p/jquerytree/
-------------------------------------*/
.ztree * {padding:0; margin:0; font-size:14px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
.ztree {margin:0; padding:5px; color:#333}
.ztree {margin:0; padding:5px; color:#333;padding-top: 40px;}
.ztree li{padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
......@@ -107,3 +107,15 @@ ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height
body .line-size{font-size: 20px; line-height: 32px;}
.lineheight28{line-height: 28px;}
body .layui-table-view .layui-table{width:100%;}
.ISearch{
position: fixed;padding: 5px 0;width: 383px;background: #fff;z-index: 100000;
}
.ISearch input{
height: 28px;
margin-left: 9px;
/* margin-top: 1px; */
width: 245px;
border: 1px solid #ccc;
border-radius: 5px;
}
/*
* JQuery zTree core v3.5.36
* JQuery zTree core v3.5.37
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2018-06-26
* Date: 2018-08-21
*/
(function ($) {
var settings = {}, roots = {}, caches = {},
......@@ -818,7 +818,7 @@
},
onClickNode: function (event, node) {
var setting = data.getSetting(event.data.treeId),
clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
clickFlag = ((setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true;
if (clickFlag === 0) {
view.cancelPreSelectedNode(setting, node);
......@@ -858,7 +858,7 @@
},
onSelectStart: function (e) {
var n = e.originalEvent.srcElement.nodeName.toLowerCase();
return (n === "input" || n === "textarea" );
return (n === "input" || n === "textarea");
}
},
//method of tools for zTree
......@@ -921,7 +921,7 @@
return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0));
},
isChildOrSelf: function (dom, parentId) {
return ( $(dom).closest("#" + parentId).length > 0 );
return ($(dom).closest("#" + parentId).length > 0);
},
uCanDo: function (setting, e) {
return true;
......@@ -1437,68 +1437,66 @@
}
return;
}
// code src: http://jsfiddle.net/08u6cxwj/
// CC-BY jocki84@googlemail.com, https://gist.github.com/jocki84/6ffafd003387179a988e
if (!Element.prototype.scrollIntoViewIfNeeded) {
Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {
function withinBounds(value, min, max, extent) {
if (false === centerIfNeeded || max <= value + extent && value <= min + extent) {
return Math.min(max, Math.max(min, value));
} else {
return (min + max) / 2;
}
}
"use strict";
function makeArea(left, top, width, height) {
return {
"left": left, "top": top, "width": width, "height": height
, "right": left + width, "bottom": top + height
, "translate": function (x, y) {
return makeArea(x + left, y + top, width, height);
function makeRange(start, length) {
return {"start": start, "length": length, "end": start + length};
}
, "relativeFromTo": function (lhs, rhs) {
var newLeft = left, newTop = top;
lhs = lhs.offsetParent;
rhs = rhs.offsetParent;
if (lhs === rhs) {
return area;
}
for (; lhs; lhs = lhs.offsetParent) {
newLeft += lhs.offsetLeft + lhs.clientLeft;
newTop += lhs.offsetTop + lhs.clientTop;
function coverRange(inner, outer) {
if (
false === centerIfNeeded ||
(outer.start < inner.end && inner.start < outer.end)
) {
return Math.max(
inner.end - outer.length,
Math.min(outer.start, inner.start)
);
}
for (; rhs; rhs = rhs.offsetParent) {
newLeft -= rhs.offsetLeft + rhs.clientLeft;
newTop -= rhs.offsetTop + rhs.clientTop;
return (inner.start + inner.end - outer.length) / 2;
}
return makeArea(newLeft, newTop, width, height);
function makePoint(x, y) {
return {
"x": x,
"y": y,
"translate": function translate(dX, dY) {
return makePoint(x + dX, y + dY);
}
};
}
var parent, elem = this, area = makeArea(
this.offsetLeft, this.offsetTop,
this.offsetWidth, this.offsetHeight);
while (tools.isElement(parent = elem.parentNode)) {
var clientLeft = parent.offsetLeft + parent.clientLeft;
var clientTop = parent.offsetTop + parent.clientTop;
// Make area relative to parent's client area.
area = area.relativeFromTo(elem, parent).translate(-clientLeft, -clientTop);
function absolute(elem, pt) {
while (elem) {
pt = pt.translate(elem.offsetLeft, elem.offsetTop);
elem = elem.offsetParent;
}
return pt;
}
parent.scrollLeft = withinBounds(
parent.scrollLeft,
area.right - parent.clientWidth, area.left,
parent.clientWidth);
var target = absolute(this, makePoint(0, 0)),
extent = makePoint(this.offsetWidth, this.offsetHeight),
elem = this.parentNode,
origin;
parent.scrollTop = withinBounds(
parent.scrollTop,
area.bottom - parent.clientHeight, area.top,
parent.clientHeight);
while (elem instanceof HTMLElement) {
// Apply desired scroll amount.
origin = absolute(elem, makePoint(elem.clientLeft, elem.clientTop));
elem.scrollLeft = coverRange(
makeRange(target.x - origin.x, extent.x),
makeRange(elem.scrollLeft, elem.clientWidth)
);
elem.scrollTop = coverRange(
makeRange(target.y - origin.y, extent.y),
makeRange(elem.scrollTop, elem.clientHeight)
);
// Determine actual scroll amount by reading back scroll properties.
area = area.translate(clientLeft - parent.scrollLeft,
clientTop - parent.scrollTop);
elem = parent;
target = target.translate(-elem.scrollLeft, -elem.scrollTop);
elem = elem.parentNode;
}
};
}
......@@ -1869,12 +1867,12 @@
return data.isSelectedNode(setting, node);
},
reAsyncChildNodesPromise: function (parentNode, reloadType, isSilent) {
var promise = new Promise(function(resolve, reject) {
var promise = new Promise(function (resolve, reject) {
try {
zTreeTools.reAsyncChildNodes(parentNode, reloadType, isSilent, function() {
zTreeTools.reAsyncChildNodes(parentNode, reloadType, isSilent, function () {
resolve(parentNode);
});
} catch(e) {
} catch (e) {
reject(e);
}
});
......
/*
* JQuery zTree excheck v3.5.36
* JQuery zTree excheck v3.5.37
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2018-06-26
* Date: 2018-08-21
*/
(function(n){var q,r,s,p={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},w={check:{enable:!1,autoCheckTrigger:!1,chkStyle:p.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:p.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};q=function(c,
a){if(a.chkDisabled===!0)return!1;var b=e.getSetting(c.data.treeId);if(i.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;var d=e.nodeChecked(b,a);e.nodeChecked(b,a,!d);f.checkNodeRelation(b,a);d=m(a,h.id.CHECK,b);f.setChkClass(b,d,a);f.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(h.event.CHECK,[c,b.treeId,a]);return!0};r=function(c,a){if(a.chkDisabled===!0)return!1;var b=e.getSetting(c.data.treeId),d=m(a,h.id.CHECK,b);a.check_Focus=!0;f.setChkClass(b,d,a);return!0};s=function(c,
......
/*
* JQuery zTree exHideNodes v3.5.37
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
*
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2018-08-21
*/
(function(j){j.extend(!0,j.fn.zTree._z,{view:{clearOldFirstNode:function(c,a){for(var b=a.getNextNode();b;){if(b.isFirstNode){b.isFirstNode=!1;e.setNodeLineIcos(c,b);break}if(b.isLastNode)break;b=b.getNextNode()}},clearOldLastNode:function(c,a,b){for(a=a.getPreNode();a;){if(a.isLastNode){a.isLastNode=!1;b&&e.setNodeLineIcos(c,a);break}if(a.isFirstNode)break;a=a.getPreNode()}},makeDOMNodeMainBefore:function(c,a,b){a=d.isHidden(a,b);c.push("<li ",a?"style='display:none;' ":"","id='",b.tId,"' class='",
l.className.LEVEL,b.level,"' tabindex='0' hidefocus='true' treenode>")},showNode:function(c,a){d.isHidden(c,a,!1);d.initShowForExCheck(c,a);k(a,c).show()},showNodes:function(c,a,b){if(a&&a.length!=0){var f={},g,i;for(g=0,i=a.length;g<i;g++){var h=a[g];if(!f[h.parentTId]){var u=h.getParentNode();f[h.parentTId]=u===null?d.getRoot(c):h.getParentNode()}e.showNode(c,h,b)}for(var j in f)a=d.nodeChildren(c,f[j]),e.setFirstNodeForShow(c,a),e.setLastNodeForShow(c,a)}},hideNode:function(c,a){d.isHidden(c,a,
!0);a.isFirstNode=!1;a.isLastNode=!1;d.initHideForExCheck(c,a);e.cancelPreSelectedNode(c,a);k(a,c).hide()},hideNodes:function(c,a,b){if(a&&a.length!=0){var f={},g,i;for(g=0,i=a.length;g<i;g++){var h=a[g];if((h.isFirstNode||h.isLastNode)&&!f[h.parentTId]){var j=h.getParentNode();f[h.parentTId]=j===null?d.getRoot(c):h.getParentNode()}e.hideNode(c,h,b)}for(var k in f)a=d.nodeChildren(c,f[k]),e.setFirstNodeForHide(c,a),e.setLastNodeForHide(c,a)}},setFirstNode:function(c,a){var b=d.nodeChildren(c,a),f=
d.isHidden(c,b[0],!1);b.length>0&&!f?b[0].isFirstNode=!0:b.length>0&&e.setFirstNodeForHide(c,b)},setLastNode:function(c,a){var b=d.nodeChildren(c,a),f=d.isHidden(c,b[0]);b.length>0&&!f?b[b.length-1].isLastNode=!0:b.length>0&&e.setLastNodeForHide(c,b)},setFirstNodeForHide:function(c,a){var b,f,g;for(f=0,g=a.length;f<g;f++){b=a[f];if(b.isFirstNode)break;if(!d.isHidden(c,b)&&!b.isFirstNode){b.isFirstNode=!0;e.setNodeLineIcos(c,b);break}else b=null}return b},setFirstNodeForShow:function(c,a){var b,f,
g,i,h;for(f=0,g=a.length;f<g;f++){b=a[f];var j=d.isHidden(c,b);if(!i&&!j&&b.isFirstNode){i=b;break}else if(!i&&!j&&!b.isFirstNode)b.isFirstNode=!0,i=b,e.setNodeLineIcos(c,b);else if(i&&b.isFirstNode){b.isFirstNode=!1;h=b;e.setNodeLineIcos(c,b);break}}return{"new":i,old:h}},setLastNodeForHide:function(c,a){var b,f;for(f=a.length-1;f>=0;f--){b=a[f];if(b.isLastNode)break;if(!d.isHidden(c,b)&&!b.isLastNode){b.isLastNode=!0;e.setNodeLineIcos(c,b);break}else b=null}return b},setLastNodeForShow:function(c,
a){var b,f,g,i;for(f=a.length-1;f>=0;f--){b=a[f];var h=d.isHidden(c,b);if(!g&&!h&&b.isLastNode){g=b;break}else if(!g&&!h&&!b.isLastNode)b.isLastNode=!0,g=b,e.setNodeLineIcos(c,b);else if(g&&b.isLastNode){b.isLastNode=!1;i=b;e.setNodeLineIcos(c,b);break}}return{"new":g,old:i}}},data:{initHideForExCheck:function(c,a){if(d.isHidden(c,a)&&c.check&&c.check.enable){if(typeof a._nocheck=="undefined")a._nocheck=!!a.nocheck,a.nocheck=!0;a.check_Child_State=-1;e.repairParentChkClassWithSelf&&e.repairParentChkClassWithSelf(c,
a)}},initShowForExCheck:function(c,a){if(!d.isHidden(c,a)&&c.check&&c.check.enable){if(typeof a._nocheck!="undefined")a.nocheck=a._nocheck,delete a._nocheck;if(e.setChkClass){var b=k(a,l.id.CHECK,c);e.setChkClass(c,b,a)}e.repairParentChkClassWithSelf&&e.repairParentChkClassWithSelf(c,a)}}}});var j=j.fn.zTree,m=j._z.tools,l=j.consts,e=j._z.view,d=j._z.data,k=m.$;d.isHidden=function(c,a,b){if(!a)return!1;c=c.data.key.isHidden;typeof b!=="undefined"&&(typeof b==="string"&&(b=m.eqs(checked,"true")),a[c]=
!!b);return a[c]};d.exSetting({data:{key:{isHidden:"isHidden"}}});d.addInitNode(function(c,a,b){a=d.isHidden(c,b);d.isHidden(c,b,a);d.initHideForExCheck(c,b)});d.addBeforeA(function(){});d.addZTreeTools(function(c,a){a.showNodes=function(a,b){e.showNodes(c,a,b)};a.showNode=function(a,b){a&&e.showNodes(c,[a],b)};a.hideNodes=function(a,b){e.hideNodes(c,a,b)};a.hideNode=function(a,b){a&&e.hideNodes(c,[a],b)};var b=a.checkNode;if(b)a.checkNode=function(f,e,i,h){(!f||!d.isHidden(c,f))&&b.apply(a,arguments)}});
var n=d.initNode;d.initNode=function(c,a,b,f,g,i,h){var j=(f?f:d.getRoot(c))[c.data.key.children];d.tmpHideFirstNode=e.setFirstNodeForHide(c,j);d.tmpHideLastNode=e.setLastNodeForHide(c,j);h&&(e.setNodeLineIcos(c,d.tmpHideFirstNode),e.setNodeLineIcos(c,d.tmpHideLastNode));g=d.tmpHideFirstNode===b;i=d.tmpHideLastNode===b;n&&n.apply(d,arguments);h&&i&&e.clearOldLastNode(c,b,h)};var o=d.makeChkFlag;if(o)d.makeChkFlag=function(c,a){(!a||!d.isHidden(c,a))&&o.apply(d,arguments)};var p=d.getTreeCheckedNodes;
if(p)d.getTreeCheckedNodes=function(c,a,b,f){if(a&&a.length>0){var e=a[0].getParentNode();if(e&&d.isHidden(c,e))return[]}return p.apply(d,arguments)};var q=d.getTreeChangeCheckedNodes;if(q)d.getTreeChangeCheckedNodes=function(c,a,b){if(a&&a.length>0){var e=a[0].getParentNode();if(e&&d.isHidden(c,e))return[]}return q.apply(d,arguments)};var r=e.expandCollapseSonNode;if(r)e.expandCollapseSonNode=function(c,a,b,f,g){(!a||!d.isHidden(c,a))&&r.apply(e,arguments)};var s=e.setSonNodeCheckBox;if(s)e.setSonNodeCheckBox=
function(c,a,b,f){(!a||!d.isHidden(c,a))&&s.apply(e,arguments)};var t=e.repairParentChkClassWithSelf;if(t)e.repairParentChkClassWithSelf=function(c,a){(!a||!d.isHidden(c,a))&&t.apply(e,arguments)}})(jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment