/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2021-11-29 11:43 * 描 述:开课计划 */ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; var cddeptname = ''; var page = { init: function () { page.inittree(); page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 250, 400); //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); $('#AcademicYearNo').lrselect({ placeholder: "请选择学年", allowSearch: true, url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', value: 'value', text: 'text' }); //年级 $('#Grade').lrselect({ placeholder: "请选择年级", allowSearch: true, url: top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/GetGradeData', value: 'value', text: 'text' }); $('#Semester').lrDataItemSelect({ code: 'Semester' }); $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' }); $('#MajorNo').lrselect({ url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', param: { strWhere: " 1=1 and CheckMark=1 " }, value: "majorno", text: "majorname", maxHeight: 200, select: function (item) { if (item) { $('#LessonNo').lrselectRefresh({ url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=LessonInfo', param: { strWhere: " 1=1 and CheckMark=1 and teachmajorno='" + item.majorno + "'" }, value: "lessonno", text: "lessonname", maxHeight: 200 }); } } }); $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form', width: 800, height: 450, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { if (keyValue.indexOf(',') != -1) { learun.alert.warning("只能选择一条记录进行编辑!"); return; } var state = $('#gridtable').jfGridValue('State'); if (state == 0) { learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form?keyValue=' + keyValue, width: 800, height: 450, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } else { learun.layerConfirm('是否确认修改,修改后可能会造成不可弥补的错误!!!', function (res) { if (res) { learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form?keyValue=' + keyValue, width: 800, height: 450, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); } } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { var state = $('#gridtable').jfGridValue('State').split(','); var allEmpty = true; for (var i = 0; i < state.length; i++) { if (state[i] != 0) { allEmpty = false; } } if (allEmpty) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ClassPlan/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } else { learun.layerConfirm('是否确认删除该项,删除数据后不可恢复!!!', function (item) { if (item) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ClassPlan/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } } }); //排课 $('#lr_courses').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { var state = $('#gridtable').jfGridValue('State').split(','); var allEmpty = true; for (var i = 0; i < state.length; i++) { if (state[i] != 0) { allEmpty = false; } } if (allEmpty) { learun.layerConfirm('确定要进行排课么!', function (res) { if (res) { learun.postForm( top.$.rootUrl + '/EducationalAdministration/ClassPlan/CourseArranging', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } else { learun.alert.warning("不嫩选择已排课的课程计划"); } } }); }, inittree: function () { $('#cddeptTree').lrtree({ url: top.$.rootUrl + '/EducationalAdministration/CdDept/GetTree', param: { parentId: '0' }, nodeClick: page.treeNodeClick }); //$('#cddeptTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681'); }, treeNodeClick: function (item) { cddeptname = item.id; $('#titleinfo').text(item.text); page.search(); var NDeptNo = item.id; if (NDeptNo != null && NDeptNo != "" && NDeptNo != 'undefined') { $('#MajorNo').lrselectRefresh({ url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', param: { strWhere: " 1=1 and CheckMark=1 and deptno in (" + NDeptNo + ")" }, value: "majorno", text: "majorname", maxHeight: 200 }); } else { $('#MajorNo').lrselectRefresh({ url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', param: { strWhere: " 1=1 and CheckMark=1 " }, value: "majorno", text: "majorname", maxHeight: 200 }); } }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/GetPageList', headData: [ { label: "学年", name: "AcademicYearNo", width: 80, align: "left" }, { label: "学期", name: "Semester", width: 50, align: "left" }, { label: "年级", name: "Grade", width: 50, align: "left" }, { label: "专业编码", name: "MajorNo", width: 80, align: "left" }, { label: "专业名称", name: "MajorNo", width: 200, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', key: value, keyId: 'majorno', callback: function (_data) { callback(_data['majorname']); } }); } }, { label: "课程编码", name: "LessonNo", width: 100, align: "left" }, { label: "课程名称", name: "LessonName", width: 200, align: "left", }, { label: "课程类型", name: "LessonTypeId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType', key: value, keyId: 'ltid', callback: function (_data) { callback(_data['lessontypename']); } }); } }, { label: "状态", name: "State", width: 80, align: "left", formatter: function (cellvalue, row) { if (cellvalue == 0) { return '未排课'; } if (cellvalue == 1) { return '已排课'; } } }, { label: "考试类型", name: "ExamType", width: 80, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'ExamType', callback: function (_data) { callback(_data.text); } }); } }, { label: "学分", name: "StudyScore", width: 80, align: "left" }, { label: "拟开教学班数", name: "TeachClassNum", width: 100, align: "left" }, //{ label: "人数", name: "StuNum", width: 80, align: "left" }, { label: "周课时", name: "WeekLessonHour", width: 80, align: "left" }, { label: "理论课时", name: "WeekHourClassroom", width: 80, align: "left" }, { label: "实践课时", name: "PracticeHour", width: 80, align: "left" }, { label: "起始周次", name: "StartWeek", width: 80, align: "left" }, //{ label: "结束周次", name: "EndWeek", width: 80, align: "left" }, //{ // label: "负责开课院系", name: "TeachDeptNo", width: 100, align: "left", // formatterAsync: function (callback, value, row, op, $cell) { // learun.clientdata.getAsync('custmerData', { // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', // key: value, // keyId: 'deptno', // callback: function (_data) { // callback(_data['deptname']); // } // }); // } //}, { label: "备注", name: "Remark", width: 100, align: "left" }, ], mainId: 'ID', sidx: 'MakeDate desc', isMultiselect: true, isPage: true }); page.search(); }, search: function (param) { param = param || {}; param.DeptNo = cddeptname; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { $('#gridtable').jfGridSet('reload'); }; page.init(); }