add:
function
() {
if
($(
this
).linkbutton(
'options'
).disabled ==
true
) {
return
;
}
var
addDialog = top.$.hDialog({
href: formUrl, title:
'添加模块(菜单)'
, iconCls:
'icon-tab_add'
, width: 490, height: 550,
onLoad:
function
() {
crud.bindCtrl();
crud.bindCategory();
var
row = grid.selected();
if
(row) {
top.$(
'#txt_ParentId'
).combotree(
'setValue'
, row.ParentId);
}
},
submit:
function
() {
if
(top.$(
'#uiform'
).validate().form()) {
var
vcategory = top.$(
'#txt_Category'
).combobox(
'getValue'
);
var
vparentid = top.$(
'#txt_ParentId'
).combobox(
'getValue'
);
var
param =
'action=Add&vcategory='
+ vcategory +
'&vparentid='
+ vparentid +
'&'
+ top.$(
'#uiform'
).serialize();
$.ajaxjson(actionUrl, param,
function
(d) {
if
(d.Success) {
msg.ok(d.Message);
addDialog.dialog(
'close'
);
grid.reload();
}
else
{
MessageOrRedirect(d);
}
});
}
}
});
},
edit:
function
() {
if
($(
this
).linkbutton(
'options'
).disabled ==
true
) {
return
;
}
var
row = grid.selected();
if
(row) {
var
editDailog = top.$.hDialog({
href: formUrl, title:
'修改模块(菜单)'
, iconCls:
'icon-tab_edit'
, width: 490, height: 550,
onLoad:
function
() {
crud.bindCtrl(row.Id);
crud.bindCategory();
top.$(
'#txt_Code'
).val(row.Code);
top.$(
'#txt_FullName'
).val(row.FullName);
top.$(
'#txt_Category'
).combobox(
'setValue'
, row.Category);
top.$(
'#txt_ParentId'
).combotree(
'setValue'
, row.ParentId);
top.$(
'#txt_NavigateUrl'
).val(row.NavigateUrl);
top.$(
'#txt_IconCss'
).val(row.IconCss);
top.$(
'#smallIcon'
).attr(
'class'
, row.IconCss);
top.$(
'#txt_AssemblyName'
).val(row.AssemblyName);
top.$(
'#txt_FormName'
).val(row.FormName);
top.$(
'#chk_Enabled'
).attr(
'checked'
, row.Enabled ==
"1"
);
top.$(
'#chk_IsPublic'
).attr(
'checked'
, row.IsPublic ==
"1"
);
top.$(
'#chk_Expand'
).attr(
'checked'
, row.Expand ==
"1"
);
top.$(
'#chk_AllowEdit'
).attr(
'checked'
, row.AllowEdit ==
"1"
);
top.$(
'#chk_AllowDelete'
).attr(
'checked'
, row.AllowDelete ==
"1"
);
top.$(
'#txt_Description'
).val(row.Description);
top.$(
'#txt_IconUrl'
).val(row.IconUrl);
},
submit:
function
() {
if
(top.$(
'#uiform'
).validate().form()) {
var
treeParentId = top.$(
'#txt_ParentId'
).combotree(
'tree'
);
var
node = treeParentId.tree(
'getSelected'
);
if
(node) {
var
nodeParentId = treeParentId.tree(
'find'
, row.Id);
var
children = treeParentId.tree(
'getChildren'
, nodeParentId.target);
var
nodeIds =
''
;
var
isFind =
'false'
;
for
(
var
index = 0; index < children.length; index++) {
if
(children[index].id == node.id) {
isFind =
'true'
;
break
;
}
}
if
(isFind ==
'true'
) {
top.$.messager.alert(
'温馨提示'
,
'请选择父节点元素!'
,
'warning'
);
return
;
}
}
var
vcategory = top.$(
'#txt_Category'
).combobox(
'getValue'
);
var
vparentid = top.$(
'#txt_ParentId'
).combobox(
'getValue'
);
var
query =
'action=Edit&vcategory='
+ vcategory +
'&vparentid='
+ vparentid +
'&KeyId='
+ row.Id +
'&'
+ top.$(
'#uiform'
).serialize();
$.ajaxjson(actionUrl, query,
function
(d) {
if
(d.Success) {
msg.ok(d.Message);
editDailog.dialog(
'close'
);
grid.reload();
}
else
{
MessageOrRedirect(d);
}
});
}
}
});
}
else
{
msg.warning(
'请选择要修改菜单!'
);
return
false
;
}
return
false
;
}