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.
 
 
 
 
 
 

208 lines
9.2 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-06-01 11:49
  5. * 描 述:收文报告
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var processId = '';
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. page.search(queryJson);
  19. }, 220, 400);
  20. // 刷新
  21. $('#lr_refresh').on('click', function () {
  22. location.reload();
  23. });
  24. // 新增
  25. $('#lr_add').on('click', function () {
  26. learun.layerForm({
  27. id: 'form',
  28. title: '新增',
  29. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?DisTitle=' + 2 + '&DisOffice=' + 2,
  30. width: 1000,
  31. height: 700,
  32. callBack: function (id) {
  33. var res = false;
  34. // 验证数据
  35. res = top[id].validForm();
  36. // 保存数据
  37. if (res) {
  38. res = top[id].save('', function () {
  39. page.search();
  40. });
  41. }
  42. return res;
  43. }
  44. });
  45. });
  46. // 编辑
  47. $('#lr_edit').on('click', function () {
  48. var keyValue = $('#gridtable').jfGridValue('Id');
  49. if (learun.checkrow(keyValue)) {
  50. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  51. if (FlowNo != 0) {
  52. learun.alert.warning("当前项目已提交不能编辑!");
  53. return;
  54. }
  55. learun.layerForm({
  56. id: 'form',
  57. title: '编辑',
  58. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?keyValue=' + keyValue + '&DisTitle=' + 2 + '&DisOffice=' + 2,
  59. width: 1000,
  60. height: 700,
  61. callBack: function (id) {
  62. var res = false;
  63. // 验证数据
  64. res = top[id].validForm();
  65. // 保存数据
  66. if (res) {
  67. res = top[id].save('', function () {
  68. page.search();
  69. });
  70. }
  71. return res;
  72. }
  73. });
  74. }
  75. });
  76. // 删除
  77. $('#lr_delete').on('click', function () {
  78. var keyValue = $('#gridtable').jfGridValue('Id');
  79. if (learun.checkrow(keyValue)) {
  80. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  81. if (FlowNo != 0) {
  82. learun.alert.warning("当前项目已提交不能删除!");
  83. return;
  84. }
  85. learun.layerConfirm('是否确认删除该项!', function (res) {
  86. if (res) {
  87. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/DeleteForm', { keyValue: keyValue }, function () {
  88. });
  89. }
  90. });
  91. }
  92. });
  93. //提交
  94. $('#lr_submit').on('click', function () {
  95. var keyValue = $('#gridtable').jfGridValue('Id');
  96. if (learun.checkrow(keyValue)) {
  97. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  98. if (FlowNo != 0) {
  99. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  100. return;
  101. }
  102. learun.layerConfirm('是否确认提交该项!', function (res) {
  103. if (res) {
  104. processId = learun.newGuid();
  105. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
  106. refreshGirdData(res, {});
  107. });
  108. }
  109. });
  110. }
  111. });
  112. // 打印
  113. $('#lr_print').on('click', function () {
  114. var keyValue = $('#gridtable').jfGridValue('Id');
  115. if (learun.checkrow(keyValue)) {
  116. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  117. if (FlowNo < 2) {
  118. learun.alert.warning("当前项目未审核通过,不能打印!");
  119. return;
  120. }
  121. learun.layerForm({
  122. id: 'from',
  123. title: '收文通告',
  124. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Print?keyValue=' + keyValue,
  125. width: 1200,
  126. height: 1200,
  127. callBack: null
  128. });
  129. }
  130. });
  131. },
  132. // 初始化列表
  133. initGird: function () {
  134. $('#gridtable').lrAuthorizeJfGrid({
  135. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/GetPageList',
  136. headData: [
  137. { label: "工作名称", name: "WorkName", width: 200, align: "center" },
  138. //{ label: "标题", name: "DisTitle", width: 200, align: "center" },
  139. {
  140. label: "标题", name: "DisTitle", width: 250, align: "left",
  141. formatterAsync: function (callback, value, row, op, $cell) {
  142. learun.clientdata.getAsync('dataItem', {
  143. key: value,
  144. code: 'Dispatch',
  145. callback: function (_data) {
  146. callback(_data.text);
  147. }
  148. });
  149. }
  150. },
  151. { label: "来文", name: "DisFrom", width: 100, align: "center" },
  152. { label: "字", name: "DisWork", width: 80, align: "center" },
  153. { label: "号", name: "DisMark", width: 80, align: "center" },
  154. { label: "份数", name: "Copies", width: 50, align: "center" },
  155. { label: "年", name: "DisYear", width: 100, align: "center" },
  156. { label: "月", name: "DisMonth", width: 50, align: "center" },
  157. { label: "日", name: "DisDay", width: 50, align: "center" },
  158. { label: "事由", name: "Reasons", width: 150, align: "center" },
  159. //{ label: "附件", name: "AttachmentName", width: 100, align: "center" },
  160. { label: "呈送意见", name: "Render", width: 100, align: "center" },
  161. {
  162. label: "呈送时间", name: "RenderDate", width: 100, align: "center",
  163. },
  164. { label: "收文", name: "DisOffice", width: 100, align: "center" },
  165. { label: "批示", name: "Instructions", width: 100, align: "center" },
  166. {
  167. label: "审批状态", name: "FlowNo", width: 100, align: "center",
  168. formatter: function (cellvalue, row) {
  169. if (cellvalue == 0) {
  170. return '<span class=\"label label-warning\">草稿</span>';
  171. } if (cellvalue == 1) {
  172. return '<span class=\"label label-warning\">审批中</span>';
  173. } else if (cellvalue == 2) {
  174. return '<span class=\"label label-success\">审批通过</span>';
  175. }
  176. }
  177. }
  178. ],
  179. mainId: 'Id',
  180. isPage: true
  181. });
  182. page.search();
  183. },
  184. search: function (param) {
  185. param = param || {};
  186. param.DisTitle = 2;
  187. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  188. }
  189. };
  190. refreshGirdData = function (res, postData) {
  191. if (res.code == 200) {
  192. // 发起流程
  193. var postData = {
  194. schemeCode: 'Dispatch',// 填写流程对应模板编号
  195. processId: processId,
  196. level: '1',
  197. };
  198. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  199. learun.loading(false);
  200. });
  201. page.search();
  202. }
  203. };
  204. page.init();
  205. }