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.
 
 
 
 
 
 

203 line
8.6 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-07-23 10:15
  5. * 描 述:学生请销假
  6. */
  7. (function () {
  8. var begin = '';
  9. var end = '';
  10. var multipleData = null;
  11. var page = {
  12. grid: null,
  13. init: function ($page) {
  14. begin = '';
  15. end = '';
  16. multipleData = null;
  17. page.grid = $page.find('#lr_EducationalAdministrationDtStuLeave_list').lrpagination({
  18. lclass: page.lclass,
  19. rows: 10, // 每页行数
  20. getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
  21. param.multipleData = multipleData;
  22. page.loadData(param, callback, $page);
  23. },
  24. renderData: function (_index, _item, _$item) {// 渲染数据模板
  25. return page.rowRender(_index, _item, _$item, $page);
  26. },
  27. click: function (item, $item, $et) {// 列表行点击事件
  28. if ($et.hasClass('lr-btn-danger')) {
  29. page.btnClick(item, $item, $page);
  30. }
  31. else if ($et.hasClass('lr-btn-blue')) {//提交
  32. page.btnClickOfSubmit(item, $item, $page);
  33. }else if ($et.hasClass('lr-btn-blue')) {//销假
  34. page.btnClickOfReply(item, $item, $page);
  35. }
  36. else {
  37. page.rowClick(item, $item, $page);
  38. }
  39. },
  40. btns: page.rowBtns });
  41. // 多条件查询
  42. var $multiple = $page.find('.lr_multiple_search').multiplequery({
  43. callback: function (data) {
  44. begin = '';
  45. end = '';
  46. multipleData = data || {};
  47. page.grid.reload();
  48. }
  49. });
  50. $multiple.find('#CreateUserDeptNo').lrpickerex({
  51. type: 'sourceData',
  52. code: 'CdDeptInfo',
  53. ivalue: 'deptno',
  54. itext: 'deptname',
  55. placeHolders: '请选择' });
  56. $multiple.find('#CreateUserClassNo').lrpickerex({
  57. type: 'sourceData',
  58. code: 'bjsj',
  59. ivalue: 'classno',
  60. itext: 'classname',
  61. placeHolders: '请选择' });
  62. $multiple.find('#LeaveType').lrpickerex({
  63. type: 'sourceData',
  64. code: 'StuLeaveType',
  65. ivalue: 'typeno',
  66. itext: 'typename',
  67. placeHolders: '请选择'
  68. });
  69. $page.find('#lr_EducationalAdministrationDtStuLeave_btn').on('tap', function () {
  70. learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '新增', type: 'right' });
  71. });
  72. },
  73. lclass: 'lr-list',
  74. loadData: function (param, callback, $page) {// 列表加载后台数据
  75. var _postParam = {
  76. pagination: {
  77. rows: param.rows,
  78. page: param.page,
  79. sidx: 'Id',
  80. sord: 'DESC'
  81. },
  82. queryJson: '{}'
  83. };
  84. if (param.multipleData) {
  85. _postParam.queryJson = JSON.stringify(multipleData);
  86. }
  87. if (param.begin && param.end) {
  88. _postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end });
  89. }
  90. learun.httpget(config.webapi + 'learun/EducationalAdministration/DtStuLeave/pagelist', _postParam, (data) => {
  91. $page.find('.lr-badge').text('0');
  92. if (data) {
  93. $page.find('.lr-badge').text(data.records);
  94. callback(data.rows, parseInt(data.records));
  95. }
  96. else {
  97. callback([], 0);
  98. }
  99. });
  100. },
  101. rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据
  102. _$item.addClass('lr-list-item lr-list-item-multi');
  103. _$item.append($('<p class="lr-ellipsis"><span>所属系:</span></p>').dataFormatter({ value: _item.CreateUserDeptNo,
  104. type: 'dataSource',
  105. code: 'CdDeptInfo',
  106. keyId: 'deptno',
  107. text: 'deptname'
  108. }));
  109. _$item.append($('<p class="lr-ellipsis"><span>班级:</span></p>').dataFormatter({ value: _item.CreateUserClassNo,
  110. type: 'dataSource',
  111. code: 'bjsj',
  112. keyId: 'classno',
  113. text: 'classname'
  114. }));
  115. _$item.append($('<p class="lr-ellipsis"><span>申请用户:</span></p>').dataFormatter({ value: _item.CreateUserName,
  116. type: 'organize',
  117. dataType: 'user'
  118. }));
  119. _$item.append($('<p class="lr-ellipsis"><span>申请类型:</span></p>').dataFormatter({ value: _item.LeaveType,
  120. type: 'dataItem',
  121. code: 'LeaveType'
  122. }));
  123. _$item.append($('<p class="lr-ellipsis"><span>开始时间:</span></p>').dataFormatter({ value: _item.BeginDate,
  124. type: 'datetime',
  125. dateformat: 'yyyy-MM-dd hh:mm'
  126. }));
  127. _$item.append($('<p class="lr-ellipsis"><span>结束时间:</span></p>').dataFormatter({ value: _item.EndDate,
  128. type: 'datetime',
  129. dateformat: 'yyyy-MM-dd hh:mm'
  130. }));
  131. _$item.append($('<p class="lr-ellipsis"><span>申请理由:</span></p>').dataFormatter({ value: _item.LeaveReason }));
  132. var lastStatus = "";
  133. if (_item.FlowNo == 0) {
  134. lastStatus = '<span class="circle bgcyellow">草稿</span>';
  135. } else if (_item.FlowNo == 1) {
  136. lastStatus = '<span class="circle bgcblue1">审批中</span>';
  137. } else if (_item.FlowNo == 2) {
  138. lastStatus = '<span class="circle bgcpink">请假中</span>';
  139. } else if (_item.FlowNo == 3){
  140. lastStatus = '<span class="circle bgccyan">已销假</span>';
  141. }
  142. _$item.append(lastStatus);
  143. return '';
  144. },
  145. rowClick: function (item, $item, $page) {// 列表行点击触发方法
  146. learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '详情', type: 'right', param: { keyValue: item.Id ,FlowNo:item.FlowNo} });
  147. },
  148. btnClickOfSubmit: function (item, $item, $page) {// 左滑按钮点击事件
  149. var FlowNo=item.FlowNo;
  150. if(FlowNo!=0)
  151. {
  152. learun.layer.toast("当前项目已提交,请勿重复提交!");
  153. return;
  154. }
  155. learun.layer.confirm('确定要提交该笔数据吗?', function (_index) {
  156. if (_index === '1') {
  157. learun.layer.loading(true, '正在提交该笔数据');
  158. learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/submit', item.Id, (data) => {
  159. if (data) {// 提交数据成功
  160. page.grid.reload();
  161. }
  162. learun.layer.loading(false);
  163. });
  164. }
  165. }, '智慧校园提示', ['取消', '确定']);
  166. },
  167. btnClick: function (item, $item, $page) {// 左滑按钮点击事件
  168. var FlowNo=item.FlowNo;
  169. if(FlowNo!=2)
  170. {
  171. learun.layer.toast("当前项目暂不能销假!");
  172. return;
  173. }
  174. learun.layer.confirm('确定要销假吗?', function (_index) {
  175. if (_index === '1') {
  176. learun.layer.loading(true, '正在销假');
  177. learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/delete', item.Id, (data) => {
  178. if (data) {// 销假成功
  179. page.grid.reload();
  180. }
  181. learun.layer.loading(false);
  182. });
  183. }
  184. }, 'Learun智慧校园提示', ['取消', '确定']);
  185. },
  186. // btnClickOfReply: function (item, $item, $page) {// 左滑按钮点击事件
  187. // var FlowNo=item.FlowNo;
  188. // if(FlowNo!=2)
  189. // {
  190. // learun.layer.toast("当前项暂不能销假,!");
  191. // return;
  192. // }
  193. // learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/reply', title: '销假', type: 'right', param: { keyValue: item.SComplaintId } });
  194. // },
  195. rowBtns: [
  196. '<a class="lr-btn-danger">删除</a>',
  197. '<a class="lr-btn-blue">提交</a>',
  198. '<a class="lr-btn-green">销假</a>',
  199. ] // 列表行左滑按钮
  200. };
  201. return page;
  202. })();