94 lines
3.3 KiB
Plaintext
94 lines
3.3 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "公用领用人管理";
|
|
}
|
|
<div id="maingrid"></div>
|
|
<div id="add" style="display:none">
|
|
<table class="t1" style="width:280px">
|
|
<tr>
|
|
<td class="ltd">姓名:</td>
|
|
<td class="rtd"><input type="text" class="l-text" id="xm" /><input id="id" value="0" type="hidden" /></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
@section scripts{
|
|
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
|
|
<script type="text/javascript">
|
|
var openf;
|
|
function edit(item) {
|
|
var id;
|
|
if (item.text === "增加") {
|
|
id = "0";
|
|
}
|
|
else if (item.text === "修改") {
|
|
var r = liger.get("maingrid").getSelectedRow();
|
|
if (!r) {
|
|
$.ligerDialog.alert("请选择要修改的数据!");
|
|
return;
|
|
}
|
|
id = r.id;
|
|
$("#xm").val(r.xm);
|
|
}
|
|
$("#id").val(id);
|
|
openf = $.ligerDialog.open({
|
|
target:$("#add"),
|
|
title: item.text,
|
|
width: 300,
|
|
height: 80, buttons: [
|
|
{
|
|
text: '确定', onclick: function (item, dialog) {
|
|
$.ajax({
|
|
url: "@Url.Action("savegylyr")", type: "post", dataType: "json", data: {
|
|
id: $("#id").val(), xm: $("#xm").val()
|
|
},
|
|
success:function(data)
|
|
{
|
|
if(data.State==1)
|
|
{
|
|
$.ligerDialog.alert(data.Message);
|
|
$("#id").val("0");
|
|
$("#xm").val("");
|
|
dialog.hidden();
|
|
liger.get("maingrid").reload();
|
|
}
|
|
else {
|
|
$.ligerDialog.alert(data.Message);
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
]
|
|
});
|
|
}
|
|
function init() {
|
|
liger.get("maingrid").reload();
|
|
openf.close();
|
|
}
|
|
$(function () {
|
|
|
|
|
|
$("#maingrid").ligerGrid({
|
|
height: '100%',
|
|
columns: [
|
|
{ display: '编号', name: 'id', align: 'left', width: 60 },
|
|
{ display: '姓名', name: 'xm', align: 'left', width: 150 }
|
|
|
|
],
|
|
url: "@Url.Action("getgylyrlist")",
|
|
|
|
usePager: false,
|
|
heightDiff: -20,
|
|
toolbar: {
|
|
items: [
|
|
{ text: '增加', click: edit, icon: 'add' },
|
|
{ line: true },
|
|
{ text: '修改', click: edit, icon: 'modify' }
|
|
]
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
}
|