|
- /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2020-11-27 10:05
- * 描 述:学生请假管理
- */
- 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: 'LeaveType' });
- $('#CheckStatus').lrselect({
- data: [{ text: "草稿", value: "0" }, { text: "审核中", value: "1" }, { text: "审核通过", value: "2" }, { text: "审核未通过", value: "3" }],
- text: "text",
- value: "value"
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form',
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var status = $('#gridtable').jfGridValue('CheckStatus');
- if (status == "1") {
- learun.alert.warning("该项已提交无法编辑!");
- return false;
- }
- if (status == "2") {
- learun.alert.warning("该项已审核无法编辑!");
- return false;
- }
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/Form?keyValue=' + keyValue,
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var status = $('#gridtable').jfGridValue('CheckStatus');
- if (status == "1") {
- learun.alert.warning("该项已提交无法删除!");
- return false;
- }
- if (status == "2") {
- learun.alert.warning("该项已审核无法删除!");
- return false;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //提交
- $('#lr_submit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var status = $('#gridtable').jfGridValue('CheckStatus');
- if (status == "1") {
- learun.alert.warning("当前项目已提交,请耐心等待审批!");
- return;
- }
- if (status == "2") {
- learun.alert.warning("当前项目已审核!");
- return;
- }
- learun.layerConfirm('是否确认提交该项!', function (res) {
- if (res) {
- processId = learun.newGuid();
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/ModifyStatus', { keyValue: keyValue, CheckStatus: "1", processId: processId }, function (res) {
- refreshGirdData(res, {});
- });
- }
- });
- }
- });
-
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/StuLeaveManagement/GetPageList',
- headData: [
- {
- label: "审核状态", name: "CheckStatus", width: 100, align: "left",
- formatter: function (cellvalue) {
- if (cellvalue == 2) {
- return "<span class=\"label label-success\">审核通过</span>";
- } else if (cellvalue == 3) {
- return "<span class=\"label label-danger\">审核未通过</span>";
- } else if (cellvalue == 1) {
- return "<span class=\"label label-warning\">审核中</span>";
- } else if (cellvalue == 0) {
- return "<span class=\"label label-default\">草稿</span>";
- }
- }
-
- },
- //{ label: "审核备注", name: "CheckRemark", width: 100, align: "left" },
- //{ label: "审核时间", name: "CheckTime", width: 130, align: "left" },
- //{
- // label: "审核人", name: "CheckUserId", width: 100, align: "left",
- // formatterAsync: function (callback, value, row, op, $cell) {
- // learun.clientdata.getAsync('custmerData', {
- // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
- // key: value,
- // keyId: 'f_userid',
- // callback: function (_data) {
- // callback(_data['f_realname']);
- // }
- // });
- // }
- //},
- {
- label: "请假类型", name: "LeaveType", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'LeaveType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "开始时间", name: "StartTime", width: 100, align: "left",
- formatter: function (value, row) {
- return learun.formatDate(value,'yyyy-MM-dd');
- }
- },
- {
- label: "结束时间", name: "EndTime", width: 100, align: "left",
- formatter: function (value, row) {
- return learun.formatDate(value, 'yyyy-MM-dd');
- }},
- { label: "请假天数", name: "LeaveDay", width: 100, align: "left" },
- { label: "请假事由", name: "LeaveReason", width: 100, align: "left" },
- { label: "学号", name: "CreateUserNo", width: 100, align: "left" },
- { label: "姓名", name: "CreateUserName", width: 100, align: "left" },
- { label: "申请时间", name: "CreateTime", width: 130, align: "left" },
- {
- label: "班级", name: "ClassNo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
- key: value,
- keyId: 'classno',
- callback: function (_data) {
- callback(_data['classname']);
- }
- });
- }
- },
- {
- label: "系部", name: "DeptNo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
- key: value,
- keyId: 'deptno',
- callback: function (_data) {
- callback(_data['deptname']);
- }
- });
- }
- },
- {
- label: "专业", name: "MajorNo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
- key: value,
- keyId: 'majorno',
- callback: function (_data) {
- callback(_data['majorname']);
- }
- });
- }
- },
- {
- label: "班主任", name: "ClassDiredctorNo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
- key: value,
- keyId: 'empno',
- callback: function (_data) {
- callback(_data['empname']);
- }
- });
- }
- },
- {
- label: "辅导员", name: "ClassTutorNo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
- key: value,
- keyId: 'empno',
- callback: function (_data) {
- callback(_data['empname']);
- }
- });
- }
- },
-
- ],
- mainId: 'Id',
- isPage: true,
- sidx: 'CreateTime desc'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.StuNo = learun.clientdata.get(['userinfo']).account;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function (res, postData) {
- if (!!res && res.code == 200) {
- // 发起流程
- var postData = {
- schemeCode: 'StuLeaveManagement',// 填写流程对应模板编号
- processId: processId,
- level: '1',
- };
- learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
- learun.loading(false);
- });
-
- }
- page.search();
- };
-
- page.init();
- }
|