@@ -362,52 +362,72 @@ $(function(){
$ ( ".action" ) . on ( "change" , function ( ) {
$ ( "#serviceId" ) . val ( $ ( this ) . attr ( "serviceId" ) ) ;
$ ( "#protocolId" ) . val ( $ ( this ) . attr ( "protocolId" ) ) ;
var actionCode = $ ( this ) . val ( ) ;
var regionCode = $ ( this ) . attr ( "regionCode" ) ;
if ( ! regionCode ) {
regionCode = $ ( "input[name='action']" ) . attr ( "regionCode" ) ;
}
if ( regionCode ) {
$ ( "[id^='cfgRegionCode']" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "id" ) == ( "cfgRegionCode" + regionCode ) ) {
$ ( this ) . attr ( "name" , "cfgRegionCod e" ) ;
} else {
$ ( this ) . removeA ttr( "name" ) ;
if ( regionCode . indexOf ( "," ) == - 1 ) {
$ ( "#cfgRegionCode" + regionCode ) . attr ( "name" , "cfgRegionCode" ) ;
$ ( "#cfgType" + regionCode ) . attr ( "name" , "cfgTyp e" ) ;
$ ( "[id^='cfgRegionCode']" ) . each ( function ( ) {
if ( $ ( this ) . a ttr( "id" ) == ( "cfgRegionCode" + regionCode ) ) {
$ ( this ) . attr ( "name" , "cfgRegionCode" ) ;
} else {
$ ( this ) . removeAttr ( "name" ) ;
}
} ) ;
$ ( "[id^='cfgType']" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "id" ) == ( "cfgType" + regionCode ) ) {
$ ( this ) . attr ( "name" , "cfgType" ) ;
} else {
$ ( this ) . removeAttr ( "name" ) ;
}
} ) ;
} else {
var _region = '' ;
var regionArr = regionCode . split ( ',' ) ;
$ ( "input[name$='cfgRegionCode'][regionType='1']" ) . each ( function ( ) {
for ( var re in regionArr ) {
if ( $ ( this ) . val ( ) == regionArr [ re ] ) {
serviceType = $ ( this ) . attr ( "serviceType" ) ;
_region = regionArr [ re ] ;
break ;
}
}
} ) ;
if ( _region != '' ) {
regionCode = _region ;
}
} ) ;
$ ( "[id^='cfgType']" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "id" ) == ( "cfgType" + regionCode ) ) {
$ ( this ) . attr ( "name" , "cfgType " ) ;
} else {
$ ( this ) . removeA ttr( "name " ) ;
}
} ) ;
var ipPortShow = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipPortShow" ) ,
ipType = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipType" ) ,
ipPattern = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipPattern" ) ,
portPattern = $ ( "input[name='cfgRegionCode']" ) . attr ( "portPattern" ) ,
direction = $ ( "input[name='cfgRegionCode']" ) . attr ( "direction" ) ,
protocol = $ ( "input[name='cfgRegionCode']" ) . attr ( "protocol" ) ;
}
var ipPortShow = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "ipPortShow" ) ,
ipType = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "ipType" ) ,
ipPattern = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "ipPattern " ) ,
portPattern = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "portPattern" ) ,
direction = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . a ttr( "direction " ) ,
protocol = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "protocol" ) ,
regionType = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "regionType" ) ;
//ip, 端口处理
if ( ipPortShow ) {
if ( ipPortShow . indexOf ( '1' ) > - 1 ) { //展示源IP,端口
$ ( "input[name='srcIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name='srcPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='srcIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='srcPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
} else {
$ ( "input[name='srcIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name='srcPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='srcIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='srcPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
}
if ( ipPortShow . indexOf ( '2' ) > - 1 ) { //展示目的IP,端口
$ ( "input[name='destIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name='destPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='destIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='destPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
} else {
$ ( "input[name='destIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name='destPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='destIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='destPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
}
}
if ( ipType ) {
var arr = ipType . split ( ',' ) ;
$ ( "select[name='ipType'] option" ) . each ( function ( ) {
$ ( "select[name$ ='ipType'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -422,10 +442,11 @@ $(function(){
$ ( this ) . attr ( "disabled" , true ) ;
}
} ) ;
$ ( "select[name$='ipType']" ) . selectpicker ( "refresh" ) ;
}
if ( ipPattern ) {
arr = ipPattern . split ( ',' ) ;
$ ( "select[name='ipPattern'] option" ) . each ( function ( ) {
$ ( "select[name$ ='ipPattern'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -440,10 +461,11 @@ $(function(){
$ ( this ) . attr ( "disabled" , true ) ;
}
} ) ;
$ ( "select[name$='ipPattern']" ) . selectpicker ( "refresh" ) ;
}
if ( portPattern ) {
arr = portPattern . split ( ',' ) ;
$ ( "select[name='portPattern'] option" ) . each ( function ( ) {
$ ( "select[name$ ='portPattern'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -458,10 +480,11 @@ $(function(){
$ ( this ) . attr ( "disabled" , true ) ;
}
} ) ;
$ ( "select[name$='portPattern']" ) . selectpicker ( "refresh" ) ;
}
if ( direction ) {
arr = direction . split ( ',' ) ;
$ ( "select[name='direction'] option" ) . each ( function ( ) {
$ ( "select[name$ ='direction'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -476,11 +499,12 @@ $(function(){
$ ( this ) . attr ( "disabled" , true ) ;
}
} ) ;
$ ( "select[name$='direction']" ) . selectpicker ( "refresh" ) ;
}
if ( protocol ) {
arr = protocol . split ( ',' ) ;
$ ( "select[name='protocol'] option" ) . each ( function ( ) {
$ ( "select[name$ ='protocol'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -495,21 +519,19 @@ $(function(){
$ ( this ) . attr ( "disabled" , true ) ;
}
} ) ;
$ ( "select[name$='protocol']" ) . selectpicker ( "refresh" ) ;
}
//处理自定义字段
var serviceType = $ ( "# cfgRegionCode" + regionCode ) . attr ( "serviceType" ) ;
var serviceType = $ ( "input[name$=' cfgRegionCode'][value=' " + regionCode + "']" ) . attr ( "serviceType" ) ;
if ( serviceType ) {
if ( serviceType . indexOf ( "ipaddr" ) > - 1 ) {
if ( $ ( this ) . val ( ) == 32 ) {
$ ( "select[name='protocol'] option" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "value" ) == 1 ) {
$ ( this ) . removeA ttr( "disabled" ) ;
}
} ) ;
$ ( "select[name='protocol']" ) . selectpicker ( "refresh" ) ;
$ ( "select[name$ ='protocol'] option[value='1']" ) . removeAttr ( "disabled" )
} else {
$ ( "select[name$='protocol'] option[value='1']" ) . a ttr( "disabled" , true );
}
$ ( "select[name$='protocol']" ) . selectpicker ( "refresh" ) ;
}
if ( serviceType . indexOf ( "ipmulitiplex" ) > - 1 ) {
$ ( ".ipmulitiplex" ) . removeClass ( "hidden" ) ;
@@ -526,7 +548,7 @@ $(function(){
$ ( ".ratelimit" ) . addClass ( "hidden" ) ;
}
if ( $ ( this ) . val ( ) == 0x20 || $ ( this ) . val ( ) == 0x60 ) {
$ ( "input[name='isAreaEffective']" ) . each ( function ( ) {
$ ( "input[name$ ='isAreaEffective']" ) . each ( function ( ) {
if ( $ ( this ) . val ( ) == 0 ) {
$ ( this ) . click ( ) ;
}
@@ -1362,35 +1384,55 @@ var validateInvisibleCharTag=function(){
return true ;
}
var initCommIpVal = function ( ) {
var regionCode , serviceType ;
if ( $ ( "input[name='action']:checked" ) . length > 0 ) {
regionCode = $ ( "input[name='action']:checked" ) . attr ( "regionCode" ) ;
serviceTyp e= $ ( "#cfgRegionCode" + regionCode ) . attr ( "serviceTyp e" ) ;
var regionCode , serviceType , ipPortShow , ipType ,
ipPattern , portPattern , direction , protocol , regionType ;
if ( $ ( "input[name$ ='action']:checked" ) . length > 0 ) {
regionCod e= $ ( "input[name$='action']:checked" ) . attr ( "regionCod e" ) ;
} else {
regionCode = $ ( "input[name='action']" ) . attr ( "regionCode" ) ;
serviceType = $ ( "#cfgRegionCode" + regionCode ) . attr ( "serviceType" ) ;
regionCode = $ ( "input[name$ ='action']" ) . attr ( "regionCode" ) ;
}
if ( regionCode ) {
if ( regionCode . indexOf ( "," ) == - 1 ) {
$ ( "#cfgRegionCode" + regionCode ) . attr ( "name" , "cfgRegionCode" ) ;
$ ( "#cfgType" + regionCode ) . attr ( "name" , "cfgType" ) ;
serviceType = $ ( "input[name$='cfgRegionCode'][regionType='1'][value='" + regionCode + "']" ) . attr ( "serviceType" ) ;
} else {
var _region = '' ;
var regionArr = regionCode . split ( ',' ) ;
$ ( "input[name$='cfgRegionCode'][regionType='1']" ) . each ( function ( ) {
for ( var re in regionArr ) {
if ( $ ( this ) . val ( ) == regionArr [ re ] ) {
serviceType = $ ( this ) . attr ( "serviceType" ) ;
_region = regionArr [ re ] ;
break ;
}
}
} ) ;
if ( _region != '' ) {
regionCode = _region ;
}
}
}
if ( serviceType ) {
if ( serviceType . indexOf ( "ipaddr" ) > - 1 && $ ( "input[name='action']:checked" ) . val ( ) == 32 ) {
$ ( "select[name='protocol'] option" ) . each ( function ( ) {
if ( serviceType . indexOf ( "ipaddr" ) > - 1 && $ ( "input[name$ ='action']:checked" ) . val ( ) == 32 ) {
$ ( "select[name$ ='protocol'] option" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "value" ) == 1 ) {
$ ( this ) . removeAttr ( "disabled" ) ;
}
} ) ;
$ ( "select[name='protocol']" ) . selectpicker ( "refresh" ) ;
$ ( "select[name$ ='protocol']" ) . selectpicker ( "refresh" ) ;
}
if ( serviceType && serviceType . indexOf ( "ipaddr" ) > - 1 && $ ( "input[name='action']" ) . val ( ) == 32 ) {
$ ( "select[name='protocol'] option" ) . each ( function ( ) {
if ( serviceType && serviceType . indexOf ( "ipaddr" ) > - 1 && $ ( "input[name$ ='action']" ) . val ( ) == 32 ) {
$ ( "select[name$ ='protocol'] option" ) . each ( function ( ) {
if ( $ ( this ) . attr ( "value" ) == 1 ) {
$ ( this ) . removeAttr ( "disabled" ) ;
}
} ) ;
$ ( "select[name='protocol']" ) . selectpicker ( "refresh" ) ;
$ ( "select[name$ ='protocol']" ) . selectpicker ( "refresh" ) ;
}
if ( serviceType . indexOf ( "ipmulitiplex" ) > - 1 ) {
$ ( ".ipmulitiplex" ) . removeClass ( "hidden" ) ;
$ ( "input[name='isAreaEffective']" ) . each ( function ( ) {
$ ( "input[name$ ='isAreaEffective']" ) . each ( function ( ) {
if ( $ ( this ) . val ( ) == 0 ) {
$ ( this ) . click ( ) ;
}
@@ -1401,7 +1443,7 @@ var initCommIpVal=function(){
$ ( ".ipmulitiplex" ) . addClass ( "hidden" ) ;
}
if ( serviceType . indexOf ( "ratelimit" ) > - 1 ) {
if ( $ ( "input[name='action']" ) . val ( ) == 64 || $ ( "input[name='action']:checked" ) . val ( ) == 64 ) {
if ( $ ( "input[name$ ='action']" ) . val ( ) == 64 || $ ( "input[name$ ='action']:checked" ) . val ( ) == 64 ) {
$ ( ".ratelimit" ) . removeClass ( "hidden" ) ;
} else {
$ ( ".ratelimit" ) . addClass ( "hidden" ) ;
@@ -1410,41 +1452,33 @@ var initCommIpVal=function(){
$ ( ".ratelimit" ) . addClass ( "hidden" ) ;
}
}
$ ( "# cfgRegionCode"+ regionCode ) . attr ( "name" , "cfgRegionCode " ) ;
$ ( "#cfgType "+ regionCode ) . attr ( "name" , "cfg Type" ) ;
$ ( "div[class^='region']" ) . each ( function ( ) {
if ( ! $ ( this ) . hasClass ( "region" + regionCode ) ) {
$ ( this ) . addClass ( "hidde n" ) ;
$ ( this ) . find ( "input " ) . removeA ttr( "name " ) ;
$ ( this ) . find ( "select " ) . removeA ttr( "nam e" ) ;
}
} )
var ipPortShow = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipPortShow" ) ,
ipType = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipType" ) ,
ipPattern = $ ( "input[name='cfgRegionCode']" ) . attr ( "ipPattern" ) ,
portPattern = $ ( "input[name='cfgRegionCode']" ) . attr ( "portPattern" ) ,
direction = $ ( "input[name='cfgRegionCode']" ) . attr ( "direction" ) ,
protocol = $ ( "input[name='cfgRegionCode']" ) . attr ( "protocol" ) ;
ipPortShow = $ ( "input[name$=' cfgRegionCode'][value=' " + regionCode + "']" ) . attr ( "ipPortShow " ) ,
ipType = $ ( "input[name$='cfgRegionCode'][value=' " + regionCode + "']" ) . attr ( "ip Type" ) ,
ipPattern = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "ipPattern" ) ,
portPattern = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "portPattern" ) ,
direction = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "']" ) . attr ( "directio n") ,
protocol = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "'] ") . a ttr( "protocol " ) ,
regionType = $ ( "input[name$='cfgRegionCode'][value='" + regionCode + "'] ") . a ttr( "regionTyp e" ) ;
//ip, 端口处理
if ( ipPortShow ) {
if ( ipPortShow . indexOf ( '1' ) > - 1 ) { //展示源IP,端口
$ ( "input[name='srcIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name='srcPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='srcIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='srcPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
} else {
$ ( "input[name='srcIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name='srcPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='srcIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='srcPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
}
if ( ipPortShow . indexOf ( '2' ) > - 1 ) { //展示目的IP,端口
$ ( "input[name='destIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name='destPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='destIpAddress']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
$ ( "input[name$ ='destPort']" ) . parents ( ".form-group" ) . removeClass ( "hidden" ) ;
} else {
$ ( "input[name='destIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name='destPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='destIpAddress']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
$ ( "input[name$ ='destPort']" ) . parents ( ".form-group" ) . addClass ( "hidden" ) ;
}
}
if ( ipType ) {
var arr = ipType . split ( ',' ) ;
$ ( "select[name='ipType'] option" ) . each ( function ( ) {
$ ( "select[name$ ='ipType'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -1462,7 +1496,7 @@ var initCommIpVal=function(){
}
if ( ipPattern ) {
arr = ipPattern . split ( ',' ) ;
$ ( "select[name='ipPattern'] option" ) . each ( function ( ) {
$ ( "select[name$ ='ipPattern'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -1480,7 +1514,7 @@ var initCommIpVal=function(){
}
if ( portPattern ) {
arr = portPattern . split ( ',' ) ;
$ ( "select[name='portPattern'] option" ) . each ( function ( ) {
$ ( "select[name$ ='portPattern'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -1498,7 +1532,7 @@ var initCommIpVal=function(){
}
if ( direction ) {
arr = direction . split ( ',' ) ;
$ ( "select[name='direction'] option" ) . each ( function ( ) {
$ ( "select[name$ ='direction'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {
@@ -1516,7 +1550,7 @@ var initCommIpVal=function(){
}
if ( protocol ) {
arr = protocol . split ( ',' ) ;
$ ( "select[name='protocol'] option" ) . each ( function ( ) {
$ ( "select[name$ ='protocol'] option" ) . each ( function ( ) {
var has = false ;
for ( var type in arr ) {
if ( $ ( this ) . val ( ) == arr [ type ] ) {