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.
 
 
 
 
 
 

227 lines
10 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/Form',
  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/Form?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_SpecifyReceiver').on('click', function () {
  84. var keyValue = $('#gridtable').jfGridValue('RFileId');
  85. if (learun.checkrow(keyValue)) {
  86. learun.layerForm({
  87. id: 'formSys_ReceiveFile',
  88. title: '指定接收人',
  89. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/SpecifyReceiverForm?keyValue=' + keyValue,
  90. width: 600,
  91. height: 400,
  92. callBack: function (id) {
  93. return top[id].acceptClick(refreshGirdData);
  94. }
  95. });
  96. }
  97. });
  98. // 删除
  99. $('#lr_delete').on('click', function () {
  100. var keyValue = $('#gridtable').jfGridValue('RFileId');
  101. selectedRow = $('#gridtable').jfGridGet('rowdata');
  102. if (learun.checkrow(keyValue)) {
  103. if (selectedRow.ReadFlag == false) {
  104. learun.alert.warning("当前公文还未查阅,无法删除!");
  105. return false;
  106. }
  107. learun.layerConfirm('是否确认删除该项!', function (res) {
  108. if (res) {
  109. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/DeleteForm', { keyValue: keyValue }, function () {
  110. refreshGirdData();
  111. });
  112. }
  113. });
  114. }
  115. });
  116. //  查看
  117. $('#lr_Read').on('click', function () {
  118. var keyValue = $('#gridtable').jfGridValue('RFileId');
  119. selectedRow = $('#gridtable').jfGridGet('rowdata');
  120. if (learun.checkrow(keyValue)) {
  121. top.layer.open({
  122. id: 'formSys_ReceiveFile',
  123. type: 2,
  124. title: '查看',
  125. area: ['1000px', '600px'],
  126. btn: null,
  127. content: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Form?keyValue=' + keyValue,
  128. skin: 'lr-layer-nobtn',
  129. success: function (layero, index) {
  130. top['formSys_ReceiveFile'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
  131. //判断查阅状态
  132. if (selectedRow.ReadFlag == false) {
  133. //判断附件
  134. //if (selectedRow.Url == null || selectedRow.Url == "") {
  135. //自动已读
  136. learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Read', { keyValue: keyValue }, function () {
  137. refreshGirdData();
  138. });
  139. //}
  140. }
  141. },
  142. end: function () {
  143. top['formSys_ReceiveFile'] = null;
  144. }
  145. });
  146. }
  147. });
  148. },
  149. // 初始化列表
  150. initGird: function () {
  151. $('#gridtable').lrAuthorizeJfGrid({
  152. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/GetPageList',
  153. headData: [
  154. { label: "发送人", name: "Sender", width: 100, align: "left" },
  155. { label: "主题", name: "Title", width: 300, align: "left" },
  156. { label: "发送时间", name: "SendTime", width: 130, align: "left" },
  157. {
  158. label: "接收对象", name: "SendType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
  159. learun.clientdata.getAsync('dataItem', {
  160. key: value,
  161. code: 'FileSendType',
  162. callback: function (_data) {
  163. callback(_data.text);
  164. }
  165. });
  166. }
  167. },
  168. {
  169. label: "指定接收人", name: "SpecifyReceiver", width: 150, align: "left", formatterAsync:
  170. function (callback, value, row, op, $cell) {
  171. learun.clientdata.getAsync('user',
  172. {
  173. key: value,
  174. callback: function (_data) {
  175. if (_data.length > 0) {
  176. var text = '';
  177. $.each(_data,
  178. function (i, item) {
  179. if (item) {
  180. text += item.name + ',';
  181. }
  182. });
  183. text = text.substring(0, text.lastIndexOf(','));
  184. callback(text);
  185. } else {
  186. callback(_data.name);
  187. }
  188. }
  189. });
  190. }
  191. },
  192. {
  193. label: "状态", name: "ReadFlag", width: 100, align: "left",
  194. formatter: function (cellvalue, row) {
  195. if (cellvalue == 1) {
  196. return '<span class=\"label label-success\">已读</span>';
  197. } else {
  198. return '<span class=\"label label-danger\" >未读</span>';
  199. }
  200. }
  201. },
  202. { label: "查阅时间", name: "ReadTime", width: 130, align: "left" },
  203. ],
  204. mainId: 'RFileId',
  205. isPage: true,
  206. sidx: 'SendTime',
  207. sord: 'DESC'
  208. });
  209. },
  210. search: function (param) {
  211. param = param || {};
  212. param.StartTime = startTime;
  213. param.EndTime = endTime;
  214. param.ReceiverId = learun.clientdata.get(['userinfo']).userId;
  215. param.STypeId = 1;
  216. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  217. }
  218. };
  219. refreshGirdData = function () {
  220. page.search();
  221. };
  222. page.init();
  223. }