getPageContext('ProblemList').bind('initfn',{},function(){
|
var c = $(this);
|
var problemId="";
|
var f_isValid="N"
|
var jqgrid=$("#problemListGrid", c);
|
$("#lineTable", c).hide();
|
var rolesArray = pageSession.roles;
|
var roleNames =[];
|
var schoolId=null;
|
for(var i=0;i<rolesArray.length;i++){
|
roleNames.push(rolesArray[i].name);
|
}
|
function optionFmt(cellvalue, options, rowObject){
|
var retrun_html="";
|
if(rowObject.scprState=="N" && contains(roleNames,rowObject.sccfRole)){
|
retrun_html+="<a href=\"javascript:$('#ediProblemHistoryOption',getPageContext('ProblemList'))." +
|
"triggerHandler('click',[{scprId:'"+rowObject.scprId+"'}])\" class='btn btn-danger btn-xs'><span class='fa fa-white fa-edit'> 修改</span> </a>";
|
retrun_html+=" <a href=\"javascript:$('#showProblemHistoryOption',getPageContext('ProblemList'))." +
|
"triggerHandler('click',[{scprId:'"+rowObject.scprId+"'}])\" class='btn btn-success btn-xs' ><span class='fa fa-white fa-search'> 查看</a>";
|
|
return retrun_html;
|
}else{
|
retrun_html+="<a href=\"javascript:$('#showProblemHistoryOption',getPageContext('ProblemList'))." +
|
"triggerHandler('click',[{scprId:'"+rowObject.scprId+"'}])\" class='btn btn-success btn-xs' ><span class='fa fa-white fa-search'> 查看</a>";
|
return retrun_html;
|
}
|
}
|
|
ScEmphasisManager.getJwclient(pageSession.user.orgId,{
|
callback:function(data){
|
if(data==null)data=false;
|
jw_client=data;
|
if(!jw_client){
|
ScEmphasisManager.getSchoolId(pageSession.user.orgId,{
|
callback:function(data2){
|
schoolId=data2;
|
},async:false
|
});
|
}
|
},async:false
|
});
|
|
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;
|
}
|
|
jqgrid.landyjgrid( {
|
colNames : [ 'ID','sccfRole', 'state','问题详情','操作'],
|
colModel : [
|
{name : 'scprId',index : 'scprId',width : 80,hidden:true},
|
{name : 'sccfRole',index : 'sccfRole',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 : '#problemListGridPager',
|
sortname : 'scprId',
|
viewrecords : true,
|
sortorder : "asc",
|
shrinkToFit :true,
|
queryType : "Problem_GetTrackListQuery",
|
autoLoad : true,
|
multiselect : false,
|
height:300,
|
onBuildAdditionQueryFields : function() {
|
$(this).clearCondition();
|
var conditions = [];
|
conditions.push({fieldName:'scprState',fieldType:'String',fieldStringValue:f_isValid});
|
|
var orgIds = [];
|
if(null != schoolId){
|
orgIds.push(schoolId);
|
}
|
orgIds.push(pageSession.user.orgId);
|
|
|
conditions.push({fieldName:'orgId',fieldType:'String[]',fieldStringValue:orgIds});
|
$(this).addConditions(conditions);
|
}
|
});
|
|
$("#solve",c).click(function(){
|
$(this).css({
|
"color" : "green",
|
});
|
$("#noSolve",c).removeAttr("style");
|
f_isValid = "Y";
|
$("#problem_left",c).width("100%");
|
c.trigger('resizeTab');
|
jqgrid.landyjgrid().trigger("reloadGrid");
|
});
|
$("#noSolve",c).click(function(){
|
$(this).css({
|
"color" : "green",
|
});
|
$("#solve",c).removeAttr("style");
|
f_isValid = "N";
|
$("#problem_left",c).width("100%");
|
c.trigger('resizeTab');
|
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<data.length;i++){
|
|
$("#tttline",c).append("<li><b></b><span>"+getTime(data[i].scphDate)+"</span><p>"+data[i].scphContent+"</p></li>");
|
}
|
$("#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('ProblemList')).triggerHandler('click',[{'scprId':problemId}]);
|
}else if(problemState=="N"){
|
$("#noSolve",c).trigger("click");
|
$('#ediProblemHistoryOption',getPageContext('ProblemList')).triggerHandler('click',[{'scprId':problemId}]);
|
}
|
},async:false
|
});
|
|
});
|
//查询
|
$("#searchBtn",c).click(function(){
|
jqgrid.landyjgrid().trigger("reloadGrid");
|
});
|
|
/**为页面添加查询按钮的回车事件*/
|
c.keydown(function (e) {
|
if (e.keyCode == '13') {
|
$('#searchBtn', c).trigger('click');
|
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
|
|
}
|
});
|
c.bind('resizeTab',{},function(){
|
resizeTab_c(jqgrid,c);
|
|
});
|
|
});
|