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.
 
 
 
 
 
 

212 lines
9.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. selectfn: function (begin, end) {
  39. startTime = begin;
  40. endTime = end;
  41. page.search();
  42. }
  43. });
  44. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  45. page.search(queryJson);
  46. }, 220, 400);
  47. // 刷新
  48. $('#lr_refresh').on('click', function () {
  49. location.reload();
  50. });
  51. // 新增
  52. $('#lr_add').on('click', function () {
  53. learun.layerForm({
  54. id: 'formSys_ReceiveFile',
  55. title: '新增',
  56. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Form',
  57. width: 600,
  58. height: 400,
  59. callBack: function (id) {
  60. return top[id].acceptClick(refreshGirdData);
  61. }
  62. });
  63. });
  64. // 编辑
  65. $('#lr_edit').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('RFileId');
  67. if (learun.checkrow(keyValue)) {
  68. learun.layerForm({
  69. id: 'formSys_ReceiveFile',
  70. title: '编辑',
  71. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Form?keyValue=' + keyValue,
  72. width: 600,
  73. height: 400,
  74. callBack: function (id) {
  75. return top[id].acceptClick(refreshGirdData);
  76. }
  77. });
  78. }
  79. });
  80. //// 指定接收人
  81. //$('#lr_SpecifyReceiver').on('click', function () {
  82. // var keyValue = $('#gridtable').jfGridValue('RFileId');
  83. // if (learun.checkrow(keyValue)) {
  84. // learun.layerForm({
  85. // id: 'formSys_ReceiveFile',
  86. // title: '指定接收人',
  87. // url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/SpecifyReceiverForm?keyValue=' + keyValue,
  88. // width: 600,
  89. // height: 400,
  90. // callBack: function (id) {
  91. // return top[id].acceptClick(refreshGirdData);
  92. // }
  93. // });
  94. // }
  95. //});
  96. // 删除
  97. $('#lr_delete').on('click', function () {
  98. var keyValue = $('#gridtable').jfGridValue('RFileId');
  99. selectedRow = $('#gridtable').jfGridGet('rowdata');
  100. if (learun.checkrow(keyValue)) {
  101. if (selectedRow.ReadFlag == false) {
  102. learun.alert.warning("当前公文还未查阅,无法删除!");
  103. return false;
  104. }
  105. learun.layerConfirm('是否确认删除该项!', function (res) {
  106. if (res) {
  107. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/DeleteForm', { keyValue: keyValue }, function () {
  108. refreshGirdData();
  109. });
  110. }
  111. });
  112. }
  113. });
  114. //  查看
  115. $('#lr_Read').on('click', function () {
  116. var keyValue = $('#gridtable').jfGridValue('RFileId');
  117. selectedRow = $('#gridtable').jfGridGet('rowdata');
  118. if (learun.checkrow(keyValue)) {
  119. //判断查阅状态
  120. if (selectedRow.ReadFlag == false) {
  121. //判断附件
  122. //if (selectedRow.Url == null || selectedRow.Url == "") {
  123. //自动已读
  124. learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Read', { keyValue: keyValue }, function () {
  125. refreshGirdData();
  126. });
  127. //}
  128. }
  129. learun.layerForm({
  130. id: 'formSys_ReceiveFile',
  131. title: '查看',
  132. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/Form?keyValue=' + keyValue + '&readFlag=' + selectedRow.ReadFlag,
  133. width: 1000,
  134. height: 600,
  135. callBack: function (id) {
  136. return top[id].acceptClick(refreshGirdData);
  137. }
  138. });
  139. }
  140. });
  141. },
  142. // 初始化列表
  143. initGird: function () {
  144. $('#gridtable').jfGrid({
  145. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveFile/GetPageList',
  146. headData: [
  147. {
  148. label: "发送人", name: "SenderId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
  149. learun.clientdata.getAsync('user', {
  150. key: value,
  151. callback: function (_data) {
  152. callback(_data.name);
  153. }
  154. });
  155. }
  156. },
  157. { label: "主题", name: "Title", width: 300, align: "left" },
  158. { label: "发送时间", name: "SendTime", width: 130, align: "left" },
  159. {
  160. label: "签批意见", name: "SpecifyReceiver", width: 300, align: "left"
  161. },
  162. {
  163. label: "状态", name: "ReadFlag", width: 100, align: "left",
  164. formatter: function (cellvalue, row) {
  165. if (cellvalue == 1) {
  166. return '<span class=\"label label-success\">已读</span>';
  167. } else {
  168. return '<span class=\"label label-danger\" >未读</span>';
  169. }
  170. }
  171. },
  172. {
  173. label: "是否通知管理员", name: "RStatus", width: 100, align: "left",
  174. formatter: function (callback, value, row, op, $cell) {
  175. switch (callback) {
  176. case 1:
  177. return '不通知';
  178. case 0:
  179. return '通知';
  180. default:
  181. }
  182. }
  183. },
  184. { label: "查阅时间", name: "ReadTime", width: 130, align: "left" },
  185. ],
  186. mainId: 'RFileId',
  187. isPage: true,
  188. sidx: 'SendTime',
  189. sord: 'DESC'
  190. });
  191. page.search();
  192. },
  193. search: function (param) {
  194. param = param || {};
  195. param.StartTime = startTime;
  196. param.EndTime = endTime;
  197. param.ReceiverId = learun.clientdata.get(['userinfo']).userId;
  198. param.STypeId = 4;
  199. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  200. }
  201. };
  202. refreshGirdData = function () {
  203. page.search();
  204. };
  205. page.init();
  206. }