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.
 
 
 
 
 
 

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