/** * 功能: * * * @author * @date 2015/11/19 */ EventManager = function() { /**定义变量**/ var _this = this; _this.listGrid = null;//数据列表 $queryForm = null;//查询区域表单 $searchButt = null;//查询按钮 $more = null; //更多 _this.loadParams = null;//列表加载参数 _this.exportParams = null;//导出EXCEL参数 //取得用户真实名字 var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name(); var realName_ID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); //部门id var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //部门名称 var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names(); //父部门id var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); /**私有方法**/ /***新增信息***/ _this.addForm = function(){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id="); }; /***修改信息***/ _this.editForm = 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 (realName_ID!=rows[0].INPUT_PER_ID_363) { top.Dialog.alert("不是本人填报的,不能修改!"); return; } else { var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID363; $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id="+fd_id); } }; /***绑定***/ _this.binding = function(){ //取得选中的Grid行 var rows = _this.listGrid.getSelectedRows(); //选中的行数 var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要绑定的记录!"); return; }else if (realName_ID!=rows[0].INPUT_PER_ID_363) { top.Dialog.alert("不是本人填报的,不能绑定!"); return; }else if(rowsLength > 1){ top.Dialog.alert("一次只能对一条记录进行绑定操作!"); return; } var id = rows[0].FD_OBJECTID363; $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventBinding.jsp?fd_id="+id); }; /***删除信息***/ _this.del = function(){ var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要删除的记录!"); return; }if (realName_ID!=rows[0].INPUT_PER_ID_363) { top.Dialog.alert("不是本人填报的,不能删除!"); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID363 + ","; } if(ids!=""){ ids = ids.substring(0,ids.length-1); } var url = $.pathname() +"/ws/EventService/EventService/deleteEvent/"; var params = { objectIDs : ids, classid : 363 }; top.Dialog.confirm("确定要删除吗?|删除", function() { $.request.del(url,params,function(result){ if (result.Msg.sucsess == true) { top.Dialog.alert("删除成功!"); var backCondition=_this.loadParams.condition; _this.listGrid.rend();//加载数据 _this.loadParams.condition= backCondition; } else { top.Dialog.alert("删除失败!"); } }); }); }; /****查看详细信息****/ _this.showInfo = 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 { var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363; $.indexOpenNextWindow($.pathname()+"/page/business/em/event/EventInfo.jsp?fd_id="+fd_id); } }; /****调整为发布****/ _this.toRelease = 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; } var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363; var url = $.pathname() + '/ws/crud/CRUDService/update/'; var params = { classid : "363", FD_OBJECTID363 : fd_id, EVENT_STATE_363 : "1" }; top.Dialog.confirm("确定调整为发布吗", function() { $.request.del(url,params,function(result){ if (result.Msg.sucsess == true) { top.Dialog.alert("发布成功!"); _this.listGrid.rend();//加载数据 } else { top.Dialog.alert("发布失败!"); } }); }); }; /****结束****/ _this.toFinish = 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; } var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363; var url = $.pathname() + '/ws/crud/CRUDService/update/'; var params = { classid : "363", FD_OBJECTID363 : fd_id, EVENT_STATE_363 : "2" }; top.Dialog.confirm("确定结束事件吗", function() { $.request.del(url,params,function(result){ if (result.Msg.sucsess == true) { top.Dialog.alert("事件已结束!"); _this.listGrid.rend();//加载数据 } else { console.log("结束事件失败!"); } }); }); }; //导出excel _this.exportData = function(){ excelExport(363,_this.exportParams,"事件列表",['IS_DEL']); }; //查询 function search(obj){ $queryForm = $("#queryForm"); if($("#EVENT_NAME_363").val()=="事件名称"){ $("#EVENT_NAME_363").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(); } return { init : function() { $("#EVENT_NAME_363").keydown(function(event){ if(event.keyCode == 13){ search(); } }); $queryForm = $("#queryForm"); /**绑定查询面板的按钮点击事件**/ $searchButt = $("#searchButt");//查询按钮 $searchButt.bind('click',function(){ search(); }); $searchButt.live('click',function(){ search(); }); /**绑定更多的按钮点击事件*/ $more = $("#more"); //更多按钮 $more.bind('click',function(){ more(); }); //列表加载参数 _this.loadParams = { listId : '363', condition : "is_del=0 and ISSUE_UNITE_ID='"+deptId+"' ", direction:'DESC', sort: 'UPDATEDATE' }; _this.exportParams = _this.loadParams; var grid_option={ columns : [ {name : 'EVENT_NAME_363',display : '事件名称',align : 'center',width : "20%",isPrimaryKey:true, render:function(rowdata, rowindex, value, column){ return "
" + value + "
"; } }, {name : 'EVENT_TYPE_363_SHOW',display : '事件类型',align : 'center', width: "20%"}, {name : 'INPUT_PER_NAME_363',display : '录入人',align : 'center', width: "20%"}, {name : 'EVENT_PLACE_363',display : '属地',align : 'center', width: "20%"}, {name : 'EVENT_STATE_363_SHOW',display : '状态',align : 'center', width: "20%"}], usePager:true, checkbox : true, pageSize : 10, percentWidthMode : true, rownumbers:true }; //查询出该角色权限下的所有按钮ID roleButtonArr()方法需引入/nwyj/scripts/freamwork/com/sinosoft/common/common.js var roleCons = roleButtonArr(); var toolBarOpt={ items: [{ text : '新增', click : "addForm", iconClass : 'add2_tem' }, { text : '删除', click : "del", iconClass : 'delete_tem' }, { text : '修改', click : "editForm", iconClass : 'update_tem' }, { text : '事件关联', click : "binding", iconClass : 'binding_tem' }, { text : '调整为发布', click : "toRelease", iconClass : 'release_tem' }, { text : '结束事件', click : "toFinish", iconClass : 'end_tem' }], roleCons:""};//将角色id传参到gridroleCons:roleCons var options={ url :'/nwyj/ws/crud/CRUDService/queryQui', params:_this.loadParams, width:960, gridOptions:grid_option, singleRecodeOptions:{a:"aa"}, paperOpration:{showInput:"true"}, toolBarOptions:toolBarOpt }; /**grid载入数据**/ /*_this.listGrid = $("#dataGrid").quiGrid(gridOptions);*/ gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options); } }; }(); $(function() { EventManager.init(); }); function showPrimaryKey(fd_id){ if(typeof fd_id =="object"){ fd_id = fd_id.FD_OBJECTID363; } var url = $.pathname()+"/page/business/em/event/EventAllInfo.jsp?fd_id="+fd_id; $.indexOpenNextWindow(url); }