/*
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.03.22
* 描 述:数据字典管理
*/
var refreshGirdData; // 更新数据
var selectedRow;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGrid();
page.bind();
},
bind: 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 f_ItemId = $('#gridtable').jfGridValue('F_ItemId');
selectedRow = null;
learun.layerForm({
id: 'ClassifyForm',
title: '添加分类',
url: top.$.rootUrl + '/LR_SystemModule/DataItem/ClassifyForm?parentId=' + f_ItemId,
width: 500,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
selectedRow = $('#gridtable').jfGridGet('rowdata');
var keyValue = $('#gridtable').jfGridValue('F_ItemId');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'ClassifyForm',
title: '编辑分类',
url: top.$.rootUrl + '/LR_SystemModule/DataItem/ClassifyForm',
width: 500,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_ItemId');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataItem/DeleteClassifyForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
},
initGrid: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyList',
headData: [
{
label: '标准编码', name: 'F_ItemCodeGB', width: 200, align: 'left'
},
{ label: '名称', name: 'F_ItemName', width: 200, align: 'left' },
{ label: '编号', name: 'F_ItemCode', width: 200, align: 'left' },
{ label: '排序', name: 'F_SortCode', width: 50, align: 'center' },
{
label: "树型", name: "F_IsTree",width: 50, align: "center",
formatter: function (cellvalue) {
return cellvalue == 1 ? "" : "";
}
},
{
label: "有效", name: "F_EnabledMark",width: 50, align: "center",
formatter: function (cellvalue) {
return cellvalue == 1 ? "" : "";
}
},
{ label: "备注", name: "F_Description", width: 200, align: "left" }
],
isTree: true,
mainId: 'F_ItemId',
parentId: 'F_ParentId',
reloadSelected:true
});
page.search();
},
search: function (param) {
$('#gridtable').jfGridSet('reload', param);
}
};
// 保存数据后回调刷新
refreshGirdData = function () {
page.search();
}
page.init();
}