|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-01-24 17:03
- * 描 述:课程信息管理
- */
- var refreshGirdData;
- var companyId;
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.inittree();
- page.initGird();
- page.bind();
- page.search();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- $('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
- $('#TeachDeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
- $('#TeachMajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/Form',
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('LessonId');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(',') != -1) {
- learun.alert.warning("只能选择一条记录进行编辑!");
- return;
- }
- var CheckMark = $('#gridtable').jfGridValue('CheckMark');
- if (CheckMark === "true") {
- learun.alert.warning("当前项目已审核不能编辑!");
- return;
- }
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/Form?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('LessonId');
- if (learun.checkrow(keyValue)) {
- var CheckMark = $('#gridtable').jfGridValue('CheckMark');
- if (CheckMark.indexOf('true') != -1) {
- learun.alert.warning("选中记录中包含已启用项目,已启用不能删除!");
- return;
- }
- //if (CheckMark === true) {
- // learun.alert.warning("当前项目已审核不能删除!");
- // return;
- //}
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //审核
- $('#lr_lock').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('LessonId');
- if (learun.checkrow(keyValue)) {
- var CheckMark = $('#gridtable').jfGridValue('CheckMark');
- if (CheckMark.indexOf('true') != -1) {
- learun.alert.warning("选中记录中包含已启用项目!");
- return;
- }
- //if (CheckMark === true) {
- // learun.alert.warning("当前项目已审核无需再审!");
- // return;
- //}
- learun.layerConfirm('是否确认启用该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/Lock', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //去审核
- $('#lr_unlock').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('LessonId');
- if (learun.checkrow(keyValue)) {
- var CheckMark = $('#gridtable').jfGridValue('CheckMark');
- if (CheckMark.indexOf('false') != -1) {
- learun.alert.warning("选中记录中包含已停用项目!");
- return;
- }
- //if (CheckMark === false) {
- // learun.alert.warning("当前项目还未审核不需要去审核!");
- // return;
- //}
- learun.layerConfirm('是否确认停用该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/UnLock', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- },
- inittree: function () {
- $('#companyTree').lrtree({
- url: top.$.rootUrl + '/EducationalAdministration/CdLessonType/GetTree',
- param: {},
- nodeClick: page.treeNodeClick
- });
- },
- treeNodeClick: function (item) {
- companyId = item.id;
- $('#titleinfo').text(item.text);
- if (companyId == "dee7bcfe-dab7-49df-8efc-406860bf2c4f") {
- page.initGirdNoMajor();
-
-
- } else {
- page.initGird();
- page.search();
- }
- },
- // 初始化列表
- initGird: function () {
- //$("#gridtable")[0].dfop = undefined;
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetPageList',
- headData: [
- { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
- { label: "课程名称", name: "LessonName", width: 200, align: "left" },
- {
- label: "系部", name: "TeachDeptNo", width: 200, 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: "TeachMajorNo", 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: "EnName", width: 100, align: "left" },
- { label: "学分", name: "StudyScore", width: 50, align: "left" },
- { label: "周理论学时", name: "WeekStudyHour", width: 80, align: "left" },
- { label: "周实验学时", name: "WeekPracticeHour", width: 80, align: "left" },
- { label: "每周课时", name: "TotalStudyHour", width: 80, align: "left" },
- { label: "总课时", name: "TotalHours", width: 80, align: "left" },
- {
- label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
- formatter: function (cellvalue) {
- return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- },
- {
- label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
- key: value,
- keyId: 'lessonname',
- callback: function (_data) {
- callback(_data['lessonno']);
- }
- });
- }
- },
- {
- label: "修读对象", name: "WhoStudy", width: 120, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
- key: value,
- keyId: 'lessonno',
- callback: function (_data) {
- callback(_data['lessonname']);
- }
- });
- }
- },
- {
- label: "课程分类", name: "LessonSortNo", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
- key: value,
- keyId: 'lessonsortno',
- callback: function (_data) {
- callback(_data['lessonsortname']);
- }
- });
- }
- },
- {
- label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
- key: value,
- keyId: 'lessonsortdetailno',
- callback: function (_data) {
- callback(_data['lessonsortdetailname']);
- }
- });
- }
- },
- {
- label: "是否启用", name: "CheckMark", width: 80, align: "center",
- formatter: function (cellvalue) {
- return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- }
- ],
- mainId: 'LessonId',
- isPage: true,
- isMultiselect: true,
- sidx: 'LessonNo',
- sord: 'ASC'
- });
-
- },
- initGirdNoMajor: function () {
- //$("#gridtable")[0].dfop = undefined;
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetPageList',
- headData: [
- { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
- { label: "课程名称", name: "LessonName", width: 200, align: "left" },
- { label: "课程简称", name: "EnName", width: 100, align: "left" },
- { label: "学分", name: "StudyScore", width: 50, align: "left" },
- { label: "周理论学时", name: "WeekStudyHour", width: 80, align: "left" },
- { label: "周实验学时", name: "WeekPracticeHour", width: 80, align: "left" },
- { label: "每周课时", name: "TotalStudyHour", width: 80, align: "left" },
- { label: "总学时", name: "TotalHours", width: 80, align: "left" },
- {
- label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
- formatter: function (cellvalue) {
- return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- },
- {
- label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
- key: value,
- keyId: 'lessonname',
- callback: function (_data) {
- callback(_data['lessonno']);
- }
- });
- }
- },
- {
- label: "修读对象", name: "WhoStudy", width: 120, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
- key: value,
- keyId: 'lessonno',
- callback: function (_data) {
- callback(_data['lessonname']);
- }
- });
- }
- },
- {
- label: "课程分类", name: "LessonSortNo", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
- key: value,
- keyId: 'lessonsortno',
- callback: function (_data) {
- callback(_data['lessonsortname']);
- }
- });
- }
- },
- {
- label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
- key: value,
- keyId: 'lessonsortdetailno',
- callback: function (_data) {
- callback(_data['lessonsortdetailname']);
- }
- });
- }
- },
- {
- label: "审核标志", name: "CheckMark", width: 80, align: "center",
- formatter: function (cellvalue) {
- return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- }
- ],
- mainId: 'LessonId',
- isPage: true,
- isMultiselect: true,
- sidx: 'LessonNo',
- sord: 'ASC'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.LessonTypeId = companyId;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|