//验证
function onvalidateIpAddress(e) {
debugger;
if (e.isValid) {
var reg = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
if (!reg.test(e.value)) {
e.errorText = "Ip格式输入错误!";
e.isValid = false;
}
}
}
//加载列表格的时候
function onActionRendererUserManage(e) {
var grid = e.sender;
var record = e.record;
var uid = record._uid;
var rowIndex = e.rowIndex;
//<img src="../JS/scripts/miniui/themes/icons/edit.gif" />
var s = '<a onclick="editSingleServer(\'' + uid + '\');" style="cursor:pointer;"><img src="../JS/scripts/miniui/themes/icons/edit.gif"/>修改</a> '
+ '<a onclick="DeleteSingleServer(\'' + uid + '\')" style="cursor:pointer;"><img src="../JS/scripts/miniui/themes/icons/cancel.gif"/>删除</a>';
return s;
}
function DeleteSingleServer(row_id) {
mini.confirm("确定删除(删除后将不能恢复)?", "确定?", function (action) {
if (action == "ok") {
var row = grid.getRowByUID(row_uid);
if (row) {
var serverId = row.ServerId;
$.ajax({
url: "../Handle/ServerManage.aspx?Method=DeleteSingleServer",
type: "post",
cache: "false",
dataType: "text",
data: { "ServerId": serverId },
success: function (msg) {
}
});
}
}
});
}
//修改单个
function editSingleServer(row_id) {
var row = grid.getRowByUID(row_id);
if (row) {
editWindow.show();
var form = new mini.Form("#editServerManageform");
form.loading();
form.setData(row);
form.unmask();
cmdType = "UpdateServer";
}
}
//新增服务器
function AddServerManage() {
editWindow.show();
var form = new mini.Form("#editServerManageform");
form.clear();
cmdType = "AddServer";
}
function CanncelSaveServerManage() {
mini.confirm("确定取消保存(取消保存后将不能恢复)?", "确定?", function (action) {
if (action == "ok") {
editWindow.hide();
}
});
}
//保存服务器信息
function SaveServerManage() {
var form = new mini.Form("#editServerManageform");
form.validate();
if (form.validate() == false) {
return;
}
mini.confirm("确定保存?", "确定?", function (action) {
if (action == "ok") {
var obj = form.getData();
var jsona = mini.encode([obj]);
var json = $.parseJSON(jsona);