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.
 
 
 
 
 
 

275 lines
13 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-11-27 10:05
  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. $('#CheckStatus').lrselect({
  22. data: [{ text: "草稿", value: "0" }, { text: "审核中", value: "1" }, { text: "审核通过", value: "2" }, { text: "审核未通过", value: "3" }],
  23. text: "text",
  24. value: "value"
  25. });
  26. // 刷新
  27. $('#lr_refresh').on('click', function () {
  28. location.reload();
  29. });
  30. // 新增
  31. $('#lr_add').on('click', function () {
  32. learun.layerForm({
  33. id: 'form',
  34. title: '新增',
  35. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form',
  36. width: 600,
  37. height: 400,
  38. callBack: function (id) {
  39. return top[id].acceptClick(refreshGirdData);
  40. }
  41. });
  42. });
  43. // 编辑
  44. $('#lr_edit').on('click', function () {
  45. var keyValue = $('#gridtable').jfGridValue('Id');
  46. if (learun.checkrow(keyValue)) {
  47. var status = $('#gridtable').jfGridValue('CheckStatus');
  48. if (status == "1") {
  49. learun.alert.warning("该项已提交无法编辑!");
  50. return false;
  51. }
  52. if (status == "2") {
  53. learun.alert.warning("该项已审核无法编辑!");
  54. return false;
  55. }
  56. learun.layerForm({
  57. id: 'form',
  58. title: '编辑',
  59. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form?keyValue=' + keyValue,
  60. width: 600,
  61. height: 400,
  62. callBack: function (id) {
  63. return top[id].acceptClick(refreshGirdData);
  64. }
  65. });
  66. }
  67. });
  68. // 删除
  69. $('#lr_delete').on('click', function () {
  70. var keyValue = $('#gridtable').jfGridValue('Id');
  71. if (learun.checkrow(keyValue)) {
  72. var status = $('#gridtable').jfGridValue('CheckStatus');
  73. if (status == "1") {
  74. learun.alert.warning("该项已提交无法删除!");
  75. return false;
  76. }
  77. if (status == "2") {
  78. learun.alert.warning("该项已审核无法删除!");
  79. return false;
  80. }
  81. learun.layerConfirm('是否确认删除该项!', function (res) {
  82. if (res) {
  83. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/DeleteForm', { keyValue: keyValue }, function () {
  84. refreshGirdData();
  85. });
  86. }
  87. });
  88. }
  89. });
  90. //提交
  91. $('#lr_submit').on('click', function () {
  92. var keyValue = $('#gridtable').jfGridValue('Id');
  93. if (learun.checkrow(keyValue)) {
  94. var status = $('#gridtable').jfGridValue('CheckStatus');
  95. if (status == "1") {
  96. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  97. return;
  98. }
  99. if (status == "2") {
  100. learun.alert.warning("当前项目已审核!");
  101. return;
  102. }
  103. learun.layerConfirm('是否确认提交该项!', function (res) {
  104. if (res) {
  105. processId = learun.newGuid();
  106. learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/ModifyStatus', { keyValue: keyValue, CheckStatus: "1", processId: processId }, function (res) {
  107. refreshGirdData(res, {});
  108. });
  109. }
  110. });
  111. }
  112. });
  113. },
  114. // 初始化列表
  115. initGird: function () {
  116. $('#gridtable').jfGrid({
  117. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/GetPageList',
  118. headData: [
  119. {
  120. label: "审核状态", name: "CheckStatus", width: 100, align: "left",
  121. formatter: function (cellvalue) {
  122. if (cellvalue == 2) {
  123. return "<span class=\"label label-success\">审核通过</span>";
  124. } else if (cellvalue == 3) {
  125. return "<span class=\"label label-danger\">审核未通过</span>";
  126. } else if (cellvalue == 1) {
  127. return "<span class=\"label label-warning\">审核中</span>";
  128. } else if (cellvalue == 0) {
  129. return "<span class=\"label label-default\">草稿</span>";
  130. }
  131. }
  132. },
  133. //{ label: "审核备注", name: "CheckRemark", width: 100, align: "left" },
  134. //{ label: "审核时间", name: "CheckTime", width: 130, align: "left" },
  135. //{
  136. // label: "审核人", name: "CheckUserId", width: 100, align: "left",
  137. // formatterAsync: function (callback, value, row, op, $cell) {
  138. // learun.clientdata.getAsync('custmerData', {
  139. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  140. // key: value,
  141. // keyId: 'f_userid',
  142. // callback: function (_data) {
  143. // callback(_data['f_realname']);
  144. // }
  145. // });
  146. // }
  147. //},
  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. {
  161. label: "开始时间", name: "StartTime", width: 100, align: "left",
  162. formatter: function (value, row) {
  163. return learun.formatDate(value,'yyyy-MM-dd');
  164. }
  165. },
  166. {
  167. label: "结束时间", name: "EndTime", width: 100, align: "left",
  168. formatter: function (value, row) {
  169. return learun.formatDate(value, 'yyyy-MM-dd');
  170. }},
  171. { label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
  172. { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
  173. { label: "学号", name: "CreateUserNo", width: 100, align: "left" },
  174. { label: "姓名", name: "CreateUserName", width: 100, align: "left" },
  175. { label: "申请时间", name: "CreateTime", width: 130, align: "left" },
  176. {
  177. label: "班级", name: "ClassNo", width: 100, align: "left",
  178. formatterAsync: function (callback, value, row, op, $cell) {
  179. learun.clientdata.getAsync('custmerData', {
  180. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  181. key: value,
  182. keyId: 'classno',
  183. callback: function (_data) {
  184. callback(_data['classname']);
  185. }
  186. });
  187. }
  188. },
  189. {
  190. label: "系部", name: "DeptNo", width: 100, align: "left",
  191. formatterAsync: function (callback, value, row, op, $cell) {
  192. learun.clientdata.getAsync('custmerData', {
  193. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  194. key: value,
  195. keyId: 'deptno',
  196. callback: function (_data) {
  197. callback(_data['deptname']);
  198. }
  199. });
  200. }
  201. },
  202. {
  203. label: "专业", name: "MajorNo", width: 100, align: "left",
  204. formatterAsync: function (callback, value, row, op, $cell) {
  205. learun.clientdata.getAsync('custmerData', {
  206. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  207. key: value,
  208. keyId: 'majorno',
  209. callback: function (_data) {
  210. callback(_data['majorname']);
  211. }
  212. });
  213. }
  214. },
  215. {
  216. label: "班主任", name: "ClassDiredctorNo", width: 100, align: "left",
  217. formatterAsync: function (callback, value, row, op, $cell) {
  218. learun.clientdata.getAsync('custmerData', {
  219. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  220. key: value,
  221. keyId: 'empno',
  222. callback: function (_data) {
  223. callback(_data['empname']);
  224. }
  225. });
  226. }
  227. },
  228. {
  229. label: "辅导员", name: "ClassTutorNo", width: 100, align: "left",
  230. formatterAsync: function (callback, value, row, op, $cell) {
  231. learun.clientdata.getAsync('custmerData', {
  232. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  233. key: value,
  234. keyId: 'empno',
  235. callback: function (_data) {
  236. callback(_data['empname']);
  237. }
  238. });
  239. }
  240. },
  241. ],
  242. mainId: 'Id',
  243. isPage: true,
  244. sidx: 'CreateTime desc'
  245. });
  246. page.search();
  247. },
  248. search: function (param) {
  249. param = param || {};
  250. param.StuNo = learun.clientdata.get(['userinfo']).account;
  251. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  252. }
  253. };
  254. refreshGirdData = function (res, postData) {
  255. if (!!res && res.code == 200) {
  256. // 发起流程
  257. var postData = {
  258. schemeCode: 'StuLeaveManagement',// 填写流程对应模板编号
  259. processId: processId,
  260. level: '1',
  261. };
  262. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  263. learun.loading(false);
  264. });
  265. }
  266. page.search();
  267. };
  268. page.init();
  269. }