/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2024-03-25 17:45 * 描 述:班级人数日报表 */ var acceptClick; var keyValue = request('keyValue'); var type = request('type');//copy代表复制,checkedit代表专业部编辑 var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { $('.lr-form-wrap').lrscroll(); page.bind(); page.initData(); if (type == "checkedit") { //日期、专业部、年级、班级无法编辑 $("#Date").attr("readonly", "readonly"); $("#DeptNo").attr("readonly", "readonly"); $("#Grade").attr("readonly", "readonly"); $("#Class").attr("readonly", "readonly"); } }, bind: function () { $('#Date').val(getnow()); if (type == "checkedit") { $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); $('#Grade').lrselect({ url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear', value: 'value', text: 'text' }); } else { $('#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" }); }, initData: function () { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/GetFormData?keyValue=' + keyValue, function (data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id ).jfGridSet('refreshdata', data[id]); } else { $('[data-table="' + id + '"]').lrSetFormData(data[id]); } if (type == "copy") { $('#Date').val(getnow()); var timer = setTimeout(function () { $('#Class').lrselectSet(data[id].Class); clearTimeout(timer); }, 2000); } } }); } } }; // 保存数据 acceptClick = function (callBack) { if (!$('body').lrValidform()) { return false; } if (type == "copy") { keyValue = ""; } var postData = { strEntity: JSON.stringify($('body').lrGetFormData()) }; $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/StuArriveSchool/SaveForm?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { callBack(); } }); }; page.init(); } function getnow() { var date = new Date(); var result = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(); return result; };