var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var corp_Id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getDept_id(); Grade = function() { /** 定义变量* */ var _this = this; _this.listGrid = null;// 数据列表 //_this.searchPanel = null; // 查询面板 $queryForm = null;// 查询区域表单 $searchButt = null;// 查询按钮 $more = null; // 更多 $reported = null; //填报 _this.loadParams = null;// 列表加载参数 /** 私有方法* */ /** *新增信息** */ _this.addForm = function() { $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/evaluate/grade/Grade_addEdit1.jsp?fd_id="); }; /** *修改信息** */ _this.editForm = function() { var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请至少选中要修改的记录!"); return; } var ids = "" ; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID798 + ","; } //alert(ids) $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/evaluate/grade/Grade_addEdit1.jsp?fd_id="+ ids); }; /** *删除信息** */ _this.del = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要删除的记录!"); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID798 + ","; } var url = $.pathname() +"/ws/crud/CRUDService/delete/"; var params = { objectIDs : ids, classid : 798 }; top.Dialog.confirm("确定要删除吗?|删除", function() { $.request.del(url,params,function(result){ if (result.Msg.sucsess == true) { var url = $.pathname() + '/ws/scoreGrade/ScoreService/delectTaskPerson'; var params = { busi_ids : ids }; $.request.query(url,params,function(data){ top.Dialog.alert("删除成功!"); _this.listGrid.rend(); }); // 刷新表格数据 //_this.listGrid.loadData(); } else { top.Dialog.alert("删除失败!"); } }); }); }; /** **查看详细信息*** */ _this.show = function() { var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要查看评分的记录!"); return; } else if (rowsLength > 1) { top.Dialog.alert("请选中一条要查看评分的记录!"); return; } else { if(rows[0].STATE_798 != "1"){ top.Dialog.alert("该记录未评分完,不能查看评分结果!"); return ; } var fd_id = rows[0].FD_OBJECTID798; var connect_ids = rows[0].CONNECT_IDS_798; var sys_id = rows[0].SYS_ID_798; var sys_id_name = rows[0].SYS_ID_798_SHOW; var is_assigning = rows[0].IS_ASSIGNING_798; //console.log(rows[0]); var url1 = "/nwyj/page/business/em/evaluate/grade/Grade_inner_view.jsp?fd_id="+ fd_id +"&sys_id="+sys_id+"&isList=isList&isFrist=true&is_assigning="+is_assigning; var url2 = "/nwyj/page/business/em/evaluate/grade/Grade_score_show.jsp?fd_id="+ fd_id +"&sys_id="+sys_id+"&isFrist=true"; if(rows[0].IS_CONNECT_798 == "1"){ var inputbtn = "",height = 70; var url = $.pathname() + '/ws/scoreGrade/ScoreService/getOuterSysId'; var params = { sys_id : sys_id }; $.request.query(url,params,function(data){ for(var i=0;i
'; } height += 40 * data.length; top.Dialog.open({ Title:"选择查看", Width:340, Height:height, //这里还可以直接写html代码 InnerHtml: '
' +'' +'
' +inputbtn +'
' +'
' }); }); }else{ var url = $.pathname() + '/ws/targetManage/ManageService/getTiXiById'; var params = { fd_id : sys_id }; $.request.query(url,params,function(data){ console.log(data); if(data[0].TYPE == "2"){ $.indexOpenSelfWindow(url2); }else{ $.indexOpenSelfWindow(url1); } }); } } }; _this.rePush = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要发布的记录!"); return; } else if (rowsLength > 1) { top.Dialog.alert("请选中一条要发布的记录!"); return; } else { if(rows[0].STATE_798 == "2"){ top.Dialog.alert("该记录已经发布!"); return ; } if(rows[0].STATE_798 == "3"){ top.Dialog.alert("该记录已经评分完!"); return ; } var fdid = rows[0].FD_OBJECTID_798; var url = $.pathname() + '/ws/scoreGrade/ScoreService/rePushProject'; var params = { fd_id : fdid }; $.request.query(url,params,function(data){ _this.listGrid.rend();//加载数据 }); } }; _this.test = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要评分的记录!"); return; } if (rowsLength > 1) { top.Dialog.alert("请选中一条要评分的记录!"); return; } var is_assinging = rows[0].IS_ASSIGNING_798;//是否分配任务 if("0"==is_assinging && rows[0].WRITER_DEPT_ID_798 != corp_Id){ top.Dialog.alert("该记录未分配任务,只能由本公司人员填写评分!"); return ; } var fdId = rows[0].FD_OBJECTID_798; var sys_id = rows[0].SYS_ID_798; /*var url = $.pathname() + '/ws/scoreGrade/ScoreService/testscore'; var params = { user_id : user_id, fd_id : fdId, sys_id : sys_id, is_assinging : is_assinging, }; $.request.query(url,params,function(data){ });*/ }; _this.goEval = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要评分的记录!"); return; } else if (rowsLength > 1) { top.Dialog.alert("请选中一条要评分的记录!"); return; } else { if(rows[0].IS_HIDE_798 == "1"){ top.Dialog.alert("该记录是隐藏关联项目,无需再评分!"); return ; } if(rows[0].STATE_798 == "1"){ top.Dialog.alert("该记录已经评分完,无需再评分!"); return ; } //console.log(rows[0]); var is_assinging = rows[0].IS_ASSIGNING_798;//是否分配任务 var fdId = rows[0].FD_OBJECTID_798; var sys_id = rows[0].SYS_ID_798; var event_id = rows[0].EVENT_ID_798; var eval_dept_id = rows[0].EVAL_DEPT_ID_798; var is_self_eval = rows[0].IS_SELF_EVAL_798;//是否自评 if("0"==is_assinging ){ if("1"==is_self_eval){ if(eval_dept_id != corp_Id){ top.Dialog.alert("该记录未分配任务且选择自评,只能由本公司人员填写评分!"); return ; }else{ window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); return ; } }else{ window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); return ; } } /*if("0"==is_assinging ){ if(rows[0].WRITER_DEPT_ID_798 != corp_Id){ top.Dialog.alert("该记录未分配任务,只能由本公司人员填写评分!"); return ; }else{ window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); return ; } }*/ var url = $.pathname() + '/ws/scoreGrade/ScoreService/checkTaskCompleted'; var params = { fd_id : fdId, sys_id : sys_id, is_assinging : is_assinging, user_id : user_id }; $.request.query(url,params,function(data){ //console.log(data); if(data[0].result == "completed"){ top.Dialog.alert("您在该记录下的任务已经完成!"); }else if(data[0].result == "uncompleted"){ window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); }else{ top.Dialog.alert("您在该记录下没有任务!"); } }); } }; _this.staticstic = function(){ $.indexOpenNextWindow("/nwyj/page/business/em/evaluate/grade/Grade_staticstic.jsp"); }; _this.importExcel = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength != 1) { top.Dialog.alert("请选中一条要导入的记录!"); return; } else { if(rows[0].STATE_798 == "1"){ top.Dialog.alert("该记录已经评分完,无需再导入评分!"); return ; } var fdId = rows[0].FD_OBJECTID_798; var sys_id = rows[0].SYS_ID_798; var eval_dept_id = rows[0].EVAL_DEPT_ID_798; var is_assigning = rows[0].IS_ASSIGNING_798; var sys_type = rows[0].SYS_TYPE_798; if(rows[0].SYS_TYPE_798 == "1"){ if(is_assigning == "1"){ var url = $.pathname() + '/ws/scoreGrade/ScoreService/checkTaskCompleted'; var params = { fd_id : fdId, sys_id : sys_id, is_assinging : is_assigning, user_id : user_id }; $.request.query(url,params,function(data){ //console.log(data); if(data[0].result == "completed"){ top.Dialog.alert("您在该记录下的任务已经完成,无需再导入!"); return; }else if(data[0].result == "uncompleted"){ //window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); $.indexOpenNextWindow("/nwyj/page/business/em/evaluate/inAndOutExcel/inner_scan.jsp?fd_id="+fdId+"&sys_id="+sys_id+"&is_assigning="+is_assigning+"&sys_type="+sys_type); }else{ top.Dialog.alert("您在该记录下没有任务,无法导入!"); return; } }); }else if(corp_Id != eval_dept_id){ top.Dialog.alert("只能导入本公司评分项目数据!"); return ; }else{ $.indexOpenNextWindow("/nwyj/page/business/em/evaluate/inAndOutExcel/inner_scan.jsp?fd_id="+fdId+"&sys_id="+sys_id+"&is_assigning="+is_assigning+"&sys_type="+sys_type); } }else{ if(is_assigning == "1"){ var url = $.pathname() + '/ws/scoreGrade/ScoreService/checkTaskCompleted'; var params = { fd_id : fdId, sys_id : sys_id, is_assinging : is_assigning, user_id : user_id }; $.request.query(url,params,function(data){ //console.log(data); if(data[0].result == "completed"){ top.Dialog.alert("您在该记录下的任务已经完成,无需再导入!"); return; }else if(data[0].result == "uncompleted"){ //window.open($.pathname()+ "/page/business/em/evaluate/grade/Grade_score.jsp?fd_id="+ fdId+"&event_id="+ event_id +"&eval_dept_id="+eval_dept_id); $.indexOpenNextWindow("/nwyj/page/business/em/evaluate/inAndOutExcel/other_import_scan.jsp?fd_id="+fdId+"&sys_id="+sys_id+"&is_assigning="+is_assigning+"&sys_type="+sys_type); }else{ top.Dialog.alert("您在该记录下没有任务,无法导入!"); return; } }); }else if(corp_Id != eval_dept_id){ top.Dialog.alert("只能导入本公司评分项目数据!"); return ; }else { $.indexOpenNextWindow("/nwyj/page/business/em/evaluate/inAndOutExcel/other_import_scan.jsp?fd_id="+fdId+"&sys_id="+sys_id+"&is_assigning="+is_assigning+"&sys_type="+sys_type); } //top.Dialog.alert("您选择的不是南方电网应急评估,不能导入得分"); return ; } } }; _this.exportExcel = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength != 1) { top.Dialog.alert("请选中一条要导出的记录!"); return; } else { var fdId = rows[0].FD_OBJECTID_798; var connect_ids=rows[0].CONNECT_IDS_798; //var destFileName = rows[0].NAME_798 + rows[0].SYS_ID_798_SHOW; var destFileName = rows[0].NAME_798; var is_assigning = rows[0].IS_ASSIGNING_798; var params = { fd_id : fdId, connect_ids:connect_ids, is_assigning:is_assigning }; var url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportEvalExcelByFdId'; if(rows[0].SYS_TYPE_798 == "2"){ url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportOuterEvalExcelByFdId'; } console.log(rows[0].SYS_TYPE_798); $.exportExcel(url,params,destFileName,"xlsx"); } }; // 查询 function search(obj) { //去掉水印 if($("#NAME_798").val().trim()==" 评 分 名 称" || $("#NAME_798").val().trim()==""){ $("#NAME_798").val(""); } $queryForm.serialize(); //获取选中的值 var searchCondition = getSelectCon(conditionData); var queryParams = getQueryFormParams($queryForm); var params=$.extend({},_this.loadParams,queryParams); //与之前参数条件拼接 params.condition = searchCondition.condition + params.condition; _this.listGrid.setOptions({"params":params}); //加载数据 _this.listGrid.rend();//加载数据 } // 更多 function more() { $('#moreTable').toggle(); // document.getElementById("queryForm").reset(); //重置一下表单 // _this.listGrid.resetHeight(); //重新设置高度 } //点击主键跳转详细信息页面 _this.openDetail = function(rowindex) { var row = _this.listGrid.getRow(rowindex); var fd_id = row.FD_OBJECTID_798; /*var event_id = row.EVENT_ID_798; var eval_dept_id = row.EVAL_DEPT_ID_798;*/ //console.log(row); $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/evaluate/grade/Grade_view.jsp?fd_id="+ fd_id); }; //点击主键跳转详细信息页面 _this.openDetail1 = function(rowindex) { var row = _this.listGrid.getRow(rowindex); var fd_id = row.FD_OBJECTID_798; var sys_id = row.SYS_ID_798; var url = $.pathname() + '/ws/targetManage/ManageService/getTiXiById'; var url1 = "/nwyj/page/business/em/evaluate/grade/Grade_inner_view.jsp?fd_id="+ fd_id +"&sys_id="+sys_id+"&isList=isList&isFrist=true"; var url2 = "/nwyj/page/business/em/evaluate/grade/Grade_score_show.jsp?fd_id="+ fd_id +"&sys_id="+sys_id+"&isFrist=true"; var params = { fd_id : sys_id }; $.request.query(url,params,function(data){ console.log(data); if(data[0].TYPE == "2"){ $.indexOpenSelfWindow(url2); }else{ $.indexOpenSelfWindow(url1); } }); }; return { init : function() { $queryForm = $("#queryForm"); //绑定查询面板的按钮点击事件 $searchButt = $("#searchButt");// 查询按钮 $searchButt.bind('click', function() { search(); }); $('#NAME_798').keydown(function(e){ if(e.keyCode==13){ search(); } }); //绑定更多的按钮点击事件 $more = $("#more"); // 更多按钮 $more.bind('click', function() { more(); }); // 获得面板对象 12 //_this.searchPanel = $("#searchPanel"); //部门id--预警范围用到 //var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); // 列表加载参数 _this.loadParams = { listId : '798', direction:'desc', sort: 'UPDATEDATE', condition : " is_del = '0' and EVAL_DEPT_ID in (select dept_id from sys_department where dept_id='"+corp_Id+"' or parent_id='"+corp_Id+"') ", }; var toolBarOpt1 = { items : [ {text : '新增',click : 'addForm',iconClass : 'add1_tem',id : '10000'}, {text : '删除',click : 'del',iconClass : 'delete_tem',id : '10002'}, {text : '修改',click : 'editForm',iconClass : 'update_tem',id : '10001'}, // {text : '发布',click : 'rePush',iconClass : 'update_tem',id : '10001'}, {text : '去评分',click : 'goEval',iconClass : 'issue_tem',id : '10003'}, {text : '查看评分',click : 'show',iconClass : 'view_tem',id : '10004'}, {text : '导出评分',click : 'exportExcel',iconClass : 'export_tem',id : '10005'}, {text : '导入评分',click : 'importExcel',iconClass : 'import_tem',id : '10006'}, {text : '统计查看',click : 'staticstic',iconClass : 'poll_tem',id : '10007'} ], roleCons:"" }; var grid_option1={ columns : [ {name : 'FD_OBJECTID798',hide : true}, {display : '评价名称', name : 'NAME_798',align : 'center', width : "20%",isPrimaryKey:true,showTitle:true, render : function(rowdata, rowindex, value, column) { //console.log(rowdata); //var event_name = "("+rowdata.EVENT_NAME_798+")"; var event_name = ""; return "" + value +""+event_name+""+ ""; } }, {display : '评价体系', name : 'SYS_ID_798_SHOW', align : 'center', width : "20%",showTitle:true}, {display : '评估单位', name : 'EVAL_DEPT_ID_798_SHOW', align : 'center', width : "13%",showTitle:true}, {display : '开始时间', name : 'START_TIME_798', align : 'center', width : "13%",showTitle:true}, {display : '结束时间', name : 'END_TIME_798', align : 'center', width : "13%",showTitle:true}, {display : '自评', name : 'IS_SELF_EVAL_798_SHOW', align : 'center', width : "7%",showTitle:true}, {display : '隐藏关联项', name : 'IS_HIDE_798_SHOW', align : 'center', width : "7%",showTitle:true}, {display : '状态', name : 'STATE_798_SHOW', align : 'center', width : "7%",showTitle:true}/*, {display : '总得分', name : 'TOTAL_SCORE_798', align : 'center', width : "6%",showTitle:true}*/ ], checkbox : true, rownumbers : true, pageSize : 10, percentWidthMode : true, }; var options1={ url :$.pathname() + '/ws/crud/CRUDService/queryQui', params: _this.loadParams, width:960, gridOptions:grid_option1, singleRecodeOptions:{a:"aa"}, paperOpration:{showInput:"true"}, toolBarOptions:toolBarOpt1 }; _this.listGrid=gridAndSingleRecode=$("#dataGrid").quickgridAndSingleRecode(options1); } }; }(); $(function() { Grade.init(); }); function getParamsFromParent (){ var userInfoStr = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo(); return userInfoStr; }