增强字符串特征匹配区域选择为others时,用户自定义输入匹配区域信息。

This commit is contained in:
zhangwei
2018-04-03 14:41:18 +08:00
parent 420be8558f
commit 0e995e7d8f
2 changed files with 60 additions and 1 deletions

View File

@@ -6,6 +6,45 @@
<script type="text/javascript">
$(function(){
if(!$(".district").val()&&$(".otherValue").val()){
$(".district").find("option").each(function(){
var text=$(this).text().toLowerCase();
if("others"==text){
$(this).attr("selected","selected");
$(this).parent().siblings(".otherValue").prop("type","text");
}
});
}
$(".district").on("change",function(){
var text=$(this).find("option:selected").text().toLowerCase();
var other=$(this).parent("div").siblings(".otherValue");
if("others"==text){
other.prop("type","text");
$(this).find("option").each(function(){
if(other.val()==$(this).text()){
other.val("");
return false;
}
});
}else{
other.prop("type","hidden");
}
});
$(".otherValue").on("change",function(){
var val=$(this).val();
if($(this).is(":visible")){
$(this).prev("div").find("option").each(function(){
if("others"==$(this).text().toLowerCase()){
$(this).prop("value",val);
if($(this).prop("selected")){
$(this).parent("select.selectpicker").selectpicker('val',val);
}
}
});
}
});
$("#save").on("click",function(){
$("#cfgFrom").attr("action","${ctx}/cfg/app/saveOrUpdateCfg");
$("#save").submit();
@@ -191,11 +230,21 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="match_area"/></label>
<div class="col-md-6">
<select name="complexFeaturesList[${index2}].district" class="required selectpicker select2 form-control" title="<spring:message code="select"/>" >
<c:set var="districtValue" value="noSelect"></c:set>
<select name="complexFeaturesList[${index2}].district" class="district required selectpicker select2 form-control" title="<spring:message code="select"/>" >
<c:forEach items="${fns:getFeaturesDictData(features.tableName) }" var="item">
<option value="${item.itemValue }" <c:if test="${_cfg.complexFeaturesList[index2].district==item.itemValue }">selected</c:if>><spring:message code="${item.itemValue}"></spring:message></option>
<c:if test="${_cfg.complexFeaturesList[index2].district==item.itemValue }">
<c:set var="districtValue" value="${item.itemValue }"></c:set>
</c:if>
</c:forEach>
<c:if test="${districtValue eq 'noSelect' and not empty _cfg.cfgId}">
<option value="${_cfg.complexFeaturesList[index2].district}" selected>
${_cfg.complexFeaturesList[index2].district}
</option>
</c:if>
</select>
<input type="hidden" name="" placeholder="请输入自定义域" class="otherValue form-control" value="${_cfg.complexFeaturesList[index2].district}"/>
<%-- <input class="required form-control" type="text" name="complexFeaturesList[${index2}].district" value="${_cfg.complexFeaturesList[index2].district }"> --%>
</div>
<div for="cfgDesc"></div>

View File

@@ -120,11 +120,21 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="match_area"/></label>
<div class="col-md-6">
<c:set var="districtValue" value="noSelect"></c:set>
<select name="complexFeaturesList[${index2}].district" class="required selectpicker select2 form-control" title="<spring:message code="select"/>" >
<c:forEach items="${fns:getFeaturesDictData(features.tableName) }" var="item">
<option value="${item.itemValue }" <c:if test="${_cfg.complexFeaturesList[index2].district==item.itemValue }">selected</c:if>><spring:message code="${item.itemValue}"></spring:message></option>
<c:if test="${_cfg.complexFeaturesList[index2].district==item.itemValue }">
<c:set var="districtValue" value="${item.itemValue }"></c:set>
</c:if>
</c:forEach>
<c:if test="${districtValue eq 'noSelect' and not empty _cfg.cfgId}">
<option value="${_cfg.complexFeaturesList[index2].district}" selected>
${_cfg.complexFeaturesList[index2].district}
</option>
</c:if>
</select>
<%-- <input class="required form-control" type="text" name="complexFeaturesList[${index2}].district" value="${_cfg.complexFeaturesList[index2].district }"> --%>
</div>
<div for="cfgDesc"></div>