var refreshGirdData;
var bootstrap = function ($, learun) {
var classNo = ClassNo;
var curWeek;
var weekList;
var page = {
init: function () {
page.bind();
//page.bindSelect();
},
loadData: function (param) {
$.lrSetFormWithParam(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetDataInEducation', param,
function (data) {
//console.log('res', data);
// 数据处理
var html = '
节次/星期 | 星期一 | 星期二 | 星期三 | 星期四 | 星期五 | 星期六 | 星期日 | 星期八 | 星期九 | 星期十 |
';
var weekLists = data.weekList;
//十节课
for (var i = 1; i < 12; i++) {
(function (arg) {
var args = arg - 1;
var datas = flogs(arg, weekLists, 'time');
//console.log('datas', datas);
html += ' ' + arg + '节 | ';
if (datas) {
var lists = datas.list;
html += tdHandles(lists);
} else {
html += tdHandle(arg);
}
html += '
';
})(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 < 11; j++) {
html += ' | ';
}
return html;
}
//某节课不空
function tdHandles(lists) {
var html = '';
for (var k = 1; k < 12; k++) {
(function (arg) {
var args = arg - 1;
var datas = flogs2(arg, lists, 'day');
if (datas.length > 0) {
html += '';
$.each(datas, function (i, item) {
if (i > 0) {
html += ' ';
}
html += '' +
item.curriculum +
' ' +
'' +
item.teacher +
' ' +
'' +
item.classRoom +
' ';
//html += '课程:' +
// item.curriculum +
// ' ' +
// '教师:' +
// item.teacher +
// ' ' +
// '班级:' +
// item.className +
// ' ' +
// '教室:' +
// item.classRoom +
// ' ';
});
html += ' | ';
} else {
html += ' | ';
}
})(k);
}
return html;
}
});
},
bind: function () {
//获取周次
learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetWeekTime', function (res) {
if (res.code == 200) {
weekList = res.data.weekList;
$('#WeekTimes').lrRadioCheckbox({
type: 'radio',
data: res.data.weekList,
value: 'value',
text: 'text'
});
curWeek = res.data.curWeek;
if (!$('#WeekTimes').find('input[value="' + res.data.curWeek + '"]').is(":checked")) {
$('#WeekTimes').find('input[value="' + res.data.curWeek + '"]').trigger('click');
}
//周次
$('#WeekTimeSelect').lrselect({
placeholder: "请选择周次",
maxHeight: 300,
allowSearch: true,
type: 'multiple',
//data: res.data.weekList,
value: 'value',
text: 'text'
});
$('#WeekTimeSelect').lrselectRefresh({
data: res.data.weekList
}
);
}
});
//切换周次
$('#WeekTimes').change(function () {
curWeek = $('#WeekTimes input[name="WeekTimes"]:checked ').val();
page.search();
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
//查询
$('#lr_search').on('click', function () {
var p = {};
p.schoolId = $('#F_SchoolId').lrselectGet();
p.ClassNo = $('#ClassNo').lrselectGet();
p.EmpNo = $('#EmpNo').lrselectGet();
page.search(p);
});
//打印课程表
$('#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 = "";
var strFormHtml = strBodyStyle + "" + myHtml + "";
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();
}
},
search: function (param) {
param = param || {};
//当前第几周
param.curWeek = curWeek;
//班级
console.log("ClassNo:", classNo)
param.classNo = ClassNo;//'202010';//
page.loadData(param);
$('#WeekTimeSelect').lrselectRefresh({
data: weekList
});
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#WeekTimeSelect').lrselectSet('');
$('#WeekSelect').lrselectSet('');
$('#NodeSelect').lrselectSet('');
}
};
refreshGirdData = function () {
page.search();
};
page.init();
};