You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

187 lines
8.2 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-11 10:08
  5. * 描 述:公文收发
  6. */
  7. var refreshGirdData;
  8. var selectedRow;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var startTime;
  12. var endTime;
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 时间搜索框
  20. $('#datesearch').lrdate({
  21. dfdata: [
  22. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { 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') } },
  24. { 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') } },
  25. { 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') } }
  26. ],
  27. // 月
  28. mShow: false,
  29. premShow: false,
  30. // 季度
  31. jShow: false,
  32. prejShow: false,
  33. // 年
  34. ysShow: false,
  35. yxShow: false,
  36. preyShow: false,
  37. yShow: false,
  38. // 默认
  39. dfvalue: '1',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  47. page.search(queryJson);
  48. }, 220, 400);
  49. // 刷新
  50. $('#lr_refresh').on('click', function () {
  51. location.reload();
  52. });
  53. // 新增
  54. $('#lr_add').on('click', function () {
  55. learun.layerForm({
  56. id: 'formSys_ReceiveFile',
  57. title: '新增',
  58. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty',
  59. width: 600,
  60. height: 400,
  61. callBack: function (id) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. });
  65. });
  66. // 编辑
  67. $('#lr_edit').on('click', function () {
  68. var keyValue = $('#gridtable').jfGridValue('RFileId');
  69. if (learun.checkrow(keyValue)) {
  70. learun.layerForm({
  71. id: 'formSys_ReceiveFile',
  72. title: '编辑',
  73. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty?keyValue=' + keyValue,
  74. width: 600,
  75. height: 400,
  76. callBack: function (id) {
  77. return top[id].acceptClick(refreshGirdData);
  78. }
  79. });
  80. }
  81. });
  82. // 删除
  83. $('#lr_delete').on('click', function () {
  84. var keyValue = $('#gridtable').jfGridValue('RFileId');
  85. selectedRow = $('#gridtable').jfGridGet('rowdata');
  86. if (learun.checkrow(keyValue)) {
  87. if (selectedRow.ReadFlag == false) {
  88. learun.alert.warning("当前公文还未查阅,无法删除!");
  89. return false;
  90. }
  91. learun.layerConfirm('是否确认删除该项!', function (res) {
  92. if (res) {
  93. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/DeleteForm', { keyValue: keyValue }, function () {
  94. refreshGirdData();
  95. });
  96. }
  97. });
  98. }
  99. });
  100. //  查看
  101. $('#lr_Read').on('click', function () {
  102. var keyValue = $('#gridtable').jfGridValue('RFileId');
  103. selectedRow = $('#gridtable').jfGridGet('rowdata');
  104. if (learun.checkrow(keyValue)) {
  105. top.layer.open({
  106. id: 'formSys_ReceiveFile',
  107. type: 2,
  108. title: '查看',
  109. area: ['1000px', '600px'],
  110. btn: null,
  111. content: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/FormParty?keyValue=' + keyValue,
  112. skin: 'lr-layer-nobtn',
  113. success: function (layero, index) {
  114. top['formSys_ReceiveFile'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
  115. //判断查阅状态
  116. if (selectedRow.ReadFlag == false) {
  117. //判断附件
  118. //if (selectedRow.Url == null || selectedRow.Url == "") {
  119. //自动已读
  120. learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Read', { keyValue: keyValue }, function () {
  121. refreshGirdData();
  122. });
  123. //}
  124. }
  125. },
  126. end: function () {
  127. top['formSys_ReceiveFile'] = null;
  128. }
  129. });
  130. }
  131. });
  132. },
  133. // 初始化列表
  134. initGird: function () {
  135. $('#gridtable').lrAuthorizeJfGrid({
  136. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/GetPageList',
  137. headData: [
  138. { label: "发送人", name: "Sender", width: 100, align: "left" },
  139. { label: "主题", name: "Title", width: 300, align: "left" },
  140. { label: "发送时间", name: "SendTime", width: 130, align: "left" },
  141. {
  142. label: "接收对象", name: "SendType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
  143. learun.clientdata.getAsync('dataItem', {
  144. key: value,
  145. code: 'FileSendType',
  146. callback: function (_data) {
  147. callback(_data.text);
  148. }
  149. });
  150. }
  151. },
  152. {
  153. label: "状态", name: "ReadFlag", width: 100, align: "left",
  154. formatter: function (cellvalue, row) {
  155. if (cellvalue == 1) {
  156. return '<span class=\"label label-success\">已读</span>';
  157. } else {
  158. return '<span class=\"label label-danger\" >未读</span>';
  159. }
  160. }
  161. },
  162. { label: "查阅时间", name: "ReadTime", width: 130, align: "left" },
  163. ],
  164. mainId: 'RFileId',
  165. isPage: true,
  166. sidx: 'SendTime',
  167. sord: 'DESC'
  168. });
  169. },
  170. search: function (param) {
  171. param = param || {};
  172. param.StartTime = startTime;
  173. param.EndTime = endTime;
  174. param.ReceiverId = learun.clientdata.get(['userinfo']).userId;
  175. param.STypeId=3
  176. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  177. }
  178. };
  179. refreshGirdData = function () {
  180. page.search();
  181. };
  182. page.init();
  183. }