mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-25 10:08:10 +08:00
160 lines
5.3 KiB
Plaintext
160 lines
5.3 KiB
Plaintext
@{
|
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
|
}
|
|
|
|
<script type="text/javascript">
|
|
function clearForm() {
|
|
$('#deviceform').form('clear');
|
|
}
|
|
|
|
function submitForm() {
|
|
var ipaddress = $("#ip").val();
|
|
var devadd = $("#devadd").val();
|
|
var devname = $("#devname").val();
|
|
var protocoltype = $("#protocoltype").val();
|
|
|
|
if (!ValidateIPaddress(ipaddress)) {
|
|
$.messager.show({ msg: '设备IP格式错误' });
|
|
return;
|
|
}
|
|
|
|
if ((!devadd) || isNaN(devadd)) {
|
|
$.messager.show({ msg: '设备ID必须为数字' });
|
|
return;
|
|
}
|
|
|
|
var id = $("#id").val();
|
|
if (id == 0) { //增加新设备
|
|
$.ajax({
|
|
url: '',
|
|
type: 'POST',
|
|
data: {
|
|
"IPAddress": ipaddress,
|
|
"DevAdd": devadd,
|
|
"DevName": devname,
|
|
"ProtocolType": protocoltype
|
|
},
|
|
success: function (result) {
|
|
if (result == "True") {
|
|
$.messager.show({
|
|
msg: '操作成功,刷新后显示'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
} else { //修改设备
|
|
$.ajax({
|
|
url: '',
|
|
type: 'POST',
|
|
data: {
|
|
"Id": id,
|
|
"IPAddress": ipaddress,
|
|
"DevAdd": devadd,
|
|
"DevName": devname,
|
|
"ProtocolType": protocoltype
|
|
},
|
|
success: function (result) {
|
|
if (result == "True") {
|
|
$.messager.show({
|
|
msg: '操作成功,刷新后显示'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function ShowAddDlg(isedit) {
|
|
if (isedit) {
|
|
var row = $('#devices').datagrid('getSelected');
|
|
if (row) {
|
|
$("#devadd").val(row.DevAdd);
|
|
$("#ip").val(row.IPAddress);
|
|
$("#devname").val(row.DevName);
|
|
$("#id").val(row.Id);
|
|
$("#protocoltype").val(row.ProtocolType);
|
|
} else {
|
|
$.messager.show({
|
|
msg: '请选择要修改的设备'
|
|
});
|
|
return;
|
|
}
|
|
} else {
|
|
$("#devadd").val('');
|
|
$("#ip").val('');
|
|
$("#devname").val('');
|
|
$("#id").val(0);
|
|
$("#protocoltype").val('');
|
|
}
|
|
$('#DialogAdd').dialog();
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
//双击设备列表,将设备信息传递给搜索框
|
|
$('#devices').datagrid({
|
|
onDblClickRow: function (index, row) {
|
|
$("#searchdevadd").val(row.DevAdd);
|
|
$("#searchip").val(row.IPAddress);
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<div data-options="region:'east',split:true,title:'设备列表'" style="width:300px;">
|
|
<table id="devices" class="easyui-datagrid" style="width:auto;"
|
|
data-options="fitColumns:true,singleSelect:true,toolbar:'#tb',fit:true">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'Id',hidden:true"></th>
|
|
<th data-options="field:'DevName',width:150">设备名称</th>
|
|
<th data-options="field:'DevAdd',width:100">设备地址</th>
|
|
<th data-options="field:'IPAddress',align:'right'">设备IP</th>
|
|
<th data-options="field:'ProtocolType',hidden:true"></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
</table>
|
|
<div id="tb" style="height:auto">
|
|
<div style="margin-bottom:5px">
|
|
<a href="javascript:ShowAddDlg(0)" class="easyui-linkbutton" iconcls="icon-add" plain="true">增加</a>
|
|
<a href="javascript:ShowAddDlg(1)" class="easyui-linkbutton" iconcls="icon-edit" plain="true">修改</a>
|
|
<a href="javascript:Remove()" class="easyui-linkbutton" iconcls="icon-remove" plain="true">删除</a>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div id="DialogAdd" title="设备管理"
|
|
data-options="iconCls:'icon-save'" style="width:300px;height:260px;padding:2px">
|
|
<div style="padding:5px 0 5px 5px">
|
|
<form id="deviceform" method="post">
|
|
<input style="display: none" id="id" />
|
|
<table>
|
|
<tr>
|
|
<td>设备名称:</td>
|
|
<td><input style="width:150px" id="devname" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>设备地址:</td>
|
|
<td><input style="width:150px" id="devadd" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>设备IP:</td>
|
|
<td><input style="width:150px" id="ip" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>数据格式:</td>
|
|
<td><textarea rows="5" cols="20" id="protocoltype"></textarea></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
<div style="text-align:center;padding:5px">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">保存</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清除</a>
|
|
</div>
|
|
</div>
|
|
|
|
@RenderBody()
|
|
|