/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2019-09-26 10:47 * 描 述:教学调度 */ var refreshGirdData; var selectedRow; var weekChina = ["一", "二", "三", "四", "五", "六", "日"]; var bootstrap = function ($, learun) { "use strict"; var processId = ''; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 300, 400); $('#AttemperType').lrDataItemSelect({ code: 'AttemperType' }); $('#AttemperTimeType').lrDataItemSelect({ code: 'AttemperTimeType' }); //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); $('#AcademicYearNo').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' }); $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' }); $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); $('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/Form', width: 1000, height: 600, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { //processId = learun.newGuid(); //res = top[id].save(processId, refreshGirdData); res = top[id].save('', function () { page.search(); }); } return res; } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { if (selectedRow.Status == 1) {//提交 learun.alert.warning("当前课程异动记录已提交!"); return false; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/Form?keyValue=' + keyValue, width: 1000, height: 600, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { if (selectedRow.Status !== 0) { learun.alert.warning("当前课程异动记录已提交,无法删除!"); return false; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/DeleteForm', { keyValue: keyValue }, function () { //refreshGirdData(); page.search(); }); } }); } }); // 提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { if (selectedRow.Status !== 0) { learun.alert.warning("当前课程异动记录已提交!"); return false; } learun.layerConfirm('是否确认提交该项!', function (res) { if (res) { processId = learun.newGuid(); learun.postForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/ModifyStatus', { keyValue: keyValue, status: 1, processId: processId }, function (res) { //selectedRow.ProcessId = processId; refreshGirdData(res, {}); }); } }); } }); // 查看 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { if (selectedRow.Status == 0) { learun.alert.warning("当前课程异动记录未提交,请提交后再查看!"); return false; } learun.layerForm({ id: 'formview', title: '查看', url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/FormView?keyValue=' + keyValue, width: 1000, height: 600, btn: null }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetPageList', headData: [ { label: "调度类型", name: "AttemperType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'AttemperType', callback: function (_data) { callback(_data.text); } }); } }, { label: "调度备注", name: "AttemperRemark", width: 100, align: "left" }, { label: "学年", name: "AcademicYearNo", width: 100, align: "left" }, { label: "学期", name: "Semester", width: 100, align: "left" }, { label: "系部", name: "DeptNo", 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: "MajorNo", width: 100, 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", 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: "TeachClassNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', key: value, keyId: 'classno', callback: function (_data) { callback(_data['classname']); } }); } }, { label: "教师", name: "EmpNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', key: value, keyId: 'empno', callback: function (_data) { callback(_data['empname']); } }); } }, { label: "教室", name: "ClassroomNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', key: value, keyId: 'classroomno', callback: function (_data) { callback(_data['classroomname']); } }); } }, { label: "日期", name: "AcademicYearNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) { if (res.code == learun.httpCode.success) { var t_data = []; for (var i = 0; i < res.data.length; i++) { if (t_data.indexOf(res.data[i].LessonDate.substring(0, 10)) < 0) { t_data.push(res.data[i].LessonDate.substring(0, 10)) } } callback(t_data.join(',')); } }); } }, { label: "星期/节次", name: "AcademicYearNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) { if (res.code == learun.httpCode.success) { var t_data = []; var t_w = [] for (var i = 0; i < res.data.length; i++) { if (t_data.indexOf(res.data[i].LessonTime.substring(1)) < 0) { t_data.push(res.data[i].LessonTime.substring(1)) } if (t_w.indexOf(res.data[i].LessonTime.substring(0, 1)) < 0) { t_w.push(res.data[i].LessonTime.substring(0, 1)) } } if (row.AttemperType == '04') { callback("星期" + weekChina[t_w.join(',') - 1] + '第' + t_data.sort((a, b) => { return a - b; }).join(',') + '节'); } else { callback(''); } } }); } }, //调课属性 { label: "调课日期", name: "AcademicYearNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) { if (res.code == learun.httpCode.success) { var t_data = []; for (var i = 0; i < res.data.length; i++) { if (t_data.indexOf(res.data[i].NewLessonDate.substring(0, 10)) < 0) { t_data.push(res.data[i].NewLessonDate.substring(0, 10)) } } if (row.AttemperType == '04') { callback(t_data.join(',')); } else { callback(''); } } }); } }, { label: "调课星期/节次", name: "AcademicYearNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) { if (res.code == learun.httpCode.success) { var t_data = []; var t_w = [] for (var i = 0; i < res.data.length; i++) { if (t_data.indexOf(res.data[i].NewLessonTime.substring(1)) < 0) { t_data.push(res.data[i].NewLessonTime.substring(1)) } if (t_w.indexOf(res.data[i].NewLessonTime.substring(0, 1)) < 0) { t_w.push(res.data[i].NewLessonTime.substring(0, 1)) } } if (row.AttemperType == '04') { callback("星期" + weekChina[t_w.join(',') - 1] + '第' + t_data.sort((a, b) => { return a - b; }).join(',') + '节'); } else { callback(''); } } }); } }, //换课属性 { label: "换课时限", name: "AttemperTimeType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'AttemperTimeType', callback: function (_data) { if (row.AttemperType == '01') { callback(_data.text); } else { callback(''); } } }); } }, { label: "换课教师", name: "NewEmpNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', key: value, keyId: 'empno', callback: function (_data) { if (row.AttemperType == '01') { callback(_data['empname']); } else { callback(''); } } }); } }, { label: "换课教室", name: "NewClassroomNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', key: value, keyId: 'classroomno', callback: function (_data) { if (row.AttemperType == '01') { callback(_data['classroomname']); } else { callback(''); } } }); } }, { label: "换课开始时间", name: "AttemperStartTime", width: 100, align: "left" }, { label: "换课结束时间", name: "AttemperEndTime", width: 100, align: "left" }, //对调属性 { label: "对调系部", name: "NewDeptNo", 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: "NewMajorNo", width: 100, 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: "NewLessonNo", 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: 'lessonno', callback: function (_data) { callback(_data['lessonname']); } }); } }, { label: "对调班级", name: "NewTeachClassNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', key: value, keyId: 'classno', callback: function (_data) { callback(_data['classname']); } }); } }, { label: "对调教师", name: "NewEmpNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', key: value, keyId: 'empno', callback: function (_data) { callback(_data['empname']); } }); } }, { label: "对调教室", name: "NewClassroomNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', key: value, keyId: 'classroomno', callback: function (_data) { callback(_data['classroomname']); } }); } }, //审核相关属性 { label: "创建用户", name: "CreateUserId", width: 100, align: "left", formatter: function (cellvalue, row) { return row.CreateUserName; } }, { label: "提交时间", name: "SubmitTime", width: 130, align: "left" }, { label: "状态", name: "Status", width: 100, align: "left", formatter: function (cellvalue, row) { if (cellvalue == 1) { return '已提交'; } else { return '未提交'; } } }, { label: "审核用户", name: "CheckUserId", width: 100, align: "left", formatter: function (cellvalue, row) { return row.CheckUserName; } }, { label: "审核时间", name: "CheckTime", width: 130, align: "left" }, { label: "审核状态", name: "CheckStatus", width: 100, align: "left", formatter: function (cellvalue, row) { if (cellvalue == 1) { return '审核中'; } else if (cellvalue == 2) { return '审核通过'; } else { return '草稿'; } } }, //{ // label: "校区", name: "F_SchoolId", width: 100, align: "left", // formatterAsync: function (callback, value, row, op, $cell) { // learun.clientdata.getAsync('custmerData', { // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', // key: value, // keyId: 'f_companyid', // callback: function (_data) { // callback(_data['f_fullname']); // } // }); // } //}, ], mainId: 'Id', isPage: true, sord: 'desc', sidx: 'CreateTime' }); page.search(); }, search: function (param) { param = param || {}; if (learun.clientdata.get(['userinfo']).account.toLowerCase() != "system") { param.CreateUserId = learun.clientdata.get(['userinfo']).userId; } $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function (res, postData) { //if (res.code == 200) { // // 发起流程 // learun.workflowapi.create({ // isNew: true, // schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号 // processId: processId, // processName: '课程异动申请',// 对应流程名称 // processLevel: '1', // description: '', // formData: JSON.stringify(postData), // callback: function (res, data) { // } // }); // page.search(); //} if (res && res.code && res.code == 200) { // 发起流程 var postData = { schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号 processId: processId, level: '1', }; learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { learun.loading(false); }); } page.search(); }; page.init(); }