(1)特定服务管理UL修改

(2)特定服务管理加入协议号重复验证,有上级配置则上级配置的所有下级配置ID不能重复,无上级配置一级配置ID不能重复
(3)取消jBox的Cookie打印
This commit is contained in:
wangxin
2018-07-30 09:15:36 +08:00
parent 78e47ac599
commit 32b67d31f3
10 changed files with 228 additions and 111 deletions

View File

@@ -250,21 +250,32 @@ public class SpecificServiceCfgController extends BaseController {
* @return
*/
@ResponseBody
@RequestMapping(value = "isIdRepeat")
public boolean isIdRepeat(String specServiceId,String oldId){
if(oldId!=null){
if(oldId.trim().equals(specServiceId)){
return true;
@RequestMapping(value = "isCodeNotRepeat")
public boolean isIdRepeat(@RequestParam(required=false,value="parentId")Integer parentId,@RequestParam(required=false,value="specServiceId")Integer specServiceId,@RequestParam(required=true,value="specServiceCode")Integer specServiceCode,@RequestParam(required=true,value="cfgType")Integer cfgType){
if(parentId!=null&&parentId.intValue()!=0) {
Integer parentCode=specificServiceCfgService.getParentCode(parentId);
if(parentCode!=null&&parentCode.intValue()==specServiceCode) {
return false;
}
}
if(specServiceId!=null){
SpecificServiceCfg ss = specificServiceCfgService.getBySpecServiceId(Integer.valueOf(specServiceId));
if(ss==null){
return true;
if(ss!=null){
if(ss.getSpecServiceCode().intValue()==specServiceCode.intValue()&&cfgType.intValue()==ss.getCfgType().intValue()) {
return true;
}else {
ss=specificServiceCfgService.getRepeat(specServiceCode, cfgType,parentId);
if(ss==null) {
return true;
}
}
}
}else {
SpecificServiceCfg ss=specificServiceCfgService.getRepeat(specServiceCode, cfgType,parentId);
if(ss==null) {
return true;
}
}
return false;
}

View File

@@ -48,5 +48,7 @@ public interface SpecificServiceCfgDao extends CrudDao<SpecificServiceCfg> {
Integer updateConfigGroupInfobyGroupId(ConfigGroupInfo entity);
Integer getParentType(Integer specServiceId);
Integer getParentCode(Integer specServiceId);
SpecificServiceCfg getRepeat(@Param("specServiceCode")Integer code, @Param("cfgType")Integer cfgType,@Param("parentId")Integer parentId);
}

View File

@@ -37,10 +37,21 @@
select <include refid="specificServiceCfgColumns" />
from specific_service_cfg s where s.spec_service_id = #{specServiceId}
</select>
<select id="getRepeat" resultType="com.nis.domain.specific.SpecificServiceCfg" >
select <include refid="specificServiceCfgColumns" />
from specific_service_cfg s where s.spec_service_code = #{specServiceCode} and s.cfg_type=#{cfgType} and s.is_valid=1
<if test="parentId != null and parentId !=''">
and parent_id= #{parentId}
</if>
</select>
<select id="getParentType" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select cfg_type
from specific_service_cfg s where s.spec_service_id = #{specServiceId}
</select>
<select id="getParentCode" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select spec_service_code
from specific_service_cfg s where s.spec_service_id = #{specServiceId}
</select>
<!-- 查出所有符合条件的顶层数据 -->

View File

@@ -143,5 +143,11 @@ public class SpecificServiceCfgService extends BaseService{
public Integer getParentType(Integer specServiceId) {
return specificServiceCfgDao.getParentType(specServiceId);
}
public Integer getParentCode(Integer specServiceId) {
return specificServiceCfgDao.getParentCode(specServiceId);
}
public SpecificServiceCfg getRepeat (Integer code,Integer cfgType,Integer parentId) {
return specificServiceCfgDao.getRepeat(code,cfgType,parentId);
}
}

View File

@@ -3,6 +3,11 @@
<html>
<head>
<title></title>
<style type="text/css">
.tabbable-custom > .tab-content {
margin-top:-121px;
}
</style>
<script type="text/javascript">
var validateForm;
$(document).ready(function() {
@@ -23,16 +28,34 @@
$("#name").focus();
validateForm = $("#inputForm").validate({
/* rules:{
specServiceId:{
remote:'${ctx}/specific/specificServiceCfg/isIdRepeat?oldId=${specificServiceCfg.specServiceId}'
}
rules:{
/* specServiceCode:{
remote:{
url:"${ctx}/specific/specificServiceCfg/isCodeNotRepeat",
type:"post",
//dataType:"json",
//contentType:"application/json; charset=utf-8",
data:{
parentId:function(){
return $("[name='parent.specServiceId']").val();
},
specServiceCode:function(){
return $("#specServiceCode").val();
},
cfgType:function(){
return $("[name='cfgType']").val();
},
specServiceId:'${specificServiceCfg.specServiceId}'
}
}
} */
},
messages: {
specServiceId:{
/* specServiceCode:{
remote:'<spring:message code="repeat"/>'
}
}, */
} */
},
submitHandler: function(form){
if(!validateForm.form()) {
@@ -51,42 +74,61 @@
}
}
});
if("${specificServiceCfg.parentType}"){
$("[name=cfgType]").each(function(){
$(this).attr("parent-type","${specificServiceCfg.parentType}");
//if("${specificServiceCfg.parentType}"){
// $("[name=cfgType]").each(function(){
// $(this).attr("parent-type","${specificServiceCfg.parentType}");
// });
//}
if(!$("[name='cfgType']").val()){
$("[name='cfgType']").val(1);
$(".cfgType").each(function(){
if($(this).attr("cfgType")!=1){
$(this).addClass("hidden");
$(this).find("[name='parent.specServiceId']").removeAttr("name");
$(this).find("[name='parent.specServiceName']").removeAttr("name");
}
if($(this).attr("cfgType")==3){
$(this).find("input").unbind("click");
}
});
}else{
$(".cfgType").each(function(){
if($(this).attr("cfgType")!=$("[name='cfgType']").val()){
$(this).addClass("hidden");
$(this).find("[name='parent.specServiceId']").removeAttr("name");
$(this).find("[name='parent.specServiceName']").removeAttr("name");
}
if($(this).attr("cfgType")==3){
$(this).find("input").unbind("click");
}
});
}
$("#specificServiceCfgId").on("change",function(){
var data=$(this).attr("cfgtype");
if(data!=0){
$("[name=cfgType]").each(function(){
$(this).attr("parent-type",data);
if($(this).val()==data){
$(this).click();
}
})
}
$(".tabs-left li").on("click",function(){
var cfgType=$(this).attr("cfgType");
$("[name=cfgType]").val(cfgType);
$(".cfgType").each(function(){
if($(this).attr("cfgType")==cfgType){
$(this).removeClass("hidden");
$("#specificServiceCfg"+cfgType+"Id").attr("name","parent.specServiceId");
}else{
$(this).addClass("hidden").addClass("disable");
$(this).find("[name='parent.specServiceId']").removeAttr("name");
$(this).find("[name='parent.specServiceName']").removeAttr("name");
}
});
});
});
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="history.go(-1)"><spring:message code="back"/></button>
</div>
<h3 class="page-title">
<spring:message code="specific_service_cfg"/>
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
@@ -100,87 +142,105 @@
<a href="javascript:;" class="remove"> </a> -->
</div>
</div>
<div class="portlet-body form">
<div class="form-body">
<!-- BEGIN FORM-->
<form:form id="inputForm" modelAttribute="specificServiceCfg" action="${ctx}/specific/specificServiceCfg/saveOrUpdate" method="post" class="form-horizontal">
<input name="specServiceId" type="hidden" value="${specificServiceCfg.specServiceId}"/>
<input name="cfgType" type="hidden" value="${specificServiceCfg.cfgType}"/>
<form:hidden path="isValid" class="form-control"/>
<sys:message content="${message}"/>
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
<c:set var="fatherName"><spring:message code="root_node"/></c:set>
<sys:treeselect id="specificServiceCfg" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${specificServiceCfg.parent.specServiceId eq '0'?fatherName:fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName}"
title="" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=0" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_code"/>:</label>
<div class="col-md-4">
<input id="specServiceCode" name="specServiceCode" maxlength="50" range="[0,2147483647]" class="form-control required digits" value="${specificServiceCfg.specServiceCode}"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_name"/>:</label>
<div class="col-md-4">
<form:input path="specServiceName" htmlEscape="false" maxlength="64" class="form-control required noBlankSpace"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label hidden"><spring:message code="group_id"/>:</label>
<div class="col-md-4">
<form:input path="groupId" htmlEscape="false" maxlength="50" range="[0,2147483647]" class="form-control digits hidden" placeholder="0"/>
</div>
</div>
<%-- <div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">
<form:select path="isLeaf" class="form-control leafChange">
<c:forEach items="${fns:getDictList('INT_YES_NO')}" var="dict">
<form:option value="${dict.itemCode}"><spring:message code="${dict.itemValue}"/></form:option>
</c:forEach>
</form:select>
</div>
</div> --%>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="cfg_type"/>:</label>
<div class="col-md-4">
<c:forEach items="${fns:getDictList('SPECIFIC_SERVICE_CFG_TYPE') }" var="dict">
<label class="radio-inline"><form:radiobutton path="cfgType" class="required checkParent" value="${dict.itemCode}"/><spring:message code="${dict.itemValue}"/></label>
</c:forEach>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="protocol_desc"/>:</label>
<div class="col-md-4">
<form:textarea path="specServiceDesc" htmlEscape="false" maxlength="64" class="form-control"/>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<shiro:hasPermission name="specific:service:edit"><button type="submit" class="btn btn-circle blue"><spring:message code="submit"/></button></shiro:hasPermission>
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)"><spring:message code="cancel"/></button>
<div class="form-body">
<div class="portlet-body flip-scroll">
<div class="row-fluid">
<div class="span12">
<div class="tabbable tabbable-custom tabs-left">
<ul class="nav nav-tabs tabs-left">
<c:forEach items="${fns:getDictList('SPECIFIC_SERVICE_CFG_TYPE') }" var="dict">
<li class="<c:if test="${(specificServiceCfg.specServiceId ==null and dict.itemCode==1) or specificServiceCfg.cfgType eq dict.itemCode}">active</c:if>" cfgType="${dict.itemCode}" >
<a data-toggle="tab" href="#">
<spring:message code="${dict.itemValue}"/>
</a>
</li>
</c:forEach>
</ul>
<div class="tab-content">
<c:set var="fatherName"><spring:message code="root_node"/></c:set>
<c:forEach items="${fns:getDictList('SPECIFIC_SERVICE_CFG_TYPE') }" var="dict">
<div class="form-group cfgType" cfgType="${dict.itemCode}">
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
<c:if test="${empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${fatherName}"
title="" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if>
<c:if test="${not empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.cfgType eq dict.itemCode?specificServiceCfg.parent.specServiceId:0}" labelName="parent.specServiceName" labelValue="${(specificServiceCfg.cfgType eq dict.itemCode and specificServiceCfg.parent.specServiceId ne '0')?fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName:fatherName}"
title="" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if>
</div>
</div>
</c:forEach>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_code"/>:</label>
<div class="col-md-4">
<input id="specServiceCode" name="specServiceCode" maxlength="50" range="[0,2147483647]" class="form-control required digits specServiceCodeCheck" value="${specificServiceCfg.specServiceCode}" ctx="${ctx}"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_name"/>:</label>
<div class="col-md-4">
<form:input path="specServiceName" htmlEscape="false" maxlength="64" class="form-control required noBlankSpace"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label hidden"><spring:message code="group_id"/>:</label>
<div class="col-md-4">
<form:input path="groupId" htmlEscape="false" maxlength="50" range="[0,2147483647]" class="form-control digits hidden" placeholder="0"/>
</div>
</div>
<%-- <div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">
<form:select path="isLeaf" class="form-control leafChange">
<c:forEach items="${fns:getDictList('INT_YES_NO')}" var="dict">
<form:option value="${dict.itemCode}"><spring:message code="${dict.itemValue}"/></form:option>
</c:forEach>
</form:select>
</div>
</div> --%>
<%-- <div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="cfg_type"/>:</label>
<div class="col-md-4">
<c:forEach items="${fns:getDictList('SPECIFIC_SERVICE_CFG_TYPE') }" var="dict">
<label class="radio-inline"><form:radiobutton path="cfgType" class="required checkParent" value="${dict.itemCode}"/><spring:message code="${dict.itemValue}"/></label>
</c:forEach>
</div>
</div> --%>
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="protocol_desc"/>:</label>
<div class="col-md-4">
<form:textarea path="specServiceDesc" htmlEscape="false" maxlength="64" class="form-control"/>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<shiro:hasPermission name="specific:service:edit"><button type="submit" class="btn btn-circle blue"><spring:message code="submit"/></button></shiro:hasPermission>
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)"><spring:message code="cancel"/></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form:form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -606,7 +606,7 @@
var lang = navigator.userLanguage;//支持IE
}*/
var arrCookie = document.cookie.toLowerCase().split(";");
console.log(document.cookie);
//console.log(document.cookie);
for(i=0;i<arrCookie.length;i++){
var key=arrCookie[i].split("=")[0];
var value=arrCookie[i].split("=")[1];

View File

@@ -601,6 +601,30 @@ jQuery.validator.addMethod("checkParent",function(value, element) {
}
return true;
});
jQuery.validator.addMethod("specServiceCodeCheck",function(value, element) {
var ctx=$(element).attr("ctx");
var parentId= $("[name='parent.specServiceId']").val();
var specServiceCode= $("#specServiceCode").val();
var cfgType= $("[name='cfgType']").val();
var specServiceId= $("[name='specServiceId']").val();
var url=ctx+"/specific/specificServiceCfg/isCodeNotRepeat";
var val=true;
$.ajax({
url:url,
type:"post",
async:false,
data:{
parentId:parentId,
specServiceCode:specServiceCode,
cfgType:cfgType,
specServiceId:specServiceId
},
success:function(data){
val=data;
}
});
return val;
});
//ip v4转数字
var ipToNumber=function (ip){
var num =0;

View File

@@ -57,6 +57,7 @@
timeout:"timeout",
areaIpPrefix:"Forbiden value: ",
domainCheck:"Please enter a valid domain.",
checkParent:"Configuration Type must match it's parent."
checkParent:"Configuration Type must match it's parent.",
specServiceCodeCheck:"Protocol No is repeat."
});
}(jQuery));

View File

@@ -55,6 +55,7 @@
timeout:"timeout",
areaIpPrefix:"Forbiden value: ",
domainCheck:"Please enter a valid domain.",
checkParent:"Configuration Type must match it's parent."
checkParent:"Configuration Type must match it's parent.",
specServiceCodeCheck:"Protocol No is repeat."
});
}(jQuery));

View File

@@ -59,6 +59,7 @@
timeout:"超时",
areaIpPrefix:"禁止使用的值: ",
domainCheck:"请输入有效的域名",
checkParent:"配置类型必须与上级配置一致!"
checkParent:"配置类型必须与上级配置一致!",
specServiceCodeCheck:"协议号重复"
});
}(jQuery));