/*
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.03.22
* 描 述:数据字典明细管理
*/
var classify_itemCode = request('itemCode');
var refreshGird;
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 () {
top.selectedDataItemRow = null;
var parentId = $('#gridtable').jfGridValue('F_ItemDetailId') || '0';
learun.layerForm({
id: 'form',
title: '添加字典',
url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?parentId=' + parentId + '&itemCode=' + classify_itemCode,
width: 500,
height: 370,
callBack: function (id) {
return top[id].acceptClick(refreshGird);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
top.selectedDataItemRow = $('#gridtable').jfGridGet('rowdata');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑字典',
url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?itemCode=' + classify_itemCode,
width: 500,
height: 370,
callBack: function (id) {
return top[id].acceptClick(refreshGird);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataItem/DeleteDetailForm', { keyValue: keyValue }, function () {
refreshGird();
});
}
});
}
});
},
initGrid: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList',
headData: [
{ label: '项目名', name: 'F_ItemName', width: 200, align: 'left' },
{ label: '项目值', name: 'F_ItemValue', width: 200, align: 'left' },
{ label: '简拼', name: 'F_SimpleSpelling', width: 150, align: 'left' },
{ label: '排序', name: 'F_SortCode', width: 80, align: 'center' },
{
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_ItemDetailId',
parentId: 'F_ParentId',
});
page.search();
},
search: function (param) {
param = param || {};
param.itemCode = classify_itemCode;
$('#gridtable').jfGridSet('reload', param);
}
};
refreshGird = function () {
page.search();
};
page.init();
}