|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-09-26 10:47
- * 描 述:教学调度
- */
- var acceptClick;
- var keyValue = request('keyValue');
- // 设置权限
- var setAuthorize;
- // 设置表单数据
- var setFormData;
- // 验证数据是否填写完整
- var validForm;
- // 保存数据
- var save;
- //绑定原课程安排
- var bindData;
- //绑定新课程安排
- var bindDataNew;
- var bootstrap = function ($, learun) {
- "use strict";
- // 设置权限
- setAuthorize = function (data) {
- };
- var page = {
- init: function () {
- $('.lr-form-wrap').lrscroll();
- page.bindSelect();
- page.bind();
- page.initData();
- },
- query: function () {
- var p = {};
- //p.F_SchoolId = $('#F_SchoolId').lrselectGet();
- p.AcademicYearNo = $('#AcademicYearNo').lrselectGet();
- p.Semester = $('#Semester').lrselectGet();
- p.DeptNo = $('#DeptNo').lrselectGet();
- p.MajorNo = $('#MajorNo').lrselectGet();
- p.LessonNo = $('#LessonNo').lrselectGet();
- p.TeachClassNo = $('#TeachClassNo').lrselectGet();
- p.EmpNo = $('#EmpNo').lrselectGet();
- p.ClassroomNo = $('#ClassroomNo').lrselectGet();
- //if (!!p.F_SchoolId && !!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
- if (!!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
- //调度开始时间
- $('#AttemperStartTime').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetList?queryJson=' + JSON.stringify(p),
- value: 'LessonDate',
- text: 'LessonDate'
- });
- //调度结束时间
- $('#AttemperEndTime').lrselectRefresh({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetList?queryJson=' + JSON.stringify(p),
- value: 'LessonDate',
- text: 'LessonDate'
- });
- }
- },
- bind: function () {
- $('#CreateTime')[0].lrvalue = learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss');
- $('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'));
- $('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId;
- $('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName);
- $('#CreateUserName')[0].lrvalue = learun.clientdata.get(['userinfo']).realName;
- //选择课程安排
- //$("#btn1").on('click', function () {
- // learun.layerForm({
- // id: 'IndexInEducationSelect',
- // title: '课程表',
- // url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
- // width: 1200,
- // height: 800,
- // callBack: function (id) {
- // return top[id].acceptClick(bindData);
- // }
- // });
- //});
- //$("#btn2").on('click', function () {
- // learun.layerForm({
- // id: 'IndexInEducationSelect',
- // title: '课程表',
- // url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
- // width: 1200,
- // height: 800,
- // callBack: function (id) {
- // return top[id].acceptClick(bindDataNew);
- // }
- // });
- //});
- },
- bindSelect: function () {
- $('#AttemperType').lrDataItemSelect({
- code: 'AttemperType', select: function (item) {
- $('.AttemperType').hide();
- $("#AttemperTimeType").removeAttr("isvalid");
- $("#AttemperTimeType").removeAttr("checkexpession");
- $("#AttemperStartTime").removeAttr("isvalid");
- $("#AttemperStartTime").removeAttr("checkexpession");
- $("#AttemperEndTime").removeAttr("isvalid");
- $("#AttemperEndTime").removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
- $('#NewEmpNo').siblings('div').html('教师');
- $('#NewClassroomNo').siblings('div').html('教室');
- if (item != null && item != undefined) {
- if (item.id === "01") { //调课
- $('.AttemperTypeTiao').show();
- $("#AttemperTimeType").attr("isvalid", "yes");
- $("#AttemperTimeType").attr("checkexpession", "NotNull");
- $("#AttemperStartTime").attr("isvalid", "yes");
- $("#AttemperStartTime").attr("checkexpession", "NotNull");
- $("#AttemperEndTime").attr("isvalid", "yes");
- $("#AttemperEndTime").attr("checkexpession", "NotNull");
- } else if (item.id === "02") { //停课
-
- } else if (item.id === "03") { //对调
- $('.AttemperTypeDuiDiao').show();
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
- $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
- $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
- }
- }
- }
- });
- $('#AttemperTimeType').lrDataItemSelect({ code: 'AttemperTimeType' });
- //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
- //$('#NewF_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
- //学年
- $('#AcademicYearNo').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
- value: 'value',
- text: 'text'
- });
- $('#NewAcademicYearNo').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
- value: 'value',
- text: 'text'
- });
- //学期
- $('#Semester').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
- value: 'value',
- text: 'text'
- });
- $('#NewSemester').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
- value: 'value',
- text: 'text'
- });
- $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
- $('#NewDeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
- $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
- $('#NewMajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
- $('#LessonNo').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
- value: 'value',
- text: 'text',
- });
- $('#NewLessonNo').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
- value: 'value',
- text: 'text',
- });
- $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
- $('#NewTeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
- $('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
- $('#NewEmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
- $('#ClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
- $('#NewClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
- //调度开始时间
- $('#AttemperStartTime').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetList?queryJson=' + JSON.stringify({}),
- value: 'LessonDate',
- text: 'LessonDate'
- });
- //调度结束时间
- $('#AttemperEndTime').lrselect({
- allowSearch: true,
- url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetList?queryJson=' + JSON.stringify({}),
- value: 'LessonDate',
- text: 'LessonDate'
- });
-
- },
- initData: function () {
- if (!!keyValue) {
- $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/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]);
- $('.AttemperType').hide();
- $("#AttemperTimeType").removeAttr("isvalid");
- $("#AttemperTimeType").removeAttr("checkexpession");
- $("#AttemperStartTime").removeAttr("isvalid");
- $("#AttemperStartTime").removeAttr("checkexpession");
- $("#AttemperEndTime").removeAttr("isvalid");
- $("#AttemperEndTime").removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
- $('#NewEmpNo').siblings('div').html('教师');
- $('#NewClassroomNo').siblings('div').html('教室');
- $('#NewEmpNo').attr('readonly', 'readonly');
- $('#NewClassroomNo').attr('readonly', 'readonly');
- if (data[id].AttemperType == "01") {
- $('.AttemperTypeTiao').show();
- $("#AttemperTimeType").attr("isvalid", "yes");
- $("#AttemperTimeType").attr("checkexpession", "NotNull");
- $("#AttemperStartTime").attr("isvalid", "yes");
- $("#AttemperStartTime").attr("checkexpession", "NotNull");
- $("#AttemperEndTime").attr("isvalid", "yes");
- $("#AttemperEndTime").attr("checkexpession", "NotNull");
- } else if (data[id].AttemperType == "02") {
- } else if (data[id].AttemperType == "03") {
- $('.AttemperTypeDuiDiao').show();
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
- $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
- $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
- }
- }
- page.query();
- }
- });
- }
- }
- };
- bindData = function (temprow) {
- if (!!temprow) {
- //$('#F_SchoolId').lrselectSet(temprow.schooldId);
- $('#AcademicYearNo').lrselectSet(temprow.academicyear);
- $('#Semester').lrselectSet(temprow.semester);
- $('#DeptNo').lrselectSet(temprow.deptNo);
- $('#MajorNo').lrselectSet(temprow.majorNo);
- $('#LessonNo').lrselectSet(temprow.lessonNo);
- $('#TeachClassNo').lrselectSet(temprow.teachClassNo);
- $('#EmpNo').lrselectSet(temprow.empno);
- $('#ClassroomNo').lrselectSet(temprow.classRoomNo);
- page.query();
- }
- };
- bindDataNew = function (temprow) {
- if (!!temprow) {
- //$('#NewF_SchoolId').lrselectSet(temprow.schooldId);
- $('#NewAcademicYearNo').lrselectSet(temprow.academicyear);
- $('#NewSemester').lrselectSet(temprow.semester);
- $('#NewDeptNo').lrselectSet(temprow.deptNo);
- $('#NewMajorNo').lrselectSet(temprow.majorNo);
- $('#NewLessonNo').lrselectSet(temprow.lessonNo);
- $('#NewTeachClassNo').lrselectSet(temprow.teachClassNo);
- $('#NewEmpNo').lrselectSet(temprow.empno);
- $('#NewClassroomNo').lrselectSet(temprow.classRoomNo);
- }
- };
- // 设置表单数据
- setFormData = function (processId) {
- if (!!processId) {
- $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetFormDataByProcessId?processId=' + processId, function (data) {
- for (var id in data) {
- if (!!data[id] && data[id].length > 0) {
- $('#' + id).jfGridSet('refreshdata', data[id]);
- }
- else {
- if (id == 'ArrangeLessonTermAttemper') {
- keyValue = data[id].Id;
- }
- $('[data-table="' + id + '"]').lrSetFormData(data[id]);
- $('.AttemperType').hide();
- $("#AttemperTimeType").removeAttr("isvalid");
- $("#AttemperTimeType").removeAttr("checkexpession");
- $("#AttemperStartTime").removeAttr("isvalid");
- $("#AttemperStartTime").removeAttr("checkexpession");
- $("#AttemperEndTime").removeAttr("isvalid");
- $("#AttemperEndTime").removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
- $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
- $('#NewEmpNo').siblings('div').html('教师');
- $('#NewClassroomNo').siblings('div').html('教室');
- $('#NewEmpNo').attr('readonly', 'readonly');
- $('#NewClassroomNo').attr('readonly', 'readonly');
- if (data[id].AttemperType == "01") {
- $('.AttemperTypeTiao').show();
- $("#AttemperTimeType").attr("isvalid", "yes");
- $("#AttemperTimeType").attr("checkexpession", "NotNull");
- $("#AttemperStartTime").attr("isvalid", "yes");
- $("#AttemperStartTime").attr("checkexpession", "NotNull");
- $("#AttemperEndTime").attr("isvalid", "yes");
- $("#AttemperEndTime").attr("checkexpession", "NotNull");
- } else if (data[id].AttemperType == "02") {
- } else if (data[id].AttemperType == "03") {
- $('.AttemperTypeDuiDiao').show();
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
- $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
- $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
- $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
- }
- }
- }
- });
- }
- }
- // 验证数据是否填写完整
- validForm = function () {
- if (!$('#form').lrValidform()) {
- return false;
- }
- return true;
- };
- // 保存数据
- save = function (processId, callBack, i) {
- var formData = $('body').lrGetFormData();
- if (formData.AttemperType == "03") { //对调:校区、学年、学期需要一致
- //if (formData.F_SchoolId !== formData.NewF_SchoolId || formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
- if (formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
- learun.alert.warning("校区、学年、学期不一致!");
- return false;
- }
- } else if (formData.AttemperType == "01") { //调课:调度时间比较
- if (formData.AttemperEndTime < formData.AttemperStartTime) {
- learun.alert.warning("调度结束时间应该大于调度开始时间!");
- return false;
- }
- }
- if (!!processId) {
- formData.ProcessId = processId;
- }
- var postData = {
- strEntity: JSON.stringify(formData)
- };
- $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/SaveForm?keyValue=' + keyValue, postData, function (res) {
- // 保存成功后才回调
- if (!!callBack) {
- callBack(res, formData, i);
- }
- });
- };
- page.init();
- }
|