343 lines
13 KiB
Plaintext
343 lines
13 KiB
Plaintext
<%@ page contentType="text/html;charset=UTF-8" %>
|
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
|
<html>
|
|
<head>
|
|
<title>系统业务管理表单</title>
|
|
<link href="${pageContext.request.contextPath}/static/pages/css/systemService.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$("#inputForm").validate({
|
|
rules: {
|
|
'serviceName':{
|
|
required:true
|
|
},
|
|
'serviceId':{
|
|
required:true,
|
|
remote:"${ctx}/systemService/serviceIdValidate?id=" + encodeURIComponent($("#id").val())
|
|
},
|
|
'action':{
|
|
required:true
|
|
},
|
|
'serviceType':{
|
|
required:true
|
|
},
|
|
'serviceDesc':{
|
|
required:true
|
|
}
|
|
},
|
|
messages: {
|
|
'serviceName':{
|
|
required:'<spring:message code="required"/>'
|
|
},
|
|
'serviceId':{
|
|
required:'<spring:message code="required"/>',
|
|
remote:'<spring:message code="repeat"/>'+'serviceId'
|
|
},
|
|
'action':{
|
|
required:'<spring:message code="required"/>'
|
|
},
|
|
'serviceType':{
|
|
required:'<spring:message code="required"/>'
|
|
},
|
|
'serviceDesc':{
|
|
required:'<spring:message code="required"/>'
|
|
}
|
|
},
|
|
submitHandler: function(form){
|
|
$("[for=childTableFlag]").css("display", "none");
|
|
var flag = true;
|
|
var tables = document.getElementsByClassName("child-required");
|
|
for (var i = 0; i < tables.length; i++) {
|
|
if (!tables[i].value || tables[i].value == '') {
|
|
$("[for=childTableFlag]").css("display", "inline");
|
|
flag = false;
|
|
break;
|
|
}
|
|
}
|
|
if (flag) {
|
|
loading('LOADING...');
|
|
$("[disabled=disabled]").attr("disabled", false);
|
|
form.submit();
|
|
} else {
|
|
flag = true;
|
|
return false;
|
|
}
|
|
},
|
|
errorContainer: "#messageBox",
|
|
errorPlacement: function(error, element) {
|
|
$("#messageBox").text("<spring:message code='enter_error'/>");
|
|
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
|
|
error.appendTo(element.parent().parent());
|
|
} else {
|
|
error.insertAfter(element);
|
|
}
|
|
}
|
|
});
|
|
|
|
changeType($("#serviceType").val(), $("#serviceType"));
|
|
|
|
//类型、动作不允许修改
|
|
if ("${systemServiceInfo.id}") {
|
|
$("#action").attr("disabled", true);
|
|
$("#serviceType").attr("disabled", true);
|
|
$("[name=tableType]").attr("disabled", true);
|
|
}
|
|
});
|
|
|
|
function changeType(v, obj) {
|
|
if ($(obj).val() == '') {
|
|
$("#addBtn").attr("disabled", true);
|
|
} else if ($(obj).val() == '1') {
|
|
if ($(".table-list").length > 1) {
|
|
alert('<spring:message code="single_service_message"/>');
|
|
$(obj).val(v);
|
|
} else if ($(".table-list").length == 1) {
|
|
$("#addBtn").attr("disabled", true);
|
|
} else if ($(".table-list").length == 0) {
|
|
$("#addBtn").attr("disabled", false);
|
|
}
|
|
} else if ($(obj).val() == '2') {
|
|
$("#addBtn").attr("disabled", false);
|
|
} else if ($(obj).val() == '3') {
|
|
if ($(".table-list").length > 1) {
|
|
alert('<spring:message code="special_service_message"/>');
|
|
$(obj).val(v);
|
|
} else if ($(".table-list").length == 1) {
|
|
$("#addBtn").attr("disabled", true);
|
|
} else if ($(".table-list").length == 0) {
|
|
$("#addBtn").attr("disabled", false);
|
|
}
|
|
}
|
|
|
|
autoServiceId();
|
|
}
|
|
|
|
//自动获取serviceId
|
|
function autoServiceId() {
|
|
if ("${systemServiceInfo.id}") {
|
|
return false;
|
|
}
|
|
var type = $("[name=tableType]").val();
|
|
var action = $("#action").val();
|
|
var serviceIdPre;
|
|
if ($("#serviceType").val() == "1" && action && type) {
|
|
serviceIdPre = type + "0" + (action < 10 ? ("0" + action) : action);
|
|
} else if ($("#serviceType").val() == "2" && action) {
|
|
type = "60";
|
|
serviceIdPre = type + (action < 10 ? ("0" + action) : action);
|
|
} else if ($("#serviceType").val() == "3" && action) {
|
|
type = "50";
|
|
serviceIdPre = type + (action < 10 ? ("0" + action) : action);
|
|
} else {
|
|
serviceIdPre = "";
|
|
}
|
|
|
|
if (serviceIdPre) {
|
|
$.ajax({
|
|
type:"get",
|
|
url:"${ctx}/systemService/newServiceId?serviceIdPre=" + serviceIdPre,
|
|
dataType:"text",
|
|
success: function(data) {
|
|
if (data) {
|
|
$("#serviceIdInput").val(data);
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
$("#serviceIdInput").val("");
|
|
}
|
|
}
|
|
|
|
function addDatatable() {
|
|
$("#datatables").append(
|
|
'<div class="table-list col-md-10">' +
|
|
'<div>' +
|
|
'<input type="hidden" name="sciId" value="0"/>' +
|
|
'<input type="hidden" name="sciIsValid" value="1"/>' +
|
|
'<span class="child-label col-md-2"><font color="red">*</font>'+'<spring:message code="table_name"/>'+':</span> ' +
|
|
'<span><input class="child-required form-control child-input" name="tableName"/></span> ' +
|
|
'</div>' +
|
|
'<div>' +
|
|
'<span class="child-label col-md-2"><font color="red">*</font>'+'<spring:message code="table_type"/>'+':</span> ' +
|
|
'<span> ' +
|
|
'<select class="child-required child-input" name="tableType" onchange="autoServiceId()"> ' +
|
|
'<option value="">'+'<spring:message code="select"/>'+'</option>' +
|
|
'<option value="1">IP</option>' +
|
|
'<option value="2">'+'<spring:message code="string"/>'+'</option>' +
|
|
'<option value="3">'+'<spring:message code="number"/>'+'</option>' +
|
|
'<option value="4">'+'<spring:message code="strong_string"/>'+'</option>' +
|
|
'</select>' +
|
|
'</span> ' +
|
|
'</div>' +
|
|
'<div>' +
|
|
'<span class="child-label col-md-2"><font color="red">*</font>MAAT '+'<spring:message code="table_name"/>'+':</span> ' +
|
|
'<span><input class="child-required form-control child-input" name="maatTable"/></span>' +
|
|
'</div>' +
|
|
'<div>' +
|
|
'<span class="child-label col-md-2"><font color="red">*</font>'+'<spring:message code="table_des"/>'+':</span> ' +
|
|
'<span><input class="child-required form-control child-input" name="tableDesc"/></span>' +
|
|
'<button type="button" class="btn btn-danger del-button" onclick="del2(this)">'+'<spring:message code="delete"/>'+'</button>' +
|
|
'</div>' +
|
|
'</div>'
|
|
);
|
|
|
|
if ($("#serviceType").val() == '1' || $("#serviceType").val() == '3') {
|
|
$("#addBtn").attr("disabled", true);
|
|
}
|
|
}
|
|
|
|
function del(obj) {
|
|
$(obj).parent().parent().find("[name=sciIsValid]").val("0");
|
|
$(obj).parent().parent().css("display", "none").attr("class", "table-delete");
|
|
changeType($("#serviceType").val(), $("#serviceType"));
|
|
}
|
|
|
|
function del2(obj) {
|
|
$(obj).parent().parent().remove();
|
|
changeType($("#serviceType").val(), $("#serviceType"));
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
<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="sysService_manage"/>
|
|
</h3>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="portlet box blue">
|
|
<div class="portlet-title">
|
|
<div class="caption">
|
|
<i class="fa fa-gift"></i><spring:message code="add"/></div>
|
|
</div>
|
|
|
|
<div class="portlet-body form">
|
|
<div class="form-body">
|
|
|
|
<!-- BEGIN FORM-->
|
|
<form:form id="inputForm" modelAttribute="systemServiceInfo" action="${ctx}/systemService/save" method="post" class="form-horizontal">
|
|
<form:hidden path="id" id="id"/>
|
|
<sys:message content="${message}"/>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="service_name"/>:</label>
|
|
<div class="col-md-4">
|
|
<form:input path="serviceName" htmlEscape="false" maxlength="30" class="required form-control"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="act"/>:</label>
|
|
<div class="col-md-4">
|
|
<form:select id="action" path="action" class="required form-control" onchange="autoServiceId()">
|
|
<form:option value=""><spring:message code="select"/></form:option>
|
|
<form:option value="1"><spring:message code="block"/></form:option>
|
|
<form:option value="2"><spring:message code="monitor"/></form:option>
|
|
<form:option value="5"><spring:message code="block_white_list"/></form:option>
|
|
<form:option value="6"><spring:message code="monitor_white_list"/></form:option>
|
|
<form:option value="7"><spring:message code="block_monitor_white_list"/></form:option>
|
|
<form:option value="8"><spring:message code="grey_list"/></form:option>
|
|
</form:select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="type"/>:</label>
|
|
<div class="col-md-4">
|
|
<form:select id="serviceType" path="serviceType" class="required form-control" onclick="now=this.value" onchange="changeType(now, this)">
|
|
<form:option value=""><spring:message code="select"/></form:option>
|
|
<form:option value="1"><spring:message code="single_domain"/></form:option>
|
|
<form:option value="2"><spring:message code="multi_domain"/></form:option>
|
|
<form:option value="3"><spring:message code="special_service"/></form:option>
|
|
</form:select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><spring:message code="datebase_table"/>:</label>
|
|
<div class="col-md-8" id="datatables">
|
|
<shiro:hasPermission name="system:service:edit">
|
|
<div>
|
|
<button id="addBtn" type="button" class="btn btn-default" onclick="addDatatable()"><spring:message code="add"/></button>
|
|
<label for="childTableFlag" class="error" style="display:none"><spring:message code="fill_all"/></label>
|
|
</div>
|
|
</shiro:hasPermission>
|
|
<c:forEach items="${systemServiceInfo.serviceConfigInfoList }" var="serviceConfigInfo">
|
|
<div class="table-list col-md-10">
|
|
<div>
|
|
<input type="hidden" name="sciId" value="${serviceConfigInfo.id }"/>
|
|
<input type="hidden" name="sciIsValid" value="1"/>
|
|
|
|
<span class="child-label col-md-2"><font color="red">*</font><spring:message code="table_name"/>:</span>
|
|
<span><input class="child-required form-control child-input" name="tableName" value="${serviceConfigInfo.tableName }"/></span>
|
|
</div>
|
|
<div>
|
|
<span class="child-label col-md-2"><font color="red">*</font><spring:message code="table_type"/>:</span>
|
|
<span>
|
|
<select class="child-required child-input" name="tableType">
|
|
<option value=""><spring:message code="select"/></option>
|
|
<option value="1" <c:if test="${serviceConfigInfo.tableType eq 1}">selected="selected"</c:if>>IP</option>
|
|
<option value="2" <c:if test="${serviceConfigInfo.tableType eq 2}">selected="selected"</c:if>><spring:message code="string"/></option>
|
|
<option value="3" <c:if test="${serviceConfigInfo.tableType eq 3}">selected="selected"</c:if>><spring:message code="number"/></option>
|
|
<option value="4" <c:if test="${serviceConfigInfo.tableType eq 4}">selected="selected"</c:if>><spring:message code="strong_string"/></option>
|
|
</select>
|
|
</span>
|
|
</div>
|
|
<div>
|
|
<span class="child-label col-md-2"><font color="red">*</font>MAAT <spring:message code="table_name"/>:</span>
|
|
<span><input class="child-required form-control child-input" name="maatTable" value="${serviceConfigInfo.maatTable }"/></span>
|
|
</div>
|
|
<div>
|
|
<span class="child-label col-md-2"><font color="red">*</font><spring:message code="table_des"/>:</span>
|
|
<span><input class="child-required form-control child-input" name="tableDesc" value="${serviceConfigInfo.tableDesc }"/></span>
|
|
|
|
<button type="button" class="btn btn-danger del-button" onclick="del(this)"><spring:message code="delete"/></button>
|
|
</div>
|
|
</div>
|
|
</c:forEach>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="service_id"/>:</label>
|
|
<div class="col-md-4">
|
|
<input id="serviceIdInput" class="required form-control" name="serviceId" value="${systemServiceInfo.serviceId }" readonly="readonly">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="describe"/>:</label>
|
|
<div class="col-md-4">
|
|
<form:textarea path="serviceDesc" htmlEscape="false" class="required form-control"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<div class="row">
|
|
<div class="col-md-offset-3 col-md-9">
|
|
<shiro:hasPermission name="system:service:edit"><input type="submit" class="btn btn-circle blue" value=<spring:message code="submit"></spring:message>></shiro:hasPermission>
|
|
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)"><spring:message code="cancel"></spring:message></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form:form>
|
|
<!-- END FORM-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html> |