1352 lines
50 KiB
JavaScript
1352 lines
50 KiB
JavaScript
|
|
//不再使用,替换为exampaper.js
|
|||
|
|
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 saveHistoryUrl = rootUrl + 'saveHistoryExam';//保存历史问卷
|
|||
|
|
var randURL = rootUrl + 'randExam';//随机添加试题
|
|||
|
|
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:"已撤销"};//试卷状态
|
|||
|
|
|
|||
|
|
$(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';//选择历史问卷 下拉框
|
|||
|
|
//-----------------------初始化--------------------------------------
|
|||
|
|
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() {
|
|||
|
|
dialog.uiDialog({
|
|||
|
|
title: '新建',
|
|||
|
|
width: dialogSize.width,
|
|||
|
|
onOpen: function () {
|
|||
|
|
var dialogP = $('#dialog').uiDialog('getUserParam');
|
|||
|
|
op = dialogP.action;
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
switch (op) {
|
|||
|
|
case 'view':
|
|||
|
|
case 'edit':
|
|||
|
|
grid_form.uiForm('load', grid.uiGrid('selectedData')[0]);
|
|||
|
|
break;
|
|||
|
|
case 'add':
|
|||
|
|
var roleType = 0;
|
|||
|
|
grid_form.uiForm('load', {});
|
|||
|
|
break;
|
|||
|
|
default :
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
onLoadComplete:function(){
|
|||
|
|
// $('#txtdepartment').dictCombobox();
|
|||
|
|
// $('#txtdepartment').uiCombobox({
|
|||
|
|
// mode: "remote",
|
|||
|
|
// url: departmentComboxUrl,
|
|||
|
|
// onLoadSuccess: function (data) {
|
|||
|
|
//
|
|||
|
|
// },
|
|||
|
|
// onLoadError: function (data) {
|
|||
|
|
//
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
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;
|
|||
|
|
}else if (startDays < 0 && endDays <= 0){
|
|||
|
|
param.state = examState.thirdState;
|
|||
|
|
}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;
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 3;
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 4;
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
param.limitation = 5;
|
|||
|
|
}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.data !== undefined){
|
|||
|
|
exam_id = result.data.examId;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if($('input:radio[id="cb3_l"]:checked').val() == "on"){
|
|||
|
|
|
|||
|
|
var instituteArray = [];
|
|||
|
|
var instituteList = {};
|
|||
|
|
instituteList.id = $('.institute_id').text();
|
|||
|
|
instituteList.orgname = "全所";
|
|||
|
|
instituteList.orgcode = "1";
|
|||
|
|
instituteList.exam = $('#txtname').val();
|
|||
|
|
instituteList.exam_id = exam_id;
|
|||
|
|
instituteList.limitation = limitation;
|
|||
|
|
instituteArray.push(instituteList);
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: departmentAddUrl,
|
|||
|
|
data: {'orgArray':JSON.stringify(instituteArray)},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("添加全所失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
// var size = $('#grid_add').find('select').length;//找到所有select
|
|||
|
|
var orgArray = [];
|
|||
|
|
for(var i=1; i<count+1; i++){
|
|||
|
|
// var a = $("#grid_add .grid_data tr:eq("+ i +")").find("select option:selected").val();//获取所有select的值
|
|||
|
|
var orgList = {};
|
|||
|
|
var txtdepartment = "#txtdepartment";
|
|||
|
|
var j = txtdepartment + i;
|
|||
|
|
if($(j).uiCombo('getText') !== "" && $(j).uiCombo('getText') !== undefined){
|
|||
|
|
var orgname = $(j).uiCombo('getText');
|
|||
|
|
var orgcode = $(j).uiCombo('getValue');
|
|||
|
|
orgList.id = "";
|
|||
|
|
orgList.orgname = orgname;
|
|||
|
|
orgList.orgcode = orgcode;
|
|||
|
|
orgList.exam = $('#txtname').val();
|
|||
|
|
orgList.exam_id = exam_id;
|
|||
|
|
orgList.limitation = limitation;
|
|||
|
|
orgArray.push(orgList);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: departmentAddUrl,
|
|||
|
|
data: {'orgArray':JSON.stringify(orgArray)},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("添加部门失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
var personArray = [];
|
|||
|
|
for(var i=1; i<count+1; i++){
|
|||
|
|
var personList = {};
|
|||
|
|
var txtperson = "#txtperson";
|
|||
|
|
var txtcard = "#txtcard";
|
|||
|
|
var j = txtperson + i;
|
|||
|
|
var k = txtcard + i;
|
|||
|
|
if($(j).val() !== "" && $(j).val() !== undefined && $(k).val() !== "" && $(k).val() !== undefined){
|
|||
|
|
personList.id = "";
|
|||
|
|
personList.orgname = $(j).val();
|
|||
|
|
personList.orgcode = $(k).val();
|
|||
|
|
personList.exam = $('#txtname').val();
|
|||
|
|
personList.exam_id = exam_id;
|
|||
|
|
personList.limitation = limitation;
|
|||
|
|
personArray.push(personList);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: departmentAddUrl,
|
|||
|
|
data: {'orgArray':JSON.stringify(personArray)},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("添加人员失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (result.success) {
|
|||
|
|
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 aN:aN:aN')
|
|||
|
|
{
|
|||
|
|
$('#startdate').val('');
|
|||
|
|
}
|
|||
|
|
if($('#enddate').val()==='NaN-aN-aN aN: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 formInit = function () {
|
|||
|
|
// $('#grid_form').uiForm({
|
|||
|
|
// template: 'grid_form_temp',
|
|||
|
|
// onLoadSuccess: function (result) {
|
|||
|
|
// switch ("add") {
|
|||
|
|
// case 'view':
|
|||
|
|
// // list_corp.uiGrid('toolbar').hide();
|
|||
|
|
// break;
|
|||
|
|
// case 'edit':
|
|||
|
|
// break;
|
|||
|
|
// case 'add':
|
|||
|
|
// break;
|
|||
|
|
// default :
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
// };
|
|||
|
|
|
|||
|
|
//初始化试卷内容编辑弹出窗口
|
|||
|
|
// var dialog = $('#dialog').uiDialog({
|
|||
|
|
// title: '新建',
|
|||
|
|
// icon: 'list',
|
|||
|
|
// // width: dialogSize.width,
|
|||
|
|
// // height: dialogSize.height,
|
|||
|
|
// width:"95%",
|
|||
|
|
// height:"95%",
|
|||
|
|
// mask: true,
|
|||
|
|
// showBtnBar: true,
|
|||
|
|
// updateOnOpen: true,
|
|||
|
|
// lazyLoad: true,
|
|||
|
|
// url: editexamPage,
|
|||
|
|
// onLoadComplete: formInit,
|
|||
|
|
// onOpen: function () {
|
|||
|
|
// var dialogP = $('#dialog').uiDialog('getUserParam');
|
|||
|
|
// var id = dialogP.id;
|
|||
|
|
// $('#grid_form').uiForm('load');
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//初始化表单-编辑试卷内容
|
|||
|
|
var formeditexampaperInit = function () {
|
|||
|
|
|
|||
|
|
var eqlist2 = $('#eqlist2');
|
|||
|
|
|
|||
|
|
eqlist2.uiGrid({
|
|||
|
|
autoFit: true,
|
|||
|
|
border:false,
|
|||
|
|
colFit:true,
|
|||
|
|
gridTitleFix: false,
|
|||
|
|
width:"100%",
|
|||
|
|
height:"100%",
|
|||
|
|
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}});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//下拉框 随机生成题目
|
|||
|
|
$('#categoryRand').dictCombobox();
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//初始化弹出窗口-编辑试卷内容 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 () {
|
|||
|
|
var dialogP = $('#editexampaper_dialog').uiDialog('getUserParam');
|
|||
|
|
var id = dialogP.id;
|
|||
|
|
},
|
|||
|
|
onPanelResize: function () {
|
|||
|
|
setStatistic();//将计算题数和总分的方法放在了组件改变大小时触发,不合理,考虑用SQL语句初始化出来,或者前端有什么方法可以初始化
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
//初始化表单——导入新试卷
|
|||
|
|
var formimportInit2 = function () {
|
|||
|
|
$('#btnUpload').uiButton();
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//初始化弹出窗口——导入新试卷
|
|||
|
|
var importnewpaper_dialog = $('#importnewpaper_dialog').uiDialog({
|
|||
|
|
title: '导入',
|
|||
|
|
icon: 'list',
|
|||
|
|
width:"80%",
|
|||
|
|
height:"60%",
|
|||
|
|
mask: true,
|
|||
|
|
showBtnBar: true,
|
|||
|
|
updateOnOpen: true,
|
|||
|
|
lazyLoad: true,
|
|||
|
|
url: importnewexampaperPage,
|
|||
|
|
onLoadComplete: formimportInit2,
|
|||
|
|
onOpen: function () {
|
|||
|
|
var dialogP = $('#importnewpaper_dialog').uiDialog('getUserParam');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function addEvents() {
|
|||
|
|
//新建
|
|||
|
|
$('#btn1').bind('click', function () {
|
|||
|
|
|
|||
|
|
if($('#grid_add').attr("class") == null)//判断是否存在css样式,借此判断标签是否被初始化,不重复初始化
|
|||
|
|
{
|
|||
|
|
$('#grid_add').uiGrid({
|
|||
|
|
url: departmentListUrl,
|
|||
|
|
queryParams:{"exam_id": 0
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else{
|
|||
|
|
$('#grid_add').uiGrid('loadData',{queryParams:{"exam_id": 0}});
|
|||
|
|
}
|
|||
|
|
$('#grid_add').hide();
|
|||
|
|
|
|||
|
|
dialog.uiDialog('setUserParam', {action: 'add', id: 0});
|
|||
|
|
dialog.uiDialog('button', 'btnOK').show();
|
|||
|
|
dialog.uiDialog('open');
|
|||
|
|
dialog.uiDialog('title').html('新建');
|
|||
|
|
});
|
|||
|
|
//删除
|
|||
|
|
$('#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: list_editexampaper_Url,
|
|||
|
|
data:{'AndEdit_id':AndEdit_id},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) { //result是接收后台return的结果
|
|||
|
|
//showResult(result.success, result.message);
|
|||
|
|
if(result.data.rows.length > 0){
|
|||
|
|
var data=result.data.rows[0];
|
|||
|
|
$('#title_name').html(data.name);//将后台return的结果显示在前端
|
|||
|
|
$('#title_description').html(data.description);
|
|||
|
|
if(data.state == examState.secondState || data.state == examState.thirdState || data.state == examState.fourthState){
|
|||
|
|
editexampaper_dialog.uiDialog('close');
|
|||
|
|
alert("正在进行、已关闭和已撤销的试卷不允许编辑!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// $('#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 (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要导出的试卷!', 'alert');
|
|||
|
|
} else {
|
|||
|
|
//导出试卷
|
|||
|
|
alert("试卷已导出。");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//撤销调研问卷
|
|||
|
|
$('#btn6').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{
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确认要撤销调研问卷吗?",
|
|||
|
|
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("撤销调研问卷失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//删除——发放范围
|
|||
|
|
$('#btnDelete').bind('click', function () {
|
|||
|
|
var ids = $('#grid_add').uiGrid('selectedData', 'id');
|
|||
|
|
if (ids.length == 0) {
|
|||
|
|
showResult(false, '请选择要删除的行!', 'alert');
|
|||
|
|
} else {
|
|||
|
|
deleteLimitation(ids);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//查看
|
|||
|
|
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();
|
|||
|
|
|
|||
|
|
exam_id = id;
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
if($('#grid_add').attr("class") == null)//判断是否存在css样式,借此判断标签是否被初始化,不重复初始化
|
|||
|
|
{
|
|||
|
|
$('#grid_add').uiGrid({
|
|||
|
|
url: departmentListUrl,
|
|||
|
|
queryParams:{"exam_id": exam_id
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else{
|
|||
|
|
$('#grid_add').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
}
|
|||
|
|
$('#grid_add').show();
|
|||
|
|
editShowHide();
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
$('#btnDelete').hide();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//编辑
|
|||
|
|
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;
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
if($('#grid_add').attr("class") == null)//判断是否存在css样式,借此判断标签是否被初始化,不重复初始化
|
|||
|
|
{
|
|||
|
|
$('#grid_add').uiGrid({
|
|||
|
|
url: departmentListUrl,
|
|||
|
|
queryParams:{"exam_id": exam_id
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
// $('#txtdepartment').uiCombobox({
|
|||
|
|
// mode: "remote",
|
|||
|
|
// url: departmentComboxUrl,
|
|||
|
|
// onLoadSuccess: function (data) {
|
|||
|
|
// },
|
|||
|
|
// onLoadError: function (data) {
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
}else{
|
|||
|
|
$('#grid_add').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
}
|
|||
|
|
$('#grid_add').show();
|
|||
|
|
editShowHide();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 删除
|
|||
|
|
function deleteRow(id) {
|
|||
|
|
deleteData_exampaper("此操作将删除试卷,可能会导致以往考试找不到试卷,确定删除吗?", deleteUrl, {ids: id}, function (result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
$('#grid').uiGrid('loadData');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除
|
|||
|
|
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);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选择要批阅的试卷 下拉框
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选择历史问卷 从前端依次获取存入数据库中
|
|||
|
|
// 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 updateuserrange_exampaper(type) {
|
|||
|
|
// ;
|
|||
|
|
if(type==0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var div_titleuser = $('#div_Listusertitle_exampaper');
|
|||
|
|
var div_Listuser = $('#div_Listuser_exampaper');
|
|||
|
|
var listuser_data = $('#list_user_exampaper');
|
|||
|
|
div_titleuser.hide();
|
|||
|
|
listuser_data.hide();
|
|||
|
|
div_Listuser.hide();
|
|||
|
|
// div_Listuser.html("");
|
|||
|
|
var div_titlegroup = $('#div_corpListtitle_exampaper');
|
|||
|
|
var div_Listgroup = $('#div_Listcorp_exampaper');
|
|||
|
|
var listgroup_data = $('#list_group_exampaper');
|
|||
|
|
div_titlegroup.hide();
|
|||
|
|
div_Listgroup.hide();
|
|||
|
|
listgroup_data.hide();
|
|||
|
|
}
|
|||
|
|
else if(type==1)
|
|||
|
|
{
|
|||
|
|
// ;
|
|||
|
|
var div_titleuser = $('#div_Listusertitle_exampaper');
|
|||
|
|
var div_Listuser = $('#div_Listuser_exampaper');
|
|||
|
|
div_titleuser.hide();
|
|||
|
|
div_Listuser.hide();
|
|||
|
|
|
|||
|
|
var div_title = $('#div_corpListtitle_exampaper');
|
|||
|
|
var div_List = $('#div_Listcorp_exampaper');
|
|||
|
|
var list_data = $('#list_group_exampaper');
|
|||
|
|
div_title.show();
|
|||
|
|
div_List.show();
|
|||
|
|
list_data.show();
|
|||
|
|
list_data.css("position", "static");
|
|||
|
|
// ;
|
|||
|
|
|
|||
|
|
if (div_List.html().length < 1) {
|
|||
|
|
list_data.uiGrid({
|
|||
|
|
localData: {
|
|||
|
|
rows: [
|
|||
|
|
{id: '1', name: '遥控'},
|
|||
|
|
{id: '2', name: '卫通'},
|
|||
|
|
{id: '3', name: '电子战'}]
|
|||
|
|
},
|
|||
|
|
defaultSortField: 'id'
|
|||
|
|
});
|
|||
|
|
div_List.append(list_data.detach());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if(type==2) {
|
|||
|
|
|
|||
|
|
var div_titlegroup = $('#div_corpListtitle_exampaper');
|
|||
|
|
var div_Listgroup = $('#div_Listcorp_exampaper');
|
|||
|
|
div_titlegroup.hide();
|
|||
|
|
div_Listgroup.hide();
|
|||
|
|
|
|||
|
|
|
|||
|
|
var div_title = $('#div_Listusertitle_exampaper');
|
|||
|
|
var div_List = $('#div_Listuser_exampaper');
|
|||
|
|
var list_data = $('#list_user_exampaper');
|
|||
|
|
div_title.show();
|
|||
|
|
div_List.show();
|
|||
|
|
list_data.show();
|
|||
|
|
// ;
|
|||
|
|
if (div_List.html().length < 1) {
|
|||
|
|
list_data.css("position", "static");
|
|||
|
|
list_data.uiGrid({
|
|||
|
|
localData: {
|
|||
|
|
rows: [
|
|||
|
|
{id: '1', name: '宁志全'},
|
|||
|
|
{id: '2', name: '龚兴兴'},
|
|||
|
|
{id: '3', name: '赵简'}]
|
|||
|
|
},
|
|||
|
|
defaultSortField: 'id'
|
|||
|
|
});
|
|||
|
|
div_List.append(list_data.detach());
|
|||
|
|
}
|
|||
|
|
// ;
|
|||
|
|
|
|||
|
|
// ;
|
|||
|
|
// div_List.append(list_data.html());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//发放范围——添加
|
|||
|
|
function addList(n) {
|
|||
|
|
if(n == 2){
|
|||
|
|
var txtdepartment = "txtdepartment";
|
|||
|
|
count++;
|
|||
|
|
var j = txtdepartment + count;
|
|||
|
|
var last_tr = $('#grid_add tr').last();
|
|||
|
|
var ihtml =
|
|||
|
|
'<tr class="rowLimit'+count+'">'+
|
|||
|
|
'<td><input class="grid_selector" type="checkbox" id="cb'+count+'"/></td>'+
|
|||
|
|
'<td class="tableCenterTd">'+
|
|||
|
|
'<a class="icon icon_rowdelete" title="删除" href="javascript:void(0);" onclick="deleteGridAdd('+count+');"></a>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'<td><span class="reorder">'+count+'</span></td>'+
|
|||
|
|
'<td>'+
|
|||
|
|
// '<input id="'+j+'" type="text" name="departmentid" class="ui_validate" ui-config="required:true,tipAfterInput:true,dictKey:\'department\'" />'+
|
|||
|
|
'<select id="'+j+'" name="departmentid" class="ui_validate" ui-config="required:true,width:200,panelHeight:150,valueField:\'orgcode\',textField:\'orgname\'"></select>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'</tr>';
|
|||
|
|
last_tr.after(ihtml);
|
|||
|
|
|
|||
|
|
// $('#'+j+'').dictCombobox();
|
|||
|
|
$('#'+j+'').uiCombobox({
|
|||
|
|
mode: "remote",
|
|||
|
|
url: departmentComboxUrl,
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$(".grid_data").css("overflow-y","auto");//加滚动条
|
|||
|
|
reorder();//重新排序
|
|||
|
|
|
|||
|
|
}else if(n == 3){
|
|||
|
|
var txtperson = "txtperson";
|
|||
|
|
var txtcard = "txtcard";
|
|||
|
|
count++;
|
|||
|
|
var f = txtperson + count;
|
|||
|
|
var g = txtcard + count;
|
|||
|
|
var last_tr_p = $('#grid_add tr').last();
|
|||
|
|
var ihtml_p =
|
|||
|
|
'<tr class="rowLimit'+count+'">'+
|
|||
|
|
'<td><input class="grid_selector" type="checkbox" id="cb'+count+'"/></td>'+
|
|||
|
|
'<td class="tableCenterTd">'+
|
|||
|
|
'<a class="icon icon_rowdelete" title="删除" href="javascript:void(0);" onclick="deleteGridAdd('+count+');"></a>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'<td><span class="reorder">'+count+'</span></td>'+
|
|||
|
|
'<td>'+
|
|||
|
|
'姓名:'+
|
|||
|
|
'<input id="'+f+'" type="text" name="personid" class="ui_validate" ui-config="required:true,width:600" style="background: #F3F0F0" />'+
|
|||
|
|
// '</td>'+
|
|||
|
|
// '<td>'+
|
|||
|
|
' 工资号:'+
|
|||
|
|
'<input id="'+g+'" type="text" name="cardid" class="ui_validate" ui-config="required:true,width:600" style="background: #F3F0F0"/>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'</tr>';
|
|||
|
|
last_tr_p.after(ihtml_p);
|
|||
|
|
reorder();//重新排序
|
|||
|
|
}
|
|||
|
|
else if(n == 4){
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if(n == 5){
|
|||
|
|
var txtcourse = "txtcourse";
|
|||
|
|
count++;
|
|||
|
|
var h = txtcourse + count;
|
|||
|
|
var last_tr_c = $('#grid_add tr').last();
|
|||
|
|
var ihtml_c =
|
|||
|
|
'<tr class="rowLimit'+count+'">'+
|
|||
|
|
'<td><input class="grid_selector" type="checkbox" id="cb'+count+'"/></td>'+
|
|||
|
|
'<td class="tableCenterTd">'+
|
|||
|
|
'<a class="icon icon_rowdelete" title="删除" href="javascript:void(0);" onclick="deleteGridAdd('+count+');"></a>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'<td><span class="reorder">'+count+'</span></td>'+
|
|||
|
|
'<td>'+
|
|||
|
|
'<select id="'+h+'" name="courseid" class="ui_validate" ui-config="required:true,width:200,panelHeight:150,valueField:\'id\',textField:\'kcmc\'"></select>'+
|
|||
|
|
'</td>'+
|
|||
|
|
'</tr>';
|
|||
|
|
last_tr_c.after(ihtml_c);
|
|||
|
|
|
|||
|
|
$('#'+h+'').uiCombobox({
|
|||
|
|
mode: "remote",
|
|||
|
|
url: courseComboxUrl,
|
|||
|
|
onLoadSuccess: function (data) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$(".grid_data").css("overflow-y","auto");//加滚动条
|
|||
|
|
reorder();//重新排序
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//发放范围 显示
|
|||
|
|
function specifiedRange(num) {
|
|||
|
|
var grid_add = $('#grid_add');
|
|||
|
|
// if(grid_add.html().length < 1285)//通过判断标签大小判断标签是否被初始化
|
|||
|
|
if(grid_add.attr("class") == null)//判断是否存在css样式,借此判断标签是否被初始化,不重复初始化
|
|||
|
|
{
|
|||
|
|
grid_add.uiGrid({
|
|||
|
|
url: departmentListUrl,
|
|||
|
|
queryParams:{"exam_id": exam_id
|
|||
|
|
// "limitation":limitation
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
// $('#txtdepartment').dictCombobox();//需在grid_add.uiGrid初始化之后,再初始化下拉框
|
|||
|
|
// $('#txtdepartment').uiCombobox();
|
|||
|
|
}else{
|
|||
|
|
// $('#grid_add').uiGrid('loadData',{queryParams:{"exam_id": exam_id}});
|
|||
|
|
}
|
|||
|
|
if(num == 1){
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
grid_add.hide();
|
|||
|
|
|
|||
|
|
}else if(num == 2){
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
grid_add.uiGrid('loadData',{queryParams:{"exam_id": 0}});
|
|||
|
|
grid_add.show();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').show();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').show();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
|
|||
|
|
}else if(num == 3){
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
grid_add.uiGrid('loadData',{queryParams:{"exam_id": 0}});
|
|||
|
|
grid_add.show();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').show();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').show();
|
|||
|
|
$('#p_c').show();
|
|||
|
|
$('#p_c2').show();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
|
|||
|
|
}else if(num == 4){
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
grid_add.uiGrid('loadData',{queryParams:{"exam_id": 0}});
|
|||
|
|
grid_add.show();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').show();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').show();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
|
|||
|
|
}else if(num == 5){
|
|||
|
|
for (var i=0; i<count+1; i++){
|
|||
|
|
deleteGridAdd(i);
|
|||
|
|
}
|
|||
|
|
grid_add.uiGrid('loadData',{queryParams:{"exam_id": 0}});
|
|||
|
|
grid_add.show();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').show();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').show();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//删除——发放范围 前端
|
|||
|
|
function deleteGridAdd(e) {
|
|||
|
|
$('.rowLimit'+e+'').remove();
|
|||
|
|
reorder();//重新排序
|
|||
|
|
}
|
|||
|
|
//删除——发放范围 后台
|
|||
|
|
function deleteLimitation(ids) {
|
|||
|
|
$.uiMessagebox.confirm({
|
|||
|
|
title: '确认操作',
|
|||
|
|
content: "确定删除吗?",
|
|||
|
|
onClose: function (value) {
|
|||
|
|
if (value) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: deleteLimitationUrl,
|
|||
|
|
data: {"ids":ids},
|
|||
|
|
dataType: "json",
|
|||
|
|
success: function (result) {
|
|||
|
|
// callback && callback.call(this, result);
|
|||
|
|
$('#grid_add').uiGrid('loadData');
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//编辑 查看 发放范围的显示
|
|||
|
|
function editShowHide() {
|
|||
|
|
if($('input:radio[id="cb3_l"]:checked').val() == "on"){
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').hide();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').show();
|
|||
|
|
$('#cb3_li').replaceWith("指定全院");
|
|||
|
|
$('#cb4_li').hide();
|
|||
|
|
$('#cb5_li').hide();
|
|||
|
|
$('#cb6_li').hide();
|
|||
|
|
$('#cb7_li').hide();
|
|||
|
|
|
|||
|
|
$('#grid_add').hide();
|
|||
|
|
}else if($('input:radio[id="cb4_l"]:checked').val() == "on"){
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').hide();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').hide();
|
|||
|
|
$('#cb4_li').show();
|
|||
|
|
$('#cb4_li').replaceWith("指定部门");
|
|||
|
|
$('#cb5_li').hide();
|
|||
|
|
$('#cb6_li').hide();
|
|||
|
|
$('#cb7_li').hide();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').show();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').show();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
}else if($('input:radio[id="cb5_l"]:checked').val() == "on"){
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').hide();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').hide();
|
|||
|
|
$('#cb4_li').hide();
|
|||
|
|
$('#cb5_li').show();
|
|||
|
|
$('#cb5_li').replaceWith("指定人员");
|
|||
|
|
$('#cb6_li').hide();
|
|||
|
|
$('#cb7_li').hide();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').show();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').show();
|
|||
|
|
$('#p_c').show();
|
|||
|
|
$('#p_c2').show();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
}else if($('input:radio[id="cb6_l"]:checked').val() == "on"){
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').hide();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').hide();
|
|||
|
|
$('#cb4_li').hide();
|
|||
|
|
$('#cb5_li').hide();
|
|||
|
|
$('#cb6_li').show();
|
|||
|
|
$('#cb6_li').replaceWith("指定班级");
|
|||
|
|
$('#cb7_li').hide();
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').show();
|
|||
|
|
$('#btnAdd_course').hide();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').show();
|
|||
|
|
$('#course_n').hide();
|
|||
|
|
}else if($('input:radio[id="cb7_l"]:checked').val() == "on"){
|
|||
|
|
$('#cb3_l').hide();
|
|||
|
|
$('#cb4_l').hide();
|
|||
|
|
$('#cb5_l').hide();
|
|||
|
|
$('#cb6_l').hide();
|
|||
|
|
$('#cb7_l').hide();
|
|||
|
|
$('#cb3_li').hide();
|
|||
|
|
$('#cb4_li').hide();
|
|||
|
|
$('#cb5_li').hide();
|
|||
|
|
$('#cb6_li').hide();
|
|||
|
|
$('#cb7_li').show();
|
|||
|
|
$('#cb7_li').replaceWith("指定课程");
|
|||
|
|
|
|||
|
|
$('#btnAdd_d').hide();
|
|||
|
|
$('#btnAdd_p').hide();
|
|||
|
|
$('#btnAdd_class').hide();
|
|||
|
|
$('#btnAdd_course').show();
|
|||
|
|
|
|||
|
|
$('#d_n').hide();
|
|||
|
|
$('#p_n').hide();
|
|||
|
|
$('#p_c').hide();
|
|||
|
|
$('#p_c2').hide();
|
|||
|
|
$('#class_n').hide();
|
|||
|
|
$('#course_n').show();
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//重新排序
|
|||
|
|
function reorder() {
|
|||
|
|
|
|||
|
|
if($('[class=order]').length > 0){
|
|||
|
|
var j = $('[class=order]').length;
|
|||
|
|
for (var i=0;i<$('[class=reorder]').length;i++){
|
|||
|
|
j = j + 1;
|
|||
|
|
$('[class=reorder]:eq('+i+')').replaceWith('<span class="reorder">'+j+'</span>');
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
for (var i=0;i<$('[class=reorder]').length;i++){
|
|||
|
|
var j = i+1;
|
|||
|
|
$('[class=reorder]:eq('+i+')').replaceWith('<span class="reorder">'+j+'</span>');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//随机添加试题
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.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');
|
|||
|
|
}
|
|||
|
|
showResult(result.success, result.message);
|
|||
|
|
},
|
|||
|
|
error:function() {
|
|||
|
|
alert("随机添加试题失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|