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.

Index.js 15 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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=' + 1 + '&DisOffice=' + 1,
  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 + '&WorkName=' + 1 + '&DisOffice=' + 1,
  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_setread').on('click', function () {
  166. var keyValue = $('#gridtable').jfGridValue('Id');
  167. var loginInfo = learun.clientdata.get(['userinfo']);
  168. if (learun.checkrow(keyValue)) {
  169. learun.layerForm({
  170. id: 'form',
  171. title: '添加传阅人员',
  172. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/SelectForm?objectId=' + keyValue + '&companyId=' + loginInfo.F_CompanyId + '&departmentId=' + loginInfo.F_DepartmentId + '&category=1',
  173. width: 800,
  174. height: 520,
  175. callBack: function (id) {
  176. return top[id].acceptClick();
  177. }
  178. });
  179. }
  180. });
  181. //查阅
  182. $('#lr_read').on('click', function () {
  183. var keyValue = $('#gridtable').jfGridValue('Id');
  184. if (learun.checkrow(keyValue)) {
  185. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  186. if (FlowNo != 2) {
  187. learun.alert.warning("当前项目不能查阅!");
  188. return;
  189. }
  190. learun.layerForm({
  191. id: 'form',
  192. title: '查阅',
  193. url: top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadForm?keyValue=' + keyValue,
  194. width: 800,
  195. height: 380,
  196. callBack: function (id) {
  197. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadLD', { keyValue: keyValue }, function (res) {
  198. });
  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. //$.each(res.data, function(i, item) {
  232. // bb += '<span onclick="downLoad(\'' +
  233. // item.F_Id +
  234. // '\')" style="color:blue">' +
  235. // item.F_FileName.substring(0,item.F_FileName.indexOf(".")) +
  236. // '</span>,&nbsp;&nbsp;&nbsp;';
  237. //})
  238. callback(bb);
  239. }
  240. });
  241. }
  242. },
  243. { label: "发起人", name: "CreateUser", width: 100, align: "center" },
  244. {
  245. label: "发起时间", name: "CreateTime", width: 100, align: "center",
  246. formatter: function (cellvalue) {
  247. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  248. }
  249. },
  250. {
  251. label: "审批状态", name: "FlowNo", width: 100, align: "center",
  252. formatter: function (cellvalue, row) {
  253. if (cellvalue == 0) {
  254. return '<span class=\"label label-warning\">草稿</span>';
  255. } if (cellvalue == 1) {
  256. return '<span class=\"label label-warning\">审批中</span>';
  257. } else if (cellvalue == 2) {
  258. return '<span class=\"label label-success\">审批通过</span>';
  259. }
  260. }
  261. }
  262. ],
  263. mainId: 'Id',
  264. sidx: 'RenderDate',
  265. sord: 'desc',
  266. isPage: true
  267. });
  268. page.search();
  269. },
  270. search: function (param) {
  271. param = param || {};
  272. param.WorkName = 1;
  273. param.StartTime = logbegin;
  274. param.EndTime = logend;
  275. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  276. },
  277. };
  278. refreshGirdData = function (res, postData) {
  279. if (res.code == 200) {
  280. var DisFrom = $('#gridtable').jfGridValue('DisFrom');
  281. var Reasons = $('#gridtable').jfGridValue('Reasons');
  282. $.ajax({
  283. url: '/LR_SystemModule/Annexes/GetAnnexesFileList',
  284. data: { folderId: Reasons },
  285. type: 'GET',
  286. dataType: "json",
  287. async: false,
  288. cache: false,
  289. success: function (res) {
  290. var bb = '';
  291. $.each(res.data,
  292. function (i, item) {
  293. bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ','
  294. })
  295. Reasons = bb;
  296. }
  297. });
  298. // 发起流程
  299. var postData = {
  300. //schemeCode: 'Dispatch',// 本地
  301. schemeCode: 'DBSW',//线上
  302. title: "(" + DisFrom + ") " + Reasons,
  303. processId: processId,
  304. level: '1',
  305. };
  306. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  307. learun.loading(false);
  308. });
  309. page.search();
  310. }
  311. };
  312. page.init();
  313. }
  314. function downLoad(fileId, fileTwo) {
  315. if (fileTwo) {
  316. top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddRecord', { fileId: fileTwo }, function () {
  317. });
  318. }
  319. top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' });
  320. }