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.
 
 
 
 
 
 

196 lines
8.4 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.07.11
  6. * 描 述:公告通知
  7. */
  8. var refreshGirdData; // 更新数据
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var processId = '';
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. var keyword = $('#txt_Keyword').val();
  21. page.search({ keyword: keyword });
  22. });
  23. // 刷新
  24. $('#lr_refresh').on('click', function () {
  25. location.reload();
  26. });
  27. // 新增
  28. $('#lr_add').on('click', function () {
  29. learun.layerForm({
  30. id: 'form',
  31. title: '添加公告',
  32. url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow',
  33. width: 1000,
  34. height: 650,
  35. maxmin: true,
  36. callBack: function (id) {
  37. var res = false;
  38. // 验证数据
  39. res = top[id].validForm();
  40. // 保存数据
  41. if (res) {
  42. res = top[id].save('', function () {
  43. page.search();
  44. });
  45. }
  46. return res;
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  53. if (learun.checkrow(keyValue)) {
  54. if (keyValue.indexOf(",") != -1) {
  55. learun.alert.warning("只能选择一条记录进行编辑!");
  56. return false;
  57. }
  58. var SendFlag = $('#gridtable').jfGridValue('F_Status');
  59. if (SendFlag == "1" || SendFlag == "2") {
  60. learun.alert.warning("当前项目已提交不能编辑!");
  61. return;
  62. }
  63. learun.layerForm({
  64. id: 'formedit',
  65. title: '编辑公告',
  66. url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow?keyValue=' + keyValue,
  67. width: 1000,
  68. height: 650,
  69. maxmin: true,
  70. callBack: function (id) {
  71. return top[id].acceptClick(refreshGirdData);
  72. }
  73. });
  74. }
  75. });
  76. // 查看
  77. $('#lr_view').on('click', function () {
  78. var keyValue = $('#gridtable').jfGridValue('SFileId');
  79. if (learun.checkrow(keyValue)) {
  80. if (keyValue.indexOf(",") != -1) {
  81. learun.alert.warning("只能选择一条记录查看!");
  82. return false;
  83. }
  84. learun.layerForm({
  85. id: 'form',
  86. title: '查看',
  87. url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow?keyValue=' + keyValue,
  88. width: 800,
  89. height: 700,
  90. btn: null
  91. });
  92. }
  93. });
  94. // 删除
  95. $('#lr_delete').on('click', function () {
  96. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  97. if (learun.checkrow(keyValue)) {
  98. learun.layerConfirm('是否确认删除该项!', function (res) {
  99. if (res) {
  100. learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Notice/DeleteForm', { keyValue: keyValue }, function () {
  101. refreshGirdData();
  102. });
  103. }
  104. });
  105. }
  106. });
  107. //  提交
  108. $('#lr_submit').on('click', function () {
  109. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  110. if (learun.checkrow(keyValue)) {
  111. var SendFlag = $('#gridtable').jfGridValue('F_Status');
  112. if (SendFlag == "1" || SendFlag=="2") {
  113. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  114. return;
  115. }
  116. learun.layerConfirm('是否确认提交该项!', function (res) {
  117. if (res) {
  118. processId = learun.newGuid();
  119. learun.postForm(top.$.rootUrl + '/LR_OAModule/Notice/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  120. refreshGirdData(res, {});
  121. });
  122. }
  123. });
  124. }
  125. });
  126. },
  127. initGrid: function () {
  128. $('#gridtable').jfGrid({
  129. url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageList',
  130. headData: [
  131. { label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' },
  132. { label: '公告类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' },
  133. {
  134. label: "发布时间", name: "F_ReleaseTime", index: "F_ReleaseTime", width: 140, align: "center",
  135. formatter: function (cellvalue) {
  136. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  137. }
  138. },
  139. { label: '信息来源', name: 'F_SourceName', index: 'F_SourceName', width: 100, align: 'center' },
  140. { label: '阅读次数', name: 'F_PV', index: 'F_PV', width: 80, align: 'center' },
  141. {
  142. label: "审核状态", name: "F_Status", width: 100, align: "left",
  143. formatter: function (cellvalue, row) {
  144. if (cellvalue === "1") {
  145. return '<span class=\"label label-warning\">审批中</span>';
  146. } else if (cellvalue === "2") {
  147. return '<span class=\"label label-success\">通过</span>';
  148. } else {
  149. return '<span class=\"label label-default\" >草稿</span>';
  150. }
  151. }
  152. },
  153. {
  154. label: "发布状态", name: "F_EnabledMark", index: "F_EnabledMark", width: 80, align: "center", autowidth: false,
  155. formatter: function (cellvalue) {
  156. if (cellvalue == 1) {
  157. return "<span class=\"label label-success\">已发布</span>";
  158. } else {
  159. return "<span class=\"label label-danger\">未发布</span>";
  160. }
  161. }
  162. },
  163. { label: "创建时间", name: "F_CreateDate", index: "F_CreateDate", width: 130, align: "center" }
  164. ],
  165. mainId: 'F_NewsId',
  166. reloadSelected: true,
  167. isMultiselect: true,
  168. isPage: true,
  169. sidx: 'F_CreateDate',
  170. sord: 'desc'
  171. });
  172. page.search();
  173. },
  174. search: function (param) {
  175. $('#gridtable').jfGridSet('reload', param);
  176. }
  177. };
  178. // 保存数据后回调刷新
  179. refreshGirdData = function (res, postData) {
  180. if (res && res.code && res.code == 200) {
  181. var postData = {
  182. schemeCode: 'OA_News',// 填写流程对应模板编号
  183. processId: processId,
  184. level: '1',
  185. };
  186. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  187. learun.loading(false);
  188. });
  189. }
  190. page.search();
  191. }
  192. page.init();
  193. }