/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2022-11-08 11:05 * 描 述:学生赛事奖励 */ var refreshGirdData; 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); }, 240, 400); $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' }); $('#ClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); $('#SCLevel').lrDataItemSelect({ code: 'Level' }); //学年 $('#AcademicYearNo').lrselect({ placeholder: "请选择学年", allowSearch: true, url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', value: 'value', text: 'text' }); //学期 $('#Semester').lrselect({ placeholder: "请选择学期", allowSearch: true, url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', value: 'value', text: 'text' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form', width: 1000, height: 800, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var Status = $('#gridtable').jfGridValue('Status'); if (Status == '2') { learun.alert.warning("当前项目已审批通过!"); return; } if (Status != '0') { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form?keyValue=' + keyValue, width: 1000, height: 800, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); } }); //修改分值 $('#lr_updscore').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var Status = $('#gridtable').jfGridValue('Status'); if (Status == '2') { learun.alert.warning("当前项目已审批通过!"); return; } if (Status != '0') { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerForm({ id: 'form_updscore', title: '修改分值', url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/FormScore?keyValue=' + keyValue, width: 500, height: 350, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); } }); //复制 $('#lr_copy').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form?keyValue=' + keyValue + '&type=copy', width: 1000, height: 800, 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'); if (learun.checkrow(keyValue)) { var Status = $('#gridtable').jfGridValue('Status'); if (Status == '2') { learun.alert.warning("当前项目已审批通过!"); return; } if (Status != '0') { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StudentCompetition/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var Status = $('#gridtable').jfGridValue('Status'); if (Status == '2') { learun.alert.warning("当前项目已审批通过!"); return; } if (Status != '0') { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerConfirm('是否确认提交该项!', function (res) { if (res) { processId = learun.newGuid(); learun.postForm(top.$.rootUrl + '/EducationalAdministration/StudentCompetition/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) { refreshGirdData(res, {}); }); } }); } }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/GetPageList', headData: [ { label: "学年", name: "AcademicYearNo", width: 80, align: "left" }, { label: "学期", name: "Semester", width: 80, align: "left" }, { label: "学生学号", name: "StuNo", width: 150, align: "left" }, { label: "学生姓名", name: "StuName", 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: "ClassNo", 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: "SCName", width: 100, align: "left" }, { label: "赛事级别", name: "SCLevel", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'Level', callback: function (_data) { callback(_data.text); } }); } }, { label: "赛事种类", name: "SCType", width: 100, align: "left" }, { label: "颁发单位", name: "Unit", width: 100, align: "left" }, { label: "分值", name: "Score", width: 100, align: "left" }, { label: "获取时间", name: "SCTime", width: 100, align: "left", formatter: function (cellvalue, row) { return learun.formatDate(cellvalue, 'yyyy-MM-dd'); } }, { label: "状态", name: "Status", width: 100, align: "left", formatter: function (cellvalue, row) { if (cellvalue === 1) { return '审批中'; } else if (cellvalue === 2) { return '审核通过'; } else { return '草稿'; } } }, ], mainId: 'Id', isPage: true }); page.search(); }, search: function (param) { param = param || {}; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function (res, postData) { if (res && res.code && res.code == 200) { var postData = { schemeCode: 'StudentCompetition',// 填写流程对应模板编号 processId: processId, level: '1', }; learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { learun.loading(false); }); } page.search(); }; page.init(); }