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.
 
 
 
 
 
 

293 lines
14 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: '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_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'form',
  30. title: '新增',
  31. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form',
  32. width: 600,
  33. height: 400,
  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 status = $('#gridtable').jfGridValue('CheckStatus');
  53. if (status != "0") {
  54. learun.alert.warning("当前项已提交!");
  55. return false;
  56. }
  57. learun.layerForm({
  58. id: 'form',
  59. title: '编辑',
  60. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form?keyValue=' + keyValue,
  61. width: 600,
  62. height: 400,
  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 status = $('#gridtable').jfGridValue('CheckStatus');
  83. if (status != "0") {
  84. learun.alert.warning("当前项已提交!");
  85. return false;
  86. }
  87. learun.layerConfirm('是否确认删除该项!', function (res) {
  88. if (res) {
  89. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/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 + '/EducationalAdministration/StuLeaveManagement/FormView?keyValue=' + keyValue,
  104. width: 600,
  105. height: 400,
  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 + '/EducationalAdministration/StuLeaveManagement/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 + '/EducationalAdministration/StuLeaveManagement/GetPageList',
  134. headData: [
  135. //{
  136. // label: "审核状态", name: "CheckStatus", width: 100, align: "left",
  137. // formatterAsync: function (callback, value, row, op, $cell) {
  138. // learun.clientdata.getAsync('dataItem', {
  139. // key: value,
  140. // code: 'LeaveCheck',
  141. // callback: function (_data) {
  142. // callback(_data.text ? _data.text : "申请中");
  143. // }
  144. // });
  145. // }
  146. //},
  147. //{ label: "审核备注", name: "CheckRemark", width: 100, align: "left" },
  148. //{ label: "审核时间", name: "CheckTime", width: 130, align: "left" },
  149. //{
  150. // label: "审核人", name: "CheckUserNo", width: 100, align: "left",
  151. // formatterAsync: function (callback, value, row, op, $cell) {
  152. // learun.clientdata.getAsync('custmerData', {
  153. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  154. // key: value,
  155. // keyId: 'empno',
  156. // callback: function (_data) {
  157. // callback(_data['empname']);
  158. // }
  159. // });
  160. // }
  161. //},
  162. { label: "学号", name: "CreateUserNo", width: 100, align: "left" },
  163. {
  164. label: "姓名", name: "CreateUserId", width: 100, align: "left",
  165. formatterAsync: function (callback, value, row, op, $cell) {
  166. learun.clientdata.getAsync('user', {
  167. key: value,
  168. callback: function (_data) {
  169. callback(_data.name);
  170. }
  171. });
  172. }
  173. },
  174. {
  175. label: "请假类型", name: "LeaveType", width: 100, align: "left",
  176. formatterAsync: function (callback, value, row, op, $cell) {
  177. learun.clientdata.getAsync('dataItem', {
  178. key: value,
  179. code: 'LeaveTypeOfStu',
  180. callback: function (_data) {
  181. callback(_data.text);
  182. }
  183. });
  184. }
  185. },
  186. { label: "请假时间", name: "StartTime", width: 120, align: "left" },
  187. { label: "返校时间", name: "EndTime", width: 120, align: "left" },
  188. { label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
  189. { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
  190. { label: "申请时间", name: "CreateTime", width: 130, align: "left" },
  191. {
  192. label: "审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
  193. 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>";
  194. }
  195. },
  196. //{
  197. // label: "班级", name: "ClassNo", width: 100, align: "left",
  198. // formatterAsync: function (callback, value, row, op, $cell) {
  199. // learun.clientdata.getAsync('custmerData', {
  200. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  201. // key: value,
  202. // keyId: 'classno',
  203. // callback: function (_data) {
  204. // callback(_data['classname']);
  205. // }
  206. // });
  207. // }
  208. //},
  209. //{
  210. // label: "系部", name: "DeptNo", width: 100, align: "left",
  211. // formatterAsync: function (callback, value, row, op, $cell) {
  212. // learun.clientdata.getAsync('custmerData', {
  213. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  214. // key: value,
  215. // keyId: 'deptno',
  216. // callback: function (_data) {
  217. // callback(_data['deptname']);
  218. // }
  219. // });
  220. // }
  221. //},
  222. //{
  223. // label: "专业", name: "MajorNo", width: 100, align: "left",
  224. // formatterAsync: function (callback, value, row, op, $cell) {
  225. // learun.clientdata.getAsync('custmerData', {
  226. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  227. // key: value,
  228. // keyId: 'majorno',
  229. // callback: function (_data) {
  230. // callback(_data['majorname']);
  231. // }
  232. // });
  233. // }
  234. //},
  235. //{
  236. // label: "班主任", name: "ClassDiredctorNo", width: 100, align: "left",
  237. // formatterAsync: function (callback, value, row, op, $cell) {
  238. // learun.clientdata.getAsync('custmerData', {
  239. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  240. // key: value,
  241. // keyId: 'empno',
  242. // callback: function (_data) {
  243. // callback(_data['empname']);
  244. // }
  245. // });
  246. // }
  247. //},
  248. //{
  249. // label: "辅导员", name: "ClassTutorNo", width: 100, align: "left",
  250. // formatterAsync: function (callback, value, row, op, $cell) {
  251. // learun.clientdata.getAsync('custmerData', {
  252. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  253. // key: value,
  254. // keyId: 'empno',
  255. // callback: function (_data) {
  256. // callback(_data['empname']);
  257. // }
  258. // });
  259. // }
  260. //},
  261. ],
  262. mainId: 'Id',
  263. isPage: true,
  264. sord: 'CreateTime desc'
  265. });
  266. page.search();
  267. },
  268. search: function (param) {
  269. param = param || {};
  270. param.StuNo = learun.clientdata.get(['userinfo']).account;
  271. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  272. }
  273. };
  274. refreshGirdData = function (res, postData) {
  275. if (!!res) {
  276. if (res.code == 200) {
  277. // 发起流程
  278. var postData = {
  279. schemeCode: 'StuLeaveManagement',// 填写流程对应模板编号
  280. processId: processId,
  281. level: '1',
  282. };
  283. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  284. learun.loading(false);
  285. });
  286. }
  287. page.search();
  288. }
  289. };
  290. page.init();
  291. }