修复匹配区域,分类在修改时不能正常选择的bug

This commit is contained in:
wangxin
2018-04-03 10:47:32 +08:00
parent beded74891
commit 33b7df09c9
7 changed files with 39 additions and 23 deletions

View File

@@ -573,6 +573,8 @@ public class MultipleCfgController extends BaseController{
this.setPropertiesToMultipleCfg(resultCfg, resultComplexCfg,"update");
}
}
List<SysDictInfo> districts=sysDictInfoService.getDistrictDict(tableName);
model.addAttribute("districts", districts);
}
}
model.addAttribute("_cfg", resultCfg);

View File

@@ -158,7 +158,6 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
should+=cfg.getIpCfg().size();
}
int result=0;
if(cfg==null) return false;
if(Constants.AUDIT_YES==cfg.getIsAudit()||Constants.AUDIT_NOT_YES==cfg.getIsAudit()){
List<BaseCfg> cfgs=new ArrayList<BaseCfg>();
if(sendCfg.getIpCfg()!=null){

View File

@@ -31,19 +31,13 @@
<c:when test="${_cfg.classify==null or _cfg.classify==''}">
<option value="${fl.serviceDictId}">${fl.itemValue}</option>
</c:when>
<c:when test="${fn:contains(_cfg.classify,',')}">
<c:otherwise>
<option value="${fl.serviceDictId}"
<c:forEach items="${fn:split(_cfg.classify,',')}" var="_classify">
<c:if test="${fl.isValid==0}">disabled="disabled"</c:if>
<c:if test="${fn:trim(fl.serviceDictId) eq _classify}">selected</c:if>
</c:forEach>
>${fl.itemValue}</option>
</c:when>
<c:otherwise>
<option value="${fl.serviceDictId}"
<c:if test="${fl.isValid==0}">disabled="disabled"</c:if>
<c:if test="${fn:trim(fl.serviceDictId) eq _classify}">selected</c:if>
>${fl.itemValue}</option>
</c:otherwise>
</c:choose>
</c:forEach>

View File

@@ -87,14 +87,18 @@
<label class="radio-inline">
<input type="radio" name="isAreaEffective" value="1"
<c:if test="${_cfg.isAreaEffective==1}">checked</c:if>
<c:if test="${action==2}">disabled</c:if>
><spring:message code="yes"/>
</label>
<label class="radio-inline">
<input type="radio" name="isAreaEffective" value="0"
<c:if test="${_cfg.isAreaEffective==0}">checked</c:if>
<c:if test="${action==2}">disabled</c:if>
><spring:message code="no"/>
</label>
<%-- <input class="form-control" type="text" name="isAreaEffective" value="${_cfg.isAreaEffective}"> --%>
<c:if test="${action==2}">
<input class="form-control" type="hidden" name="isAreaEffective" value="${_cfg.isAreaEffective}">
</c:if>
</div>
<div for="isAreaEffective"></div>
</div>

View File

@@ -53,25 +53,18 @@
<label class="control-label col-md-3"><spring:message code="type"/></label>
<div class="col-md-6">
<select name="classify" multiple class="selectpicker form-control" title=<spring:message code="select"/>>
<c:forEach items="${fls}" var="fl">
<c:choose>
<c:when test="${_cfg.classify==null or _cfg.classify==''}">
<option value="${fl.serviceDictId}">${fl.itemValue}</option>
</c:when>
<c:when test="${fn:contains(_cfg.classify,',')}">
<c:otherwise>
<option value="${fl.serviceDictId}"
<c:forEach items="${fn:split(_cfg.classify,',')}" var="_classify">
<c:if test="${fl.isValid==0}">disabled="disabled"</c:if>
<c:if test="${fn:trim(fl.serviceDictId) eq _classify}">selected</c:if>
</c:forEach>
>${fl.itemValue}</option>
</c:when>
<c:otherwise>
<option value="${fl.serviceDictId}"
<c:if test="${fl.isValid==0}">disabled="disabled"</c:if>
<c:if test="${fn:trim(fl.serviceDictId) eq _classify}">selected</c:if>
>${fl.itemValue}</option>
</c:otherwise>
</c:choose>
</c:forEach>

View File

@@ -1,5 +1,18 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<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");
}
});
}
})
</script>
<h3 class="form-section">增强字符串<spring:message code="block_config"/><!-- <small><span class="glyphicon glyphicon-chevron-down" data-toggle="collapse" data-target=".complexCfg" title="add"></span></small> --></h3>
<div class="row complexCfg">
<div class="col-md-6">
@@ -26,7 +39,9 @@
<select name="complexCfg[${mainTable}].district" class="district selectpicker select2 form-control">
<option value=""><spring:message code='select'/></option>
<c:forEach items="${districts}" var="district">
<option value="${district.itemValue}">${district.itemValue}</option>
<option value="${district.itemValue}"
<c:if test="${_cfg.complexCfg[mainTable].district eq district.itemValue}">selected</c:if>
>${district.itemValue}</option>
</c:forEach>
</select>
</c:when>
@@ -34,7 +49,9 @@
<select name="complexCfg[${otherTable.tableName}].district" class="district selectpicker select2 form-control">
<option value=""><spring:message code='select'/></option>
<c:forEach items="${districts}" var="district">
<option value="${district.itemValue}">${district.itemValue}</option>
<option value="${district.itemValue}"
<c:if test="${_cfg.complexCfg[otherTable.tableName].district eq district.itemValue}">selected</c:if>
>${district.itemValue}</option>
</c:forEach>
</select>
</c:when>

View File

@@ -153,11 +153,18 @@ $(function(){
}
});
$(".district").on("change",function(){
var val=$(this).val().toLowerCase();
if("others"==val){
$(this).parent("div").siblings(".otherValue").prop("type","text");
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{
$(this).parent("div").siblings(".otherValue").prop("type","hidden").attr("value","");
other.prop("type","hidden");
}
});
$(".otherValue").on("change",function(){