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.
 
 
 
 
 
 

326 lines
15 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 startTime;
  12. var endTime;
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 时间搜索框
  20. $('#datesearch').lrdate({
  21. dfdata: [
  22. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { 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') } },
  24. { 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') } },
  25. { 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') } }
  26. ],
  27. // 月
  28. mShow: false,
  29. premShow: false,
  30. // 季度
  31. jShow: false,
  32. prejShow: false,
  33. // 年
  34. ysShow: false,
  35. yxShow: false,
  36. preyShow: false,
  37. yShow: false,
  38. // 默认
  39. dfvalue: '1',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  47. page.search(queryJson);
  48. }, 250, 400);
  49. // 刷新
  50. $('#lr_refresh').on('click', function () {
  51. location.reload();
  52. });
  53. $("#ReceiverIddiv").hide();
  54. $("#PostIddiv").hide();
  55. $('#CompanyId').lrCompanySelect({ type: 'multiple' });
  56. $('#DeptId').lrDepartmentSelect({ type: 'treemultiple' });
  57. $('#PostId').lrPostSelect({ type: 'treemultiple' });
  58. $('#ReceiverUserId').lrUserSelect({ type: '1' });
  59. $('#SendType').lrDataItemSelect({
  60. code: 'FileSendType', select: function (item) {
  61. if (item != null && item != undefined) {
  62. if (item.id === 1 || item.id === "1") {
  63. $("#CompanyIddiv").show();
  64. $("#CompanyId").attr("isvalid", "yes");
  65. $("#CompanyId").attr("checkexpession", "NotNull");
  66. $("#DeptIddiv").hide();
  67. $("#DeptId").removeAttr("isvalid");
  68. $("#DeptId").removeAttr("NotNull");
  69. $("#ReceiverIddiv").hide();
  70. $("#ReceiverUserId").removeAttr("isvalid");
  71. $("#ReceiverUserId").removeAttr("NotNull");
  72. $("#PostIddiv").hide();
  73. $("#PostId").removeAttr("isvalid");
  74. $("#PostId").removeAttr("NotNull");
  75. } else if (item.id === 2 || item.id === "2") {
  76. $("#CompanyIddiv").hide();
  77. $("#CompanyId").removeAttr("isvalid");
  78. $("#CompanyId").removeAttr("NotNull");
  79. $("#DeptIddiv").show();
  80. $("#DeptId").attr("isvalid", "yes");
  81. $("#DeptId").attr("checkexpession", "NotNull");
  82. $("#ReceiverIddiv").hide();
  83. $("#ReceiverUserId").removeAttr("isvalid");
  84. $("#ReceiverUserId").removeAttr("NotNull");
  85. $("#PostIddiv").hide();
  86. $("#PostId").removeAttr("isvalid");
  87. $("#PostId").removeAttr("NotNull");
  88. } else if (item.id === 3 || item.id === "3") {
  89. $("#CompanyIddiv").hide();
  90. $("#CompanyId").removeAttr("isvalid");
  91. $("#CompanyId").removeAttr("NotNull");
  92. $("#DeptIddiv").hide();
  93. $("#DeptId").removeAttr("isvalid");
  94. $("#DeptId").removeAttr("NotNull");
  95. $("#ReceiverIddiv").hide();
  96. $("#ReceiverUserId").removeAttr("isvalid");
  97. $("#ReceiverUserId").removeAttr("NotNull");
  98. $("#PostIddiv").show();
  99. $("#PostId").attr("isvalid", "yes");
  100. $("#PostId").attr("checkexpession", "NotNull");
  101. } else {
  102. $("#CompanyIddiv").hide();
  103. $("#CompanyId").removeAttr("isvalid");
  104. $("#CompanyId").removeAttr("NotNull");
  105. $("#DeptIddiv").hide();
  106. $("#DeptId").removeAttr("isvalid");
  107. $("#DeptId").removeAttr("NotNull");
  108. $("#ReceiverIddiv").show();
  109. $("#ReceiverUserId").attr("isvalid", "yes");
  110. $("#ReceiverUserId").attr("checkexpession", "NotNull");
  111. $("#PostIddiv").hide();
  112. $("#PostId").removeAttr("isvalid");
  113. $("#PostId").removeAttr("NotNull");
  114. }
  115. }
  116. }
  117. });
  118. // 新增
  119. $('#lr_add').on('click', function () {
  120. learun.layerForm({
  121. id: 'form',
  122. title: '新增',
  123. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/Form',
  124. width: 800,
  125. height: 700,
  126. callBack: function (id) {
  127. var res = false;
  128. // 验证数据
  129. res = top[id].validForm();
  130. // 保存数据
  131. if (res) {
  132. res = top[id].save('', function () {
  133. page.search();
  134. });
  135. }
  136. return res;
  137. }
  138. });
  139. });
  140. // 编辑
  141. $('#lr_edit').on('click', function () {
  142. var keyValue = $('#gridtable').jfGridValue('SFileId');
  143. if (learun.checkrow(keyValue)) {
  144. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  145. if (SendFlag !== 0) {
  146. learun.alert.warning("当前项目已提交不能编辑!");
  147. return;
  148. }
  149. learun.layerForm({
  150. id: 'form',
  151. title: '编辑',
  152. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/Form?keyValue=' + keyValue,
  153. width: 800,
  154. height: 700,
  155. callBack: function (id) {
  156. var res = false;
  157. // 验证数据
  158. res = top[id].validForm();
  159. // 保存数据
  160. if (res) {
  161. res = top[id].save('', function () {
  162. page.search();
  163. });
  164. }
  165. return res;
  166. }
  167. });
  168. }
  169. });
  170. // 查看
  171. $('#lr_view').on('click', function () {
  172. var keyValue = $('#gridtable').jfGridValue('SFileId');
  173. if (learun.checkrow(keyValue)) {
  174. learun.layerForm({
  175. id: 'form',
  176. title: '查看',
  177. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/FormView?keyValue=' + keyValue,
  178. width: 800,
  179. height: 700,
  180. btn: null
  181. });
  182. }
  183. });
  184. // 查阅情况
  185. $('#lr_read').on('click', function () {
  186. var keyValue = $('#gridtable').jfGridValue('SFileId');
  187. if (learun.checkrow(keyValue)) {
  188. learun.layerForm({
  189. id: 'form',
  190. title: '查阅情况',
  191. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/ReadList?keyValue=' + keyValue,
  192. width: 850,
  193. height: 400,
  194. btn: null
  195. });
  196. }
  197. });
  198. // 删除
  199. $('#lr_delete').on('click', function () {
  200. var keyValue = $('#gridtable').jfGridValue('SFileId');
  201. if (learun.checkrow(keyValue)) {
  202. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  203. if (SendFlag !== 0) {
  204. learun.alert.warning("当前项目已提交不能删除!");
  205. return;
  206. }
  207. learun.layerConfirm('是否确认删除该项!', function (res) {
  208. if (res) {
  209. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/DeleteForm', { keyValue: keyValue }, function () {
  210. refreshGirdData();
  211. });
  212. }
  213. });
  214. }
  215. });
  216. //  提交
  217. $('#lr_submit').on('click', function () {
  218. var keyValue = $('#gridtable').jfGridValue('SFileId');
  219. if (learun.checkrow(keyValue)) {
  220. var SendFlag = $('#gridtable').jfGridValue('SendFlag');
  221. if (SendFlag !== 0) {
  222. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  223. return;
  224. }
  225. learun.layerConfirm('是否确认提交该项!', function (res) {
  226. if (res) {
  227. processId = learun.newGuid();
  228. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  229. refreshGirdData(res, {});
  230. });
  231. }
  232. });
  233. }
  234. });
  235. // 结束下发
  236. $('#lr_OverIssue').on('click', function () {
  237. var keyValue = $('#gridtable').jfGridValue('SFileId');
  238. if (learun.checkrow(keyValue)) {
  239. learun.layerConfirm('是否结束下发!', function (res) {
  240. if (res) {
  241. processId = learun.newGuid();
  242. learun.postForm(top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/OverIssue', { keyValue: keyValue, }, function (res) {
  243. page.search();
  244. });
  245. }
  246. });
  247. }
  248. });
  249. },
  250. // 初始化列表
  251. initGird: function () {
  252. $('#gridtable').lrAuthorizeJfGrid({
  253. url: top.$.rootUrl + '/EducationalAdministration/Sys_SendFile/GetPageList',
  254. headData: [
  255. { label: "主题", name: "Title", width: 300, align: "left" },
  256. { label: "文号", name: "DocNo", width: 300, align: "left" },
  257. {
  258. label: "接收对象", name: "SendType", width: 100, align: "left",
  259. formatterAsync: function (callback, value, row, op, $cell) {
  260. learun.clientdata.getAsync('dataItem', {
  261. key: value,
  262. code: 'FileSendType',
  263. callback: function (_data) {
  264. callback(_data.text);
  265. }
  266. });
  267. }
  268. },
  269. {
  270. label: "接收人", name: "Receiver", width: 300, align: "left"
  271. },
  272. {
  273. label: "下发人", name: "Sender", width: 100, align: "left"
  274. },
  275. {
  276. label: "下发时间", name: "SendTime", width: 150, align: "left"
  277. },
  278. {
  279. label: "状态", name: "SendFlag", width: 100, align: "left",
  280. formatter: function (cellvalue, row) {
  281. if (cellvalue === 1) {
  282. return '<span class=\"label label-warning\">审批中</span>';
  283. } else if (cellvalue === 2) {
  284. return '<span class=\"label label-success\">已下发</span>';
  285. } else {
  286. return '<span class=\"label label-default\" >草稿</span>';
  287. }
  288. }
  289. },
  290. {
  291. label: "阅读数/接受人数", name: "NumberPeople", width: 150, align: "left"
  292. },
  293. ],
  294. mainId: 'SFileId',
  295. isPage: true
  296. });
  297. //page.search();
  298. },
  299. search: function (param) {
  300. param = param || {};
  301. param.StartTime = startTime;
  302. param.EndTime = endTime;
  303. param.ReceiverId = param.DeptId + param.ReceiverUserId + param.PostId + param.CompanyId;
  304. param.SqlParameter = ' AND SendFlag<>4 and STypeId=1';
  305. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  306. }
  307. };
  308. refreshGirdData = function (res, postData) {
  309. if (res && res.code && res.code == 200) {
  310. var postData = {
  311. schemeCode: 'Sys_SendFile',// 填写流程对应模板编号
  312. processId: processId,
  313. level: '1',
  314. };
  315. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  316. learun.loading(false);
  317. });
  318. }
  319. page.search();
  320. };
  321. page.init();
  322. }