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.
 
 
 
 
 
 

185 lines
7.7 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-12-13 11:01
  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. // 刷新
  18. $('#lr_refresh').on('click', function () {
  19. location.reload();
  20. });
  21. // 新增
  22. $('#lr_add').on('click', function () {
  23. learun.layerForm({
  24. id: 'form',
  25. title: '新增',
  26. url: top.$.rootUrl + '/LR_LGManager/StampApply/Form',
  27. width: 600,
  28. height: 500,
  29. callBack: function (id) {
  30. var res = false;
  31. // 验证数据
  32. res = top[id].validForm();
  33. // 保存数据
  34. if (res) {
  35. //processId = learun.newGuid();
  36. //res = top[id].save(processId, refreshGirdData);
  37. res = top[id].save('', function () {
  38. page.search();
  39. });
  40. }
  41. return res;
  42. }
  43. });
  44. });
  45. // 编辑
  46. $('#lr_edit').on('click', function () {
  47. var AAStatus = $('#gridtable').jfGridValue('Status');
  48. console.log(AAStatus);
  49. if (AAStatus > 0) {
  50. learun.alert.warning("当前项目已提交不能编辑!");
  51. return;
  52. }
  53. var keyValue = $('#gridtable').jfGridValue('ID');
  54. if (learun.checkrow(keyValue)) {
  55. learun.layerForm({
  56. id: 'form',
  57. title: '编辑',
  58. url: top.$.rootUrl + '/LR_LGManager/StampApply/Form?keyValue=' + keyValue,
  59. width: 600,
  60. height: 500,
  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 AAStatus = $('#gridtable').jfGridValue('Status');
  79. if (AAStatus > 0) {
  80. learun.alert.warning("当前项目已提交不能编辑!");
  81. return;
  82. }
  83. var keyValue = $('#gridtable').jfGridValue('ID');
  84. if (learun.checkrow(keyValue)) {
  85. learun.layerConfirm('是否确认删除该项!', function (res) {
  86. if (res) {
  87. learun.deleteForm(top.$.rootUrl + '/LR_LGManager/StampApply/DeleteForm', { keyValue: keyValue }, function () {
  88. refreshGirdData();
  89. });
  90. }
  91. });
  92. }
  93. });
  94. //提交
  95. $('#lr_submit').on('click', function () {
  96. var keyValue = $('#gridtable').jfGridValue('ID');
  97. if (learun.checkrow(keyValue)) {
  98. var AAStatus = $('#gridtable').jfGridValue('Status');
  99. console.log(AAStatus);
  100. if (AAStatus > 0) {
  101. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  102. return;
  103. }
  104. learun.layerConfirm('是否确认提交该项!', function (res) {
  105. if (res) {
  106. processId = learun.newGuid();
  107. learun.postForm(top.$.rootUrl + '/LR_LGManager/StampApply/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
  108. refreshGirdData(res, {});
  109. });
  110. }
  111. });
  112. }
  113. });
  114. },
  115. // 初始化列表
  116. initGird: function () {
  117. $('#gridtable').lrAuthorizeJfGrid({
  118. url: top.$.rootUrl + '/LR_LGManager/StampApply/GetPageList',
  119. headData: [
  120. { label: "使用部门", name: "UseDepartment", width: 100, align: "left" },
  121. {
  122. label: "用章情况", name: "StampSituration", width: 100, align: "left",
  123. formatterAsync: function (callback, value, row, op, $cell) {
  124. learun.clientdata.getAsync('dataItem', {
  125. key: value,
  126. code: 'JYStampType',
  127. callback: function (_data) {
  128. callback(_data.text);
  129. }
  130. });
  131. }
  132. },
  133. {
  134. label: "用章选择", name: "StampType", width: 100, align: "left",
  135. formatterAsync: function (callback, value, row, op, $cell) {
  136. learun.clientdata.getAsync('dataItem', {
  137. key: value,
  138. code: 'JYStampCheck',
  139. callback: function (_data) {
  140. callback(_data.text);
  141. }
  142. });
  143. }
  144. },
  145. {
  146. label: "状态", name: "Status", width: 100, align: "left",
  147. formatter: function (cellvalue, row) {
  148. if (cellvalue === 1) {
  149. return '<span class=\"label label-warning\">审批中</span>';
  150. } else if (cellvalue === 2) {
  151. return '<span class=\"label label-success\">审批通过</span>';
  152. } else {
  153. return '<span class=\"label label-default\" >草稿</span>';
  154. }
  155. }
  156. },
  157. { label: "备注", name: "Remark", width: 100, align: "left" },
  158. ],
  159. mainId: 'ID',
  160. isPage: true
  161. });
  162. page.search();
  163. },
  164. search: function (param) {
  165. param = param || {};
  166. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  167. }
  168. };
  169. refreshGirdData = function (res, postData) {
  170. if (res.code == 200) {
  171. // 发起流程
  172. var postData = {
  173. schemeCode: 'StampApply',// 填写流程对应模板编号
  174. processId: processId,
  175. level: '1',
  176. };
  177. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  178. learun.loading(false);
  179. });
  180. page.search();
  181. }
  182. };
  183. page.init();
  184. }