2653 lines
112 KiB
JavaScript
2653 lines
112 KiB
JavaScript
|
|
var webroot = $("#hdWebroot").val();
|
|||
|
|
var rootUrl = webroot + '/exam/exampaper/';
|
|||
|
|
var deleteUrl = rootUrl + 'delete';//删除地址
|
|||
|
|
var editexamPage =rootUrl + 'editexamPage';//编辑页面地址
|
|||
|
|
var editexampaperPage =rootUrl + 'editexampaperPage';//编辑页面地址
|
|||
|
|
var importnewexampaperPage =rootUrl + 'importnewexampaperPage';//试卷导入页面地址
|
|||
|
|
var fileImportUrl = rootUrl + 'fileImport';//试卷导入按钮
|
|||
|
|
var fileImportQuestionUrl = rootUrl + 'fileImportQuestion';//试卷试题导入按钮
|
|||
|
|
var fileImportResearchUrl = rootUrl + 'fileImportResearch';//调研问卷导入按钮
|
|||
|
|
var fileImportQuestionUrl_R = rootUrl + 'fileImportQuestionR';//调研问卷试题导入按钮
|
|||
|
|
var saveHistoryUrl = rootUrl + 'saveHistoryExam';//保存历史问卷
|
|||
|
|
var randUrl = rootUrl + 'randExam';//随机添加试题
|
|||
|
|
var randNumUrl = rootUrl + 'randNum';//随机添加试题更新序号
|
|||
|
|
// var departmentComboxUrl = rootUrl+'departmentCombox';//部门下拉框
|
|||
|
|
var departmentAddUrl= rootUrl+'departmentAdd';//添加部门
|
|||
|
|
var departmentListUrl= rootUrl+'departmentList';//初始化添加部门列表
|
|||
|
|
// var courseComboxUrl = rootUrl+'courseCombox';//课程下拉框
|
|||
|
|
var deleteLimitationUrl = rootUrl + 'deleteLimitation';//发放范围——删除
|
|||
|
|
|
|||
|
|
var examId = "";//试卷id,想使用的历史问卷的id
|
|||
|
|
var count = 0;//添加部门计数
|
|||
|
|
// var exam_id = "";//在该试卷上添加部门时使用的试卷id
|
|||
|
|
var limitation = "";//指定发放范围,1全所2部门3人员4班级5课程
|
|||
|
|
var examState = {firstState:"未开始", secondState:"正在进行", thirdState:"已关闭", fourthState:"已撤销",fifthState:"线下考试"};//试卷状态
|
|||
|
|
|
|||
|
|
var limitationUrl = rootUrl + 'limitationList';//发放范围 grid list
|
|||
|
|
// var departmentComboxUrl = rootUrl+'departmentCombox';//部门下拉框
|
|||
|
|
var departmentComboxUrl = webroot+'/train/createClass/GetOrgList?orgid=001001001';
|
|||
|
|
var classComboxUrl = rootUrl+'classCombox';//班级下拉框
|
|||
|
|
var courseComboxUrl = rootUrl+'courseCombox';//课程下拉框
|
|||
|
|
var saveLimitationUrl = rootUrl + 'saveLimitation';//发放范围save
|
|||
|
|
var deleteOtherUrl = rootUrl + 'deleteOtherLimitation';//删除其他发放范围
|
|||
|
|
var saveCourseUrl = rootUrl + 'saveCourse';//发放范围save课程对应的人员
|
|||
|
|
var saveClassUrl = rootUrl + 'saveClass';//发放范围save班级对应的人员
|
|||
|
|
var deleteLimitationExampaperUrl = rootUrl + 'deleteLimitationExampaper';//依据试卷id删除limitation表中的全所部门人员课程班级
|
|||
|
|
var deletePersonUrl = rootUrl + 'deletePerson';//删除课程班级对应的人
|
|||
|
|
var exam_id = "";//临时试卷id
|
|||
|
|
var temporary_exam = "临时试卷";
|
|||
|
|
var deleteTemporaryExamUrl = rootUrl + 'deleteTemporaryExam';//删除临时试卷
|
|||
|
|
|
|||
|
|
var exampaperReturnUrl = rootUrl + 'exampaperReturn';//查询返回试卷名称 试卷描述 试卷状态 试卷类别 +检查试卷能否发布
|
|||
|
|
var category_ = "";//试卷类别
|
|||
|
|
var categoryid_ = "";//试卷类别id
|
|||
|
|
|
|||
|
|
var checkDeleteUrl = rootUrl + 'checkDelete';//检查未开始状态之外的的试卷不允许删除
|
|||
|
|
var personImportUrl = rootUrl + 'personImport';//发放范围 人员导入
|
|||
|
|
|
|||
|
|
var updateClassUrl = rootUrl + 'updateClass';//更新班级班级对应人的表的exam_id
|
|||
|
|
var updateCourseUrl = rootUrl + 'updateCourse';//更新班级课程对应人的表的exam_id
|
|||
|
|
var updateLimitationUrl = rootUrl + "updateLimitation";//更新limitation表中的试卷id
|
|||
|
|
var deleteExamQuestionUrl = rootUrl + 'deleteExamQuestion';//删除试卷中的试题
|
|||
|
|
|
|||
|
|
var previewPageUrl = rootUrl + 'previewPage';//预览 试卷 问卷
|
|||
|
|
var previewUrl = rootUrl + 'preview';//预览 试卷 问卷
|
|||
|
|
|
|||
|
|
var detailUrl = rootUrl + 'detail';//考试调研详情 查看已答未答
|
|||
|
|
|
|||
|
|
var saveResitPaperUrl = rootUrl + 'saveResitPaper';//重新推送考试 保存原试卷试题至补考试卷中
|
|||
|
|
var exam_id_resit = "";//重新考试要用到的原试卷id
|
|||
|
|
var srp = 0;//判断是否执行 重新推送考试 保存原试卷试题至补考试卷中的方法 0不执行1执行
|
|||
|
|
|
|||
|
|
var getUserNameAndCodeUrl= webroot + '/train/plantodo/pdcreateclass/' + 'getUserNameAndCode';
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
//------------------------属性-------------------------------------
|
|||
|
|
var listUrl = rootUrl + 'list';//分页数据地址
|
|||
|
|
var saveUrl = rootUrl + 'save';//保存添加数据地址
|
|||
|
|
|
|||
|
|
var dialogSize = {width: '95%', height: '95%'};//弹出窗口大小
|
|||
|
|
var dialog = $('#dialog');
|
|||
|
|
var grid_form = $('#grid_form');
|
|||
|
|
|
|||
|
|
var grid = $('#grid');
|
|||
|
|
var pg = "";//控制考试与调研页面交替,1考试2调研
|
|||
|
|
pg = $('#pg').val();
|
|||
|
|
|
|||
|
|
var list_editexampaper_Url = rootUrl + 'list_editexampaper';//编辑试卷内容 list地址
|
|||
|
|
//var save_editexampaper_Url = rootUrl + 'save_editexampaper';//编辑试卷内容 保存数据地址
|
|||
|
|
var comboxUrl=rootUrl+ 'examPaperCombox';//选择历史问卷 下拉框
|
|||
|
|
|
|||
|
|
var dialog_department = $('#dialog_department');//发放范围 部门 弹出窗口
|
|||
|
|
var grid_form_department = $('#grid_form_department');//发放范围 部门 弹出窗口 form
|
|||
|
|
var dialog_person = $('#dialog_person');//发放范围 人员 弹出窗口
|
|||
|
|
var grid_form_person = $('#grid_form_person');//发放范围 人员 弹出窗口 form
|
|||
|
|
var dialog_class = $('#dialog_class');//发放范围 班级 弹出窗口
|
|||
|
|
var grid_form_class = $('#grid_form_class');//发放范围 班级 弹出窗口 form
|
|||
|
|
var dialog_course = $('#dialog_course');//发放范围 课程 弹出窗口
|
|||
|
|
var grid_form_course = $('#grid_form_course');//发放范围 课程 弹出窗口 form
|
|||
|
|
var dialog_personimport = $('#dialog_personimport');//发放范围 人员导入 弹出窗口
|
|||
|
|
var grid_form_personimport = $('#grid_form_personimport');//发放范围 人员导入 弹出窗口 form
|
|||
|
|
|
|||
|
|
var getQuestionNumUrl = rootUrl +'getQuestionNum';//判断试卷有无试题
|
|||
|
|
var resitUrl = rootUrl + 'resit';//重新考试存入缺考和不及格人员
|
|||
|
|
|
|||
|
|
|
|||
|
|
//-----------------------初始化--------------------------------------
|
|||
|
|
initExampapersGrid();
|
|||
|
|
initExampapersForm();
|
|||
|
|
// addFilter();
|
|||
|
|
addEvents();
|
|||
|
|
|
|||
|
|
//-------------------------------------方法--------------------------------------------------------
|
|||
|
|
function initExampapersGrid() {
|
|||
|
|
//初始化搜索框
|
|||
|
|
$('#searchbox').uiSearchbox({
|
|||
|
|
width: 240,
|
|||
|
|
prompt: '试卷名称|试卷类别|部门',
|
|||
|
|
searcher: function (v) {
|
|||
|
|
grid.uiGrid('loadData', {queryParams: {key: $.trim(v)}, pageIndex: 1});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//初始化grid
|
|||
|
|
grid.uiGrid({
|
|||
|
|
url: listUrl,
|
|||
|
|
queryParams:{pg: pg},
|
|||
|
|
// localData:{rows:[
|
|||
|
|
// {id: '1',name:'试卷1',category:'项目管理',categoryid:'1',passpoints:'60',description:'这张试卷是关于项目管理考试的第一张试卷',edittime:'2019-01-01 11:15:10'},
|
|||
|
|
// {id: '2',name:'试卷2',category:'项目管理',categoryid:'1',passpoints:'60',description:'这张试卷是关于项目管理考试的第二张试卷',edittime:'2019-01-03 11:15:10'},
|
|||
|
|
// {id: '3',name:'试卷3',category:'质量管理',categoryid:'2',passpoints:'60',description:'这张试卷是关于质量管理考试的第一张试卷',edittime:'2019-01-05 11:15:10'},
|
|||
|
|
// {id: '4',name:'试卷4',category:'项目管理',categoryid:'1',passpoints:'60',description:'这张试卷是关于项目管理考试的第三张试卷',edittime:'2019-01-14 11:15:10'},
|
|||
|
|
// {id: '5',name:'试卷5',category:'项目管理',categoryid:'1',passpoints:'60',description:'这张试卷是关于项目管理考试的第四张试卷',edittime:'2019-01-19 11:15:10'}]},
|
|||
|
|
defaultSortField: 'edittime'
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function initExampapersForm() {
|
|||
|
|
|
|||
|
|
//初始化 发放范围
|
|||
|
|
var formInit = function () {
|
|||
|
|
|
|||
|
|
//初始化发放范围grid
|
|||
|
|
$('#grid_limitation').uiGrid({
|
|||
|
|
url: limitationUrl
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-添加部门 弹出窗口dialog
|
|||
|
|
$('#dialog_department').uiDialog({
|
|||
|
|
title: '添加',
|
|||
|
|
icon: 'list',
|
|||
|
|
width: "60%",
|
|||
|
|
height: "60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
maskContainer: $('#dialog'),
|
|||
|
|
onOpen: function () {
|
|||
|
|
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
var dialogP = $('#dialog_department').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#grid_form_department').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#grid_form_department').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onClose:function () {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '保存',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
$('#grid_form_department').uiForm('submit', {
|
|||
|
|
url: saveLimitationUrl,
|
|||
|
|
onSubmit: function (param) {
|
|||
|
|
param.id = $('#hdIDDepartment').val();
|
|||
|
|
param.user = $('#txtdepartment').uiCombo('getText');
|
|||
|
|
param.user_id = $('#txtdepartment').uiCombo('getValue');
|
|||
|
|
param.exam_id = exam_id;
|
|||
|
|
param.exam = temporary_exam;
|
|||
|
|
param.limitation = "2";
|
|||
|
|
|
|||
|
|
var isValid = $('#grid_form_department').uiForm('validate');
|
|||
|
|
return isValid; // 返回false终止表单提交
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
dialog_department.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_department.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]});
|
|||
|
|
|
|||
|
|
//初始化 发放范围 添加部门 弹出窗口form
|
|||
|
|
grid_form_department.uiForm({
|
|||
|
|
template: 'grid_form_temp_department',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtdepartment').uiCombobox({
|
|||
|
|
mode: "remote",
|
|||
|
|
url: departmentComboxUrl
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-添加人员 弹出窗口 dialog
|
|||
|
|
dialog_person.uiDialog({
|
|||
|
|
title: '添加',
|
|||
|
|
icon: 'list',
|
|||
|
|
width: "60%",
|
|||
|
|
height: "60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
maskContainer: $('#dialog'),
|
|||
|
|
onOpen: function () {
|
|||
|
|
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
var dialogP = $('#dialog_person').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#grid_form_person').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#grid_form_person').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onClose:function () {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '保存',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
$('#grid_form_person').uiForm('submit', {
|
|||
|
|
url: saveLimitationUrl,
|
|||
|
|
onSubmit: function (param) {
|
|||
|
|
param.id = $('#hdIDPerson').val();
|
|||
|
|
param.user = $('#txtperson').uiCombobox("getText");
|
|||
|
|
param.user_id = $('#txtcard').uiCombobox("getText");
|
|||
|
|
// var uuid = guid();//前端生成32位UUID
|
|||
|
|
param.exam_id = exam_id;
|
|||
|
|
param.exam = temporary_exam;
|
|||
|
|
param.limitation = "3";
|
|||
|
|
|
|||
|
|
var isValid = $('#grid_form_person').uiForm('validate');
|
|||
|
|
return isValid; // 返回false终止表单提交
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
dialog_person.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_person.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-添加人员 弹出窗口 form
|
|||
|
|
grid_form_person.uiForm({
|
|||
|
|
template: 'grid_form_temp_person',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtperson').uiCombobox({
|
|||
|
|
mode: 'remote',
|
|||
|
|
searchable: true,
|
|||
|
|
loader: comboxLoad,
|
|||
|
|
delay:500,
|
|||
|
|
hasDownArrow:false,
|
|||
|
|
url: getUserNameAndCodeUrl,
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtperson').uiCombobox("setText",$('#txtperson').val());
|
|||
|
|
},
|
|||
|
|
onSelect:function (data) {
|
|||
|
|
var dataArray = data.usercode.split("|");
|
|||
|
|
var teacher = dataArray[0];
|
|||
|
|
var teacher_code = dataArray[1];
|
|||
|
|
$('#txtperson').uiCombobox("setText",teacher);
|
|||
|
|
$('#txtcard').uiCombobox("setText",teacher_code);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$('#txtcard').uiCombobox({
|
|||
|
|
mode: 'remote',
|
|||
|
|
searchable: true,
|
|||
|
|
loader: comboxLoad,
|
|||
|
|
delay:500,
|
|||
|
|
hasDownArrow:false,
|
|||
|
|
url: getUserNameAndCodeUrl,
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtcard').uiCombobox("setText",$('#txtcard').val());
|
|||
|
|
},
|
|||
|
|
onSelect:function (data) {
|
|||
|
|
var dataArray = data.usercode.split("|");
|
|||
|
|
var teacher = dataArray[0];
|
|||
|
|
var teacher_code = dataArray[1];
|
|||
|
|
$('#txtperson').uiCombobox("setText",teacher);
|
|||
|
|
$('#txtcard').uiCombobox("setText",teacher_code);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-添加班级 弹出窗口dialog
|
|||
|
|
$('#dialog_class').uiDialog({
|
|||
|
|
title: '添加',
|
|||
|
|
icon: 'list',
|
|||
|
|
width: "60%",
|
|||
|
|
height: "60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
maskContainer: $('#dialog'),
|
|||
|
|
onOpen: function () {
|
|||
|
|
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
var dialogP = $('#dialog_class').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#grid_form_class').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#grid_form_class').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onClose:function () {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '保存',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
$('#grid_form_class').uiForm('submit', {
|
|||
|
|
url: saveLimitationUrl,
|
|||
|
|
onSubmit: function (param) {
|
|||
|
|
param.id = $('#hdIDClass').val();
|
|||
|
|
param.user = $('#txtclass').uiCombo('getText');
|
|||
|
|
param.user_id = $('#txtclass').uiCombo('getValue');
|
|||
|
|
// var uuid = guid();//前端生成32位UUID
|
|||
|
|
param.exam_id = exam_id;
|
|||
|
|
param.exam = temporary_exam;
|
|||
|
|
param.limitation = "4";
|
|||
|
|
|
|||
|
|
var isValid = $('#grid_form_class').uiForm('validate');
|
|||
|
|
return isValid; // 返回false终止表单提交
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
dialog_class.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//通过班级id将对应的人和工资号存入limitation_class表的person和person_id
|
|||
|
|
var limitation_id = "";
|
|||
|
|
if(result.data.id != undefined){
|
|||
|
|
limitation_id = result.data.id;
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveClassUrl,
|
|||
|
|
data: {'classid':$('#txtclass').uiCombo('getValue'),
|
|||
|
|
'exam_id':exam_id,
|
|||
|
|
'limitation_id':limitation_id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
// dialog_course.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("提交失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_class.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]});
|
|||
|
|
|
|||
|
|
//初始化 发放范围 添加班级 弹出窗口form
|
|||
|
|
grid_form_class.uiForm({
|
|||
|
|
template: 'grid_form_temp_class',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtclass').uiCombobox({
|
|||
|
|
mode: "remote",
|
|||
|
|
searchable: true,
|
|||
|
|
url: classComboxUrl
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-添加课程 弹出窗口dialog
|
|||
|
|
$('#dialog_course').uiDialog({
|
|||
|
|
title: '添加',
|
|||
|
|
icon: 'list',
|
|||
|
|
width: "60%",
|
|||
|
|
height: "60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
maskContainer: $('#dialog'),
|
|||
|
|
onOpen: function () {
|
|||
|
|
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
var dialogP = $('#dialog_course').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#grid_form_course').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#grid_form_course').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onClose:function () {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '保存',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
$('#grid_form_course').uiForm('submit', {
|
|||
|
|
url: saveLimitationUrl,
|
|||
|
|
onSubmit: function (param) {
|
|||
|
|
param.id = $('#hdIDCourse').val();
|
|||
|
|
param.user = $('#txtcourse').uiCombo('getText');
|
|||
|
|
param.user_id = $('#txtcourse').uiCombo('getValue');
|
|||
|
|
// var uuid = guid();//前端生成32位UUID
|
|||
|
|
param.exam_id = exam_id;
|
|||
|
|
param.exam = temporary_exam;
|
|||
|
|
param.limitation = "5";
|
|||
|
|
|
|||
|
|
var isValid = $('#grid_form_course').uiForm('validate');
|
|||
|
|
return isValid; // 返回false终止表单提交
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
dialog_course.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//通过课程id将对应的人和工资号存入limitation_course表的person和person_id
|
|||
|
|
var limitation_id = "";
|
|||
|
|
if(result.data.id != undefined){
|
|||
|
|
limitation_id = result.data.id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveCourseUrl,
|
|||
|
|
data: {'courseid':$('#txtcourse').uiCombo('getValue'),
|
|||
|
|
'exam_id':exam_id,
|
|||
|
|
'limitation_id':limitation_id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
// dialog_course.uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("提交失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_course.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]});
|
|||
|
|
|
|||
|
|
//初始化 发放范围 添加课程 弹出窗口form
|
|||
|
|
grid_form_course.uiForm({
|
|||
|
|
template: 'grid_form_temp_course',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#txtcourse').uiCombobox({
|
|||
|
|
mode: "remote",
|
|||
|
|
searchable: true,
|
|||
|
|
url: courseComboxUrl
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围-人员导入 弹出窗口dialog
|
|||
|
|
$('#dialog_personimport').uiDialog({
|
|||
|
|
title: '导入',
|
|||
|
|
icon: 'list',
|
|||
|
|
width: "60%",
|
|||
|
|
height: "60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
maskContainer: $('#dialog'),
|
|||
|
|
onOpen: function () {
|
|||
|
|
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
var dialogP = $('#dialog_personimport').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#grid_form_personimport').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#grid_form_personimport').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onClose:function () {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 发放范围 人员导入 弹出窗口form
|
|||
|
|
grid_form_personimport.uiForm({
|
|||
|
|
template: 'grid_form_temp_perosnimport',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#btnUpload_person').bind('click', function () {
|
|||
|
|
$('#grid_form_personimport').uiForm('submit', {
|
|||
|
|
url: personImportUrl,
|
|||
|
|
dataType: "application/json",
|
|||
|
|
onSubmit: function (params) {
|
|||
|
|
params.exam_id = exam_id;
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#dialog_personimport').uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//添加部门按钮点击事件
|
|||
|
|
$('#btnDepartment').bind('click', function () {
|
|||
|
|
dialog_department.uiDialog('title').html('添加');
|
|||
|
|
dialog_department.uiDialog('setUserParam', {action: 'add'});
|
|||
|
|
dialog_department.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_department.uiDialog('button', 'btnSave').hide();
|
|||
|
|
dialog_department.uiDialog('open');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//添加人员按钮点击事件
|
|||
|
|
$('#btnPerson').bind('click', function () {
|
|||
|
|
dialog_person.uiDialog('title').html('添加');
|
|||
|
|
dialog_person.uiDialog('setUserParam', {action: 'add'});
|
|||
|
|
dialog_person.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_person.uiDialog('button', 'btnSave').hide();
|
|||
|
|
dialog_person.uiDialog('open');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//添加班级按钮点击事件
|
|||
|
|
$('#btnClass').bind('click', function () {
|
|||
|
|
dialog_class.uiDialog('title').html('添加');
|
|||
|
|
dialog_class.uiDialog('setUserParam', {action: 'add'});
|
|||
|
|
dialog_class.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_class.uiDialog('button', 'btnSave').hide();
|
|||
|
|
dialog_class.uiDialog('open');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//添加课程按钮点击事件
|
|||
|
|
$('#btnCourse').bind('click', function () {
|
|||
|
|
dialog_course.uiDialog('title').html('添加');
|
|||
|
|
dialog_course.uiDialog('setUserParam', {action: 'add'});
|
|||
|
|
dialog_course.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_course.uiDialog('button', 'btnSave').hide();
|
|||
|
|
dialog_course.uiDialog('open');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//删除
|
|||
|
|
$('#btnDelete').bind('click', function () {
|
|||
|
|
var ids = $('#grid_limitation').uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要删除的行!', 'alert');
|
|||
|
|
} else {
|
|||
|
|
deleteLimitationRow(ids);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//人员导入 按钮点击事件
|
|||
|
|
$('#btnImport').bind('click', function () {
|
|||
|
|
dialog_personimport.uiDialog('title').html('添加');
|
|||
|
|
dialog_personimport.uiDialog('setUserParam', {action: 'add'});
|
|||
|
|
dialog_personimport.uiDialog('open');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$('#grid_limitation').hide();//刚打开窗口时先隐藏
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
dialog.uiDialog({
|
|||
|
|
title: '新建',
|
|||
|
|
width: dialogSize.width,
|
|||
|
|
onOpen: function () {
|
|||
|
|
var dialogP = $('#dialog').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
grid_form.uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
limitationHide();
|
|||
|
|
|
|||
|
|
//查看时隐藏按钮等
|
|||
|
|
// $(':radio').attr('disabled', true);//隐藏所有按钮
|
|||
|
|
$('#cb3_l').attr('disabled', true);
|
|||
|
|
$('#cb4_l').attr('disabled', true);
|
|||
|
|
$('#cb5_l').attr('disabled', true);
|
|||
|
|
$('#cb6_l').attr('disabled', true);
|
|||
|
|
$('#cb7_l').attr('disabled', true);
|
|||
|
|
setTimeout( function(){
|
|||
|
|
$("#grid_limitation .grid_toolbar table").find("tr").find("td:eq(0)").hide();
|
|||
|
|
$("#grid_limitation .grid_data table").find("tr").find("td:eq(1)").hide();
|
|||
|
|
},1000);
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 'edit':
|
|||
|
|
grid_form.uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
limitationHide();
|
|||
|
|
|
|||
|
|
$("#grid_limitation .grid_toolbar table").find("tr").find("td:eq(0)").show();
|
|||
|
|
$("#grid_limitation .grid_data table").find("tr").find("td:eq(1)").show();
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
var roleType = 0;
|
|||
|
|
grid_form.uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 'resit':
|
|||
|
|
grid_form.uiForm('load', {});
|
|||
|
|
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').show();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').hide();
|
|||
|
|
$('#cb4_li').hide();
|
|||
|
|
$('#cb5_li').show();
|
|||
|
|
$('#cb6_li').hide();
|
|||
|
|
$('#cb7_li').hide();
|
|||
|
|
|
|||
|
|
$('#cb5_l').attr("checked",true);
|
|||
|
|
$('#cb5_l').attr("disabled",true);
|
|||
|
|
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').show();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').show();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').show();
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onLoadComplete: formInit,
|
|||
|
|
onClose:function () {
|
|||
|
|
setTimeout( function(){
|
|||
|
|
//关闭窗口将临时试卷清空
|
|||
|
|
$.ajax({
|
|||
|
|
type:'post',
|
|||
|
|
url:deleteTemporaryExamUrl,
|
|||
|
|
data:{"exam":temporary_exam,
|
|||
|
|
"exam_id":exam_id
|
|||
|
|
},
|
|||
|
|
dataType:'json',
|
|||
|
|
success:function (result) {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error:function () {
|
|||
|
|
alert("删除临时试卷失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},100);
|
|||
|
|
|
|||
|
|
srp = 0;//关闭窗口,重新考试标志置为0
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '保存',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
$('#grid_form').uiForm('submit', {
|
|||
|
|
url: saveUrl,
|
|||
|
|
onSubmit: function (param) {
|
|||
|
|
|
|||
|
|
param.pg = $('#pg').val();//uiForm控件向后台传入参数,不是queryParams
|
|||
|
|
param.id = $('#hdID').val();
|
|||
|
|
|
|||
|
|
//谷歌支持
|
|||
|
|
// var startDate = new Date($('#startdate').val());
|
|||
|
|
// var endtDate = new Date($('#enddate').val());
|
|||
|
|
// var now = new Date(new Date().toLocaleDateString());
|
|||
|
|
// var startMillisecond = startDate.getTime() - now;//时间差的毫秒数
|
|||
|
|
// var endMillisecond = endtDate.getTime() - now;
|
|||
|
|
// var startDays=Math.floor(startMillisecond / (24*3600*1000));// 计算出相差天数
|
|||
|
|
// var endDays=Math.floor(endMillisecond / (24*3600*1000));
|
|||
|
|
|
|||
|
|
//IE支持
|
|||
|
|
var startDate = $('#startdate').val();
|
|||
|
|
var endtDate = $('#enddate').val();
|
|||
|
|
var now_ = new Date();
|
|||
|
|
var month = now_.getMonth() + 1;
|
|||
|
|
var now = now_.getFullYear() + "/" + month + "/" + now_.getDate();
|
|||
|
|
var startMillisecond = Date.parse(startDate.replace(/-/g,"/")) - Date.parse(now);//时间差的毫秒数
|
|||
|
|
var endMillisecond = Date.parse(endtDate.replace(/-/g,"/")) - Date.parse(now);
|
|||
|
|
var startDays=Math.floor(startMillisecond / (24*3600*1000));// 计算出相差天数
|
|||
|
|
var endDays=Math.floor(endMillisecond / (24*3600*1000));
|
|||
|
|
|
|||
|
|
if(endDays - startDays < 0 )
|
|||
|
|
{
|
|||
|
|
alert("开放时间中的结束时间应大于开始时间!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(startDays > 0 && endDays > 0){
|
|||
|
|
param.state = examState.firstState;
|
|||
|
|
}else if (startDays <= 0 && endDays >= 0){
|
|||
|
|
// param.state = examState.secondState;
|
|||
|
|
param.state = examState.firstState;//所有试卷初始状态都为“未开始”,点击发布按钮后,为“正在进行”
|
|||
|
|
}else if (startDays < 0 && endDays < 0){
|
|||
|
|
// param.state = examState.thirdState;
|
|||
|
|
alert("开放时间已过,请修改!");
|
|||
|
|
return false;
|
|||
|
|
}else{
|
|||
|
|
param.state = "状态有误";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if($('input:radio[id="cb3_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 1;
|
|||
|
|
}else if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 2;
|
|||
|
|
if($('[class=spanId]').length == 0){
|
|||
|
|
alert("请添加部门!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 3;
|
|||
|
|
if($('[class=spanId]').length == 0){
|
|||
|
|
alert("请添加人员!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 4;
|
|||
|
|
if($('[class=spanId]').length == 0){
|
|||
|
|
alert("请添加班级!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 5;
|
|||
|
|
if($('[class=spanId]').length == 0){
|
|||
|
|
alert("请添加课程!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
alert("请指定试卷发放范围!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
limitation=param.limitation;
|
|||
|
|
var isValid = $('#grid_form').uiForm('validate');
|
|||
|
|
|
|||
|
|
return isValid; // 返回false终止表单提交
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success === false){
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (result.success) {
|
|||
|
|
|
|||
|
|
//试卷表操作成功后,更新发放范围limitation表
|
|||
|
|
var exam_id_ = "";
|
|||
|
|
if(result.data !== undefined){
|
|||
|
|
exam_id_ = result.data.examId;
|
|||
|
|
}
|
|||
|
|
if($('input:radio[id="cb3_l"]:checked').val() == "on"){
|
|||
|
|
var spanId = $('[class=spanId]:eq(0)').text();
|
|||
|
|
var user = "全所";
|
|||
|
|
var user_id = "1";
|
|||
|
|
var limitation = "1";
|
|||
|
|
var exam = "";
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveLimitationUrl,
|
|||
|
|
data: {"id":spanId,
|
|||
|
|
"user":user,
|
|||
|
|
"user_id":user_id,
|
|||
|
|
"exam_id":exam_id_,
|
|||
|
|
"limitation":limitation,
|
|||
|
|
"exam":exam
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("插入试卷全所权限失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
var exam = "";
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: updateLimitationUrl,
|
|||
|
|
data: {"exam_id":exam_id,
|
|||
|
|
"exam_id_":exam_id_,
|
|||
|
|
"exam":exam
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("更新试卷权限失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// //var limitationArray = [];//批量更新
|
|||
|
|
// if($('[class=spanId]').length > 0){
|
|||
|
|
// var j = $('[class=spanId]').length;
|
|||
|
|
// for (var i=0;i<$('[class=spanId]').length;i++){//应当改为更新条件为exam_id而不是id
|
|||
|
|
// var spanId=$('[class=spanId]:eq('+i+')').text();
|
|||
|
|
// // var limitationInfo = {};
|
|||
|
|
// // limitationInfo.id = spanId;
|
|||
|
|
// // limitationInfo.exam_id = exam_id;
|
|||
|
|
// var exam = "";
|
|||
|
|
//
|
|||
|
|
// $.ajax({
|
|||
|
|
// type: 'post',
|
|||
|
|
// url: saveLimitationUrl,
|
|||
|
|
// data: {"id":spanId,
|
|||
|
|
// "exam_id":exam_id_,
|
|||
|
|
// "exam":exam
|
|||
|
|
// },
|
|||
|
|
// dataType: "json",
|
|||
|
|
// success: function (result) {
|
|||
|
|
// },
|
|||
|
|
// error:function() {
|
|||
|
|
// alert("更新试卷权限失败");
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//更新班级课程对应人的表的exam_id
|
|||
|
|
if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: updateClassUrl,
|
|||
|
|
data: {"exam_id":exam_id,//临时试卷id
|
|||
|
|
"exam_id_":exam_id_//正式试卷id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("更新班级对应人的表的exam_id失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: updateCourseUrl,
|
|||
|
|
data: {"exam_id":exam_id,//临时试卷id
|
|||
|
|
"exam_id_":exam_id_//正式试卷id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("更新课程对应人的表的exam_id失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(srp == 1){
|
|||
|
|
saveResitPaper(exam_id_);//重新推送考试 保存原试卷试题至补考试卷中
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
dialog.uiDialog('close');
|
|||
|
|
grid.uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
grid_form.uiForm({
|
|||
|
|
template: 'grid_form_temp',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
|
|||
|
|
$('#txtcategory').dictCombobox();
|
|||
|
|
|
|||
|
|
$('#startdate').uiDate({
|
|||
|
|
required:true,
|
|||
|
|
// dateFmt:'yyyy-MM-dd HH:mm:ss',
|
|||
|
|
dateFmt:'yyyy-MM-dd',
|
|||
|
|
disabled: false
|
|||
|
|
});
|
|||
|
|
$('#enddate').uiDate({
|
|||
|
|
required:true,
|
|||
|
|
// dateFmt:'yyyy-MM-dd HH:mm:ss',
|
|||
|
|
dateFmt:'yyyy-MM-dd',
|
|||
|
|
disabled: false
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
if($('#startdate').val()==='NaN-aN-aN')
|
|||
|
|
{
|
|||
|
|
$('#startdate').val('');
|
|||
|
|
}
|
|||
|
|
if($('#enddate').val()==='NaN-aN-aN')
|
|||
|
|
{
|
|||
|
|
$('#enddate').val('');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var me = $(this);
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
me.uiForm('setReadonly', true);
|
|||
|
|
break;
|
|||
|
|
case 'edit':
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//初始化表单-编辑试卷内容
|
|||
|
|
var formeditexampaperInit = function () {
|
|||
|
|
|
|||
|
|
var eqlist2 = $('#eqlist2');
|
|||
|
|
|
|||
|
|
eqlist2.uiGrid({
|
|||
|
|
autoFit: true,
|
|||
|
|
border:false,
|
|||
|
|
colFit:true,
|
|||
|
|
gridTitleFix: false,
|
|||
|
|
width:"100%",
|
|||
|
|
height:"80%",
|
|||
|
|
showHeader:false,
|
|||
|
|
icon: 'list',
|
|||
|
|
url: list_editexampaper_Url,
|
|||
|
|
queryParams: {AndEdit_id: grid.uiGrid('selectedData', 'id')[0]},//从前端获取,向后台传递参数
|
|||
|
|
// localData:{rows:[
|
|||
|
|
// {id: '1', subject: '项目管理培训题目1?',type:'1',isMust:'1',score:'10',optionA:'选项A',optionB:'选项B',optionC:'选项C',optionD:'选项D',optionE:'',optionF:'',num:'11',isParagraph:'0'}
|
|||
|
|
// // {id: '2', subject: '项目管理培训题目2?',type:'1',isMust:'0',score:'10',optionA:'选项A',optionB:'选项B',optionC:'选项C',optionD:'选项D',optionE:'',optionF:'',num:'2',isParagraph:'0'},
|
|||
|
|
// // {id: '3', subject: '项目管理培训题目3?',type:'2',isMust:'0',score:'10',optionA:'选项A',optionB:'选项B',optionC:'选项C',optionD:'选项D',optionE:'选项E',optionF:'选项F',num:'3',isParagraph:'0'},
|
|||
|
|
// // {id: '4', subject: '项目管理培训题目4?',type:'3',isMust:'0',score:'10',optionA:'',optionB:'',optionC:'',optionD:'',optionE:'',optionF:'',num:'4',isParagraph:'0'},
|
|||
|
|
// // {id: '5', subject: '项目管理培训题目5?',type:'4',isMust:'0',score:'10',optionA:'',optionB:'',optionC:'',optionD:'',optionE:'',optionF:'',num:'5',isParagraph:'0'}
|
|||
|
|
// ]},
|
|||
|
|
//单选1,多选2,判断3,问答4
|
|||
|
|
defaultSortField: 'num'
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//下拉框 选择历史问卷
|
|||
|
|
$('#name').uiCombobox({
|
|||
|
|
mode: 'remote',
|
|||
|
|
searchable: true,
|
|||
|
|
// delay :500,
|
|||
|
|
// hasDownArrow:false,
|
|||
|
|
loader: comboxLoad,
|
|||
|
|
url: comboxUrl + "?pg=" + pg,
|
|||
|
|
onSelect: function(record) {
|
|||
|
|
examId = record.id;
|
|||
|
|
eqlist2.uiGrid('loadData', {queryParams:{AndEdit_id: examId}});
|
|||
|
|
saveHistoryExam();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//下拉框 随机生成题目
|
|||
|
|
$('#categoryRand').dictCombobox();
|
|||
|
|
|
|||
|
|
//初始化Excel导入
|
|||
|
|
var importUrl = "";
|
|||
|
|
if(pg == "2"){
|
|||
|
|
importUrl = fileImportQuestionUrl_R;
|
|||
|
|
}else{
|
|||
|
|
importUrl = fileImportQuestionUrl;
|
|||
|
|
}
|
|||
|
|
$('#fileform_edit').uiForm({
|
|||
|
|
template: 'grid_form_temp2_edit',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#btnUpload_edit').bind('click', function () {
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确定导入该试卷吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
$('#fileform_edit').uiForm('submit', {
|
|||
|
|
url: importUrl,
|
|||
|
|
dataType: "application/json",
|
|||
|
|
onSubmit: function (params) {
|
|||
|
|
params.id = AndEdit_id;
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
// $('#editexampaper_dialog').uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
eqlist2.uiGrid('loadData');
|
|||
|
|
setTimeout( function(){
|
|||
|
|
setStatistic();
|
|||
|
|
},100);
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//初始化弹出窗口-编辑试卷内容 editexampaper_dialog在哪???
|
|||
|
|
var editexampaper_dialog = $('#editexampaper_dialog').uiDialog({
|
|||
|
|
title: '新建',
|
|||
|
|
icon: 'list',
|
|||
|
|
// width: dialogSize.width,
|
|||
|
|
// height: dialogSize.height,
|
|||
|
|
width:"95%",
|
|||
|
|
height:"95%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
url: editexampaperPage,
|
|||
|
|
queryParams:{pg: pg},
|
|||
|
|
onLoadComplete: formeditexampaperInit,
|
|||
|
|
onOpen: function () {
|
|||
|
|
$('#fileform_edit').uiForm('load');//为组件加载数据
|
|||
|
|
|
|||
|
|
// var dialogP = $('#editexampaper_dialog').uiDialog('getUserParam');
|
|||
|
|
// op = dialogP.action;
|
|||
|
|
// var id = dialogP.id;
|
|||
|
|
// switch (op) {
|
|||
|
|
// case 'view':
|
|||
|
|
// case 'edit':
|
|||
|
|
// $('#fileform').uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
// break;
|
|||
|
|
// case 'add':
|
|||
|
|
// $('#fileform').uiForm('load', {});
|
|||
|
|
// break;
|
|||
|
|
// default :
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
setTimeout( function(){//延时等模板加载完毕再计算题数和总分
|
|||
|
|
setStatistic();
|
|||
|
|
},100);
|
|||
|
|
},
|
|||
|
|
onPanelResize: function () {
|
|||
|
|
// setStatistic();//将计算题数和总分的方法放在了组件改变大小时触发,不合理,考虑用SQL语句初始化出来,或者前端有什么方法可以初始化
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnOK',
|
|||
|
|
label: '完成编辑',
|
|||
|
|
style: 'button_submit',
|
|||
|
|
icons: {left: 'icon_submit'},
|
|||
|
|
disabled: false,
|
|||
|
|
onClick: function () {
|
|||
|
|
|
|||
|
|
if(isComplete()){
|
|||
|
|
$('#editexampaper_dialog').uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
showResult(true,"编辑完成!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化表单——导入新试卷
|
|||
|
|
var formimportInit2 = function () {
|
|||
|
|
// $('#btnUpload').uiButton();
|
|||
|
|
|
|||
|
|
// $('#btnUpload').uiButton({
|
|||
|
|
// style: 'button_submit',
|
|||
|
|
// icons: {left: 'icon_edit'},
|
|||
|
|
// onClick:function () {
|
|||
|
|
// $('#fileform').uiForm('submit', {
|
|||
|
|
// url: fileImportUrl,
|
|||
|
|
// onSubmit: function (params) {
|
|||
|
|
//
|
|||
|
|
// },
|
|||
|
|
// success: function (result) {
|
|||
|
|
// if (result.success) {
|
|||
|
|
// $('#importnewpaper_dialog').uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
// }
|
|||
|
|
// showResult(result.success, result.message);
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
|
|||
|
|
var importUrl = "";
|
|||
|
|
if(pg == "2"){
|
|||
|
|
importUrl = fileImportResearchUrl;
|
|||
|
|
}else{
|
|||
|
|
importUrl = fileImportUrl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$('#fileform').uiForm({
|
|||
|
|
template: 'grid_form_temp2',
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
$('#btnUpload').bind('click', function () {
|
|||
|
|
$('#fileform').uiForm('submit', {
|
|||
|
|
url: importUrl,
|
|||
|
|
dataType: "application/json",
|
|||
|
|
onSubmit: function (params) {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#importnewpaper_dialog').uiDialog('close');//保存成功后关闭对话框
|
|||
|
|
grid.uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//初始化弹出窗口——导入新试卷
|
|||
|
|
var importnewpaper_dialog = $('#importnewpaper_dialog').uiDialog({
|
|||
|
|
title: '导入',
|
|||
|
|
icon: 'list',
|
|||
|
|
width:"80%",
|
|||
|
|
height:"60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
url: importnewexampaperPage,
|
|||
|
|
queryParams:{pg: pg},
|
|||
|
|
onLoadComplete: formimportInit2,
|
|||
|
|
onOpen: function () {
|
|||
|
|
var dialogP = $('#importnewpaper_dialog').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
$('#fileform').uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
$('#fileform').uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// $('#fileform').uiForm('load');//为组件加载数据
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化表单 预览 试卷 问卷
|
|||
|
|
var formeditexamInit = function () {
|
|||
|
|
|
|||
|
|
var eqlist2_preview = $('#eqlist2_preview');
|
|||
|
|
|
|||
|
|
eqlist2_preview.uiGrid({
|
|||
|
|
autoFit: true,
|
|||
|
|
border: false,
|
|||
|
|
colFit: true,
|
|||
|
|
gridTitleFix: false,
|
|||
|
|
width: "100%",
|
|||
|
|
height: "80%",
|
|||
|
|
showHeader: false,
|
|||
|
|
icon: 'list',
|
|||
|
|
pageSize: 50,
|
|||
|
|
url:previewUrl,
|
|||
|
|
queryParams: {'id': grid.uiGrid('selectedData', 'id')[0]},//从前端获取,向后台传递参数
|
|||
|
|
|
|||
|
|
defaultSortField: 'num'
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//预览 试卷 问卷
|
|||
|
|
var dialog_preview = $('#dialog_preview').uiDialog({
|
|||
|
|
title: '新建',
|
|||
|
|
icon: 'list',
|
|||
|
|
width:"95%",
|
|||
|
|
height:"95%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
// url: previewPageUrl,
|
|||
|
|
onLoadComplete: formeditexamInit,
|
|||
|
|
onOpen: function () {
|
|||
|
|
if($('#eqlist2_preview').attr("class") != null){
|
|||
|
|
$('#eqlist2_preview').uiGrid('loadData', {queryParams:{'id': grid.uiGrid('selectedData', 'id')[0]}});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// var dialogP = $('#dialog_preview').uiDialog('getUserParam');
|
|||
|
|
// op = dialogP.action;
|
|||
|
|
// var id = dialogP.id;
|
|||
|
|
// switch (op) {
|
|||
|
|
// case 'view':
|
|||
|
|
// case 'edit':
|
|||
|
|
// $('#fileform').uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
// break;
|
|||
|
|
// case 'add':
|
|||
|
|
// $('#fileform').uiForm('load', {});
|
|||
|
|
// break;
|
|||
|
|
// default :
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
},
|
|||
|
|
onClose:function(){
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_preview.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化表单 考试调研详情 查看已答未答
|
|||
|
|
var detailInit = function () {
|
|||
|
|
|
|||
|
|
if($('#grid_detail').attr("class") == null){
|
|||
|
|
$('#grid_detail').uiGrid({
|
|||
|
|
autoFit: true,
|
|||
|
|
border: false,
|
|||
|
|
colFit: true,
|
|||
|
|
gridTitleFix: false,
|
|||
|
|
width: "100%",
|
|||
|
|
height: "80%",
|
|||
|
|
showHeader: false,
|
|||
|
|
icon: 'list',
|
|||
|
|
pageSize: 50,
|
|||
|
|
url: detailUrl,
|
|||
|
|
queryParams: {'id': grid.uiGrid('selectedData', 'id')[0]}//从前端获取,向后台传递参数
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
$('#grid_detail').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//考试调研详情 查看已答未答
|
|||
|
|
var dialog_detail = $('#dialog_detail').uiDialog({
|
|||
|
|
title: '新建',
|
|||
|
|
icon: 'list',
|
|||
|
|
width:"95%",
|
|||
|
|
height:"95%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
// onLoadComplete: detailInit,
|
|||
|
|
onOpen: function () {
|
|||
|
|
|
|||
|
|
if($('#grid_detail').attr("class") == null){
|
|||
|
|
$('#grid_detail').uiGrid({
|
|||
|
|
// autoFit: true,
|
|||
|
|
// border: false,
|
|||
|
|
// colFit: true,
|
|||
|
|
// gridTitleFix: false,
|
|||
|
|
// width: "100%",
|
|||
|
|
// height: "80%",
|
|||
|
|
// showHeader: false,
|
|||
|
|
icon: 'list',
|
|||
|
|
// pageSize: 50,
|
|||
|
|
url: detailUrl,
|
|||
|
|
queryParams: {'id': grid.uiGrid('selectedData', 'id')[0]}//从前端获取,向后台传递参数
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
$('#grid_detail').uiGrid('loadData', {queryParams:{'id': grid.uiGrid('selectedData', 'id')[0]}});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onClose:function(){
|
|||
|
|
// window.location.reload();
|
|||
|
|
},
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
id: 'btnCancel',
|
|||
|
|
label: '关闭',
|
|||
|
|
icons: {left: 'icon_cancel'},
|
|||
|
|
disabled: false,
|
|||
|
|
style: 'button_cancel',
|
|||
|
|
onClick: function () {
|
|||
|
|
dialog_detail.uiDialog('close');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function addEvents() {
|
|||
|
|
//新建
|
|||
|
|
$('#btn1').bind('click', function () {
|
|||
|
|
dialog.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog.uiDialog('open');
|
|||
|
|
dialog.uiDialog('title').html('新建');
|
|||
|
|
|
|||
|
|
$('#grid_limitation').hide();
|
|||
|
|
exam_id = guid();//只要新建就生成临时文件id
|
|||
|
|
|
|||
|
|
$("#grid_limitation .grid_toolbar table").find("tr").find("td:eq(0)").show();
|
|||
|
|
$("#grid_limitation .grid_data table").find("tr").find("td:eq(1)").show();
|
|||
|
|
});
|
|||
|
|
//删除
|
|||
|
|
$('#btn2').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要删除的行!', 'alert');
|
|||
|
|
} else {
|
|||
|
|
deleteRow(ids);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//编辑试卷内容
|
|||
|
|
$('#btn3').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
AndEdit_id = ids[0];
|
|||
|
|
// console.log(AndEdit_id);
|
|||
|
|
|
|||
|
|
if(ids.length == 0){
|
|||
|
|
showResult(false,'请选择要编辑的试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要编辑的一张试卷,不支持同时选择多张试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
editexampaper_dialog.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
editexampaper_dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
editexampaper_dialog.uiDialog('open');
|
|||
|
|
editexampaper_dialog.uiDialog('title').html('编辑试卷');
|
|||
|
|
// $('#eqlist2').uiGrid('loadData',{queryParams: {AndEdit_id: AndEdit_id}});
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: exampaperReturnUrl,
|
|||
|
|
data:{'AndEdit_id':AndEdit_id},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
//showResult(result.success, result.message);
|
|||
|
|
|
|||
|
|
setTimeout(function () {
|
|||
|
|
if(result.data.rows.length > 0){
|
|||
|
|
var data=result.data.rows[0];//将后台return的结果显示在前端
|
|||
|
|
$('#title_name').html(data.name);//试卷名称
|
|||
|
|
$('#title_description').html(data.description);//试卷描述
|
|||
|
|
if(data.state == examState.secondState || data.state == examState.thirdState || data.state == examState.fourthState){
|
|||
|
|
editexampaper_dialog.uiDialog('close');
|
|||
|
|
alert("正在进行、已关闭和已撤销的试卷不允许编辑!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
category_ = data.category;//试卷类别
|
|||
|
|
categoryid_ = data.categoryid;//试卷类别id
|
|||
|
|
}
|
|||
|
|
},100);
|
|||
|
|
|
|||
|
|
// $('#eqlist2').uiGrid('loadData');
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("提交失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//导入试卷
|
|||
|
|
$('#btn4').bind('click', function () {
|
|||
|
|
importnewpaper_dialog.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
importnewpaper_dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
importnewpaper_dialog.uiDialog('open');
|
|||
|
|
importnewpaper_dialog.uiDialog('title').html('导入');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//导出试卷
|
|||
|
|
$('#btn5').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
if(pg == "1"){//考试
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要导出的试卷!', 'alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要导出的一张试卷,不支持同时选择多张试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
var j = ids[0];
|
|||
|
|
for (var i=1;i<ids.length;i++){
|
|||
|
|
j = j + '\',\'' + ids[i];
|
|||
|
|
}
|
|||
|
|
var openurl =webroot+"/ReportServer?reportlet=exam.cpt"+'&id='+j+"&format=excel";
|
|||
|
|
// var openurl="http://localhost:8075/WebReport/ReportServer?reportlet=exam.cpt&format=excel";
|
|||
|
|
window.open(openurl);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}else if(pg == "2"){//调研
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要导出的问卷!', 'alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要导出的一张问卷,不支持同时选择多张问卷!','alert');
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
var j = ids[0];
|
|||
|
|
for (var i=1;i<ids.length;i++){
|
|||
|
|
j = j + '\',\'' + ids[i];
|
|||
|
|
}
|
|||
|
|
var openurl =webroot+"/ReportServer?reportlet=research.cpt"+'&id='+j+"&format=excel";
|
|||
|
|
// var openurl="http://localhost:8075/WebReport/ReportServer?reportlet=exam.cpt&format=excel";
|
|||
|
|
window.open(openurl);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//撤销调研问卷
|
|||
|
|
$('#btn6').bind('click', function () {
|
|||
|
|
var message1 = "";
|
|||
|
|
var message2 = "";
|
|||
|
|
var message3 = "";
|
|||
|
|
if(pg === "2"){
|
|||
|
|
message1 = "请选择要撤销的调研问卷!";
|
|||
|
|
message2 = "请选择要撤销的一张调研问卷,不支持同时选择多张调研问卷!";
|
|||
|
|
message3 = "确认要撤销调研问卷吗?";
|
|||
|
|
}else{
|
|||
|
|
message1 = "请选择要撤销的试卷!";
|
|||
|
|
message2 = "请选择要撤销的一张试卷,不支持同时选择多张试卷!";
|
|||
|
|
message3 = "确认要撤销试卷吗?";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, message1, 'alert');
|
|||
|
|
} else if(ids.length > 1){
|
|||
|
|
showResult(false,message2,'alert');
|
|||
|
|
} else{
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: message3,
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
var id = ids[0];
|
|||
|
|
var state = examState.fourthState;
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveUrl,
|
|||
|
|
data:{'id':id,
|
|||
|
|
'state':state
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
grid.uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("撤销失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//发布
|
|||
|
|
$('#btn7').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要发布的试卷!', 'alert');
|
|||
|
|
} else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要发布的一张试卷,不支持同时选择多张试卷!','alert');
|
|||
|
|
} else{
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: exampaperReturnUrl,
|
|||
|
|
data: {"AndEdit_id":ids[0]},
|
|||
|
|
dataType:'json',
|
|||
|
|
success:function (result) {
|
|||
|
|
if(result.success){
|
|||
|
|
if(result.data.rows.length > 0){
|
|||
|
|
|
|||
|
|
var timestamp = new Date().getTime();//获取当前时间戳的三种方式
|
|||
|
|
// var timestamp = (new Date()).valueOf();
|
|||
|
|
// var timestamp = Date.parse(new Date());
|
|||
|
|
|
|||
|
|
var data=result.data.rows[0];//将后台return的结果显示在前端
|
|||
|
|
if(data.state == examState.thirdState || data.state == examState.fourthState || data.state == examState.fifthState){
|
|||
|
|
alert("已关闭、已撤销、线下考试的试卷不允许再次发布!");
|
|||
|
|
}else if(data.startdate === undefined || data.enddate === undefined){
|
|||
|
|
alert("请修改试卷开放时间再发布!");
|
|||
|
|
}else if(timestamp < data.startdate){
|
|||
|
|
alert("试卷开始时间未到,请修改试卷开放时间再发布!");
|
|||
|
|
}else if(data.limitation === undefined){
|
|||
|
|
alert("请选择试卷发放范围再发布!");
|
|||
|
|
}else {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: getQuestionNumUrl,
|
|||
|
|
data:{"AndEdit_id":ids[0]
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
if(result.data.rows[0].num == 0){
|
|||
|
|
alert("请先编辑试卷内容,空试卷不能发布!");
|
|||
|
|
}else{
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确认要发布试卷吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
var id = ids[0];
|
|||
|
|
var state = examState.secondState;
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveUrl,
|
|||
|
|
data:{'id':id,
|
|||
|
|
'state':state
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
grid.uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("发布试卷失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("判断试卷有无试题失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function () {
|
|||
|
|
alert("检查发布试卷失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//调研信息汇总
|
|||
|
|
$('#btn8').bind('click', function () {
|
|||
|
|
//get传参
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要统计的一张调研问卷!', 'alert');
|
|||
|
|
}else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要统计的一张调研问卷,不支持同时选择多张调研问卷!','alert');
|
|||
|
|
}else{
|
|||
|
|
var j = ids[0];
|
|||
|
|
for (var i=1;i<ids.length;i++){
|
|||
|
|
j = j + '\',\'' + ids[i];
|
|||
|
|
}
|
|||
|
|
var openurl =webroot+"/ReportServer?reportlet=userTest.cpt"+'&edit_id='+j;
|
|||
|
|
// var openurl="http://localhost:8075/WebReport/ReportServer?reportlet=userTest.cpt&format=excel";
|
|||
|
|
window.open(openurl);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//预览
|
|||
|
|
$('#btn9').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
var id = ids[0];
|
|||
|
|
|
|||
|
|
if(ids.length == 0){
|
|||
|
|
showResult(false,'请选择要预览的试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要预览的一张试卷,不支持同时选择多张试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
dialog_preview.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
dialog_preview.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_preview.uiDialog('open');
|
|||
|
|
if(pg == "2"){
|
|||
|
|
dialog_preview.uiDialog('title').html('调研');
|
|||
|
|
}else {
|
|||
|
|
dialog_preview.uiDialog('title').html('考试');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: previewUrl,
|
|||
|
|
data:{'id':id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
|
|||
|
|
setTimeout( function(){
|
|||
|
|
if(result.data.rows.length > 0){
|
|||
|
|
var data=result.data.rows[0];
|
|||
|
|
|
|||
|
|
$('#title_name_p').html(data.name);//将后台return的结果显示在前端
|
|||
|
|
$('#title_description_p').html(data.description);
|
|||
|
|
|
|||
|
|
setStatistic_preview();
|
|||
|
|
}
|
|||
|
|
},100);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("预览试卷失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//考试调研详情 查看已答未答
|
|||
|
|
$('#btn10').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
var id = ids[0];
|
|||
|
|
|
|||
|
|
if(ids.length == 0){
|
|||
|
|
showResult(false,'请选择要查看的考试!','alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要查看的一场考试,不支持同时选择多场考试!','alert');
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
dialog_detail.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
dialog_detail.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_detail.uiDialog('open');
|
|||
|
|
if(pg == "2"){
|
|||
|
|
dialog_detail.uiDialog('title').html('调研');
|
|||
|
|
}else {
|
|||
|
|
dialog_detail.uiDialog('title').html('考试');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//考试调研详情 查看已答未答 导出人员
|
|||
|
|
$('#btnExportPerson').bind('click', function () {
|
|||
|
|
//get传参
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: exampaperReturnUrl,
|
|||
|
|
data:{'AndEdit_id':ids[0]
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
if(result.data.rows.length > 0){
|
|||
|
|
var data=result.data.rows[0];//将后台return的结果显示在前端
|
|||
|
|
if(data.limitation === '1'){
|
|||
|
|
var j1 = ids[0];
|
|||
|
|
var openurl1 =webroot+"/ReportServer?reportlet=detailInstitution.cpt"+'&id='+j1+'&format=excel';
|
|||
|
|
window.open(openurl1);
|
|||
|
|
}else if(data.limitation === '2'){
|
|||
|
|
var j2 = ids[0];
|
|||
|
|
var openurl2 =webroot+"/ReportServer?reportlet=detailDepartment.cpt"+'&id='+j2+'&format=excel';
|
|||
|
|
window.open(openurl2);
|
|||
|
|
}else if(data.limitation === '3'){
|
|||
|
|
var j3 = ids[0];
|
|||
|
|
var openurl3 =webroot+"/ReportServer?reportlet=detailPerson.cpt"+'&id='+j3+'&format=excel';
|
|||
|
|
window.open(openurl3);
|
|||
|
|
}else if(data.limitation === '4'){
|
|||
|
|
var j4 = ids[0];
|
|||
|
|
var openurl4 =webroot+"/ReportServer?reportlet=detailClass.cpt"+'&id='+j4+'&format=excel';
|
|||
|
|
window.open(openurl4);
|
|||
|
|
}else if(data.limitation === '5'){
|
|||
|
|
var j5 = ids[0];
|
|||
|
|
var openurl5 =webroot+"/ReportServer?reportlet=detailCourse.cpt"+'&id='+j5+'&format=excel';
|
|||
|
|
window.open(openurl5);
|
|||
|
|
}else {
|
|||
|
|
alert("导出人员异常");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("考试调研详情查看已答未答导出人员失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//重新考试
|
|||
|
|
$('#btn11').bind('click', function () {
|
|||
|
|
var ids = grid.uiGrid('selectedData', 'id');
|
|||
|
|
var id = ids[0];
|
|||
|
|
exam_id_resit = id;//重新考试要用到的原试卷id
|
|||
|
|
|
|||
|
|
if(ids.length == 0){
|
|||
|
|
showResult(false,'请选择要重新考试的试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else if(ids.length > 1){
|
|||
|
|
showResult(false,'请选择要重新考试的一张试卷,不支持同时选择多张试卷!','alert');
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: exampaperReturnUrl,
|
|||
|
|
data:{'AndEdit_id':id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
if(result.data.rows.length > 0) {
|
|||
|
|
var data = result.data.rows[0];//将后台return的结果显示在前端
|
|||
|
|
if (data.state === examState.thirdState) {
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确定要为缺考和不及格的考生重新推送考试吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
|
|||
|
|
var passpoints = data.passpoints;//及格分
|
|||
|
|
var limitation = data.limitation;//发放范围
|
|||
|
|
var temporary_id = guid();//生成临时试卷id
|
|||
|
|
exam_id = temporary_id;
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: resitUrl,
|
|||
|
|
data:{'exam_id':id,
|
|||
|
|
'passpoints':passpoints,
|
|||
|
|
'limitation':limitation,
|
|||
|
|
'temporary_id':temporary_id
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
dialog.uiDialog('setUserParam', {action: 'resit', id: temporary_id});//打开窗口可用编辑时的窗口里的方法拿过来
|
|||
|
|
dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog.uiDialog('open');
|
|||
|
|
dialog.uiDialog('title').html('新建');
|
|||
|
|
|
|||
|
|
srp = 1;//打开窗口,重新考试标志置为1
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("重新推送考试存入人员失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
alert("只有已关闭状态的试卷允许重新推送考试!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("检查重新推送考试失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//arttemplate语法
|
|||
|
|
template.helper('judge', function (data, format) {
|
|||
|
|
if (data!=undefined && data.indexOf(format)!=-1){
|
|||
|
|
return true;
|
|||
|
|
}else {
|
|||
|
|
return false;}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//查看
|
|||
|
|
function viewRow(id, title) {
|
|||
|
|
var dialog = $('#dialog');
|
|||
|
|
dialog.uiDialog('setUserParam', {action: 'view', id: id});
|
|||
|
|
dialog.uiDialog('open');
|
|||
|
|
title = '-' + title || '';
|
|||
|
|
dialog.uiDialog('title').html('查看' + title);
|
|||
|
|
dialog.uiDialog('button', 'btnOK').hide();
|
|||
|
|
dialog.uiDialog('button', 'btnSave').hide();
|
|||
|
|
|
|||
|
|
exam_id = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//编辑
|
|||
|
|
function editRow(id) {
|
|||
|
|
var dialog = $('#dialog');
|
|||
|
|
dialog.uiDialog('setUserParam', {action: 'edit', id: id});
|
|||
|
|
dialog.uiDialog('open');
|
|||
|
|
dialog.uiDialog('title').html('编辑');
|
|||
|
|
dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
|
|||
|
|
exam_id = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//查看发放范围
|
|||
|
|
function viewLimitationRow(id) {
|
|||
|
|
if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_department = $('#dialog_department');
|
|||
|
|
dialog_department.uiDialog('setUserParam', {action: 'view', id: id});
|
|||
|
|
// dialog_department.uiDialog('button', 'btnSave').hide();
|
|||
|
|
// dialog_department.uiDialog('button', 'btnOK').hide();
|
|||
|
|
dialog_department.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_person = $('#dialog_person');
|
|||
|
|
dialog_person.uiDialog('setUserParam', {action: 'view', id: id});
|
|||
|
|
// dialog_person.uiDialog('button', 'btnSave').hide();
|
|||
|
|
// dialog_person.uiDialog('button', 'btnOK').hide();
|
|||
|
|
dialog_person.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_class = $('#dialog_class');
|
|||
|
|
dialog_class.uiDialog('setUserParam', {action: 'view', id: id});
|
|||
|
|
// dialog_class.uiDialog('button', 'btnSave').hide();
|
|||
|
|
// dialog_class.uiDialog('button', 'btnOK').hide();
|
|||
|
|
dialog_class.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_course = $('#dialog_person');
|
|||
|
|
dialog_course.uiDialog('setUserParam', {action: 'view', id: id});
|
|||
|
|
// dialog_course.uiDialog('button', 'btnSave').hide();
|
|||
|
|
// dialog_course.uiDialog('button', 'btnOK').hide();
|
|||
|
|
dialog_course.uiDialog('open');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//编辑发放范围
|
|||
|
|
function editLimitationRow(id) {
|
|||
|
|
if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_department = $('#dialog_department');
|
|||
|
|
dialog_department.uiDialog('title').html('编辑');
|
|||
|
|
dialog_department.uiDialog('setUserParam', {action: 'edit', id: id});
|
|||
|
|
dialog_department.uiDialog('button', 'btnSave').show();
|
|||
|
|
dialog_department.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_department.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_person = $('#dialog_person');
|
|||
|
|
dialog_person.uiDialog('title').html('编辑');
|
|||
|
|
dialog_person.uiDialog('setUserParam', {action: 'edit', id: id});
|
|||
|
|
dialog_person.uiDialog('button', 'btnSave').show();
|
|||
|
|
dialog_person.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_person.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_class = $('#dialog_class');
|
|||
|
|
dialog_class.uiDialog('title').html('编辑');
|
|||
|
|
dialog_class.uiDialog('setUserParam', {action: 'edit', id: id});
|
|||
|
|
dialog_class.uiDialog('button', 'btnSave').show();
|
|||
|
|
dialog_class.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_class.uiDialog('open');
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
var dialog_course = $('#dialog_course');
|
|||
|
|
dialog_course.uiDialog('title').html('编辑');
|
|||
|
|
dialog_course.uiDialog('setUserParam', {action: 'edit', id: id});
|
|||
|
|
dialog_course.uiDialog('button', 'btnSave').show();
|
|||
|
|
dialog_course.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog_course.uiDialog('open');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除 发放范围
|
|||
|
|
function deleteLimitationRow(id) {
|
|||
|
|
deleteData_exampaper("确定要删除所选信息吗?", deleteLimitationUrl, {ids: id}, function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
deletePerson(id,2);//依据limitation id删除课程班级对应的人
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 删除
|
|||
|
|
function deleteRow(id) {
|
|||
|
|
$.ajax({
|
|||
|
|
type:'post',
|
|||
|
|
url:checkDeleteUrl,
|
|||
|
|
data:{"id":id},
|
|||
|
|
dataType:'json',
|
|||
|
|
success:function (res) {
|
|||
|
|
if(res.success){
|
|||
|
|
deleteData_exampaper("此操作将删除试卷,可能会导致以往考试找不到试卷,确定删除吗?", deleteUrl, {ids: id}, function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#grid').uiGrid('loadData');
|
|||
|
|
|
|||
|
|
deleteLimitation(id);//依据试卷id删除limitation表中的全所部门人员课程班级
|
|||
|
|
deletePerson(id,1);//依据试卷id删除课程班级对应的人
|
|||
|
|
deleteExamQuestion(id);//删除试卷中的试题
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function () {
|
|||
|
|
alert("检查试卷能否删除失败!");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除
|
|||
|
|
function deleteData_exampaper(confirmText, url, data, callback) {
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: confirmText,
|
|||
|
|
height: 110,
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: url,
|
|||
|
|
data: data,
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
callback && callback.call(this, result);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//依据试卷id删除limitation表中的全所部门人员课程班级
|
|||
|
|
function deleteLimitation(id) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: deleteLimitationExampaperUrl,
|
|||
|
|
data: {'id':id},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("依据试卷id删除limitation表中的全所部门人员课程班级失败!");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除课程班级对应的人
|
|||
|
|
function deletePerson(id,num) {//num 1依据试卷id删 2依据limitation id删
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: deletePersonUrl,
|
|||
|
|
data: {'id':id,
|
|||
|
|
'num':num},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("删除课程班级对应的人失败!");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除试卷中的试题
|
|||
|
|
function deleteExamQuestion(id) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: deleteExamQuestionUrl,
|
|||
|
|
data: {'id':id},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("删除试卷中的试题失败!");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选择历史试卷 下拉框
|
|||
|
|
function comboxLoad(param, success, error) {
|
|||
|
|
var opts = $(this).uiCombobox('options');
|
|||
|
|
if (!opts.url) return false;
|
|||
|
|
$.ajax({
|
|||
|
|
type: opts.method,
|
|||
|
|
url: opts.url,
|
|||
|
|
showLoading: false,
|
|||
|
|
data: param,
|
|||
|
|
showAlert:false,
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
success(result.data);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function () {
|
|||
|
|
error.apply(this, arguments);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选择历史问卷 不从前端依次获取插入,在数据库中将题目复制插入到数据库中
|
|||
|
|
function saveHistoryExam() {
|
|||
|
|
if($('#name').uiCombo('getText') == ""){
|
|||
|
|
alert("请选择历史试卷!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确定使用该历史问卷吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveHistoryUrl,
|
|||
|
|
data: {'examId':examId,'id':AndEdit_id},//examId是想使用的历史问卷的id,AndEdit_id是正在编辑的试卷id
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
$('#eqlist2').uiGrid('loadData', {queryParams:{AndEdit_id: AndEdit_id}});
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
setStatistic();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else{
|
|||
|
|
$('#eqlist2').uiGrid('loadData', {queryParams:{AndEdit_id: AndEdit_id}});
|
|||
|
|
$('#name').uiCombo('clear');//清除下拉框已选项
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选择历史问卷 从前端依次获取存入数据库中 未使用
|
|||
|
|
// function saveHistoryExam() {
|
|||
|
|
// for (var i=1; i<$('#eqlist2').find('tr').length; i++){
|
|||
|
|
// var parent="";
|
|||
|
|
// // var history_id="";
|
|||
|
|
// var edit_id="";
|
|||
|
|
// var num="";
|
|||
|
|
// var subject="";
|
|||
|
|
// var type="";
|
|||
|
|
// var type_num="";
|
|||
|
|
// var ismust="";
|
|||
|
|
// var score="";
|
|||
|
|
// var a="";
|
|||
|
|
// var b="";
|
|||
|
|
// var c="";
|
|||
|
|
// var d="";
|
|||
|
|
// var ee="";
|
|||
|
|
// var f="";
|
|||
|
|
// var isParagraph = "";
|
|||
|
|
// var answer="";
|
|||
|
|
//
|
|||
|
|
// parent=$('#eqlist2').find('tr:eq('+i+')');
|
|||
|
|
// // history_id=parent.find(".qid").html();
|
|||
|
|
// edit_id=AndEdit_id;//试卷的id
|
|||
|
|
// num=parent.find(".qxh").html();
|
|||
|
|
// subject=parent.find(".qtm").html();
|
|||
|
|
// type=parent.find(".qtype").html();
|
|||
|
|
// if(type == "单选题"){
|
|||
|
|
// type_num = 1;
|
|||
|
|
// }else if(type == "多选题"){
|
|||
|
|
// type_num = 2;
|
|||
|
|
// }else if(type == "判断题"){
|
|||
|
|
// type_num = 3;
|
|||
|
|
// }else if(type == "填空题"){
|
|||
|
|
// type_num = 4;
|
|||
|
|
// }else if(type == "问答题"){
|
|||
|
|
// type_num = 5;
|
|||
|
|
// }
|
|||
|
|
// ismust=parent.find(".qbd").html();
|
|||
|
|
// score=parent.find(".score").html();
|
|||
|
|
// a=parent.find(".a").html();
|
|||
|
|
// b=parent.find(".b").html();
|
|||
|
|
// c=parent.find(".c").html();
|
|||
|
|
// d=parent.find(".d").html();
|
|||
|
|
// ee=parent.find(".e").html();
|
|||
|
|
// f=parent.find(".f").html();
|
|||
|
|
// isParagraph = 0;
|
|||
|
|
// answer=parent.find(".answer").html();
|
|||
|
|
//
|
|||
|
|
// $.ajax({
|
|||
|
|
// type: 'post',
|
|||
|
|
// url: "",
|
|||
|
|
// data: {
|
|||
|
|
// // 'history_id':id,
|
|||
|
|
// 'edit_id':edit_id,
|
|||
|
|
// 'num':num,
|
|||
|
|
// 'subject':subject,
|
|||
|
|
// 'type':type,
|
|||
|
|
// 'type_num':type_num,
|
|||
|
|
// 'ismust':ismust,
|
|||
|
|
// 'score':score,
|
|||
|
|
// 'optionA':a,
|
|||
|
|
// 'optionB':b,
|
|||
|
|
// 'optionC':c,
|
|||
|
|
// 'optionD':d,
|
|||
|
|
// 'optionE':ee,
|
|||
|
|
// 'optionF':f,
|
|||
|
|
// 'isParagraph':isParagraph,
|
|||
|
|
// 'answer':answer},
|
|||
|
|
// dataType: "json",
|
|||
|
|
// success: function (result) {
|
|||
|
|
// if (result.success) {
|
|||
|
|
// $('#eqlist2').uiGrid('loadData');
|
|||
|
|
// }
|
|||
|
|
// showResult(result.success, result.message);
|
|||
|
|
// },
|
|||
|
|
// error:function() {
|
|||
|
|
// alert("提交历史试卷失败");
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//发放范围——添加
|
|||
|
|
function addList(n) {
|
|||
|
|
if(n == 2){
|
|||
|
|
|
|||
|
|
}else if(n == 3){
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if(n == 4){
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if(n == 5){
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//发放范围 显示
|
|||
|
|
function specifiedRange(num) {
|
|||
|
|
if (num === 1){
|
|||
|
|
deleteOtherLimitation();
|
|||
|
|
$('#grid_limitation').hide();
|
|||
|
|
|
|||
|
|
}else if(num === 2){
|
|||
|
|
deleteOtherLimitation();
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
$('#spanDepartment').show();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').show();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
|
|||
|
|
}else if(num === 3){
|
|||
|
|
deleteOtherLimitation();
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').show();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').show();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').show();
|
|||
|
|
|
|||
|
|
}else if(num === 4){
|
|||
|
|
deleteOtherLimitation();
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').show();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').show();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
|
|||
|
|
}else if(num === 5){
|
|||
|
|
deleteOtherLimitation();
|
|||
|
|
$('#grid_limitation').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
$('#grid_limitation').show();
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').show();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').show();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//随机添加试题
|
|||
|
|
function randomAdd() {
|
|||
|
|
var categoryRand = 0;
|
|||
|
|
var singleNum = 0;
|
|||
|
|
var multipleNum = 0;
|
|||
|
|
var judgementNum = 0;
|
|||
|
|
var essayNum = 0;
|
|||
|
|
var blankNum = 0;
|
|||
|
|
|
|||
|
|
if($('#categoryRand').uiCombo('getText') == ""){
|
|||
|
|
alert("请选择试卷类别!");
|
|||
|
|
return;
|
|||
|
|
}else {
|
|||
|
|
categoryRand = $('#categoryRand').uiCombo('getValue');
|
|||
|
|
}
|
|||
|
|
if($('#singleNum').val() != ""){
|
|||
|
|
singleNum = $('#singleNum').val();
|
|||
|
|
}
|
|||
|
|
if($('#multipleNum').val() != ""){
|
|||
|
|
multipleNum = $('#multipleNum').val();
|
|||
|
|
}
|
|||
|
|
if($('#judgementNum').val() != ""){
|
|||
|
|
judgementNum = $('#judgementNum').val();
|
|||
|
|
}
|
|||
|
|
if($('#essayNum').val() != ""){
|
|||
|
|
essayNum = $('#essayNum').val();
|
|||
|
|
}
|
|||
|
|
if($('#blankNum').val() != ""){
|
|||
|
|
blankNum = $('#blankNum').val();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确定随机添加试题吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: randUrl,
|
|||
|
|
data: {'id':AndEdit_id,
|
|||
|
|
'categoryid':categoryRand,
|
|||
|
|
'singleNum':singleNum,
|
|||
|
|
'multipleNum':multipleNum,
|
|||
|
|
'judgementNum':judgementNum,
|
|||
|
|
'essayNum':essayNum,
|
|||
|
|
'blankNum':blankNum},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#eqlist2').uiGrid('loadData');
|
|||
|
|
|
|||
|
|
setTimeout( function(){
|
|||
|
|
setStatistic();
|
|||
|
|
},100);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("随机添加试题失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除其他的指定范围
|
|||
|
|
function deleteOtherLimitation(){
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: deleteOtherUrl,
|
|||
|
|
data: {"exam_id": exam_id},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
deletePerson(exam_id,1);//依据试卷id删除课程班级对应的人
|
|||
|
|
$('#grid_limitation').uiGrid('loadData');
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("删除其他的指定范围失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//生成32位UUID
|
|||
|
|
function S4() {
|
|||
|
|
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
|||
|
|
}
|
|||
|
|
function guid() {
|
|||
|
|
return (S4()+S4()+S4()+S4()+S4()+S4()+S4()+S4());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//查看 编辑 指定范围
|
|||
|
|
function limitationHide() {
|
|||
|
|
if($('input:radio[id="cb3_l"]:checked').val() == "on"){
|
|||
|
|
$('#grid_limitation').hide();
|
|||
|
|
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定全所</td>");
|
|||
|
|
|
|||
|
|
}else if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
$('#spanDepartment').show();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').show();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定部门</td>");
|
|||
|
|
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').show();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').show();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').show();
|
|||
|
|
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定人员</td>");
|
|||
|
|
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').show();
|
|||
|
|
$('#spanCourse').hide();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').show();
|
|||
|
|
$('#btnCourse').hide();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
$('#spanDepartment').hide();
|
|||
|
|
$('#spanPerson').hide();
|
|||
|
|
$('#spanClass').hide();
|
|||
|
|
$('#spanCourse').show();
|
|||
|
|
$('#btnDepartment').hide();
|
|||
|
|
$('#btnPerson').hide();
|
|||
|
|
$('#btnClass').hide();
|
|||
|
|
$('#btnCourse').show();
|
|||
|
|
$('#btnImport').hide();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function checkSize(ele){
|
|||
|
|
var size_m = (ele.files[0].size / 1024);
|
|||
|
|
if(size_m >= 1024*1024*5){
|
|||
|
|
$('#hidFile').val(1);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
$('#hidFile').val(0);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//验证题目完整性
|
|||
|
|
function isComplete() {
|
|||
|
|
var count=$('#eqlist2').find("button").length;//计算页面中有多少个button按钮,使用length方法
|
|||
|
|
if(count > 1)
|
|||
|
|
{
|
|||
|
|
alert("请先保存所有题目再点击完成编辑!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (var i=1; i<$('#eqlist2').find('tr').length; i++){
|
|||
|
|
var parent="";
|
|||
|
|
var qtm="";
|
|||
|
|
var score = "";
|
|||
|
|
var a = "";
|
|||
|
|
var b = "";
|
|||
|
|
var c = "";
|
|||
|
|
var d = "";
|
|||
|
|
var ee = "";
|
|||
|
|
var f = "";
|
|||
|
|
var answer = "";
|
|||
|
|
var type = "";
|
|||
|
|
|
|||
|
|
parent=$('#eqlist2').find('tr:eq('+i+')');
|
|||
|
|
type = parent.find('.qtype').text();
|
|||
|
|
qtm = parent.find('.qtm').text();
|
|||
|
|
if($.trim(qtm) == ''){//trim函数 去掉空格
|
|||
|
|
alert("请先填写第"+i+"题的题目再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(qtm.length > 200){
|
|||
|
|
alert("第"+i+"题的题目限制200个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if($('#pg').val() == "1"){
|
|||
|
|
score =parent.find('.score').text();
|
|||
|
|
if($.trim(score) == ''){//trim函数 去掉空格
|
|||
|
|
alert("请先设置第"+i+"题的分数再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if(type == "单选题" || type == "多选题") {
|
|||
|
|
if (typeof (parent.find('#a').html()) !== "undefined") {
|
|||
|
|
a = parent.find("#a").text();
|
|||
|
|
if ($.trim(a) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第" + i + "题的选项A再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (a.length > 100) {
|
|||
|
|
alert("第" + i + "题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (typeof (parent.find('#b').html()) !== "undefined") {
|
|||
|
|
b = parent.find("#b").text();
|
|||
|
|
if ($.trim(b) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第" + i + "题的选项B再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (b.length > 100) {
|
|||
|
|
alert("第" + i + "题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (typeof (parent.find('#c').html()) !== "undefined") {
|
|||
|
|
c = parent.find("#c").text();
|
|||
|
|
if ($.trim(c) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第" + i + "题的选项C再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (c.length > 100) {
|
|||
|
|
alert("第" + i + "题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (typeof (parent.find('#d').html()) !== "undefined") {
|
|||
|
|
d = parent.find("#d").text();
|
|||
|
|
if ($.trim(d) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第" + i + "题的选项D再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (d.length > 100) {
|
|||
|
|
alert("第" + i + "题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if(type == "多选题") {
|
|||
|
|
if (typeof (parent.find('#e').html()) !== "undefined") {
|
|||
|
|
ee = parent.find("#e").text();
|
|||
|
|
if ($.trim(ee) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第"+i+"题的选项E再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(ee.length > 100){
|
|||
|
|
alert("第"+i+"题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (typeof (parent.find('#f').html()) !== "undefined") {
|
|||
|
|
f = parent.find("#f").text();
|
|||
|
|
if ($.trim(f) == '') {//trim函数 去掉空格
|
|||
|
|
alert("请先填写第"+i+"题的选项F再保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(f.length > 100){
|
|||
|
|
alert("第"+i+"题的选项限制100个字符,请修改后保存!");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// answer = parent.find(".answer").text();//取不到值?
|
|||
|
|
// if($('#pg').val() == "1"){
|
|||
|
|
// if($.trim(answer) == ''){//trim函数 去掉空格
|
|||
|
|
// alert("请先填写第"+i+"题的答案再保存!");
|
|||
|
|
// return false;
|
|||
|
|
// }
|
|||
|
|
// if(answer.length > 2000){
|
|||
|
|
// alert("第"+i+"题的答案限制2000个字符,请修改后保存!");
|
|||
|
|
// return false;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//重新推送考试 保存原试卷试题至补考试卷中
|
|||
|
|
function saveResitPaper(exam_id_) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: saveResitPaperUrl,
|
|||
|
|
data:{'exam_id_':exam_id_,
|
|||
|
|
'exam_id_resit':exam_id_resit
|
|||
|
|
},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
if(result.success){
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("重新推送考试,保存原试卷试题至补考试卷中失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
srp = 0;
|
|||
|
|
}
|