/*
* 描 述:功能模块
*/
var selectedRow;
var refreshGirdData; // 更新数据
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGrid();
page.bindEvent();
},
bindEvent: function () {
// 查询
$('#btn_Search').on('click', function () {
var keyword = $('#txt_Keyword').val();
page.search({ keyword: keyword });
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 新增
$('#lr_add').on('click', function () {
var keyValue = {};
selectedRow = {};
learun.layerForm({
id: 'form',
title: '添加功能',
url: top.$.rootUrl + '/DevelopmentManager/Module/Form',
height: 400,
width: 800,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_NO');
selectedRow = $('#gridtable').jfGridGet('rowdata');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑功能',
url: top.$.rootUrl + '/DevelopmentManager/Module/Form?keyValue=' + keyValue,
height: 400,
width: 800,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_NO');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/DevelopmentManager/Module/DeleteForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
},
initGrid: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/DevelopmentManager/Module/GetModuleList',
headData: [
{ label: "名称", name: "F_NAME", width: 200, align: "left" },
{ label: "编号", name: "F_NO", width: 350, align: "left" },
{ label: "地址", name: "F_URLADDR", width: 350, align: "left" },
{
label: "目标", name: "F_TARGET", width: 60, align: "center",
formatterAsync: function (callback, value, row) {
learun.clientdata.getAsync('dataItem', {
Rowkey: value,
GrpCode: 'EModuleTarget',
getType: 'Num',
callback: function (_data) {
callback(_data.F_NAME);
}
});
}
},
{
label: "菜单", name: "F_ISMENU", width: 50, align: "center",
formatter: function (cellvalue, rowObject) {
return cellvalue == 1 ? "" : "";
}
},
{
label: "展开", name: "F_ALLOWEXPAND", width: 50, align: "center",
formatter: function (cellvalue, rowObject) {
return cellvalue == 1 ? "" : "";
}
},
{
label: "有效", name: "F_ISSTOP", width: 50, align: "center",
formatter: function (cellvalue, rowObject) {
return cellvalue == 0 ? "" : "";
}
},
{
label: "排序号", name: "F_SORTNUM", width: 50, align: "center",
},
{ label: "描述", name: "F_MEMO", width: 200, align: "left" }
],
isTree: true,
mainId: 'F_NO',
parentId: 'F_PNO'
});
page.search();
},
search: function (param) {
$('#gridtable').jfGridSet('reload', param);
}
};
// 保存数据后回调刷新
refreshGirdData = function () {
var keyword = $('#txt_Keyword').val();
page.search({ keyword: keyword });
};
page.init();
}