178 lines
6.6 KiB
Plaintext
178 lines
6.6 KiB
Plaintext
|
||
@{
|
||
ViewBag.Title = "艾防微信管理菜单";
|
||
}
|
||
<input id="id" type="hidden" value="0" />
|
||
<table style="width:100%;height:100%">
|
||
<tr>
|
||
<td width="300px" style="vertical-align:top">
|
||
<div id="cd"></div>
|
||
<div id="menutree"></div>
|
||
</td>
|
||
<td style="vertical-align:top">
|
||
<div id="gl">
|
||
<table class="t1" style="width:100%;">
|
||
<tr>
|
||
<td class="ltd" style="width:160px">上级菜单:</td>
|
||
<td class="rtd"><input id="sjcd" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd">菜单名称:</td>
|
||
<td class="rtd"><input id="cdname" type="text" class="l-text" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd">菜单类型:</td>
|
||
<td class="rtd"><input id="cdlx" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd">key:</td>
|
||
<td class="rtd"><input id="key" type="text" class="l-text" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd">url:</td>
|
||
<td class="rtd"><input id="url" type="text" class="l-text" style="width:300px" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd"></td>
|
||
<td class="rtd"><div id="save">保存</div></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
@section scripts
|
||
{
|
||
<script type="text/javascript">
|
||
function itemclick(item) {
|
||
if(item.text=="增加")
|
||
{
|
||
addnew();
|
||
}
|
||
else if (item.text == "修改")
|
||
{
|
||
var t = liger.get("menutree").getSelected();
|
||
if(!t)
|
||
{
|
||
$.ligerDialog.warn("请选择要修改的行!");
|
||
return;
|
||
}
|
||
$("#id").val(t.data.id);
|
||
$("#key").val(t.data.key);
|
||
$("#url").val(t.data.url);
|
||
liger.get("cdlx").setValue(t.data.cdlx);
|
||
liger.get("sjcd").setValue(t.data.pid);
|
||
$("#cdname").val(t.data.name);
|
||
}
|
||
else if(item.text=="删除")
|
||
{
|
||
var t = liger.get("menutree").getSelected();
|
||
if (!t) {
|
||
$.ligerDialog.warn("请选择要删除的行!");
|
||
return;
|
||
}
|
||
$.ajax({
|
||
url:"@Url.Action("delCD")",type:"post",dataType:"json",data:{id:t.data.id},
|
||
beforeSend:function(){$.ligerDialog.waitting("正在删除请稍后……");},
|
||
success:function(data){
|
||
$.ligerDialog.closeWaitting();
|
||
if(data.State==1)
|
||
{
|
||
$.ligerDialog.success(data.Message,function(){
|
||
liger.get("menutree").reload();
|
||
liger.get("sjcd").reload();
|
||
});
|
||
}
|
||
else
|
||
{
|
||
$.ligerDialog.warn(data.Message);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
else if (item.text == "提交")
|
||
{
|
||
CreateWXMenu();
|
||
}
|
||
}
|
||
function addnew()
|
||
{
|
||
$("#id").val("0");
|
||
|
||
$("#cdname").val("");
|
||
$("#key").val("");
|
||
$("#url").val("");
|
||
liger.get("cdlx").setValue("zu");
|
||
liger.get("sjcd").setValue("0");
|
||
}
|
||
$(function () {
|
||
$("#cd").ligerToolBar({
|
||
items: [
|
||
{ text: '增加', click: itemclick, icon: 'add' }, { line: true }
|
||
, { text: '修改', click: itemclick, icon: 'modify' }, { line: true }
|
||
, { text: '删除', click: itemclick, icon: 'delete' }, { line: true }
|
||
, { text: '提交', click: itemclick, icon: 'ok' }
|
||
]
|
||
});
|
||
$("#gl").ligerPanel({
|
||
title: "管理菜单信息",
|
||
width: "100%", height: "100px",
|
||
});
|
||
$("#save").ligerButton({
|
||
click: function () {
|
||
$.ajax(
|
||
{
|
||
url: "@Url.Action("saveCD")",
|
||
data: {
|
||
id: $("#id").val(), name: $("#cdname").val(), pid: liger.get("sjcd").getValue(), cdlx: liger.get("cdlx").getValue(),
|
||
key: $("#key").val(), url: $("#url").val()
|
||
}, type: "post", dataType: "json",
|
||
beforeSend: function () {
|
||
$.ligerDialog.waitting("正在保存菜单信息……");
|
||
},
|
||
success:function(data)
|
||
{
|
||
$.ligerDialog.closeWaitting();
|
||
$.ligerDialog.success("保存成功!", function () {
|
||
liger.get("menutree").reload();
|
||
liger.get("sjcd").reload();
|
||
addnew();
|
||
})
|
||
}
|
||
}
|
||
);
|
||
}
|
||
});
|
||
$("#sjcd").ligerComboBox({
|
||
url: "@Url.Action("getSJCD")",
|
||
valueField: "id",
|
||
textField: "name"
|
||
});
|
||
liger.get("sjcd").setValue("0");
|
||
$("#cdlx").ligerComboBox({
|
||
url: "@Url.Action("getCDLX")",
|
||
valueField: "id",
|
||
textField: "name"
|
||
});
|
||
liger.get("cdlx").setValue("zu");
|
||
$("#menutree").ligerTree({
|
||
url: "@Url.Action("getMeun")",
|
||
checkbox:false,
|
||
textFieldName: "name",
|
||
idFieldName: "id",
|
||
parentIDFieldName: "pid",
|
||
idField: "id", parentIDField:"pid"
|
||
});
|
||
});
|
||
function CreateWXMenu()
|
||
{
|
||
$.ajax({
|
||
url: "@Url.Action("CreateWXMenu")", type: "post", dataType: "json",
|
||
success:function(data)
|
||
{
|
||
$.ligerDialog.alert(data.errmsg);
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
} |