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.
 
 
 
 
 
 

323 lines
14 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 logbegin = '';
  12. var logend = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. page.search(queryJson);
  21. }, 220, 400);
  22. $('#datesearch').lrdate({
  23. dfdata: [
  24. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  25. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  26. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  27. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  28. ],
  29. // 月
  30. mShow: false,
  31. premShow: false,
  32. // 季度
  33. jShow: false,
  34. prejShow: false,
  35. // 年
  36. ysShow: false,
  37. yxShow: false,
  38. preyShow: false,
  39. yShow: false,
  40. // 默认
  41. selectfn: function (begin, end) {
  42. logbegin = begin;
  43. logend = end;
  44. page.search();
  45. }
  46. });
  47. // 查询
  48. $('#btn_Search').on('click', function () {
  49. var keyword = $('#txt_Keyword').val();
  50. page.search({ keyword: keyword });
  51. });
  52. // 刷新
  53. $('#lr_refresh').on('click', function () {
  54. location.reload();
  55. });
  56. // 新增
  57. $('#lr_add').on('click', function () {
  58. learun.layerForm({
  59. id: 'form',
  60. title: '新增',
  61. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?WorkName=' + 2 + '&DisOffice=' + 2,
  62. width: 800,
  63. height: 380,
  64. callBack: function (id) {
  65. var res = false;
  66. // 验证数据
  67. res = top[id].validForm();
  68. // 保存数据
  69. if (res) {
  70. res = top[id].save('', function () {
  71. page.search();
  72. });
  73. }
  74. return res;
  75. }
  76. });
  77. });
  78. // 编辑
  79. $('#lr_edit').on('click', function () {
  80. var keyValue = $('#gridtable').jfGridValue('Id');
  81. if (learun.checkrow(keyValue)) {
  82. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  83. if (FlowNo != 0) {
  84. learun.alert.warning("当前项目已提交不能编辑!");
  85. return;
  86. }
  87. learun.layerForm({
  88. id: 'form',
  89. title: '编辑',
  90. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?keyValue=' + keyValue,
  91. width: 800,
  92. height: 380,
  93. callBack: function (id) {
  94. var res = false;
  95. // 验证数据
  96. res = top[id].validForm();
  97. // 保存数据
  98. if (res) {
  99. res = top[id].save('', function () {
  100. page.search();
  101. });
  102. }
  103. return res;
  104. }
  105. });
  106. }
  107. });
  108. // 删除
  109. $('#lr_delete').on('click', function () {
  110. var keyValue = $('#gridtable').jfGridValue('Id');
  111. if (learun.checkrow(keyValue)) {
  112. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  113. if (FlowNo != 0) {
  114. learun.alert.warning("当前项目已提交不能删除!");
  115. return;
  116. }
  117. learun.layerConfirm('是否确认删除该项!', function (res) {
  118. if (res) {
  119. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/DeleteForm', { keyValue: keyValue }, function () {
  120. page.search();
  121. });
  122. }
  123. });
  124. }
  125. });
  126. //提交
  127. $('#lr_submit').on('click', function () {
  128. var keyValue = $('#gridtable').jfGridValue('Id');
  129. if (learun.checkrow(keyValue)) {
  130. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  131. if (FlowNo != 0) {
  132. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  133. return;
  134. }
  135. learun.layerConfirm('是否确认提交该项!', function (res) {
  136. if (res) {
  137. processId = learun.newGuid();
  138. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
  139. refreshGirdData(res, {});
  140. });
  141. }
  142. });
  143. }
  144. });
  145. // 打印
  146. $('#lr_print').on('click', function () {
  147. var keyValue = $('#gridtable').jfGridValue('Id');
  148. if (learun.checkrow(keyValue)) {
  149. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  150. if (FlowNo < 2) {
  151. learun.alert.warning("当前项目未审核通过,不能打印!");
  152. return;
  153. }
  154. learun.layerForm({
  155. id: 'from',
  156. title: '收文通告',
  157. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Print?keyValue=' + keyValue,
  158. width: 1200,
  159. height: 1200,
  160. callBack: null
  161. });
  162. }
  163. });
  164. //查阅
  165. $('#lr_read').on('click', function () {
  166. var keyValue = $('#gridtable').jfGridValue('Id');
  167. if (learun.checkrow(keyValue)) {
  168. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  169. if (FlowNo != 2) {
  170. learun.alert.warning("当前项目不能查阅!");
  171. return;
  172. }
  173. learun.layerForm({
  174. id: 'form',
  175. title: '查阅',
  176. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadForm?keyValue=' + keyValue,
  177. width: 800,
  178. height: 380,
  179. callBack: function (id) {
  180. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadLD', { keyValue: keyValue }, function (res) {
  181. });
  182. }
  183. });
  184. }
  185. });
  186. // 添加传阅人
  187. $('#lr_setread').on('click', function () {
  188. var keyValue = $('#gridtable').jfGridValue('Id');
  189. var loginInfo = learun.clientdata.get(['userinfo']);
  190. if (learun.checkrow(keyValue)) {
  191. learun.layerForm({
  192. id: 'form',
  193. title: '添加传阅人员',
  194. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/SelectForm?objectId=' + keyValue + '&companyId=' + loginInfo.F_CompanyId + '&departmentId=' + loginInfo.F_DepartmentId + '&category=1',
  195. width: 800,
  196. height: 520,
  197. callBack: function (id) {
  198. return top[id].acceptClick();
  199. }
  200. });
  201. }
  202. });
  203. },
  204. // 初始化列表
  205. initGird: function () {
  206. $('#gridtable').lrAuthorizeJfGrid({
  207. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/GetPageList',
  208. headData:
  209. [
  210. { label: "来文单位", name: "DisFrom", width: 400, align: "center" },
  211. { label: "字", name: "DisWork", width: 150, align: "center" },
  212. { label: "号", name: "DisMark", width: 150, align: "center" },
  213. { label: "年", name: "DisYear", width: 100, align: "center" },
  214. { label: "月", name: "DisMonth", width: 50, align: "center" },
  215. { label: "日", name: "DisDay", width: 50, align: "center" },
  216. {
  217. label: "事由", name: "Reasons", width: 500, align: "center",
  218. formatterAsync: function (callback, value, row, op, $cell) {
  219. $.ajax({
  220. url: '/LR_SystemModule/Annexes/GetAnnexesFileList',
  221. data: { folderId: value },
  222. type: 'GET',
  223. dataType: "json",
  224. async: false,
  225. cache: false,
  226. success: function (res) {
  227. var bb = '';
  228. $.each(res.data, function (i, item) {
  229. bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ','
  230. })
  231. bb
  232. callback(bb);
  233. }
  234. });
  235. }
  236. },
  237. { label: "发起人", name: "CreateUser", width: 100, align: "center" },
  238. {
  239. label: "发起时间", name: "CreateTime", width: 100, align: "center",
  240. formatter: function (cellvalue) {
  241. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  242. }
  243. },
  244. {
  245. label: "审批状态", name: "FlowNo", width: 100, align: "center",
  246. formatter: function (cellvalue, row) {
  247. if (cellvalue == 0) {
  248. return '<span class=\"label label-warning\">草稿</span>';
  249. } if (cellvalue == 1) {
  250. return '<span class=\"label label-warning\">审批中</span>';
  251. } else if (cellvalue == 2) {
  252. return '<span class=\"label label-success\">审批通过</span>';
  253. }
  254. }
  255. }
  256. ],
  257. mainId: 'Id',
  258. sidx: 'RenderDate',
  259. sord: 'desc',
  260. isPage: true
  261. });
  262. page.search();
  263. },
  264. search: function (param) {
  265. param = param || {};
  266. param.WorkName = 2;
  267. param.StartTime = logbegin;
  268. param.EndTime = logend;
  269. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  270. },
  271. downLoad: function (fileId) {
  272. top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: top.$.lrToken }, method: 'POST' });
  273. }
  274. };
  275. refreshGirdData = function (res, postData) {
  276. if (res.code == 200) {
  277. var DisFrom = $('#gridtable').jfGridValue('DisFrom');
  278. var Reasons = $('#gridtable').jfGridValue('Reasons');
  279. $.ajax({
  280. url: '/LR_SystemModule/Annexes/GetAnnexesFileList',
  281. data: { folderId: Reasons },
  282. type: 'GET',
  283. dataType: "json",
  284. async: false,
  285. cache: false,
  286. success: function (res) {
  287. var bb = '';
  288. $.each(res.data,
  289. function (i, item) {
  290. bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ','
  291. })
  292. Reasons = bb;
  293. }
  294. });
  295. // 发起流程
  296. var postData = {
  297. //schemeCode: 'Dispatch',// 本地
  298. schemeCode: 'XBSW',// 线上
  299. title: "(" + DisFrom + ") " + Reasons,
  300. processId: processId,
  301. level: '1',
  302. };
  303. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  304. learun.loading(false);
  305. });
  306. page.search();
  307. }
  308. };
  309. page.init();
  310. }
  311. function downLoad(fileId, fileTwo) {
  312. if (fileTwo) {
  313. top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddRecord', { fileId: fileTwo }, function () {
  314. });
  315. }
  316. top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' });
  317. }