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.
 
 
 
 
 
 

210 lines
9.3 KiB

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