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.
 
 
 
 
 
 

209 lines
10 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-03-04 14:21
  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: 'LeaveType' });
  21. $('#CreateUserId').lrUserSelect(0);
  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 + '/PersonnelManagement/TeacherCancelLeaveManagement/Form?keyValue=' + keyValue + '&keyValueInLeave=' + keyValueInLeave,
  40. width: 1000,
  41. height: 800,
  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 CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
  62. if (CheckStatus != "0") {
  63. learun.alert.warning("当前项已提交销假!");
  64. return false;
  65. }
  66. learun.layerConfirm('是否确认删除该项!', function (res) {
  67. if (res) {
  68. learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/TeacherCancelLeaveManagement/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 + '/PersonnelManagement/TeacherCancelLeaveManagement/FormView?keyValue=' + keyValue,
  83. width: 1000,
  84. height: 800,
  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 + '/PersonnelManagement/TeacherCancelLeaveManagement/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 + '/PersonnelManagement/TeacherCancelLeaveManagement/GetPageList',
  113. headData: [
  114. //{
  115. // label: "请假姓名", name: "CreateUserIdInLeave", width: 100, align: "left",
  116. // formatterAsync: function (callback, value, row, op, $cell) {
  117. // learun.clientdata.getAsync('user', {
  118. // key: value,
  119. // callback: function (_data) {
  120. // callback(_data.name);
  121. // }
  122. // });
  123. // }
  124. //},
  125. //{ label: "请假填表时间", name: "CreateTimeInLeave", width: 130, align: "left" },
  126. { label: "联系电话", name: "Telephone", width: 100, align: "left" },
  127. {
  128. label: "请假种类", name: "LeaveType", width: 60, align: "left",
  129. formatterAsync: function (callback, value, row, op, $cell) {
  130. learun.clientdata.getAsync('dataItem', {
  131. key: value,
  132. code: 'LeaveType',
  133. callback: function (_data) {
  134. callback(_data.text);
  135. }
  136. });
  137. }
  138. },
  139. { label: "请假开始时间", name: "StartTime", width: 120, align: "left" },
  140. { label: "请假结束时间", name: "EndTime", width: 120, align: "left" },
  141. {
  142. label: "请假天数", name: "LeaveDay", width: 100, align: "left",
  143. formatterAsync: function (callback, value, row, op, $cell) {
  144. learun.clientdata.getAsync('dataItem', {
  145. key: value,
  146. code: 'LeaveDay',
  147. callback: function (_data) {
  148. callback(_data.text);
  149. }
  150. });
  151. }
  152. },
  153. { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
  154. {
  155. label: "请假审核状态", name: "CheckStatusInLeave", width: 80, align: "left", formatter: function (cellvalue) {
  156. 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>";
  157. }
  158. },
  159. {
  160. label: "姓名", name: "CreateUserId", width: 100, align: "left",
  161. formatterAsync: function (callback, value, row, op, $cell) {
  162. learun.clientdata.getAsync('user', {
  163. key: value,
  164. callback: function (_data) {
  165. callback(_data.name);
  166. }
  167. });
  168. }
  169. },
  170. { label: "销假填表时间", name: "CreateTime", width: 130, align: "left" },
  171. { label: "到岗时间", name: "WorkTime", width: 120, align: "left" },
  172. { label: "销假事由", name: "CancelLeaveReason", width: 150, align: "left" },
  173. {
  174. label: "销假审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
  175. 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>" : "";
  176. }
  177. },
  178. ],
  179. mainId: 'Id',
  180. isPage: true,
  181. sidx: 'CreateTimeInLeave desc'
  182. });
  183. page.search();
  184. },
  185. search: function (param) {
  186. param = param || {};
  187. param.CreateUserIdInLeave = learun.clientdata.get(['userinfo']).userId; //登录用户的已审核通过的请假单
  188. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  189. }
  190. };
  191. refreshGirdData = function (res, postData) {
  192. if (!!res) {
  193. if (res.code == 200) {
  194. // 发起流程
  195. var postData = {
  196. schemeCode: 'TeacherCancelLeaveManagement',// 填写流程对应模板编号
  197. processId: processId,
  198. level: '1',
  199. };
  200. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  201. learun.loading(false);
  202. });
  203. }
  204. page.search();
  205. }
  206. };
  207. page.init();
  208. }