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.
 
 
 
 
 
 

225 lines
8.8 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  3. * Copyright (c) 2013-2017
  4. * 创建人:陈彬彬
  5. * 日 期:2017.06.04
  6. * 描 述:邮件管理
  7. */
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var datebegin = '';
  11. var dateend = '';
  12. var selectedRow = '';
  13. var currentPage='2';
  14. var refreshGirdData = function () {
  15. page.search();
  16. }
  17. var page = {
  18. init: function () {
  19. page.initleft();
  20. page.initGrid();
  21. page.bind();
  22. },
  23. bind: function () {
  24. $('.datetime').each(function () {
  25. $(this).lrdate({
  26. dfdata: [
  27. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  28. { 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') } },
  29. { 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') } },
  30. { 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') } },
  31. ],
  32. // 月
  33. mShow: false,
  34. premShow: false,
  35. // 季度
  36. jShow: false,
  37. prejShow: false,
  38. // 年
  39. ysShow: false,
  40. yxShow: false,
  41. preyShow: false,
  42. yShow: false,
  43. // 默认
  44. dfvalue: '1',
  45. selectfn: function (begin, end) {
  46. datebegin = begin;
  47. dateend = end;
  48. page.search();
  49. }
  50. });
  51. });
  52. // 查询
  53. $('#btn_Search').on('click', function () {
  54. var keyword = $('#txt_Keyword').val();
  55. page.search({ keyword: keyword });
  56. });
  57. // 刷新
  58. $('#lr_refresh').on('click', function () {
  59. location.reload();
  60. });
  61. // 发邮件
  62. $('#lr_sendemail').on('click', function () {
  63. learun.layerForm({
  64. id: 'sendform',
  65. title: '发送邮件',
  66. url: top.$.rootUrl + '/LR_OAModule/Email/Form',
  67. width: 800,
  68. height: 700,
  69. callBack: function (id) {
  70. return top[id].acceptClick(refreshGirdData);
  71. }
  72. });
  73. });
  74. // 收邮件
  75. $('#lr_getemail').on('click', function () {
  76. learun.loading(true);
  77. learun.httpAsyncGet(top.$.rootUrl + '/LR_OAModule/Email/GetMail', function (res) {
  78. console.log(res);
  79. learun.loading(false);
  80. page.search();
  81. });
  82. });
  83. // 查看
  84. $('#lr_detail').on('click', function () {
  85. var keyValue = '';
  86. if (currentPage == '2') {
  87. keyValue = $('#receivetable').jfGridValue('F_Id');
  88. }
  89. else {
  90. keyValue = $('#sendtable').jfGridValue('F_Id');
  91. }
  92. if (learun.checkrow(keyValue)) {
  93. learun.layerForm({
  94. id: 'detailform',
  95. title: '查看',
  96. url: top.$.rootUrl + '/LR_OAModule/Email/DetailForm?keyValue=' + keyValue + '&type=' + currentPage,
  97. width: 800,
  98. height: 700,
  99. callBack: function (id) {
  100. return top[id].acceptClick(refreshGirdData);
  101. }
  102. });
  103. }
  104. });
  105. // 删除
  106. $('#lr_delete').on('click', function () {
  107. var keyValue = '';
  108. if (currentPage == '2') {
  109. keyValue = $('#receivetable').jfGridValue('F_Id');
  110. }
  111. else {
  112. keyValue = $('#sendtable').jfGridValue('F_Id');
  113. }
  114. if (learun.checkrow(keyValue)) {
  115. learun.layerConfirm('是否确认删除该项!', function (res) {
  116. if (res) {
  117. learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Email/DeleteForm', { keyValue: keyValue, type: currentPage }, function () {
  118. refreshGirdData();
  119. });
  120. }
  121. });
  122. }
  123. });
  124. },
  125. initleft: function () {
  126. $('#lr_sendemail').hide();
  127. $('#sendtable').css('display', "none");
  128. $('#lr_left_list li').on('click', function () {
  129. var $this = $(this);
  130. var $parent = $this.parent();
  131. $parent.find('.active').removeClass('active');
  132. $this.addClass('active');
  133. var data_value=$this.context.dataset.value;
  134. switch (data_value) {
  135. case "1":
  136. $('#sendtable').css('display', "");
  137. $('#receivetable').css('display', "none");
  138. $('#lr_getemail').hide();
  139. $('#lr_sendemail').show();
  140. currentPage='1';
  141. break;
  142. case "2":
  143. $('#sendtable').css('display', "none");
  144. $('#receivetable').css('display', "");
  145. $('#lr_sendemail').hide();
  146. $('#lr_getemail').show();
  147. currentPage='2';
  148. break;
  149. case "3":
  150. $('#lr_sendemail').hide();
  151. $('#lr_getemail').hide();
  152. learun.layerForm({
  153. id: 'configform',
  154. title: '邮件配置',
  155. url: top.$.rootUrl + '/LR_OAModule/Email/ConfigForm',
  156. width: 400,
  157. height: 450,
  158. callBack: function (id) {
  159. return top[id].acceptClick(refreshGirdData);
  160. }
  161. });
  162. break;
  163. default: break;
  164. }
  165. });
  166. },
  167. initGrid: function () {
  168. $('#sendtable').jfGrid({
  169. url: top.$.rootUrl + '/LR_OAModule/Email/GetSendList',
  170. headData: [
  171. { label: "收件人", name: "F_To", width: 200, align: "left" },
  172. { label: "主题", name: "F_Subject", width: 450, align: "left" },
  173. {
  174. label: "发件时间", name: "F_CreatorTime", width: 135, align: "left",
  175. formatter: function (cellvalue) {
  176. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  177. }
  178. }
  179. ],
  180. mainId: 'F_Id',
  181. isPage: true,
  182. sidx: 'F_CreatorTime',
  183. });
  184. $('#receivetable').jfGrid({
  185. url: top.$.rootUrl + '/LR_OAModule/Email/GetReceiveList',
  186. headData: [
  187. { label: "发件人", name: "F_SenderName", width: 200, align: "left" },
  188. { label: "主题", name: "F_Subject", width: 450, align: "left" },
  189. {
  190. label: "收件时间", name: "F_Date", width: 135, align: "left",
  191. formatter: function (cellvalue) {
  192. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  193. }
  194. }
  195. ],
  196. mainId: 'F_Id',
  197. isPage: true,
  198. sidx: 'F_Date',
  199. sord: 'DESC'
  200. });
  201. },
  202. search: function (param) {
  203. param = param || {};
  204. param.StartTime = datebegin;
  205. param.EndTime = dateend;
  206. console.log(param);
  207. if (currentPage == '1') {
  208. $('#sendtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  209. }
  210. else {
  211. $('#receivetable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  212. }
  213. }
  214. };
  215. page.init();
  216. }