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.
 
 
 
 
 
 

242 lines
11 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-06 17:15
  5. * 描 述:日志发送
  6. */
  7. var refreshGirdData;
  8. var sendthismessage;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var datebegin = '';
  12. var dateend = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. $('.datetime').each(function () {
  20. $(this).lrdate({
  21. dfdata: [
  22. { name: '清空', begin: function () { return '' }, end: function () { return '' } },
  23. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  24. { 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') } },
  25. { 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') } },
  26. { 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') } },
  27. ],
  28. // 月
  29. mShow: false,
  30. premShow: false,
  31. // 季度
  32. jShow: false,
  33. prejShow: false,
  34. // 年
  35. ysShow: false,
  36. yxShow: false,
  37. preyShow: false,
  38. yShow: false,
  39. // 默认
  40. dfvalue: '0',
  41. selectfn: function (begin, end) {
  42. datebegin = begin;
  43. dateend = end;
  44. page.search();
  45. }
  46. });
  47. });
  48. // 查询
  49. $('#btn_Search').on('click', function () {
  50. var keyword = $('#txt_Keyword').val();
  51. page.search({ keyword: keyword });
  52. });
  53. // 刷新
  54. $('#lr_refresh').on('click', function () {
  55. location.reload();
  56. });
  57. // 新增
  58. $('#lr_add').on('click', function () {
  59. top.layer.open({
  60. id: 'sendform',
  61. title: '发日志',
  62. type: 2,
  63. skin: 'lr-layer',
  64. btn: ['发送', '保存草稿', '关闭'],
  65. content: top.$.rootUrl + '/EducationalAdministration/JournalSend/Form',
  66. area: ['800px', '700px'],
  67. success: function (layero, index) {
  68. top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
  69. },
  70. yes: function (index, layero) {
  71. var flag = true;
  72. flag = top['sendform'].acceptClick(sendthismessage);
  73. if (!!flag) {
  74. learun.layerClose('', index);
  75. }
  76. }
  77. , btn2: function (index, layero) {
  78. var flag = true;
  79. flag = top['sendform'].acceptClick(refreshGirdData);
  80. if (!!flag) {
  81. learun.layerClose('', index);
  82. }
  83. return false;
  84. }
  85. , btn3: function (index, layero) {
  86. top['sendform'] = null;
  87. top.layer.close(index);
  88. }
  89. });
  90. });
  91. // 编辑
  92. $('#lr_edit').on('click', function () {
  93. var keyValue = $('#gridtable').jfGridValue('JournalSendId');
  94. var JIsSend = $('#gridtable').jfGridValue('JIsSend');
  95. if (learun.checkrow(keyValue)) {
  96. if (JIsSend === true) {
  97. learun.alert.warning("该日志已发送不能编辑!");
  98. return;
  99. }
  100. top.layer.open({
  101. id: 'sendform',
  102. title: '发日志',
  103. type: 2,
  104. skin: 'lr-layer',
  105. btn: ['发送', '保存草稿', '关闭'],
  106. content: top.$.rootUrl + '/EducationalAdministration/JournalSend/Form?keyValue=' + keyValue,
  107. area: ['800px', '700px'],
  108. success: function (layero, index) {
  109. top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
  110. },
  111. yes: function (index, layero) {
  112. var flag = true;
  113. flag = top['sendform'].acceptClick(sendthismessage);
  114. if (!!flag) {
  115. learun.layerClose('', index);
  116. }
  117. }
  118. , btn2: function (index, layero) {
  119. var flag = true;
  120. flag = top['sendform'].acceptClick(refreshGirdData);
  121. if (!!flag) {
  122. learun.layerClose('', index);
  123. }
  124. return false;
  125. }
  126. , btn3: function (index, layero) {
  127. top['sendform'] = null;
  128. top.layer.close(index);
  129. }
  130. });
  131. }
  132. });
  133. // 编辑
  134. $('#lr_view').on('click', function () {
  135. var keyValue = $('#gridtable').jfGridValue('JournalSendId');
  136. if (learun.checkrow(keyValue)) {
  137. top.layer.open({
  138. id: 'sendform',
  139. title: '发日志',
  140. type: 2,
  141. skin: 'lr-layer-nobtn',
  142. btn: null,
  143. content: top.$.rootUrl + '/EducationalAdministration/JournalSend/FormView?keyValue=' + keyValue,
  144. area: ['800px', '700px'],
  145. success: function (layero, index) {
  146. top['sendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames);
  147. },
  148. end: function () {
  149. top['sendform'] = null;
  150. }
  151. });
  152. }
  153. });
  154. // 删除
  155. $('#lr_delete').on('click', function () {
  156. var keyValue = $('#gridtable').jfGridValue('JournalSendId');
  157. var JIsSend = $('#gridtable').jfGridValue('JIsSend');
  158. if (learun.checkrow(keyValue)) {
  159. if (JIsSend === true) {
  160. learun.alert.warning("该日志已发送不能删除!");
  161. return;
  162. }
  163. learun.layerConfirm('是否确认删除该项!', function (res) {
  164. if (res) {
  165. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/DeleteForm', { keyValue: keyValue }, function () {
  166. refreshGirdData();
  167. });
  168. }
  169. });
  170. }
  171. });
  172. //发送
  173. $('#lr_send').on('click', function () {
  174. var keyValue = $('#gridtable').jfGridValue('JournalSendId');
  175. var JIsSend = $('#gridtable').jfGridValue('JIsSend');
  176. if (learun.checkrow(keyValue)) {
  177. if (JIsSend === true) {
  178. learun.alert.warning("该日志已发送不能再次发送!");
  179. return;
  180. }
  181. learun.layerConfirm('是否确认发送该项!', function (res) {
  182. if (res) {
  183. learun.postForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/Send', { keyValue: keyValue }, function () {
  184. refreshGirdData();
  185. });
  186. }
  187. });
  188. }
  189. });
  190. },
  191. // 初始化列表
  192. initGird: function () {
  193. $('#gridtable').lrAuthorizeJfGrid({
  194. url: top.$.rootUrl + '/EducationalAdministration/JournalSend/GetPageList',
  195. headData: [
  196. { label: "日志主题", name: "JTitle", width: 400, align: "left" },
  197. {
  198. label: "日志类型", name: "JTypeId", width: 150, align: "left",
  199. formatterAsync: function (callback, value, row, op, $cell) {
  200. learun.clientdata.getAsync('dataItem', {
  201. key: value,
  202. code: 'JournalType',
  203. callback: function (_data) {
  204. callback(_data.text);
  205. }
  206. });
  207. }
  208. },
  209. { label: "接收人", name: "JReceive", width: 200, align: "left" },
  210. {
  211. label: "状态", name: "JIsSend", width: 100, align: "left", formatter: function (cellvalue) {
  212. return cellvalue == false ? "<span class=\"label label-danger\">草稿</span>" : "<span class=\"label label-success\">已发送</span>";
  213. }
  214. },
  215. { label: "发送时间", name: "JSendTime", width: 100, align: "left" }
  216. ],
  217. mainId: 'JournalSendId',
  218. isPage: true
  219. });
  220. page.search();
  221. },
  222. search: function (param) {
  223. param = param || {};
  224. param.userId = userId;
  225. param.StartTime = datebegin;
  226. param.EndTime = dateend;
  227. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  228. }
  229. };
  230. refreshGirdData = function () {
  231. page.search();
  232. };
  233. sendthismessage = function (id) {
  234. learun.loading(true, '发送中...');
  235. learun.postForm(top.$.rootUrl + '/EducationalAdministration/JournalSend/Send', { keyValue: id }, function () {
  236. refreshGirdData();
  237. top.learun.layerClose(window.name);
  238. });
  239. };
  240. page.init();
  241. }