Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

302 linhas
13 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-10-22 16:58
  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. $('#RReceiveUnit').lrDepartmentSelect();
  21. // 刷新
  22. $('#lr_refresh').on('click', function () {
  23. location.reload();
  24. });
  25. // 新增
  26. $('#lr_add').on('click', function () {
  27. learun.layerForm({
  28. id: 'form',
  29. title: '新增',
  30. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/Form',
  31. width: 800,
  32. height: 600,
  33. callBack: function (id) {
  34. var res = false;
  35. // 验证数据
  36. res = top[id].validForm();
  37. // 保存数据
  38. if (res) {
  39. res = top[id].save('', function () {
  40. page.search();
  41. });
  42. }
  43. return res;
  44. }
  45. });
  46. });
  47. // 编辑
  48. $('#lr_edit').on('click', function () {
  49. var keyValue = $('#gridtable').jfGridValue('RID');
  50. if (learun.checkrow(keyValue)) {
  51. var SendFlag = $('#gridtable').jfGridValue('RSendFlag');
  52. if (SendFlag != 0) {
  53. learun.alert.warning("当前项目已提交不能编辑!");
  54. return;
  55. }
  56. learun.layerForm({
  57. id: 'form',
  58. title: '编辑',
  59. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/Form?keyValue=' + keyValue,
  60. width: 800,
  61. height: 600,
  62. callBack: function (id) {
  63. var res = false;
  64. // 验证数据
  65. res = top[id].validForm();
  66. // 保存数据
  67. if (res) {
  68. res = top[id].save('', function () {
  69. page.search();
  70. });
  71. }
  72. return res;
  73. }
  74. });
  75. }
  76. });
  77. // 查看
  78. $('#lr_view').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('RID');
  80. if (learun.checkrow(keyValue)) {
  81. learun.layerForm({
  82. id: 'form',
  83. title: '查看',
  84. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/FormView?keyValue=' + keyValue,
  85. width: 800,
  86. height: 600,
  87. callBack: function (id) {
  88. var res = false;
  89. // 验证数据
  90. res = top[id].validForm();
  91. // 保存数据
  92. if (res) {
  93. res = top[id].save('', function () {
  94. page.search();
  95. });
  96. }
  97. return res;
  98. }
  99. });
  100. }
  101. });
  102. // 删除
  103. $('#lr_delete').on('click', function () {
  104. var keyValue = $('#gridtable').jfGridValue('RID');
  105. if (learun.checkrow(keyValue)) {
  106. var SendFlag = $('#gridtable').jfGridValue('RSendFlag');
  107. if (SendFlag != 0) {
  108. learun.alert.warning("当前项目已提交不能删除!");
  109. return;
  110. }
  111. learun.layerConfirm('是否确认删除该项!', function (res) {
  112. if (res) {
  113. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/DeleteForm', { keyValue: keyValue }, function () {
  114. refreshGirdData();
  115. });
  116. }
  117. });
  118. }
  119. });
  120. //  提交
  121. $('#lr_submit').on('click', function () {
  122. var keyValue = $('#gridtable').jfGridValue('RID');
  123. if (learun.checkrow(keyValue)) {
  124. var SendFlag = $('#gridtable').jfGridValue('RSendFlag');
  125. if (SendFlag != 0) {
  126. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  127. return;
  128. }
  129. learun.layerConfirm('是否确认提交该项!', function (res) {
  130. if (res) {
  131. processId = learun.newGuid();
  132. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  133. refreshGirdData(res, {});
  134. });
  135. }
  136. });
  137. }
  138. });
  139. // 下发审批指定接收人
  140. $('#lr_IssueSpecifyReceiver').on('click', function () {
  141. var keyValue = $('#gridtable').jfGridValue('RID');
  142. if (learun.checkrow(keyValue)) {
  143. learun.layerForm({
  144. id: 'form',
  145. title: '下发审批指定接收人',
  146. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/IssueForm?keyValue=' + keyValue,
  147. width: 800,
  148. height: 200,
  149. callBack: function (id) {
  150. var res = false;
  151. // 验证数据
  152. res = top[id].validForm();
  153. // 保存数据
  154. if (res) {
  155. res = top[id].save('', function () {
  156. page.search();
  157. });
  158. }
  159. return res;
  160. }
  161. });
  162. }
  163. });
  164. // 结束下发
  165. $('#lr_OverIssue').on('click', function () {
  166. var keyValue = $('#gridtable').jfGridValue('RID');
  167. if (learun.checkrow(keyValue)) {
  168. var SendFlag = $('#gridtable').jfGridValue('RSendFlag');
  169. console.log(SendFlag);
  170. if (SendFlag !== '2') {
  171. learun.alert.warning("当前公文未审批通过,请耐心等待审批!");
  172. return;
  173. }
  174. learun.layerConfirm('是否结束下发!', function (res) {
  175. if (res) {
  176. processId = learun.newGuid();
  177. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/OverIssue', { keyValue: keyValue, }, function (res) {
  178. refreshGirdData(res, {});
  179. });
  180. }
  181. });
  182. }
  183. });
  184. // 查阅情况
  185. $('#lr_read').on('click', function () {
  186. var keyValue = $('#gridtable').jfGridValue('RID');
  187. if (learun.checkrow(keyValue)) {
  188. learun.layerForm({
  189. id: 'form',
  190. title: '查阅情况',
  191. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/ReadList?keyValue=' + keyValue,
  192. width: 850,
  193. height: 400,
  194. btn: null
  195. });
  196. }
  197. });
  198. },
  199. // 初始化列表
  200. initGird: function () {
  201. $('#gridtable').lrAuthorizeJfGrid({
  202. url: top.$.rootUrl + '/EducationalAdministration/Sys_ReceiveDocument/GetPageList',
  203. headData: [
  204. { label: "来文单位", name: "RSourceUnit", width: 100, align: "left" },
  205. {
  206. label: "收文单位", name: "RReceiveUnit", width: 100, align: "left",
  207. formatterAsync: function (callback, value, row, op, $cell) {
  208. learun.clientdata.getAsync('department', {
  209. key: value,
  210. callback: function (_data) {
  211. callback(_data.name);
  212. }
  213. });
  214. }
  215. },
  216. {
  217. label: "缓急程度", name: "RUrgencyDegree", width: 100, align: "left",
  218. formatterAsync: function (callback, value, row, op, $cell) {
  219. learun.clientdata.getAsync('dataItem', {
  220. key: value,
  221. code: 'UrgencyDegree',
  222. callback: function (_data) {
  223. callback(_data.text);
  224. }
  225. });
  226. }
  227. },
  228. { label: "文件标题", name: "RTitle", width: 100, align: "left" },
  229. {
  230. label: "已接收", name: "ReceiverId", width: 300, align: "left", formatterAsync:
  231. function (callback, value, row, op, $cell) {
  232. learun.clientdata.getAsync('user',
  233. {
  234. key: value,
  235. callback: function (_data) {
  236. if (_data.length > 0) {
  237. var text = '';
  238. $.each(_data,
  239. function (i, item) {
  240. if (item) {
  241. text += item.name + ',';
  242. }
  243. });
  244. text = text.substring(0, text.lastIndexOf(','));
  245. callback(text);
  246. } else {
  247. callback(_data.name);
  248. }
  249. }
  250. });
  251. }
  252. },
  253. { label: "审批意见", name: "SpecifyReceiver", width: 300, align: "left" },
  254. {
  255. label: "状态", name: "RSendFlag", width: 100, align: "left",
  256. formatter: function (cellvalue, row) {
  257. if (cellvalue === "1") {
  258. return '<span class=\"label label-warning\">审批中</span>';
  259. } else if (cellvalue === "2") {
  260. return '<span class=\"label label-info\">审批通过</span>';
  261. } else if (cellvalue === "3") {
  262. return '<span class=\"label label-danger\" >审批失败</span>';
  263. } else if (cellvalue === "4") {
  264. return '<span class=\"label label-success\" >下发完毕</span>';
  265. } else {
  266. return '<span class=\"label label-default\" >草稿</span>';
  267. }
  268. }
  269. }
  270. ],
  271. mainId: 'RID',
  272. isPage: true
  273. });
  274. page.search();
  275. },
  276. search: function (param) {
  277. param = param || {};
  278. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  279. }
  280. };
  281. refreshGirdData = function (res, postData) {
  282. if (res.code == 200) {
  283. // 发起流程
  284. var postData = {
  285. schemeCode: 'Sys_ReceiveDocument',// 填写流程对应模板编号
  286. processId: processId,
  287. level: '1',
  288. };
  289. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  290. learun.loading(false);
  291. });
  292. page.search();
  293. }
  294. };
  295. page.init();
  296. }