增强字符串配置,如果district字段内容为others,用户可手动输入匹配区域。

This commit is contained in:
zhangwei
2018-06-04 14:31:26 +08:00
parent 24c37c1834
commit 50e1b73d44
5 changed files with 55 additions and 8 deletions

View File

@@ -3,11 +3,7 @@
<html>
<head>
<title></title>
<script type="text/javascript">
$(function(){
});
</script>
</head>
<c:forEach items="${regionList}" var="regionDistrict">
<c:if
@@ -33,18 +29,19 @@ $(function(){
<spring:message code="district" /></label>
<div class="col-md-6">
<select name="${cfgName}.district"
class="selectpicker show-tick form-control required">
class="selectpicker show-tick form-control required district" onchange="changeDistrict($(this))">
<c:forEach items="${regionList}" var="regionDistrict">
<c:if
test="${_cfg.functionId eq regionDistrict.functionId and regionValue eq regionDistrict.configRegionValue}">
<c:forEach items="${fn:split(regionDistrict.configDistrict,',')}"
var="_district">
<option value="${_district }"
<c:if test="${complexCfg.district==_district || complexCfg.district==null}">selected</c:if>>${_district }</option>
<c:if test="${complexCfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</c:if>
</c:forEach>
</select>
<input type="hidden" name="${cfgName}.districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${complexCfg.district}"/>
</div>
<div for="${cfgName}.district"></div>
</div>
@@ -134,4 +131,11 @@ $(function(){
</div>
</div>
</div>
</html>
</html>
<script type="text/javascript">
function changeDistrict(obj){
if("others"==obj.val()){
obj.parent().siblings(".otherValue").prop("type","text");
}
}
</script>

View File

@@ -71,6 +71,15 @@
/* $("span[title='add']").on("click", function() {
$(".ipPort0").removeClass("hidden");
}); */
$(".district").each(function(){
if($(this).siblings(".otherValue").val()!=''){
if($(this).val()!=$(this).siblings(".otherValue").val()){
$(this).find("option[value=others]").attr("selected","selected");
$(this).siblings(".otherValue").prop("type","text");
}
}
});
});

View File

@@ -92,6 +92,16 @@
/* $("span[title='add']").on("click", function() {
$(".ipPort0").removeClass("hidden");
}); */
$(".district").each(function(){
if($(this).siblings(".otherValue").val()!=''){
if($(this).val()!=$(this).siblings(".otherValue").val()){
$(this).find("option[value=others]").attr("selected","selected");
$(this).siblings(".otherValue").prop("type","text");
}
}
});
});