develop

Conflicts:
	src/main/webapp/WEB-INF/include/excel/importModal.jsp
	src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp
增加region和service导入属性,动态控制导入业务
优化导入界面
This commit is contained in:
duandongmei
2018-10-19 17:19:52 +08:00
23 changed files with 250 additions and 70 deletions

View File

@@ -28,6 +28,14 @@ public class FunctionRegionDict extends BaseCfg<FunctionRegionDict> {
private String configDirection;
private String configProtocol;
private Integer configRegionSort;
private Integer isImport;
public Integer getIsImport() {
return isImport;
}
public void setIsImport(Integer isImport) {
this.isImport = isImport;
}
public Integer getConfigRegionSort() {
return configRegionSort;

View File

@@ -18,6 +18,15 @@ public class FunctionServiceDict extends BaseCfg<FunctionServiceDict> {
private String actionCode;
private String regionCode;
private Integer isImport;
public Integer getIsImport() {
return isImport;
}
public void setIsImport(Integer isImport) {
this.isImport = isImport;
}
public String getRegionCode() {
return regionCode;
}

View File

@@ -23,14 +23,14 @@ public class IpPayloadTemplate extends IpAllTemplate {
public String getUserRegion2() {
return userRegion2;
}
public void setUserRegion2(String userRegion1) {
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
@ExcelField(title="replace_content",align=2,sort=4)
public String getUserRegion3() {
return userRegion3;
}
public void setUserRegion3(String userRegion1) {
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
}

View File

@@ -359,7 +359,11 @@ public class ImportExcel {
ExcelField ef = (ExcelField)os[0];
// If is dict type, get dict value
if (StringUtils.isNotBlank(ef.dictType())){
val = DictUtils.getDictCode(ef.dictType(), val.toString(), "");
Object val1 = DictUtils.getDictCode(ef.dictType(), val.toString(), "");
//没有获取到字典值的话会影响验证判断
if(val1!=null&&StringUtils.isNotBlank(val1.toString())) {
val=val1;
}
//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
}
// Get param type and type cast

View File

@@ -50,6 +50,7 @@ import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.configuration.template.IpPayloadTemplate;
import com.nis.domain.configuration.template.IpRateLimitTemplate;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.SearchReport;
@@ -825,6 +826,44 @@ public class BaseController {
StringBuffer errInfo = new StringBuffer();
IpPortCfg baseIpCfg = new IpPortCfg();
BeanUtils.copyProperties(list.get(i), baseIpCfg);
//特殊字段验证
//packet ip ratelimit
if(serviceDict.getFunctionId().intValue()==5&&serviceDict.getAction().intValue()==64) {
String userRegion1=baseIpCfg.getUserRegion1();
try {
Double ratelimt= Double.parseDouble(userRegion1);
if(ratelimt>0.009||ratelimt<0.001) {
errInfo.append(prop.getProperty("ratelimit")+"."+String.format(prop.getProperty("must_between"),0.001,0.009)+";");
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit"))+";");
}
}
//payload ip
if(regionDict.getFunctionId().equals(212)) {
//replace_zone
String userRegion1=baseIpCfg.getUserRegion1();
if(StringUtils.isNotBlank(userRegion1)) {
Object val = DictUtils.getDictLabel("INTERCEPT_REPLACE_ZONE", userRegion1);
if(StringUtils.isBlank(val.toString())) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone"))+";");
}
}else {
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone"))+";");
}
//replaced_content
String userRegion2=baseIpCfg.getUserRegion2();
if(StringUtils.isBlank(userRegion2)) {
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content"))+";");
}
//replace_content
String userRegion3=baseIpCfg.getUserRegion3();
if(StringUtils.isBlank(userRegion3)) {
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content"))+";");
}
}
if (regionDict.getRegionType().equals(1)) {
// 校验必填的IP端口
for (String code : configIpPortShow.split(",")) {
@@ -1205,7 +1244,7 @@ public class BaseController {
}
}
if (!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("direction")) + ","
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("direction")) + "."
+ String.format(prop.getProperty("alternative_values"), directionPattern) + ";");
}
return has;
@@ -1233,7 +1272,7 @@ public class BaseController {
}
}
if (!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol")) + ","
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol")) + "."
+ String.format(prop.getProperty("alternative_values"), protocolPattern) + ";");
}
return has;
@@ -2415,6 +2454,11 @@ public class BaseController {
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}
}
}else if(regionDict.getFunctionId().equals(212)) {
if (regionDict.getRegionType().equals(1)) {
List<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}
} else if (regionDict.getRegionType().equals(1)) {
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);

View File

@@ -5,6 +5,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -232,29 +233,18 @@ public class IpController extends BaseController{
,FunctionRegionDict regionDict
,FunctionServiceDict serviceDict
,Integer requestId) throws Exception{
String fileName = "template.xlsx";
//ip类模板
if(regionDict.getRegionType().equals(1)){
if(regionDict.getFunctionId().equals(5)){// IP Address
if(serviceDict.getAction().equals(64)){//ip限速
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpRateLimitTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else{
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(212)){ //IP Payload
List<IpPayloadTemplate> classList=new ArrayList<IpPayloadTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpPayloadTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(7)){ //Dns IP
List<DnsIpTemplate> classList=new ArrayList<DnsIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, DnsIpTemplate.class, 2);
Properties pro=getMsgProp();
String serviceName=pro.getProperty(serviceDict.getServiceName());
String regionName=pro.getProperty(regionDict.getConfigRegionValue());
serviceName=StringUtil.isEmpty(serviceName) ?serviceDict.getServiceName():serviceName;
regionName=StringUtil.isEmpty(regionName) ?regionDict.getConfigRegionValue():regionName;
String fileName = serviceName+"_"+regionName+"_template.xlsx";
//ip类模板
if(regionDict.getRegionType().equals(1)){
if(regionDict.getFunctionId().equals(5)){// IP Address
if(serviceDict.getAction().equals(64)){//ip限速
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpRateLimitTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else{
@@ -263,41 +253,57 @@ public class IpController extends BaseController{
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
}
//str类模板
if(regionDict.getRegionType().equals(2)){
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
}else if(regionDict.getFunctionId().equals(212)){ //IP Payload
List<IpPayloadTemplate> classList=new ArrayList<IpPayloadTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpPayloadTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(7)){ //Dns IP
List<DnsIpTemplate> classList=new ArrayList<DnsIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, DnsIpTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else{
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
//district类模板
if(regionDict.getRegionType().equals(3)){
if(regionDict.getFunctionId().equals(7)){//DNS DISTRICT STRING
List<DnsComplexStringTemplate> classList=new ArrayList<DnsComplexStringTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else{
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
}
//str类模板
if(regionDict.getRegionType().equals(2)){
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
//district类模板
if(regionDict.getRegionType().equals(3)){
if(regionDict.getFunctionId().equals(7)){//DNS DISTRICT STRING
List<DnsComplexStringTemplate> classList=new ArrayList<DnsComplexStringTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}else{
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose();
}
}
}
//ip配置导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files
,Integer serviceDictId
,Integer requestId
,String regionDictIds) {
this._import(redirectAttributes, files,serviceDictId,regionDictIds,requestId);
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+5;
}
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files
,Integer serviceDictId
,Integer requestId
,String regionDictIds
,String importPath) {
this._import(redirectAttributes, files,serviceDictId,regionDictIds,requestId);
return "redirect:" + adminPath+ importPath;
}
//ip配置导出
@RequestMapping(value = "exportIpAddr")
public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response,

View File

@@ -23,12 +23,13 @@
<result column="config_direction" property="configDirection" jdbcType="VARCHAR" />
<result column="config_protocol" property="configProtocol" jdbcType="VARCHAR" />
<result column="config_region_sort" property="configRegionSort" jdbcType="INTEGER" />
<result column="is_import" property="isImport" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
dict_id, function_id, config_region_value,config_region_code, config_district, config_desc, is_valid,is_maat,region_type
,config_multi_keywords,config_hex,config_expr_type,config_match_method,config_service_type,config_ip_port_show,config_ip_type,
config_ip_pattern,config_port_pattern,config_direction,config_protocol,config_region_sort
config_ip_pattern,config_port_pattern,config_direction,config_protocol,config_region_sort,is_import
</sql>
<select id="getList" resultMap="BaseResultMap" >
select

View File

@@ -12,10 +12,11 @@
<result column="service_desc" property="serviceDesc" jdbcType="VARCHAR" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="region_code" property="regionCode" jdbcType="VARCHAR" />
<result column="is_import" property="isImport" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
dict_id, function_id, protocol_id, action,action_code, service_id, service_name,service_desc,is_valid,region_code
dict_id, function_id, protocol_id, action,action_code, service_id, service_name,service_desc,is_valid,region_code,is_import
</sql>
<select id="getList" resultMap="BaseResultMap" >
select

View File

@@ -780,7 +780,7 @@ intra=Inbound
#=============about Maintenance=========
#=============some validation===========
line=line %s
can_not_null=%sCan't be empty
can_not_null=%s can't be empty
is_incorrect=%s value is incorrect
are_the_same=%s and %s can't be equal
is_in_wrong_format=%s formatting error

View File

@@ -0,0 +1,2 @@
ALTER TABLE function_region_dict ADD is_import int(2) DEFAULT 0 COMMENT '域是否是否支持导出';
ALTER TABLE function_service_dict ADD is_import int(2) DEFAULT 0 COMMENT '业务是否支持导出';

View File

@@ -0,0 +1,2 @@
#域名修改长度为1024
ALTER TABLE website_domain_topic MODIFY domain VARCHAR(1024);

View File

@@ -0,0 +1,33 @@
#ip addr
update function_service_dict set is_import=1 where function_id=5 and is_valid=1 and dict_id in(23,24,25,108);
update function_region_dict set is_import=1 where function_id=5 and is_valid=1 and dict_id in(27,35,228);
#basic
update function_service_dict set is_import=1 where function_id=407 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=407 and is_valid=1 and dict_id in(107);
#tunnel
update function_service_dict set is_import=1 where function_id=408 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=408 and is_valid=1 and dict_id in(157);
#ip payload
update function_service_dict set is_import=1 where function_id=212 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=212 and is_valid=1 and dict_id in(230);
#app
update function_service_dict set is_import=1 where function_id=63 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=63 and is_valid=1 and dict_id in(78);
#dns
update function_service_dict set is_import=1 where function_id=7 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=7 and is_valid=1 and dict_id in(28,29);
#url
update function_service_dict set is_import=1 where function_id=6 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=6 and is_valid=1 ;
#url advanced
update function_service_dict set is_import=1 where function_id=8 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=8 and is_valid=1 and dict_id in(9,10,11,12,13,14);
#mail
update function_service_dict set is_import=1 where function_id=37 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=37 and is_valid=1 and dict_id in(599);
#mail advanced
update function_service_dict set is_import=1 where function_id=35 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=35 and is_valid=1 and dict_id in(30,31,33);
#ftp
update function_service_dict set is_import=1 where function_id=51 and is_valid=1 ;
update function_region_dict set is_import=1 where function_id=51 and is_valid=1 and dict_id in(36,37,38);

View File

@@ -2,6 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<script src="${pageContext.request.contextPath}/static/pages/scripts/importExcel.js" type="text/javascript"></script>
<div class="modal fade" id="import_modal" tabindex="-1" role="dialog" aria-labelledby="mo" aria-hidden="true">
<<<<<<< HEAD
<form id="importForm1" action="${ctx}/ntc/iplist/import?importPath=${importPath}" method="post" enctype="multipart/form-data" class="form-horizontal"
onsubmit="loading('<spring:message code='loading'/>');">

View File

@@ -24,7 +24,7 @@
<c:if test="${_cfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</select>
<input type="hidden" name="districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
<input type="hidden" name="districtShowName" maxlength="64" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
</div>
<div for="district"></div>
</div>

View File

@@ -92,8 +92,6 @@
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js"></script>
</c:otherwise>
</c:choose>
<script src="${pageContext.request.contextPath}/static/pages/scripts/importExcel.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/global/scripts/jquery.tagsinput.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>

View File

@@ -165,7 +165,7 @@ $(function(){
<c:if test="${_cfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</select>
<input type="hidden" name="districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
<input type="hidden" name="districtShowName" maxlength="64" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
</div>
<div for="district"></div>
</div>

View File

@@ -165,7 +165,7 @@ $(function(){
<c:if test="${_cfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</select>
<input type="hidden" name="districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
<input type="hidden" name="districtShowName" maxlength="64" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
</div>
<div for="district"></div>
</div>

View File

@@ -164,7 +164,7 @@ $(function(){
<c:if test="${_cfg.district eq dict.itemValue}">selected</c:if>>${dict.itemValue }</option>
</c:forEach>
</select>
<input type="hidden" name="districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
<input type="hidden" name="districtShowName" maxlength="64" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${_cfg.district}"/>
</div>
<div for="district"></div>
</div>

View File

@@ -41,7 +41,7 @@
<c:if test="${cfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</select>
<input type="hidden" name="${cfgName}.districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control invisibleChar" value="${cfg.district}"/>
<input type="hidden" name="${cfgName}.districtShowName" maxlength="64" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control invisibleChar" value="${cfg.district}"/>
</div>
<div for="${cfgName}.districtShowName"></div>
<div for="${cfgName}.district"></div>

View File

@@ -99,6 +99,11 @@
onClick="javascript:window.location='${ctx}/proxy/intercept/intercept${interceptType}Form?functionId=${cfg.functionId}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message></button>
<c:if test="${cfg.functionId eq 212}">
<button type="button" class="btn btn-primary import" >
<i class="fa fa-plus"></i>
<spring:message code="import"></spring:message></button>
</c:if>
</customTag:hasAnyPermissions>
</div>
@@ -531,6 +536,9 @@
</div>
</div>
</div>
<c:set var="importPath" value="/proxy/intercept/${fn:toLowerCase(interceptType)}/list"/>
<c:set var="functionId" value="${cfg.functionId}"/>
<!-- 模板导入start -->
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
</body>
</html>

View File

@@ -471,8 +471,9 @@
</div>
</div>
</div>
<c:set var="importPath" value="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}"/>
<<<<<<< HEAD
<c:set var="importPath" value="/ntc/iplist/list?functionId=${cfg.functionId}"/>
<!-- 模板导入start -->
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
</body>
</html>

View File

@@ -2,6 +2,7 @@ $(function(){
//增加描述新增时的文字长度限制
$("form input[name='cfgDesc']").attr("maxlength","128");
$("form input[name$='cfgKeywords']").attr("maxlength","1024");
$("form input[class~='domainCheck']").attr("maxlength","1024");
//截取过长的文字 使用id选择器;例如:tab对象->tr->td对象. 排除日志table .logTb
$("#contentTable").not(".logTb").find("td").each(function(i){
//获取td当前对象的文本,如果长度大于25;

View File

@@ -7,12 +7,30 @@ $(function(){
show:true
});
});
$("#appIdId").on("change",function(){
ajaxBehaviour($(this).val());
});
switchService();
$("input[name='serviceDictId']").click(function(){
switchService();
});
$("input[name='regionDictIds']").click(function(){
});
});
/**
* action动作切换
*/
function switchService(){
var functionId=$("#functionId").val();
if(functionId==5){//IP配置特殊处理
var cfgRegionCodeS=$("input[name='serviceDictId']:checked").attr("cfgRegionCodeS");
var cfgRegionCode=cfgRegionCodeS.split(",")[0];
$("input[name='regionDictIds'][cfgregioncoder!='"+cfgRegionCode+"']").prop("checked",false);
$("input[name='regionDictIds'][cfgRegionCodeR!='"+cfgRegionCode+"']").parents(".radio-inline").addClass("hidden");
$("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").prop("checked",true);
$("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").parents(".radio-inline").removeClass("hidden");
}
}
/**
* 模板下载
* TODO 后期修改为传入regionDictId
@@ -27,3 +45,46 @@ function downLoadTemplate(path){
document.location.href = path+'/ntc/iplist/import/template?' + params;
}
var ajaxBehaviour=function(val){
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4);
var request=$.ajax({
type:'post',
url:pathName+'/specific/specificServiceCfg/childrenList',
data:{"parent":val},
dataType:'json',
async:true,
success:function(data,textStatus){//处理返回结果
if(textStatus=="success"){
var html='<select name="behaviorId" data-live-search="true" class="selectpicker form-control">'
+'<option value=""><spring:message code="select"/></option>';
if(data.length>0){
for(i=0;i<data.length;i++){
html+='<option value="'+data[i].code+'"';
html+='>'+data[i].name+'</option>';
}
html+='</select>';
$("#behaviorId").html(html);
$("[name='behaviorId']").selectpicker("refresh");
$("[name='behaviorId']").selectpicker("render");
}else{
html+='</select>';
$("#behaviorId").html(html);
$("[name='behaviorId']").selectpicker("refresh");
$("[name='behaviorId']").selectpicker("render");
}
}
},
complete:function(XMLHttpRequest,status){//超时设置
if(status=="timeout"){
var html='<select name="behaviorId" data-live-search="true" class="selectpicker form-control">'
+'<option value=""><spring:message code="select"/></option></select>';
$("#behaviorId").html(html);
$("[name='behaviorId']").selectpicker("refresh");
$("[name='behaviorId']").selectpicker("render");
}
}
});
}