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.
 
 
 
 
 
 

197 lines
8.5 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. return top[id].save(refreshGirdData);
  73. }
  74. });
  75. }
  76. });
  77. // 查看
  78. $('#lr_view').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  80. if (learun.checkrow(keyValue)) {
  81. if (keyValue.indexOf(",") != -1) {
  82. learun.alert.warning("只能选择一条记录查看!");
  83. return false;
  84. }
  85. learun.layerForm({
  86. id: 'form',
  87. title: '查看',
  88. url: top.$.rootUrl + '/LR_OAModule/Notice/FormFlow?keyValue=' + keyValue,
  89. width: 1000,
  90. height: 650,
  91. btn: null
  92. });
  93. }
  94. });
  95. // 删除
  96. $('#lr_delete').on('click', function () {
  97. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  98. if (learun.checkrow(keyValue)) {
  99. learun.layerConfirm('是否确认删除该项!', function (res) {
  100. if (res) {
  101. learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Notice/DeleteForm', { keyValue: keyValue }, function () {
  102. refreshGirdData();
  103. });
  104. }
  105. });
  106. }
  107. });
  108. //  提交
  109. $('#lr_submit').on('click', function () {
  110. var keyValue = $('#gridtable').jfGridValue('F_NewsId');
  111. if (learun.checkrow(keyValue)) {
  112. var SendFlag = $('#gridtable').jfGridValue('F_Status');
  113. if (SendFlag == "1" || SendFlag=="2") {
  114. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  115. return;
  116. }
  117. learun.layerConfirm('是否确认提交该项!', function (res) {
  118. if (res) {
  119. processId = learun.newGuid();
  120. learun.postForm(top.$.rootUrl + '/LR_OAModule/Notice/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  121. refreshGirdData(res, {});
  122. });
  123. }
  124. });
  125. }
  126. });
  127. },
  128. initGrid: function () {
  129. $('#gridtable').jfGrid({
  130. url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageList',
  131. headData: [
  132. { label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' },
  133. { label: '公告类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' },
  134. {
  135. label: "发布时间", name: "F_ReleaseTime", index: "F_ReleaseTime", width: 140, align: "center",
  136. formatter: function (cellvalue) {
  137. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  138. }
  139. },
  140. { label: '信息来源', name: 'F_SourceName', index: 'F_SourceName', width: 100, align: 'center' },
  141. { label: '阅读次数', name: 'F_PV', index: 'F_PV', width: 80, align: 'center' },
  142. {
  143. label: "审核状态", name: "F_Status", width: 100, align: "left",
  144. formatter: function (cellvalue, row) {
  145. if (cellvalue === "1") {
  146. return '<span class=\"label label-warning\">审批中</span>';
  147. } else if (cellvalue === "2") {
  148. return '<span class=\"label label-success\">通过</span>';
  149. } else {
  150. return '<span class=\"label label-default\" >草稿</span>';
  151. }
  152. }
  153. },
  154. {
  155. label: "发布状态", name: "F_EnabledMark", index: "F_EnabledMark", width: 80, align: "center", autowidth: false,
  156. formatter: function (cellvalue) {
  157. if (cellvalue == 1) {
  158. return "<span class=\"label label-success\">已发布</span>";
  159. } else {
  160. return "<span class=\"label label-danger\">未发布</span>";
  161. }
  162. }
  163. },
  164. { label: "创建时间", name: "F_CreateDate", index: "F_CreateDate", width: 130, align: "center" }
  165. ],
  166. mainId: 'F_NewsId',
  167. reloadSelected: true,
  168. isMultiselect: true,
  169. isPage: true,
  170. sidx: 'F_CreateDate',
  171. sord: 'desc'
  172. });
  173. page.search();
  174. },
  175. search: function (param) {
  176. $('#gridtable').jfGridSet('reload', param);
  177. }
  178. };
  179. // 保存数据后回调刷新
  180. refreshGirdData = function (res, postData) {
  181. if (res && res.code && res.code == 200) {
  182. var postData = {
  183. schemeCode: 'OA_News',// 填写流程对应模板编号
  184. processId: processId,
  185. level: '1',
  186. };
  187. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  188. learun.loading(false);
  189. });
  190. }
  191. page.search();
  192. }
  193. page.init();
  194. }