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.
 
 
 
 
 
 

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