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.
 
 
 
 
 
 

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