/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2022-04-14 09:50
* 描 述:监考老师
*/
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGird();
page.bind();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
},
220,
400);
$('#AcademicYearNo').lrselect({
placeholder: "学年",
allowSearch: true,
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
value: 'value',
text: 'text'
});
//学期
$('#Semester').lrselect({
placeholder: "学期",
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
value: 'value',
text: 'text'
});
$.get('/Home/GetYearAndSemesteResult', function (ref) {
if (ref.code == "200") {
$('#AcademicYearNo').lrselectSet(ref.data.Item1);
$('#Semester').lrselectSet(ref.data.Item3);
}
}.bind(this), "json");
$('#ITEnabled').lrDataItemSelect({
code: "YesOrNoBit"
});
// 刷新
$('#lr_refresh').on('click',
function () {
location.reload();
});
// 新增
$('#lr_add').on('click',
function () {
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Form',
width: 600,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('ITId');
if (learun.checkrow(keyValue)) {
var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
if (ITEnabled.indexOf('true') != -1) {
learun.alert.warning("选中记录已启用!");
return;
}
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl +
'/EducationalAdministration/Exam_InvigilateTeacher/Form?keyValue=' +
keyValue,
width: 600,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('ITId');
if (learun.checkrow(keyValue)) {
var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
if (ITEnabled.indexOf('true') != -1) {
learun.alert.warning("选中记录已启用!");
return;
}
learun.layerConfirm('是否确认删除该项!',
function (res) {
if (res) {
learun.deleteForm(
top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/DeleteForm',
{ keyValue: keyValue },
function () {
refreshGirdData();
});
}
});
}
});
// 打印
$('#lr_print').on('click',
function () {
$('#gridtable').jqprintTable();
});
//启用
$('#lr_lock').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('ITId');
if (learun.checkrow(keyValue)) {
var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
if (ITEnabled.indexOf('true') != -1) {
learun.alert.warning("选中记录中包含已启用项目!");
return;
}
learun.layerConfirm('是否确认启用选中记录!',
function (res) {
if (res) {
learun.deleteForm(
top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Lock',
{ keyValue: keyValue, ITEnabled: 1 },
function () {
refreshGirdData();
});
}
});
}
});
//禁用
$('#lr_unlock').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('ITId');
if (learun.checkrow(keyValue)) {
var ELEnabled = $('#gridtable').jfGridValue('ITEnabled');
if (ELEnabled.indexOf('false') != -1) {
learun.alert.warning("选中记录中包含已停用项目!");
return;
}
learun.layerConfirm('是否确认停用选中记录!',
function (res) {
if (res) {
learun.deleteForm(
top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Lock',
{ keyValue: keyValue, ITEnabled: 0 },
function () {
refreshGirdData();
});
}
});
}
});
// 导入
$('#lr_importByBasic').on('click',
function () {
learun.layerForm({
id: 'form_import',
title: '导入',
url: top.$.rootUrl +
'/EducationalAdministration/Exam_InvigilateTeacher/FormYearSemester?type=1',
width: 500,
height: 300,
btn: ['一键导入', '关闭'],
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 按条件清空数据
$('#lr_emptyWhere').on('click',
function () {
learun.layerForm({
id: 'form_empty',
title: '清空数据',
url: top.$.rootUrl +
'/EducationalAdministration/Exam_InvigilateTeacher/FormYearSemester?type=2',
width: 500,
height: 300,
btn: ['清空', '关闭'],
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/GetPageList',
headData: [
{ label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
{ label: "学期", name: "Semester", width: 100, align: "left" },
{ label: "教师编号", name: "EmpNo", width: 100, align: "left" },
{ label: "教师姓名", name: "EmpName", width: 100, align: "left" },
{
label: "是否启用", name: "ITEnabled", width: 100, align: "left",
formatter: function (cellvalue) {
return cellvalue == 1 ? "是" : "否";
}
},
],
mainId: 'ITId',
isMultiselect: true,
isPage: true,
sidx: 'AcademicYearNo desc,Semester desc,ITOrder asc'
});
page.search();
},
search: function (param) {
param = param || {};
if (IsTwoDept)
param.ImportDeptNo = CurrentDeptNo;
else
param.ImportDeptNo = "0";
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
page.init();
}