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.
 
 
 
 
 
 

343 lines
16 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. $('#lr_submit').on('click', function () {
  131. var keyValue = $('#gridtable').jfGridValue('Id');
  132. if (learun.checkrow(keyValue)) {
  133. var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
  134. if (CheckStatus != "0") {
  135. learun.alert.warning("当前项已提交!");
  136. return false;
  137. }
  138. learun.layerConfirm('是否确认提交该项!', function (res) {
  139. if (res) {
  140. learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/DoSubmit', { keyValue: keyValue }, function (res) {
  141. refreshGirdData(res, {});
  142. });
  143. }
  144. });
  145. }
  146. });
  147. //审核
  148. $('#lr_check').on('click', function () {
  149. var keyValue = $('#gridtable').jfGridValue('Id');
  150. if (learun.checkrow(keyValue)) {
  151. var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
  152. if (CheckStatus != "1") {
  153. learun.alert.warning("当前项不可审核!");
  154. return false;
  155. } learun.layerForm({
  156. id: 'form',
  157. title: '审核',
  158. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form?keyValue=' + keyValue,
  159. width: 600,
  160. height: 400
  161. //callBack: function (id) {
  162. // var res = false;
  163. // // 验证数据
  164. // res = top[id].validForm();
  165. // // 保存数据
  166. // if (res) {
  167. // res = top[id].save('', function () {
  168. // page.search();
  169. // });
  170. // }
  171. // return res;
  172. //}
  173. });
  174. }
  175. });
  176. },
  177. // 初始化列表
  178. initGird: function () {
  179. $('#gridtable').lrAuthorizeJfGrid({
  180. url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/GetPageList',
  181. headData: [
  182. //{
  183. // label: "审核状态", name: "CheckStatus", width: 100, align: "left",
  184. // formatterAsync: function (callback, value, row, op, $cell) {
  185. // learun.clientdata.getAsync('dataItem', {
  186. // key: value,
  187. // code: 'LeaveCheck',
  188. // callback: function (_data) {
  189. // callback(_data.text ? _data.text : "申请中");
  190. // }
  191. // });
  192. // }
  193. //},
  194. //{ label: "审核备注", name: "CheckRemark", width: 100, align: "left" },
  195. //{ label: "审核时间", name: "CheckTime", width: 130, align: "left" },
  196. //{
  197. // label: "审核人", name: "CheckUserNo", width: 100, align: "left",
  198. // formatterAsync: function (callback, value, row, op, $cell) {
  199. // learun.clientdata.getAsync('custmerData', {
  200. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  201. // key: value,
  202. // keyId: 'empno',
  203. // callback: function (_data) {
  204. // callback(_data['empname']);
  205. // }
  206. // });
  207. // }
  208. //},
  209. { label: "学号", name: "CreateUserNo", width: 100, align: "left" },
  210. {
  211. label: "姓名", name: "CreateUserId", width: 100, align: "left",
  212. formatterAsync: function (callback, value, row, op, $cell) {
  213. learun.clientdata.getAsync('user', {
  214. key: value,
  215. callback: function (_data) {
  216. callback(_data.name);
  217. }
  218. });
  219. }
  220. },
  221. {
  222. label: "请假类型", name: "LeaveType", width: 100, align: "left",
  223. formatterAsync: function (callback, value, row, op, $cell) {
  224. learun.clientdata.getAsync('dataItem', {
  225. key: value,
  226. code: 'LeaveTypeOfStu',
  227. callback: function (_data) {
  228. callback(_data.text);
  229. }
  230. });
  231. }
  232. },
  233. { label: "请假时间", name: "StartTime", width: 120, align: "left" },
  234. { label: "返校时间", name: "EndTime", width: 120, align: "left" },
  235. { label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
  236. { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
  237. { label: "申请时间", name: "CreateTime", width: 130, align: "left" },
  238. {
  239. label: "审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
  240. 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>";
  241. }
  242. },
  243. //{
  244. // label: "班级", name: "ClassNo", width: 100, align: "left",
  245. // formatterAsync: function (callback, value, row, op, $cell) {
  246. // learun.clientdata.getAsync('custmerData', {
  247. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  248. // key: value,
  249. // keyId: 'classno',
  250. // callback: function (_data) {
  251. // callback(_data['classname']);
  252. // }
  253. // });
  254. // }
  255. //},
  256. //{
  257. // label: "系部", name: "DeptNo", width: 100, align: "left",
  258. // formatterAsync: function (callback, value, row, op, $cell) {
  259. // learun.clientdata.getAsync('custmerData', {
  260. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  261. // key: value,
  262. // keyId: 'deptno',
  263. // callback: function (_data) {
  264. // callback(_data['deptname']);
  265. // }
  266. // });
  267. // }
  268. //},
  269. //{
  270. // label: "专业", name: "MajorNo", width: 100, align: "left",
  271. // formatterAsync: function (callback, value, row, op, $cell) {
  272. // learun.clientdata.getAsync('custmerData', {
  273. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  274. // key: value,
  275. // keyId: 'majorno',
  276. // callback: function (_data) {
  277. // callback(_data['majorname']);
  278. // }
  279. // });
  280. // }
  281. //},
  282. //{
  283. // label: "班主任", name: "ClassDiredctorNo", width: 100, align: "left",
  284. // formatterAsync: function (callback, value, row, op, $cell) {
  285. // learun.clientdata.getAsync('custmerData', {
  286. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  287. // key: value,
  288. // keyId: 'empno',
  289. // callback: function (_data) {
  290. // callback(_data['empname']);
  291. // }
  292. // });
  293. // }
  294. //},
  295. //{
  296. // label: "辅导员", name: "ClassTutorNo", width: 100, align: "left",
  297. // formatterAsync: function (callback, value, row, op, $cell) {
  298. // learun.clientdata.getAsync('custmerData', {
  299. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  300. // key: value,
  301. // keyId: 'empno',
  302. // callback: function (_data) {
  303. // callback(_data['empname']);
  304. // }
  305. // });
  306. // }
  307. //},
  308. ],
  309. mainId: 'Id',
  310. isPage: true,
  311. sord: 'CreateTime desc'
  312. });
  313. page.search();
  314. },
  315. search: function (param) {
  316. param = param || {};
  317. param.StuNo = learun.clientdata.get(['userinfo']).account;
  318. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  319. }
  320. };
  321. //refreshGirdData = function (res, postData) {
  322. // if (!!res) {
  323. // if (res.code == 200) {
  324. // // 发起流程
  325. // var postData = {
  326. // schemeCode: 'StuLeaveManagement',// 填写流程对应模板编号
  327. // processId: processId,
  328. // level: '1',
  329. // };
  330. // learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  331. // learun.loading(false);
  332. // });
  333. // }
  334. // page.search();
  335. // }
  336. //};
  337. refreshGirdData = function () {
  338. $('#gridtable').jfGridSet('reload');
  339. };
  340. page.init();
  341. }