(1)没有分类的特定服务追加到ztree树的末尾

(2)业务类别下有特定服务的时候更改样式,与有特定服务一致
(3)树修改搜索属性,当页面上的sys:treeselect标签配置了enableSearch="true"属性的时候,开启搜索节点的功能
This commit is contained in:
wangxin
2018-08-30 16:58:33 +08:00
parent d1acc38429
commit 374087ca85
4 changed files with 35 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ public class TagController extends BaseController {
model.addAttribute("title", request.getParameter("title"));//根节点替换文本
model.addAttribute("enableAddBtn", request.getParameter("enableAddBtn"));//节点是否可编辑
model.addAttribute("userId", UserUtils.getUser().getId());//如果启用了addBtn,则使用userId判断是否是用户自己创建的用户自己创建的节点可删除
model.addAttribute("enableSearch", request.getParameter("enableSearch"));//是否允许搜索
return "/sys/tagTreeselect";
}

View File

@@ -242,6 +242,7 @@ public class SpecificServiceCfgController extends BaseController {
continue;
}
if(businessTypeList.size()>0) {
boolean hasBusinessType=false;
for(SysDataDictionaryItem business:businessTypeList) {
if(String.valueOf(business.getItemCode()).equals(specificServiceCfg.getBusinessType())) {
Map<String, Object> map = Maps.newHashMap();
@@ -256,9 +257,24 @@ public class SpecificServiceCfgController extends BaseController {
map.put("user",specificServiceCfg.getAddFlag());
}
mapList.add(map);
hasBusinessType=true;
break;
}
}
if(!hasBusinessType) {//没有对应的业务类别
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("serviceCode",specificServiceCfg.getSpecServiceCode());
map.put("businessType",specificServiceCfg.getBusinessType());
map.put("groupId",specificServiceCfg.getGroupId());
if(specificServiceCfg.getAddFlag()!=null) {
map.put("user",specificServiceCfg.getAddFlag());
}
mapList.add(map);
}
}else {
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());

View File

@@ -27,6 +27,7 @@
<%@ attribute name="checkedPS" type="java.lang.String" required="false" description="复选框选中时是否关联父子节点ps关联父子p关联父s关联子,都不关联为空"%>
<%@ attribute name="unCheckedPS" type="java.lang.String" required="false" description="复选框取消选中时是否关联父子节点ps关联父子p关联父s关联子,都不关联为空"%>
<%@ attribute name="enableAddBtn" type="java.lang.Boolean" required="false" description="节点是否可编辑"%>
<%@ attribute name="enableSearch" type="java.lang.Boolean" required="false" description="是否开启节点搜索功能"%>
<div class="input-group">
<input id="${id}Id" name="${name}" class="${cssClass} singleClass" type="hidden" value="${value}" />
<input id="${id}Name" name="${labelName}" ${allowInput?'':'readonly="readonly"'} type="text" value="<spring:message code='${empty value?"":labelValue}'/>" data-msg-required="${dataMsgRequired}" placeholder="${empty value?labelValue:value}"
@@ -46,7 +47,7 @@
return true;
}
// 正常打开
top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&title=${title}&enableAddBtn=${enableAddBtn}", "<spring:message code='choose'/> <spring:message code='${title}'/>", 320, 420, {
top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&title=${title}&enableAddBtn=${enableAddBtn}&enableSearch=${enableSearch}", "<spring:message code='choose'/> <spring:message code='${title}'/>", 320, 420, {
ajaxData:{selectIds: $("#${id}Id").val()},buttons:{"<spring:message code='ok'/>":"ok", "<spring:message code='clear'/>":"clear","<spring:message code='close'/>":true}, submit:function(v, h, f){
if (v == "ok"){
var tree = h.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();

View File

@@ -91,6 +91,14 @@
var nodes = tree.getNodesByParam("level", 1);
for(var i=0; i<nodes.length; i++) {
tree.expandNode(nodes[i], true, false, false);
var nodeId=nodes[i].id;
//处理特定服务业务类型的图标
if(typeof nodeId=='string'&&nodeId.indexOf("businessType")==0){
if(!nodes[i].isParent){//强制改变没有子节点的特定服务业务类型为父节点,让其改变样式
nodes[i].isParent=true;
tree.updateNode(nodes[i],false);
}
}
}
nodes=tree.getNodesByParam("level", 0);
for(var i=0; i<nodes.length; i++) {
@@ -217,8 +225,8 @@
// 开始搜索
function search() {
$("#search").slideToggle(200);
$("#txt").toggle();
//$("#search").slideToggle(200);
//$("#txt").toggle();
$("#key").focus();
}
function beforeEditName(treeId, treeNode) {
@@ -362,10 +370,12 @@
<div style="position:absolute;right:8px;top:5px;cursor:pointer;" onclick="search();">
<i class="icon-search"></i><label id="txt">搜索</label>
</div> -->
<div id="search" class="form-search hide" style="padding:10px 0 0 13px;">
<label for="key" class="control-label" style="padding:5px 5px 3px 0;">关键字:</label>
<input type="text" class="empty" id="key" name="key" maxlength="50" style="width:110px;">
<button class="btn" id="btn" onclick="searchNode()"> <i class="icon-search"></i> &nbsp;搜索 </button>
<c:if test="${enableSearch ne null and enableSearch==true}">
<div id="search" class="form-search input-group" style="padding:10px 0 0 13px;">
<label for="key" class="control-label" style="padding:5px 5px 3px 0;"><spring:message code="keywords"/>:</label>
<input type="text" class="empty input-small" id="key" name="key" maxlength="50" style="width:170px;" placeholder="<spring:message code='search'/>...">
<!-- <button class="btn" id="btn" onclick="searchNode()"> <i class="icon-search"></i> &nbsp;搜索 </button> -->
</div>
</c:if>
<div id="tree" class="ztree" style="padding:15px 20px;"></div>
</body>