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.
 
 
 
 
 
 

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