123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var corp = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var dept = top.com.sinosoft.lz.system.user.LoginInfo.getDept_id();
- var projectData = [];
- var excelData = [];
- question_import = function() {
- /**定义变量**/
- var _this = this;
- _this.grid = null;
- _this.tixi = null;
- /**私有方法**/
-
-
- function getColumns(){
- var columns = [];
- //{name : 'FD_OBJECTID880',hide : true},
- columns.push({name: 'FD_ID',align: 'center',hide : true});
- columns.push({display: '考试内容类别', name: 'QUESTION_CLASSIFY',align: 'center', width: "100"});
- columns.push({display: '考试内容来源', name: 'EXAMINATION_CONTENT',align: 'center', width: "150"});
- var childColumns = [];
- childColumns.push({display: 'Ⅰ类', name: 'APPLICABLE_OBJECT_1',align: 'center', width: "50"});
- childColumns.push({display: 'Ⅱ类', name: 'APPLICABLE_OBJECT_2',align: 'center', width: "50"});
- childColumns.push({display: 'Ⅲ类', name: 'APPLICABLE_OBJECT_3',align: 'center', width: "50"});
- childColumns.push({display: 'Ⅳ类', name: 'APPLICABLE_OBJECT_4',align: 'center', width: "50"});
-
- columns.push({display: '适用对象', columns:childColumns, width: (50*childColumns.length) });
- columns.push({display: '题型', name: 'QUESTION_TYPE',align: 'center', width: "80"});
- columns.push({display: '题干', name: 'QUESTION_NAME',align: 'center', width: "400"});
- columns.push({display: 'A', name: 'ANSWER_A',align: 'center', width: "100"});
- columns.push({display: 'B', name: 'ANSWER_B',align: 'center', width: "100"});
- columns.push({display: 'C', name: 'ANSWER_C',align: 'center', width: "100"});
- columns.push({display: 'D', name: 'ANSWER_D',align: 'center', width: "100"});
- columns.push({display: 'E', name: 'ANSWER_E',align: 'center', width: "100"});
- columns.push({display: 'F', name: 'ANSWER_F',align: 'center', width: "100"});
- columns.push({display: 'G', name: 'ANSWER_G',align: 'center', width: "100"});
- columns.push({display: '答案', name: 'QUESTION_ANSWER',align: 'center', width: "100"});
-
- return columns;
- }
-
-
- return {
- init:function(){
- $(".titleShow").text("题库导入");
- },
-
- initList : function(data) {
- //$("#maingrid").html("");
- var rowsdata = data[0].result;
- //console.log(rowsdata);
- var option = {
- rownumbers:true,
- columns:getColumns(),
- data:{rows:rowsdata},
- usePager:true,
- pageSize: 10,
- fixedCellHeight:false,
- //percentWidthMode : true,
- rownumbers:true,
- showPageSize:false,
- minColumnWidth:0,
- columnWidth:10,
- sortName: 'FD_ID',
- rownumbers:false,
- checkbox:false,
- height: 'auto',
- // width:"100%",
- isScroll:true,
- headerRowHeight:50,
- onToFirst:setPageHeight,
- onToLast:setPageHeight,
- onToNext:setPageHeight,
- onToPrev:setPageHeight
- };
- _this.grid = $("#maingrid").quiGrid(option);
- _this.grid.setScroller(null,"bottom",false);
- setPageHeight();
- }
- };
-
- }();
- function setPageHeight(){
- ////console.log(123456);
- setTimeout(function(){
- $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
- },200);
- }
- $(function() {
- question_import.init();
- //Grade_inner_view.initList();
-
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
- $('#back').bind('click',back);
-
- $("#import_btn").on("click",function(){
- $("body").eq(0).showLoading();
- var val = $("#import_eval").val();
- var end = val.substring(val.indexOf(".") + 1);
- if (end == "xls" || end == "xlsx") {
- $("#evalFileForm").ajaxSubmit({
- url : $.pathname() + "/ws/Examine/ExamineManagementService/getExcelToList?fileExt="+end,
- type : 'post',
- success : function(responseText, statusText, xhr, $form) {
- if(responseText.state=="false"){
- $("body").eq(0).hideLoading();
- top.Dialog.alert(responseText.message);
- return;
- }
- $("body").eq(0).hideLoading();
- $("#save_eval").show();
- //console.log(responseText);
- if(typeof responseText == 'string')
- responseText = eval('(' + responseText + ')');
- //console.log(responseText);
- excelData = responseText;
- question_import.initList(responseText);
- },error : function(e) {
- top.Dialog.alert("导入数据失败!");
- }
- });
- } else {
- $("body").eq(0).hideLoading();
- top.Dialog.alert("请导入正确的excel文件");
- return;
- }
- });
-
- $("#downloadModel").on("click",function(){
- window.open("/nwyj/excels/examineQuestion.xlsx");
- });
-
- $("#save_eval").on("click",function(){
- $("body").eq(0).showLoading();
- var saveData = excelData[0].result;
- var url = $.pathname() + '/ws/Examine/ExamineManagementService/saveQuestion';
- var params = {
- userName : real_name,
- userId : user_id,
- userUnit : corp,
- userDept : dept,
- versionId: versionId,
- data:JSON.stringify(saveData)
- };
- /*$.request.query(url,params,function(data){
- $("body").eq(0).hideLoading();
- if(data[0].questionResult == "true" && data[0].questionSubResult == "true"){
- top.Dialog.alert('提交成功!');
- back();
- }else{
- top.Dialog.alert('提交失败!');
- return;
- }
- });*/
- $.ajax({
- url : url,
- data : params,
- type : 'post',
- dataType : 'json',
- success : function(data) {
- $("body").eq(0).hideLoading();
- if(data[0].questionResult == "true" && data[0].questionSubResult == "true"){
- top.Dialog.alert('提交成功!');
- back();
- }else{
- top.Dialog.alert('提交失败!');
- return;
- }
- },error : function(e) {
- $("body").eq(0).hideLoading();
- top.Dialog.alert('网络异常!');
- return;
- }
- });
- });
-
-
- });
- function back(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/exercise/examineManagement/questionBank.jsp");
- };
|