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.
 
 
 
 
 
 

186 lines
9.2 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-03-26 11:35
  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. $('#LeaveType').lrDataItemSelect({ code: 'LeaveTypeOfStu' });
  21. $('#CheckStatus').lrselect({ data: [{ id: '0', text: '草稿' }, { id: '1', text: '审批中' }, { id: '2', text: '审批通过' }, { id: '3', text: '审批不通过' }] });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 编辑
  27. $('#lr_edit').on('click', function () {
  28. var keyValueInLeave = $('#gridtable').jfGridValue('IdInLeave');
  29. if (learun.checkrow(keyValueInLeave)) {
  30. var keyValue = $('#gridtable').jfGridValue('Id');
  31. var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
  32. if (keyValue != null && CheckStatus != "0") {
  33. learun.alert.warning("当前项已提交销假!");
  34. return false;
  35. }
  36. learun.layerForm({
  37. id: 'form',
  38. title: '编辑',
  39. url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/Form?keyValue=' + keyValue + '&keyValueInLeave=' + keyValueInLeave,
  40. width: 600,
  41. height: 400,
  42. callBack: function (id) {
  43. var res = false;
  44. // 验证数据
  45. res = top[id].validForm();
  46. // 保存数据
  47. if (res) {
  48. res = top[id].save('', function () {
  49. page.search();
  50. });
  51. }
  52. return res;
  53. }
  54. });
  55. }
  56. });
  57. // 删除
  58. $('#lr_delete').on('click', function () {
  59. var keyValue = $('#gridtable').jfGridValue('Id');
  60. if (learun.checkrow(keyValue)) {
  61. var status = $('#gridtable').jfGridValue('CheckStatus');
  62. if (status != "0") {
  63. learun.alert.warning("当前项已提交销假!");
  64. return false;
  65. }
  66. learun.layerConfirm('是否确认删除该项!', function (res) {
  67. if (res) {
  68. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/DeleteForm', { keyValue: keyValue}, function () {
  69. page.search();
  70. });
  71. }
  72. });
  73. }
  74. });
  75. //  查看
  76. $('#lr_view').on('click', function () {
  77. var keyValue = $('#gridtable').jfGridValue('Id');
  78. if (learun.checkrow(keyValue)) {
  79. learun.layerForm({
  80. id: 'formview',
  81. title: '查看',
  82. url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/FormView?keyValue=' + keyValue,
  83. width: 600,
  84. height: 400,
  85. btn: null
  86. });
  87. }
  88. });
  89. //  提交
  90. $('#lr_submit').on('click', function () {
  91. var keyValue = $('#gridtable').jfGridValue('Id');
  92. if (learun.checkrow(keyValue)) {
  93. var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
  94. if (CheckStatus != "0") {
  95. learun.alert.warning("当前项已提交销假!");
  96. return false;
  97. }
  98. learun.layerConfirm('是否确认提交该项!', function (res) {
  99. if (res) {
  100. processId = learun.newGuid();
  101. learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/DoSubmit', { keyValue: keyValue, status: "1", processId: processId }, function (res) {
  102. refreshGirdData(res, {});
  103. });
  104. }
  105. });
  106. }
  107. });
  108. },
  109. // 初始化列表
  110. initGird: function () {
  111. $('#gridtable').jfGrid({
  112. url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/GetPageList',
  113. headData: [
  114. { label: "学号", name: "CreateUserNoInLeave", width: 100, align: "left" },
  115. {
  116. label: "姓名", name: "CreateUserIdInLeave", width: 100, align: "left",
  117. formatterAsync: function (callback, value, row, op, $cell) {
  118. learun.clientdata.getAsync('user', {
  119. key: value,
  120. callback: function (_data) {
  121. callback(_data.name);
  122. }
  123. });
  124. }
  125. },
  126. {
  127. label: "请假类型", name: "LeaveType", width: 100, align: "left",
  128. formatterAsync: function (callback, value, row, op, $cell) {
  129. learun.clientdata.getAsync('dataItem', {
  130. key: value,
  131. code: 'LeaveTypeOfStu',
  132. callback: function (_data) {
  133. callback(_data.text);
  134. }
  135. });
  136. }
  137. },
  138. { label: "请假时间", name: "StartTime", width: 120, align: "left" },
  139. { label: "返校时间", name: "EndTime", width: 120, align: "left" },
  140. { label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
  141. { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
  142. {
  143. label: "审核状态", name: "CheckStatusInLeave", width: 100, align: "left", formatter: function (cellvalue) {
  144. return cellvalue == "1" ? "<span class=\"label label-warning\">审核中</span>" : cellvalue == "2" ? "<span class=\"label label-success\">审核通过</span>" : cellvalue == "3" ? "<span class=\"label label-danger\">审核未通过</span>" : "<span class=\"label label-default\">草稿</span>";
  145. }
  146. },
  147. { label: "销假填表时间", name: "CreateTime", width: 130, align: "left" },
  148. { label: "到校时间", name: "WorkTime", width: 120, align: "left"},
  149. { label: "销假事由", name: "CancelLeaveReason", width: 100, align: "left" },
  150. {
  151. label: "销假审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
  152. return cellvalue == "1" ? "<span class=\"label label-warning\">审核中</span>" : cellvalue == "2" ? "<span class=\"label label-success\">审核通过</span>" : cellvalue == "3" ? "<span class=\"label label-danger\">审核未通过</span>" : cellvalue == "0" ? "<span class=\"label label-default\">草稿</span>" : "";
  153. }
  154. },
  155. ],
  156. mainId:'Id',
  157. isPage: true,
  158. sord: 'CreateTimeInLeave desc'
  159. });
  160. page.search();
  161. },
  162. search: function (param) {
  163. param = param || {};
  164. param.CreateUserIdInLeave = learun.clientdata.get(['userinfo']).userId; //登录用户的已审核通过的请假单
  165. $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) });
  166. }
  167. };
  168. refreshGirdData = function (res, postData) {
  169. if (!!res) {
  170. if (res.code == 200) {
  171. // 发起流程
  172. var postData = {
  173. schemeCode: 'StuCancelLeaveManagement',// 填写流程对应模板编号
  174. processId: processId,
  175. level: '1',
  176. };
  177. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  178. learun.loading(false);
  179. });
  180. }
  181. page.search();
  182. }
  183. };
  184. page.init();
  185. }