function initProblemPage(scId,c){ var problemId=""; var f_isValid="N"; var school_problem_jqgrid=$("#problemListGrid1", c); $("#lineTable", c).hide(); function optionFmt(cellvalue, options, rowObject){ // var return_edit_html =" 修改 "; var return_show_html =" 查看"; // if(rowObject.scprState=="Y"){ // return return_show_html; // }else{ // return return_show_html+" "+return_edit_html; // } return return_show_html } function getTime(d){ var month=d.getMonth()+1; month =(month<10 ? "0"+month:month); var day = (d.getDate()<10 ? "0"+d.getDate():d.getDate()); var hours = (d.getHours()<10 ? "0"+d.getHours():d.getHours()); var minutes = (d.getMinutes()<10 ? "0"+d.getMinutes():d.getMinutes()); var seconds = (d.getSeconds()<10 ? "0"+d.getSeconds():d.getSeconds()); var YMDHMS = d.getFullYear() + "-" +month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; return YMDHMS; } school_problem_jqgrid.landyjgrid( { colNames : [ 'ID', 'state','问题详情','操作'], colModel : [ {name : 'scprId',index : 'scprId',width : 80,hidden:true}, {name : 'scprState',index : 'scprState',width : 80,hidden:true}, {name : 'scosProblem',index : 'scosProblem',width : 180,align:'center',sortable:false}, {name : 'caozuo',index : 'caozuo',width : 60,align : "center",formatter:optionFmt,sortable:false} ], altRows:true, rowNum : 20, rownumbers:true, rowList : [10, 20, 50, 100 ,500], pager : '#problemListGridPager1', sortname : 'scprId', viewrecords : true, sortorder : "asc", shrinkToFit :true, queryType : "Problem_GetTrackListQuery", autoLoad : false, gridComplete: function () { //$("#noSolve",c).trigger("click"); }, multiselect : false, height:270, onBuildAdditionQueryFields : function() { $(this).clearCondition(); var conditions = []; conditions.push({fieldName:'scprState',fieldType:'string',fieldStringValue:f_isValid}); var orgIds = []; orgIds.push($("#hidden_districtIds",c).val().split(",")[0]); conditions.push({fieldName:'orgId',fieldType:'String[]',fieldStringValue:orgIds}); $(this).addConditions(conditions); } }); school_problem_jqgrid.landyjgrid().trigger("reloadGrid"); $("#solve",c).click(function(){ $("#problem_right",c).hide(); $(this).css({ "color" : "green", }); $("#noSolve",c).removeAttr("style"); f_isValid = "Y"; $("#problem_left",c).width("100%"); c.trigger('resizeTab'); school_problem_jqgrid.landyjgrid().trigger("reloadGrid"); }); $("#noSolve",c).click(function(){ $("#problem_right",c).hide(); $(this).css({ "color" : "green", }); $("#solve",c).removeAttr("style"); f_isValid = "N"; $("#problem_left",c).width("100%"); c.trigger('resizeTab'); school_problem_jqgrid.landyjgrid().trigger("reloadGrid"); }); // $('#categoryTab',c).on("click","a",function (e) { // e.preventDefault(); // $(this).tab('show'); // }); //--------------------------------添加检查项类别addNewsBtn $("#showProblemHistoryOption",c).bind("click", function(event,data) {//为新增按钮添加一个单击事件 $("#lineTable", c).hide(); showRight(data); problemId = data.scprId; }); function showRight(data){ //添加时间轴 $("#tttline",c).children().remove(); ScProblemHistoryManager.getHisotryByPrId(data.scprId,{ callback:function(data){ for(var i=0;i"+getTime(data[i].scphDate)+"

"+data[i].scphContent+"

"); } $("#problem_right",c).show(); $("#problem_left",c).width("60%"); c.trigger('resizeTab'); },async:false }); } $("#ediProblemHistoryOption",c).bind("click", function(event,data) {//为新增按钮添加一个单击事件 problemId = data.scprId; //添加时间轴 showRight(data); //设置初始值 $("#scemContent",c).val(""); $("input[type=radio][value=N]").attr("checked",'checked'); $("#lineTable", c).show(); }); //保存事件 $("#saveBtn",c).bind("click",function(){ var scemContent = $("#scemContent",c).val(); var problemState = $("input[name='problemState']:checked").val(); if(!isNotNull(scemContent.trim())){ prompt("记录明细不能为空"); return; } ScProblemHistoryManager.saveHisotryByPrId(problemId,problemState,scemContent,{ callback:function(){ prompt("保存成功"); if(problemState=="Y"){ $("#solve",c).trigger("click"); $('#showProblemHistoryOption',getPageContext('CheckResultList')).triggerHandler('click',[{'scprId':problemId}]); }else if(problemState=="N"){ $("#noSolve",c).trigger("click"); $('#ediProblemHistoryOption',getPageContext('CheckResultList')).triggerHandler('click',[{'scprId':problemId}]); } },async:false }); }); c.bind('resizeTab',{},function(){ school_problem_jqgrid.setGridWidth($("#tableCont3", c).width()-$("#problem_right:visible",c).width()); //$grid.setGridWidth($("#tableCont",c).width()); }); c.trigger('resizeTab'); }