|
|
<%@page language="java" contentType="text/html;charset=utf-8" %>
|
|
|
<form method="post" class="form-horizontal" id="smsTemplateForm" name="smsTemplateForm">
|
|
|
<form method="post" class="form-horizontal" id="hostInfoForm" name="hostInfoForm">
|
|
|
|
|
|
<div>
|
|
|
<label> <span style="color:red">*</span>主机别名:</label>
|
|
|
<input type="text" class="form-control" id="alias" name="alias" placeholder="输入主机别名" maxlength="30" size="40"/>
|
|
|
<div class="form-group" >
|
|
|
<label class="col-sm-2 control-label"> <span style="color:red">*</span>主机别名:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<input type="text" class="form-control" id="alias" name="alias" placeholder="输入主机别名" maxlength="30" size="40"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
<label> <span style="color:red">*</span>主机IP:label>
|
|
|
<input type="text" class="form-control" id="hostIP" name="hostIP" placeholder="输入IP地址" maxlength="30" size="40"/>
|
|
|
<div class="form-group" >
|
|
|
<label class="col-sm-2 control-label"> <span style="color:red">*</span>主机IP:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<input type="text" class="form-control" id="hostIp" name="hostIp" placeholder="输入IP地址" maxlength="30" size="40"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
<label> <span style="color:red">*</span>云类型:</label>
|
|
|
<input type="text" class="form-control" id="smsTemplateTitle" name="smsTemplateTitle" placeholder="最多30个汉字" maxlength="30" size="40"/>
|
|
|
<div class="form-group" >
|
|
|
<label class="col-sm-2 control-label"> <span style="color:red">*</span>云类型:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<select id="cloudType" name="cloudType" class="form-control">
|
|
|
<option value="1">AWS</option>
|
|
|
<option value="2">腾讯云</option>
|
|
|
<option value="3">其他</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
<div class="form-group">
|
|
|
<input type="button" class="btn btn-primary" style="margin-left:100px" id="saveSmsTemplateBtn" value="保存" />
|
|
|
<div class="form-group" >
|
|
|
<label class="col-sm-2 control-label"> <span style="color:red">*</span>主机组:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<select id="groupId" name="groupId" class="form-control">
|
|
|
<option value="1">AWS</option>
|
|
|
<option value="2">腾讯云</option>
|
|
|
<option value="3">其他</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group" >
|
|
|
<label class="col-sm-2 control-label"> <span style="color:red">*</span>安装软件:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<input type="checkbox" name="appName" value="JAVA"> JAVA <input type="checkbox" name="appName" value="Redis" > Redis
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
var TextCount = (function () {
|
|
|
var _bind = function (that) {
|
|
|
that.input.on('keyup', function () {
|
|
|
that.render();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
var _getNum = function (that) {
|
|
|
return that.input.val().length;
|
|
|
}
|
|
|
|
|
|
var TextCountFun = function (config) {
|
|
|
this.id = config.id;
|
|
|
}
|
|
|
|
|
|
TextCountFun.prototype.init = function () {
|
|
|
this.input = $(this.id);
|
|
|
this.render();
|
|
|
_bind(this);
|
|
|
};
|
|
|
|
|
|
TextCountFun.prototype.render = function () {
|
|
|
var num = _getNum(this);
|
|
|
if ($('#_test_count').length == 0) {
|
|
|
$('#countDiv').append('<span id="_test_count"></span>');
|
|
|
};
|
|
|
|
|
|
if (num < 71) {
|
|
|
$('#_test_count').html(num + '/990');
|
|
|
} else if (num <= 990) {
|
|
|
var message = "共" + num + "字符,含短信签名,将被做" + Math.ceil(num / 70) + "条短信计价。每条短信最多70个字符";
|
|
|
$('#_test_count').html(num + '/990' + ' <span style="color: red">' + message + '</span>');
|
|
|
} else {
|
|
|
$('#_test_count').html('990/990');
|
|
|
}
|
|
|
};
|
|
|
return TextCountFun;
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
$("#smsTemplateForm #smsTemplateTitle").validate({
|
|
|
required: true,
|
|
|
validateOnBlur : false
|
|
|
});
|
|
|
|
|
|
$("form #smsTemplateContent").validate({
|
|
|
required: true,
|
|
|
validateOnBlur : false
|
|
|
});
|
|
|
if(paramObj.hoseInfoId > 0){
|
|
|
|
|
|
//保存
|
|
|
$("#saveSmsTemplateBtn").click(function(){
|
|
|
var smsTemplateId = $("#smsTemplateId").val();
|
|
|
var btn = $(this);
|
|
|
btn.prop("disabled", true);
|
|
|
$("#smsTemplateForm").form("submit", {
|
|
|
submitUrl : contextPath + "/SmsTemplateController/saveSmsTemplate.do",
|
|
|
submitData : {
|
|
|
smsTemplateId : paramObj.smsTemplateId
|
|
|
//加载form
|
|
|
$("#hostInfoForm").form({
|
|
|
loadUrl : contextPath + "/hostInfo/getHostInfoById.do",
|
|
|
loadParams : {
|
|
|
id : paramObj.hoseInfoId
|
|
|
},
|
|
|
onBeforeSubmit : function() {
|
|
|
if (!$("#smsTemplateForm").form("validate")) {
|
|
|
btn.removeAttr("disabled");
|
|
|
loadFilter : function(data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onBeforeLoad : function(loadParams) {
|
|
|
if (loadParams.hoseInfoId == 0) {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
onLoadSuccess : function(data) {
|
|
|
|
|
|
success : function(data) {
|
|
|
btn.removeAttr("disabled");
|
|
|
if (!data || data.code != 200) {
|
|
|
$.messageAlert("错误", data.message);
|
|
|
return;
|
|
|
}else{
|
|
|
$("#body").load(contextPath + "/html/chatChannel/smsTemplate/smsTemplateList.html")
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//加载form
|
|
|
$("#smsTemplateForm").form({
|
|
|
loadUrl : contextPath + "/SmsTemplateController/getTemplateById.do",
|
|
|
loadParams : {
|
|
|
smsTemplateId : paramObj.smsTemplateId
|
|
|
},
|
|
|
loadFilter : function(data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onBeforeLoad : function(loadParams) {
|
|
|
if (loadParams.smsTemplateId == 0) {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
onLoadSuccess : function(data) {
|
|
|
new TextCount({id: '#smsTemplateContent'}).init();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new TextCount({id: '#smsTemplateContent'}).init();
|
|
|
}
|
|
|
});
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|