/*
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.07.11
* 描 述:公告通知
*/
var refreshGirdData; // 更新数据
var bootstrap = function ($, learun) {
"use strict";
var processId = '';
var page = {
init: function () {
page.initGrid();
page.bind();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);
//公告类别
$('#F_CategoryId').lrDataItemSelect({
code: 'MessageType'
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 新增
$('#lr_add').on('click', function () {
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + '/EducationalAdministration/SchoolNews/Form',
width: 1200,
height: 750,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_NewsId');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl + '/EducationalAdministration/SchoolNews/Form?keyValue=' + keyValue,
width: 1200,
height: 750,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('F_NewsId');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/SchoolNews/DeleteForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
// 打印
$('#lr_print').on('click', function () {
$('#gridtable').jqprintTable();
});
},
initGrid: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/EducationalAdministration/SchoolNews/GetPageList',
headData: [
{ label: '标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' },
{ label: '发布人员', name: 'F_CreateUserName', index: 'F_CreateUserName', width: 100, align: 'left' },
{ label: '类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' },
{
label: "发布时间", name: "F_ReleaseTime", index: "F_ReleaseTime", width: 140, align: "center",
formatter: function (cellvalue) {
return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
}
},
{ label: '信息来源', name: 'F_SourceName', index: 'F_SourceName', width: 100, align: 'center' },
{
label: "有效", name: "F_EnabledMark", width: 50, align: "center",
formatter: function (cellvalue) {
return cellvalue == 1 ? "" : "";
}
},
{ label: "创建时间", name: "F_CreateDate", index: "F_CreateDate", width: 130, align: "center" }
],
mainId: 'F_NewsId',
reloadSelected: true,
isMultiselect: true,
isPage: true,
sidx: 'F_CreateDate',
sord: 'desc'
});
page.search();
},
search: function (param) {
param = param || {};
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};
// 保存数据后回调刷新
refreshGirdData = function (res, postData) {
if (res && res.code && res.code == 200) {
var postData = {
schemeCode: 'OA_News',// 填写流程对应模板编号
processId: processId,
level: '1',
};
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
learun.loading(false);
});
}
page.search();
}
page.init();
}