/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:超级管理员
* 日 期:2019-10-28 11:48
* 描 述:学籍异动
*/
var acceptClick;
var keyValue = request('keyValue');
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
$('.lr-form-wrap').lrscroll();
page.bind();
page.initData();
},
bind: function () {
//$('#StuChangeType').lrDataItemSelect({
// code: 'StuChangeType',
// select: function (item) {
// console.log(item);
// }
//});
//异动类型下拉不显示复学、学籍关键信息更改、转入/进、;
$('#StuChangeType').lrselect({
data: [{ text: '留级', id: '01' }, { text: '转出/校', id: '02' }, { text: '退学', id: '05' }, { text: '休学', id: '06' }, { text: '转班', id: '07' }, { text: '转专业', id: '08' }],
select: function (item) {
if (item != null && item != undefined) {
var StuNo = $('#StuNo').val();
if (!StuNo) {
learun.alert.warning("请输入学号或姓名!");
$('#StuChangeType').lrselectSet();
return false;
}
$(".NewContainer").find('.contentDiv').lrselectSet();
$(".NewContainer").find('.contentDiv').attr("isvalid", "yes");
$(".NewContainer").find('.contentDiv').attr("checkexpession", "NotNull");
$(".NewContainer").find('.contentDiv').attr('readonly', 'readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title') + '*');
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title') + '*');
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title') + '*');
$(".NewContainer").show();
$('#OutSchool').removeAttr("isvalid");
$('#OutSchool').removeAttr("checkexpession");
$("#OutSchool").siblings('div').html($("#OutSchool").siblings('div').attr('data-title'));
$('#OutSchool').val('');
$(".NewSchool").hide();
if (item.id === "01" || item.id === "07") { //留级、转班
$(".NewContainer").find('.contentDiv.zhuanban').removeAttr('readonly');
$("#NewDeptNo").lrselectSet($("#DeptNo").lrselectGet());
var timer1 = setInterval(function () {
if ($("#NewDeptNo").lrselectGet()) {
$("#NewMajorNo").lrselectSet($("#MajorNo").lrselectGet());
console.log("系部赋值后,在赋值专业:" + $("#NewMajorNo").lrselectGet());
clearInterval(timer1);
}
}, 1000);
} else if (item.id === "02") {//转校
$(".NewContainer").find('.contentDiv').removeAttr("isvalid");
$(".NewContainer").find('.contentDiv').removeAttr("checkexpession");
$(".NewContainer").find('.contentDiv').removeAttr('readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title'));
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title'));
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title'));
$(".NewContainer").hide();
$('#OutSchool').attr("isvalid", 'yes');
$('#OutSchool').attr("checkexpession", "NotNull");
$("#OutSchool").siblings('div').html($("#OutSchool").siblings('div').attr('data-title') + '*');
$(".NewSchool").show();
}
else if (item.id === "05" || item.id === "06") { //退学、休学、
$(".NewContainer").find('.contentDiv').removeAttr("isvalid");
$(".NewContainer").find('.contentDiv').removeAttr("checkexpession");
$(".NewContainer").find('.contentDiv').removeAttr('readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title'));
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title'));
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title'));
$(".NewContainer").hide();
}
else if (item.id === "08") { //转专业、
$(".NewContainer").find('.contentDiv.zhuanzhuanye').removeAttr('readonly');
$(".NewContainer").find('.contentDiv.zhuanban').removeAttr('readonly');
$("#NewDeptNo").lrselectSet($("#DeptNo").lrselectGet());
}
}
}
});
$('#StuChangeReason').lrDataItemSelect({ code: 'StuChangeReason' });
$('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
$('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
$('#ClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
$('#NewDeptNo').lrDataSourceSelect({
code: 'CdDeptInfo', value: 'deptno', text: 'deptname', select: function (item) {
//console.log("选择的系部为:" + JSON.stringify(item));
if (item != null && item != undefined) {
$('#NewMajorNo').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo',
param: { strWhere: "deptno='" + item.deptno + "' AND CheckMark=1 order by majorno" }
});
} else {
$('#NewMajorNo').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo',
param: { strWhere: "CheckMark=1 order by majorno" }
});
}
}
});
$('#NewMajorNo').lrDataSourceSelect({
code: 'CdMajorInfo', value: 'majorno', text: 'majorname', select: function (item) {
//console.log("选择的专业为:" + JSON.stringify(item));
if (item != null && item != undefined) {
$('#NewClassNo').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
param: { strWhere: "MajorNo='" + item.majorno + "' AND CheckMark=1 order by classno" }
});
} else {
$('#NewClassNo').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj',
param: { strWhere: "CheckMark=1 order by classno" }
});
}
}
});
$('#NewClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
//监听学号
$("#StuNo").on('blur', function () {
var StuNo = $(this).val();
if (StuNo) {
learun.httpAsync('get', top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/GetStuInfo?Account=' + StuNo, '', function (data) {
if (data) {
$("#StuNo").val(data.StuNo);
$("#StuName").val(data.StuName);
$("#DeptNo").lrselectSet(data.DeptNo);
$("#MajorNo").lrselectSet(data.MajorNo);
$("#ClassNo").lrselectSet(data.ClassNo);
} else {
learun.alert.warning("学生不存在!");
//return false;
}
});
}
});
//监听姓名
$("#StuName").on('blur', function () {
var StuName = $(this).val().trim();
if (StuName) {
learun.httpAsync('get', top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/GetStuInfoBasicEntityByStuName?name=' + StuName, '', function (data) {
if (data) {
$("#StuNo").val(data.StuNo);
$("#StuName").val(data.StuName);
$("#DeptNo").lrselectSet(data.DeptNo);
$("#MajorNo").lrselectSet(data.MajorNo);
$("#ClassNo").lrselectSet(data.ClassNo);
} else {
learun.alert.warning("学生不存在!");
return false;
}
});
}
});
//编辑
if (!!keyValue) {
$("#StuNo").attr('readonly', 'readonly');
$("#StuName").attr('readonly', 'readonly');
}
},
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuInfoBasicChange/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]);
$(".NewContainer").find('.contentDiv').attr("isvalid", "yes");
$(".NewContainer").find('.contentDiv').attr("checkexpession", "NotNull");
$(".NewContainer").find('.contentDiv').attr('readonly', 'readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title') + '*');
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title') + '*');
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title') + '*');
$(".NewContainer").show();
$('#OutSchool').removeAttr("isvalid");
$('#OutSchool').removeAttr("checkexpession");
$("#OutSchool").siblings('div').html($("#OutSchool").siblings('div').attr('data-title'));
$('#OutSchool').val('');
$(".NewSchool").hide();
if (data[id].StuChangeType == "01" || data[id].StuChangeType == "07") { //留级、转班
$(".NewContainer").find('.contentDiv.zhuanban').removeAttr('readonly');
}
else if (data[id].StuChangeType == "02") {//转校
$(".NewContainer").find('.contentDiv').removeAttr("isvalid");
$(".NewContainer").find('.contentDiv').removeAttr("checkexpession");
$(".NewContainer").find('.contentDiv').removeAttr('readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title'));
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title'));
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title'));
$(".NewContainer").hide();
$('#OutSchool').attr("isvalid", 'yes');
$('#OutSchool').attr("checkexpession", "NotNull");
$("#OutSchool").siblings('div').html($("#OutSchool").siblings('div').attr('data-title') + '*');
$(".NewSchool").show();
}
else if (data[id].StuChangeType == "05" || data[id].StuChangeType == "06") { //退学、休学、
$(".NewContainer").find('.contentDiv').removeAttr("isvalid");
$(".NewContainer").find('.contentDiv').removeAttr("checkexpession");
$(".NewContainer").find('.contentDiv').removeAttr('readonly');
$("#NewDeptNo").siblings('div').html($("#NewDeptNo").siblings('div').attr('data-title'));
$("#NewMajorNo").siblings('div').html($("#NewMajorNo").siblings('div').attr('data-title'));
$("#NewClassNo").siblings('div').html($("#NewClassNo").siblings('div').attr('data-title'));
$(".NewContainer").hide();
}
else if (data[id].StuChangeType == "08") { //转专业、
$(".NewContainer").find('.contentDiv.zhuanzhuanye').removeAttr('readonly');
$(".NewContainer").find('.contentDiv.zhuanban').removeAttr('readonly');
}
}
}
});
}
}
};
// 保存数据
acceptClick = function (callBack) {
//console.log($('body').lrGetFormData());
if (!$('body').lrValidform()) {
return false;
}
var postData = {
strEntity: JSON.stringify($('body').lrGetFormData())
};
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/StuInfoBasicChange/SaveForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
}
});
};
page.init();
}