|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2021-07-23 10:15
- * 描 述:学生请销假
- */
- (function () {
- var begin = '';
- var end = '';
- var multipleData = null;
- var page = {
- grid: null,
- init: function ($page) {
- begin = '';
- end = '';
- multipleData = null;
- page.grid = $page.find('#lr_EducationalAdministrationDtStuLeave_list').lrpagination({
- lclass: page.lclass,
- rows: 10, // 每页行数
- getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
- param.multipleData = multipleData;
- page.loadData(param, callback, $page);
- },
- renderData: function (_index, _item, _$item) {// 渲染数据模板
- return page.rowRender(_index, _item, _$item, $page);
- },
- click: function (item, $item, $et) {// 列表行点击事件
- if ($et.hasClass('lr-btn-danger')) {
- page.btnClick(item, $item, $page);
- }
- else if ($et.hasClass('lr-btn-blue')) {//提交
- page.btnClickOfSubmit(item, $item, $page);
- }else if ($et.hasClass('lr-btn-blue')) {//销假
- page.btnClickOfReply(item, $item, $page);
- }
- else {
- page.rowClick(item, $item, $page);
- }
- },
- btns: page.rowBtns });
- // 多条件查询
- var $multiple = $page.find('.lr_multiple_search').multiplequery({
- callback: function (data) {
- begin = '';
- end = '';
- multipleData = data || {};
- page.grid.reload();
- }
- });
- $multiple.find('#CreateUserDeptNo').lrpickerex({
- type: 'sourceData',
- code: 'CdDeptInfo',
- ivalue: 'deptno',
- itext: 'deptname',
- placeHolders: '请选择' });
- $multiple.find('#CreateUserClassNo').lrpickerex({
- type: 'sourceData',
- code: 'bjsj',
- ivalue: 'classno',
- itext: 'classname',
- placeHolders: '请选择' });
- $multiple.find('#LeaveType').lrpickerex({
- type: 'sourceData',
- code: 'StuLeaveType',
- ivalue: 'typeno',
- itext: 'typename',
- placeHolders: '请选择'
- });
- $page.find('#lr_EducationalAdministrationDtStuLeave_btn').on('tap', function () {
- learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '新增', type: 'right' });
- });
- },
- lclass: 'lr-list',
- loadData: function (param, callback, $page) {// 列表加载后台数据
- var _postParam = {
- pagination: {
- rows: param.rows,
- page: param.page,
- sidx: 'Id',
- sord: 'DESC'
- },
- queryJson: '{}'
- };
- if (param.multipleData) {
- _postParam.queryJson = JSON.stringify(multipleData);
- }
- if (param.begin && param.end) {
- _postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end });
- }
- learun.httpget(config.webapi + 'learun/EducationalAdministration/DtStuLeave/pagelist', _postParam, (data) => {
- $page.find('.lr-badge').text('0');
- if (data) {
- $page.find('.lr-badge').text(data.records);
- callback(data.rows, parseInt(data.records));
- }
- else {
- callback([], 0);
- }
- });
- },
- rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据
- _$item.addClass('lr-list-item lr-list-item-multi');
- _$item.append($('<p class="lr-ellipsis"><span>所属系:</span></p>').dataFormatter({ value: _item.CreateUserDeptNo,
- type: 'dataSource',
- code: 'CdDeptInfo',
- keyId: 'deptno',
- text: 'deptname'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>班级:</span></p>').dataFormatter({ value: _item.CreateUserClassNo,
- type: 'dataSource',
- code: 'bjsj',
- keyId: 'classno',
- text: 'classname'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>申请用户:</span></p>').dataFormatter({ value: _item.CreateUserName,
- type: 'organize',
- dataType: 'user'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>申请类型:</span></p>').dataFormatter({ value: _item.LeaveType,
- type: 'dataItem',
- code: 'LeaveType'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>开始时间:</span></p>').dataFormatter({ value: _item.BeginDate,
- type: 'datetime',
- dateformat: 'yyyy-MM-dd hh:mm'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>结束时间:</span></p>').dataFormatter({ value: _item.EndDate,
- type: 'datetime',
- dateformat: 'yyyy-MM-dd hh:mm'
- }));
- _$item.append($('<p class="lr-ellipsis"><span>申请理由:</span></p>').dataFormatter({ value: _item.LeaveReason }));
- var lastStatus = "";
- if (_item.FlowNo == 0) {
- lastStatus = '<span class="circle bgcyellow">草稿</span>';
- } else if (_item.FlowNo == 1) {
- lastStatus = '<span class="circle bgcblue1">审批中</span>';
- } else if (_item.FlowNo == 2) {
- lastStatus = '<span class="circle bgcpink">请假中</span>';
- } else if (_item.FlowNo == 3){
- lastStatus = '<span class="circle bgccyan">已销假</span>';
- }
- _$item.append(lastStatus);
- return '';
- },
- rowClick: function (item, $item, $page) {// 列表行点击触发方法
- learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '详情', type: 'right', param: { keyValue: item.Id ,FlowNo:item.FlowNo} });
- },
- btnClickOfSubmit: function (item, $item, $page) {// 左滑按钮点击事件
- var FlowNo=item.FlowNo;
- if(FlowNo!=0)
- {
- learun.layer.toast("当前项目已提交,请勿重复提交!");
- return;
- }
- learun.layer.confirm('确定要提交该笔数据吗?', function (_index) {
- if (_index === '1') {
- learun.layer.loading(true, '正在提交该笔数据');
- learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/submit', item.Id, (data) => {
- if (data) {// 提交数据成功
- page.grid.reload();
- }
- learun.layer.loading(false);
- });
- }
- }, '智慧校园提示', ['取消', '确定']);
- },
- btnClick: function (item, $item, $page) {// 左滑按钮点击事件
- var FlowNo=item.FlowNo;
- if(FlowNo!=2)
- {
- learun.layer.toast("当前项目暂不能销假!");
- return;
- }
- learun.layer.confirm('确定要销假吗?', function (_index) {
- if (_index === '1') {
- learun.layer.loading(true, '正在销假');
- learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/delete', item.Id, (data) => {
- if (data) {// 销假成功
- page.grid.reload();
- }
- learun.layer.loading(false);
- });
- }
- }, 'Learun智慧校园提示', ['取消', '确定']);
- },
- // btnClickOfReply: function (item, $item, $page) {// 左滑按钮点击事件
- // var FlowNo=item.FlowNo;
- // if(FlowNo!=2)
- // {
- // learun.layer.toast("当前项暂不能销假,!");
- // return;
- // }
- // learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/reply', title: '销假', type: 'right', param: { keyValue: item.SComplaintId } });
- // },
- rowBtns: [
- '<a class="lr-btn-danger">删除</a>',
- '<a class="lr-btn-blue">提交</a>',
- '<a class="lr-btn-green">销假</a>',
- ] // 列表行左滑按钮
- };
- return page;
- })();
|