|
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- var startTime;
- var endTime;
- var page = {
- init: function () {
- page.bind();
- page.bindSelect();
- },
- loadData: function (param) {
- $.lrSetFormWithParam(top.$.rootUrl + '/PersonnelManagement/TimeTable/GetDataInEducation', param,
- function (data) {
- // 数据处理
- var html = '';
- var weekLists = data.weekList;
- for (var i = 1; i < 11; i++) {
- (function (arg) {
- var args = arg - 1;
- var datas = flogs(arg, weekLists, 'time');
- html += ' <tr><td>' + arg + '节</td>';
- if (datas) {
- var lists = datas.list;
- html += tdHandles(lists);
- } else {
- html += tdHandle(arg);
- }
- html += '</tr>';
- })(i); //调用时参数
- }
- $('.personT').text(data.schoolName);
- $('.perSemester').text(data.semester);
- $('.perFestivalsBox table').html(html);
-
- function flogs(num, data, obj) {
- var flog = false;
- $.each(data,
- function (i, n) {
- if (n[obj] == num) {
- flog = n;
- return;
- }
- })
- return flog;
- }
- function flogs2(num, data, obj) {
- var arr = new Array();
- $.each(data,
- function (i, n) {
- if (n[obj] == num) {
- arr.push(n);
- }
- })
- return arr;
- }
-
- //某节课空
- function tdHandle() {
- var html = '';
- for (var j = 0; j < 7; j++) {
- html += '<td><div></div><div></div><div></div><div></div></td>';
- }
- return html;
- }
-
- //某节课不空
- function tdHandles(lists) {
- var html = '';
- for (var k = 1; k < 8; k++) {
- (function (arg) {
- var args = arg - 1;
- var datas = flogs2(arg, lists, 'day');
- if (datas.length > 0) {
- html += '<td class="active">';
- $.each(datas, function (i, item) {
- if (i > 0) {
- html += '<hr>';
- }
- html += '<div>课程:' +
- item.curriculum +
- '</div>' +
- '<div>教师:' +
- item.teacher +
- '</div>' +
- '<div>班级:' +
- item.className +
- '</div>' +
- '<div>教室:' +
- item.classRoom +
- '</div>';
- });
- html += '</td>';
-
- } else {
- html += '<td><div></div><div></div><div></div><div></div></td>';
- }
-
- })(k);
- }
- return html;
- }
- });
- },
- bind: function () {
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- $('#datesearch').lrdate({
- dfdata: [
- {
- name: '上周',
- begin: function () { return learun.getTime(7); },
- end: function () {
- return learun.getTime(1);
- }
- },
- {
- name: '本周',
- begin: function () { return learun.getTime(0); },
- end: function () {
- return learun.getTime(-6);
- }
- },
- {
- name: '下周',
- begin: function () { return learun.getTime(-7); },
- end: function () {
- return learun.getTime(-13);
- }
- }],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: 'currentWeek',
- selectfn: function (begin, end) {
- startTime = begin;
- endTime = end;
- page.search();
- }
- });
- //查询
- $('#lr_search').on('click', function () {
- var p = {};
- p.schoolId = $('#F_SchoolId').lrselectGet();
- p.ClassNo = $('#ClassNo').lrselectGet();
- p.EmpNo = $('#EmpNo').lrselectGet();
- page.search(p);
- });
- // 按条件清空排课数据
- $('#emptyByCondition').on('click', function () {
- learun.layerForm({
- id: 'EmptyByConditionForm',
- title: '按条件清空排课数据',
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/EmptyByConditionForm',
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 按条件同步排课数据
- $('#syncByCondition').on('click', function () {
- learun.layerForm({
- id: 'SyncByConditionForm',
- title: '按条件同步排课数据',
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/SyncByConditionForm',
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- //按条件重置基础数据同步状态
- $('#initByCondition').on('click', function () {
- learun.layerForm({
- id: 'SyncByConditionForm',
- title: '按条件重置基础数据同步状态',
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/ClearByConditionForm',
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick();
- }
- });
- });
-
- //打印课程表
- $('#perBtn').on('click',
- function () {
- AddPrintContent();
- });
- var LODOP, P_ID = "", TaskID1, TaskID2, t, waiting = false, c = 0, loop = 0; //声明为全局变量
-
- function AddPrintContent() {
- var myHtml = myHtml = $('.personalBox').html();
- var strBodyStyle = "<style>" + document.getElementById("style1").innerHTML + "</style>";
- var strFormHtml = strBodyStyle + "<body>" + myHtml + "</body>";
-
- LODOP = getLodop();
- LODOP.PRINT_INIT("个人授课表");
- LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
-
- LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
- LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
-
- LODOP.ADD_PRINT_HTM(10, 10, '284mm', '185mm', strFormHtml);
- //打印预览
- LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); //横向时的正向显示
- var TaskID1 = LODOP.PREVIEW();
- // 直接打印
- // var TaskID1=LODOP.PRINT();
-
- }
- },
- bindSelect: function () {
- //校区
- $('#F_SchoolId').lrDataSourceSelect({
- code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) {
- if (!!item) {
- // 班级
- $('#ClassNo').lrselectRefresh({
- placeholder: "请选择班级",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
- param: { schoolId: item.f_companyid },
- value: 'value',
- text: 'text'
- });
- // 教师
- $('#EmpNo').lrselectRefresh({
- placeholder: "请选择教师",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
- param: { schoolId: item.f_companyid },
- value: 'value',
- text: 'text'
- });
- } else {
- //班级
- $('#ClassNo').lrselectRefresh({
- placeholder: "请选择班级",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
- param: { schoolId: "" },
- value: 'value',
- text: 'text'
- });
- //教师
- $('#EmpNo').lrselectRefresh({
- placeholder: "请选择教师",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
- param: { schoolId: "" },
- value: 'value',
- text: 'text'
- });
- }
- }
- });
- //班级
- $('#ClassNo').lrselect({
- placeholder: "请选择班级",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
- value: 'value',
- text: 'text'
- });
- //教师
- $('#EmpNo').lrselect({
- placeholder: "请选择教师",
- allowSearch: true,
- url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
- value: 'value',
- text: 'text'
- });
- },
- search: function (param) {
- param = param || {};
- param.StartTime = startTime;
- param.EndTime = endTime;
- page.loadData(param);
- }
- };
- page.init();
- };
|