|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2021-03-03 11:29
- * 描 述:教师请假管理
- */
- 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' });
- $('#CreateUserId').lrUserSelect(0);
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/PersonnelManagement/TeacherLeaveManagement/Form',
- width: 1000,
- height: 800,
- callBack: function (id) {
- var res = false;
- // 验证数据
- res = top[id].validForm();
- // 保存数据
- if (res) {
- res = top[id].save('', function () {
- page.search();
- });
- }
- return res;
- }
- });
- });
- // 编辑
- $('#lr_edit').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.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/PersonnelManagement/TeacherLeaveManagement/Form?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- 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 CheckStatus = $('#gridtable').jfGridValue('CheckStatus');
- if (CheckStatus != "0") {
- learun.alert.warning("当前项已提交!");
- return false;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/TeacherLeaveManagement/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 查看
- $('#lr_view').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'formview',
- title: '查看',
- url: top.$.rootUrl + '/PersonnelManagement/TeacherLeaveManagement/FormView?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- 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 + '/PersonnelManagement/TeacherLeaveManagement/DoSubmit', { keyValue: keyValue, status: "1", processId: processId }, function (res) {
- refreshGirdData(res, {});
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/PersonnelManagement/TeacherLeaveManagement/GetPageList',
- headData: [
- {
- label: "姓名", name: "CreateUserId", 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: "CreateTime", width: 130, align: "left" },
- { label: "联系电话", name: "Telephone", width: 100, align: "left" },
- {
- 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: 120, align: "left" },
- { label: "结束时间", name: "EndTime", width: 120, align: "left" },
- {
- label: "请假天数", name: "LeaveDay", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'LeaveDay',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "请假事由", name: "LeaveReason", width: 150, align: "left" },
- {
- label: "审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue) {
- 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>";
- }
- },
- ],
- mainId: 'Id',
- isPage: true,
- sidx: 'CreateTime desc'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function (res, postData) {
- if (!!res) {
- if (res.code == 200) {
- // 发起流程
- var postData = {
- schemeCode: 'TeacherLeaveManagement',// 填写流程对应模板编号
- processId: processId,
- level: '1',
- };
- learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
- learun.loading(false);
- });
- }
- page.search();
- }
- };
- page.init();
- }
|