/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2021-03-26 11:35
* 描 述:学生销假管理
*/
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var processId = '';
var page = {
init: function () {
page.initGird();
page.bind();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);
$('#LeaveType').lrDataItemSelect({ code: 'LeaveTypeOfStu' });
$('#CheckStatus').lrselect({ data: [{ id: '0', text: '草稿' }, { id: '1', text: '审批中' }, { id: '2', text: '审批通过' }, { id: '3', text: '审批不通过' }] });
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValueInLeave = $('#gridtable').jfGridValue('IdInLeave');
if (learun.checkrow(keyValueInLeave)) {
var keyValue = $('#gridtable').jfGridValue('Id');
var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
if (keyValue != null && CheckStatus != "0") {
learun.alert.warning("当前项已提交销假!");
return false;
}
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/Form?keyValue=' + keyValue + '&keyValueInLeave=' + keyValueInLeave,
width: 600,
height: 400,
callBack: function (id) {
var res = false;
// 验证数据
res = top[id].validForm();
// 保存数据
if (res) {
res = top[id].save('', function () {
page.search();
});
}
return res;
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
var status = $('#gridtable').jfGridValue('CheckStatus');
if (status != "0") {
learun.alert.warning("当前项已提交销假!");
return false;
}
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/DeleteForm', { keyValue: keyValue}, function () {
page.search();
});
}
});
}
});
// 查看
$('#lr_view').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'formview',
title: '查看',
url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/FormView?keyValue=' + keyValue,
width: 600,
height: 400,
btn: null
});
}
});
// 提交
$('#lr_submit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
var CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
if (CheckStatus != "0") {
learun.alert.warning("当前项已提交销假!");
return false;
}
learun.layerConfirm('是否确认提交该项!', function (res) {
if (res) {
processId = learun.newGuid();
learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/DoSubmit', { keyValue: keyValue, status: "1", processId: processId }, function (res) {
refreshGirdData(res, {});
});
}
});
}
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/EducationalAdministration/StuCancelLeaveManagement/GetPageList',
headData: [
{ label: "学号", name: "CreateUserNoInLeave", width: 100, align: "left" },
{
label: "姓名", name: "CreateUserIdInLeave", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('user', {
key: value,
callback: function (_data) {
callback(_data.name);
}
});
}
},
{
label: "请假类型", name: "LeaveType", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'LeaveTypeOfStu',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{ label: "请假时间", name: "StartTime", width: 120, align: "left" },
{ label: "返校时间", name: "EndTime", width: 120, align: "left" },
{ label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
{ label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
{
label: "审核状态", name: "CheckStatusInLeave", width: 100, align: "left", formatter: function (cellvalue) {
return cellvalue == "1" ? "审核中" : cellvalue == "2" ? "审核通过" : cellvalue == "3" ? "审核未通过" : "草稿";
}
},
{ label: "销假填表时间", name: "CreateTime", width: 130, align: "left" },
{ label: "到校时间", name: "WorkTime", width: 120, align: "left"},
{ label: "销假事由", name: "CancelLeaveReason", width: 100, align: "left" },
{
label: "销假审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
return cellvalue == "1" ? "审核中" : cellvalue == "2" ? "审核通过" : cellvalue == "3" ? "审核未通过" : cellvalue == "0" ? "草稿" : "";
}
},
],
mainId:'Id',
isPage: true,
sord: 'CreateTimeInLeave desc'
});
page.search();
},
search: function (param) {
param = param || {};
param.CreateUserIdInLeave = learun.clientdata.get(['userinfo']).userId; //登录用户的已审核通过的请假单
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) });
}
};
refreshGirdData = function (res, postData) {
if (!!res) {
if (res.code == 200) {
// 发起流程
var postData = {
schemeCode: 'StuCancelLeaveManagement',// 填写流程对应模板编号
processId: processId,
level: '1',
};
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
learun.loading(false);
});
}
page.search();
}
};
page.init();
}