|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-03-06 17:15
- * 描 述:日志发送
- */
- var refreshGirdData;
- var sendthismessage;
- var bootstrap = function ($, learun) {
- "use strict";
- var datebegin = '';
- var dateend = '';
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('.datetime').each(function () {
- $(this).lrdate({
- dfdata: [
- { name: '清空', begin: function () { return '' }, end: function () { return '' } },
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: '0',
- selectfn: function (begin, end) {
- datebegin = begin;
- dateend = end;
- page.search();
- }
- });
- });
- // 查询
- $('#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.layer.open({
- id: 'sendform',
- title: '发日志',
- type: 2,
- skin: 'lr-layer',
- btn: ['发送', '保存草稿', '关闭'],
- content: top.$.rootUrl + '/EducationalAdministration/JournalSend/Form',
- area: ['800px', '700px'],
- success: function (layero, index) {
- top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
- },
- yes: function (index, layero) {
- var flag = true;
- flag = top['sendform'].acceptClick(sendthismessage);
- if (!!flag) {
- learun.layerClose('', index);
- }
- }
- , btn2: function (index, layero) {
- var flag = true;
- flag = top['sendform'].acceptClick(refreshGirdData);
- if (!!flag) {
- learun.layerClose('', index);
- }
- return false;
- }
- , btn3: function (index, layero) {
- top['sendform'] = null;
- top.layer.close(index);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('JournalSendId');
- var JIsSend = $('#gridtable').jfGridValue('JIsSend');
- if (learun.checkrow(keyValue)) {
- if (JIsSend === true) {
- learun.alert.warning("该日志已发送不能编辑!");
- return;
- }
- top.layer.open({
- id: 'sendform',
- title: '发日志',
- type: 2,
- skin: 'lr-layer',
- btn: ['发送', '保存草稿', '关闭'],
- content: top.$.rootUrl + '/EducationalAdministration/JournalSend/Form?keyValue=' + keyValue,
- area: ['800px', '700px'],
- success: function (layero, index) {
- top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
- },
- yes: function (index, layero) {
- var flag = true;
- flag = top['sendform'].acceptClick(sendthismessage);
- if (!!flag) {
- learun.layerClose('', index);
- }
- }
- , btn2: function (index, layero) {
- var flag = true;
- flag = top['sendform'].acceptClick(refreshGirdData);
- if (!!flag) {
- learun.layerClose('', index);
- }
- return false;
- }
- , btn3: function (index, layero) {
- top['sendform'] = null;
- top.layer.close(index);
- }
- });
- }
- });
- // 编辑
- $('#lr_view').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('JournalSendId');
- if (learun.checkrow(keyValue)) {
- top.layer.open({
- id: 'sendform',
- title: '发日志',
- type: 2,
- skin: 'lr-layer-nobtn',
- btn: null,
- content: top.$.rootUrl + '/EducationalAdministration/JournalSend/FormView?keyValue=' + keyValue,
- area: ['800px', '700px'],
- success: function (layero, index) {
- top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
- },
- end: function () {
- top['sendform'] = null;
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('JournalSendId');
- var JIsSend = $('#gridtable').jfGridValue('JIsSend');
- if (learun.checkrow(keyValue)) {
- if (JIsSend === true) {
- learun.alert.warning("该日志已发送不能删除!");
- return;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //发送
- $('#lr_send').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('JournalSendId');
- var JIsSend = $('#gridtable').jfGridValue('JIsSend');
- if (learun.checkrow(keyValue)) {
- if (JIsSend === true) {
- learun.alert.warning("该日志已发送不能再次发送!");
- return;
- }
- learun.layerConfirm('是否确认发送该项!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/Send', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/JournalSend/GetPageList',
- headData: [
- { label: "日志主题", name: "JTitle", width: 400, align: "left" },
- {
- label: "日志类型", name: "JTypeId", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'JournalType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "接收人", name: "JReceive", width: 200, align: "left" },
- {
- label: "状态", name: "JIsSend", width: 100, align: "left", formatter: function (cellvalue) {
- return cellvalue == false ? "<span class=\"label label-danger\">草稿</span>" : "<span class=\"label label-success\">已发送</span>";
- }
- },
- { label: "发送时间", name: "JSendTime", width: 100, align: "left" }
- ],
- mainId: 'JournalSendId',
- isPage: true
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.userId = userId;
- param.StartTime = datebegin;
- param.EndTime = dateend;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- sendthismessage = function (id) {
- learun.loading(true, '发送中...');
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/Send', { keyValue: id }, function () {
- refreshGirdData();
- top.learun.layerClose(window.name);
- });
- };
- page.init();
- }
|