|
- /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2024-03-25 17:45
- * 描 述:班级人数日报表
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var startTime;
- var endTime;
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 时间搜索框
- $('#datesearch').lrdate({
- dfdata: [
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: '0',
- selectfn: function (begin, end) {
- startTime = begin;
- endTime = end;
- page.search();
- }
- });
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- $('#DeptNo').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo',
- value: "deptno",
- text: "deptname",
- param: { strWhere: "1=1" },
- select: function (item) {
- var Grades = $("#Grade").lrselectGet();
- if (Grades != null && Grades != "" && Grades != "undefined") {
- if (item) {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "deptno='" + item.deptno + "' AND CheckMark=1 AND Grade='" + Grades + "' order by classno desc" }
- });
- } else {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "1=1 AND CheckMark=1 order by classno desc" }
- });
- }
- } else {
- if (item) {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "deptno='" + item.deptno + "' AND CheckMark=1 order by classno desc" }
- });
- } else {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "1=1 AND CheckMark=1 order by classno desc" }
- });
- }
- }
- }
- });
- $('#Grade').lrselect({
- url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear',
- value: 'value',
- text: 'text',
- select: function (item) {
- var DeptNo = $("#DeptNo").lrselectGet();
- if (DeptNo != null && DeptNo != "" && DeptNo != "undefined") {
- if (item) {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: {
- strWhere: "deptno='" + DeptNo + "' AND CheckMark=1 AND Grade='" + item.text + "' order by classno desc"
- }
- });
- } else {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "1=1 AND CheckMark=1 order by classno desc" }
- });
- }
- } else {
- if (item) {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: {
- strWhere: "CheckMark=1 AND Grade='" + item.text + "' order by classno desc"
- }
- });
- } else {
- $('#Class').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "1=1 AND CheckMark=1 order by classno desc" }
- });
- }
- }
-
- }
- });
- $('#Class').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
- param: { strWhere: "1=1 AND CheckMark=1 order by classno desc" },
- value: "classno",
- text: "classname"
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/Form',
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- var Status = $('#gridtable').jfGridValue('Status');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(",") != -1) {
- learun.alert.warning("只能选择一条记录进行操作!");
- return false;
- }
- if (Status == "1") {
- learun.alert.warning("该项已提交,无法编辑!");
- return false;
- } else if (Status == "2") {
- learun.alert.warning("该项已审核,无法编辑!");
- return false;
- }
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/Form?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 复制
- $('#lr_copy').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(",") != -1) {
- learun.alert.warning("只能选择一条记录进行操作!");
- return false;
- }
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/Form?type=copy&keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- var Status = $('#gridtable').jfGridValue('Status');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(",") != -1) {
- learun.alert.warning("只能选择一条记录进行操作!");
- return false;
- }
- if (Status == "1") {
- learun.alert.warning("该项已提交,无法删除!");
- return false;
- } else if (Status == "2") {
- learun.alert.warning("该项已审核,无法删除!");
- return false;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //提交
- $('#lr_submit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- var Status = $('#gridtable').jfGridValue('Status');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(",") != -1) {
- learun.alert.warning("只能选择一条记录进行操作!");
- return false;
- }
- if (Status == "1") {
- learun.alert.warning("该项已提交!");
- return false;
- } else if (Status == "2") {
- learun.alert.warning("该项已审核!");
- return false;
- }
- learun.layerConfirm('是否确认提交该项!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/DoSubmit', { keyValue: keyValue, status: "1" }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //审核
- $('#lr_check').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- var Status = $('#gridtable').jfGridValue('Status');
- if (learun.checkrow(keyValue)) {
- if (Status.indexOf("2") != -1) {
- learun.alert.warning("选中项中包含已审核的数据!");
- return false;
- }
- if (Status.indexOf("0") != -1 || Status.indexOf(" ") != -1) {
- learun.alert.warning("选中项中包含未提交的数据!");
- return false;
- }
- learun.layerConfirm('是否确认审核选中项!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/DoSubmit', { keyValue: keyValue, status: "2" }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //专业部编辑
- $('#lr_checkEdit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- var Status = $('#gridtable').jfGridValue('Status');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(",") != -1) {
- learun.alert.warning("只能选择一条记录进行操作!");
- return false;
- }
- if (Status == "2") {
- learun.alert.warning("该项已审核!");
- return false;
- }
- if (Status != "1") {
- learun.alert.warning("该项未提交,专业部无法编辑!");
- return false;
- }
- learun.layerForm({
- id: 'form',
- title: '专业部编辑',
- url: top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/Form?type=checkedit&keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/GetPageList',
- headData: [
- {
- label: "状态", name: "Status", width: 60, align: "left", formatter: function (cellvalue) {
- if (cellvalue == "1") {
- return '<span class=\"label label-warning\">已提交</span>';
- } else if (cellvalue == "2") {
- return '<span class=\"label label-success\">已审核</span>';
- } else {
- return '<span class=\"label label-default\" >草稿</span>';
- }
- }
- },
- {
- label: "日期", name: "Date", width: 80, align: "left", formatter: function (cellvalue) {
- return learun.formatDate(cellvalue, 'yyyy-MM-dd');
- }
- },
- {
- 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: "Grade", width: 50, align: "left" },
- {
- label: "班级", name: "Class", 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: "YingDaoNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "实到人数", name: "ShiDaoNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "未到人数", name: "WeiDaoNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "病假人数", name: "BingJiaNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "病假人员", name: "BingJiaPeople", width: 100, align: "left" },
- { label: "事假人数", name: "ShiJiaNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "事假人员", name: "ShiJiaPeople", width: 100, align: "left" },
- { label: "拟退学人数", name: "NiTuiXueNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "拟退学人员", name: "NiTuiXuePeople", width: 100, align: "left" },
- { label: "拟休学人数", name: "NiXiuXueNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "拟休学人员", name: "NiXiuXuePeople", width: 100, align: "left" },
- { label: "拟转出人数", name: "NiZhuanChuNum", width: 100, align: "left", statistics: true, isInt: true },
- { label: "拟转出人员", name: "NiZhuanChuPeople", width: 100, align: "left" },
- ],
- mainId: 'Id',
- isPage: true,
- isMultiselect: true,
- sidx: 'Date desc,DeptNo',
- sord: 'asc'
- });
- },
- search: function (param) {
- param = param || {};
- param.StartTime = startTime;
- param.EndTime = endTime;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- $('#gridtable').jfGridSet('reload');
- };
- page.init();
- }
|