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.
 
 
 
 
 
 

227 lines
9.7 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-11 10:31
  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/Sys_SendFile/Form',
  30. width: 800,
  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('SFileId');
  49. if (learun.checkrow(keyValue)) {
  50. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  51. if (SendFlag !== 0) {
  52. learun.alert.warning("当前项目已提交不能编辑!");
  53. return;
  54. }
  55. learun.layerForm({
  56. id: 'form',
  57. title: '编辑',
  58. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/Form?keyValue=' + keyValue,
  59. width: 800,
  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_view').on('click', function () {
  78. var keyValue = $('#gridtable').jfGridValue('SFileId');
  79. if (learun.checkrow(keyValue)) {
  80. learun.layerForm({
  81. id: 'form',
  82. title: '查看',
  83. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/FormView?keyValue=' + keyValue,
  84. width: 800,
  85. height: 700,
  86. btn: null
  87. });
  88. }
  89. });
  90. // 查阅情况
  91. $('#lr_read').on('click', function () {
  92. var keyValue = $('#gridtable').jfGridValue('SFileId');
  93. if (learun.checkrow(keyValue)) {
  94. learun.layerForm({
  95. id: 'form',
  96. title: '查阅情况',
  97. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/ReadList?keyValue=' + keyValue,
  98. width: 850,
  99. height: 400,
  100. btn: null
  101. });
  102. }
  103. });
  104. // 删除
  105. $('#lr_delete').on('click', function () {
  106. var keyValue = $('#gridtable').jfGridValue('SFileId');
  107. if (learun.checkrow(keyValue)) {
  108. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  109. if (SendFlag !== 0) {
  110. learun.alert.warning("当前项目已提交不能删除!");
  111. return;
  112. }
  113. learun.layerConfirm('是否确认删除该项!', function (res) {
  114. if (res) {
  115. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/DeleteForm', { keyValue: keyValue }, function () {
  116. refreshGirdData();
  117. });
  118. }
  119. });
  120. }
  121. });
  122. //  提交
  123. $('#lr_submit').on('click', function () {
  124. var keyValue = $('#gridtable').jfGridValue('SFileId');
  125. if (learun.checkrow(keyValue)) {
  126. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  127. if (SendFlag !== 0) {
  128. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  129. return;
  130. }
  131. top.layer.confirm('请选择模板?', {
  132. btn: ['同师', '幼师']
  133. }, function () {
  134. learun.layerConfirm('是否确认提交该项!(同师)', function (res) {
  135. if (res) {
  136. processId = learun.newGuid();
  137. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  138. res.type = 1;
  139. refreshGirdData(res, {});
  140. });
  141. }
  142. });
  143. }, function () {
  144. learun.layerConfirm('是否确认提交该项!(幼师)', function (res) {
  145. if (res) {
  146. processId = learun.newGuid();
  147. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  148. res.type = 2;
  149. refreshGirdData(res, {});
  150. });
  151. }
  152. });
  153. });
  154. }
  155. });
  156. },
  157. // 初始化列表
  158. initGird: function () {
  159. $('#gridtable').lrAuthorizeJfGrid({
  160. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/GetPageList',
  161. headData: [
  162. { label: "主题", name: "Title", width: 300, align: "left" },
  163. {
  164. label: "接收对象", name: "SendType", width: 100, align: "left",
  165. formatterAsync: function (callback, value, row, op, $cell) {
  166. learun.clientdata.getAsync('dataItem', {
  167. key: value,
  168. code: 'FileSendType',
  169. callback: function (_data) {
  170. callback(_data.text);
  171. }
  172. });
  173. }
  174. },
  175. {
  176. label: "接收人", name: "Receiver", width: 300, align: "left"
  177. },
  178. {
  179. label: "下发人", name: "Sender", width: 100, align: "left"
  180. },
  181. {
  182. label: "下发时间", name: "SendTime", width: 150, align: "left"
  183. },
  184. {
  185. label: "状态", name: "SendFlag", width: 100, align: "left",
  186. formatter: function (cellvalue, row) {
  187. if (cellvalue === 1) {
  188. return '<span class=\"label label-warning\">审批中</span>';
  189. } else if (cellvalue === 2) {
  190. return '<span class=\"label label-success\">已下发</span>';
  191. } else {
  192. return '<span class=\"label label-default\" >草稿</span>';
  193. }
  194. }
  195. },
  196. ],
  197. mainId: 'SFileId',
  198. isPage: true
  199. });
  200. page.search();
  201. },
  202. search: function (param) {
  203. param = param || {};
  204. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  205. }
  206. };
  207. refreshGirdData = function (res, postData) {
  208. if (res && res.code && res.code == 200) {
  209. // 发起流程
  210. learun.workflowapi.create({
  211. isNew: true,
  212. schemeCode: res.type === 1 ? 'Sys_SendFile' :'Sys_SendFileYS',// 填写流程对应模板编号
  213. processId: processId,
  214. processName: '公文下发审批',// 对应流程名称
  215. processLevel: '1',
  216. description: '',
  217. formData: JSON.stringify(postData),
  218. callback: function (res, data) {
  219. }
  220. });
  221. }
  222. page.search();
  223. };
  224. page.init();
  225. }