|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-09-26 10:47
- * 描 述:教学调度
- */
- var refreshGirdData;
- var selectedRow;
- 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: "AttemperTimeType", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'AttemperTimeType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- //{
- // 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']);
- // }
- // });
- // }
- //},
- { 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: "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: "AttemperStartTime", width: 100, align: "left" },
- { label: "调度结束时间", name: "AttemperEndTime", width: 100, align: "left" },
- {
- 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 '<span class=\"label label-success\" >已提交</span>';
- } else {
- return '<span class=\"label label-default\" >未提交</span>';
- }
- }
- },
- {
- 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 '<span class=\"label label-warning\" >审核中</span>';
- } else if (cellvalue == 2) {
- return '<span class=\"label label-success\" >审核通过</span>';
- } else {
- return '<span class=\"label label-default\" >草稿</span>';
- }
- }
- },
- ],
- mainId: 'Id',
- isPage: true,
- sord: 'desc',
- sidx: 'CreateTime'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#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();
- }
- };
- page.init();
- }
|