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.

IndexFlow.js 8.8 KiB

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