/* * 版 本 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 () { // 查询 $('#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 () { learun.layerForm({ id: 'form', title: '添加公告', url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow', width: 1000, height: 650, maxmin: true, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NewsId'); if (learun.checkrow(keyValue)) { if (keyValue.indexOf(",") != -1) { learun.alert.warning("只能选择一条记录进行编辑!"); return false; } var SendFlag = $('#gridtable').jfGridValue('F_Status'); if (SendFlag == "1" || SendFlag == "2") { learun.alert.warning("当前项目已提交不能编辑!"); return; } learun.layerForm({ id: 'formedit', title: '编辑公告', url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow?keyValue=' + keyValue, width: 1000, height: 650, maxmin: true, callBack: function (id) { //return top[id].acceptClick(refreshGirdData); return top[id].save(refreshGirdData); } }); } }); // 查看 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NewsId'); if (learun.checkrow(keyValue)) { if (keyValue.indexOf(",") != -1) { learun.alert.warning("只能选择一条记录查看!"); return false; } learun.layerForm({ id: 'form', title: '查看', url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow?keyValue=' + keyValue + '&isView=' + true, width: 1000, height: 650, btn: null }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NewsId'); if (learun.checkrow(keyValue)) { var SendFlag = $('#gridtable').jfGridValue('F_Status'); if (SendFlag == "1" || SendFlag == "2") { learun.alert.warning("当前项目已提交不能编辑!"); return; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Notice/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); //  提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NewsId'); if (learun.checkrow(keyValue)) { var SendFlag = $('#gridtable').jfGridValue('F_Status'); if (SendFlag == "1" || SendFlag == "2") { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerConfirm('是否确认提交该项!', function (res) { if (res) { processId = learun.newGuid(); learun.postForm(top.$.rootUrl + '/LR_OAModule/Notice/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) { refreshGirdData(res, {}); }); } }); } }); }, initGrid: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageList', headData: [ { label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, 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_PV', index: 'F_PV', width: 80, align: 'center' }, { label: "审核状态", name: "F_Status", width: 100, align: "left", formatter: function (cellvalue, row) { if (cellvalue === "1") { return '审批中'; } else if (cellvalue === "2") { return '通过'; } else { return '草稿'; } } }, { label: "发布状态", name: "F_EnabledMark", index: "F_EnabledMark", width: 80, align: "center", autowidth: false, formatter: function (cellvalue) { if (cellvalue == 1) { return "已发布"; } else { return "未发布"; } } }, { 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) { $('#gridtable').jfGridSet('reload', 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(); }