|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-04-11 10:08
- * 描 述:公文收发
- */
- var refreshGirdData;
- var selectedRow;
- var bootstrap = function ($, learun) {
- "use strict";
- var startTime;
- var endTime;
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 时间搜索框
- $('#datesearch').lrdate({
- dfdata: [
- { 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: '1',
- selectfn: function (begin, end) {
- startTime = begin;
- endTime = end;
- page.search();
- }
- });
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'formSys_ReceiveFile',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty',
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('RFileId');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'formSys_ReceiveFile',
- title: '编辑',
- url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty?keyValue=' + keyValue,
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('RFileId');
- selectedRow = $('#gridtable').jfGridGet('rowdata');
- if (learun.checkrow(keyValue)) {
- if (selectedRow.ReadFlag == false) {
- learun.alert.warning("当前公文还未查阅,无法删除!");
- return false;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 查看
- $('#lr_Read').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('RFileId');
- selectedRow = $('#gridtable').jfGridGet('rowdata');
- if (learun.checkrow(keyValue)) {
- top.layer.open({
- id: 'formSys_ReceiveFile',
- type: 2,
- title: '查看',
- area: ['1000px', '600px'],
- btn: null,
- content: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty?keyValue=' + keyValue,
- skin: 'lr-layer-nobtn',
- success: function (layero, index) {
- top['formSys_ReceiveFile'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
-
- //判断查阅状态
- if (selectedRow.ReadFlag == false) {
- //判断附件
- //if (selectedRow.Url == null || selectedRow.Url == "") {
- //自动已读
- learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Read', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- //}
- }
- },
- end: function () {
- top['formSys_ReceiveFile'] = null;
- }
- });
- }
-
- });
-
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/GetPageList',
- headData: [
- { label: "发送人", name: "Sender", width: 100, align: "left" },
- { label: "主题", name: "Title", width: 300, align: "left" },
- { label: "发送时间", name: "SendTime", width: 130, align: "left" },
- {
- label: "接收对象", name: "SendType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'FileSendType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "状态", name: "ReadFlag", width: 100, align: "left",
- formatter: function (cellvalue, row) {
- if (cellvalue == 1) {
- return '<span class=\"label label-success\">已读</span>';
- } else {
- return '<span class=\"label label-danger\" >未读</span>';
- }
- }
- },
- { label: "查阅时间", name: "ReadTime", width: 130, align: "left" },
- ],
- mainId: 'RFileId',
- isPage: true,
- sidx: 'SendTime',
- sord: 'DESC'
- });
- },
- search: function (param) {
- param = param || {};
- param.StartTime = startTime;
- param.EndTime = endTime;
- param.ReceiverId = learun.clientdata.get(['userinfo']).userId;
- param.STypeId=3
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|