123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- /**
- * 功能:
- *
- *
- * @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参数
- /**私有方法**/
- /***新增信息***/
- _this.addForm = function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id=");
- };
- var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- /***修改信息***/
- _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 (real_name!=rows[0].WRITER_394) {
- top.Dialog.alert("不是本人填报的,不能修改!");
- return;
- } else {
- var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID394;
- $('#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 (real_name!=rows[0].WRITER_394) {
- top.Dialog.alert("不是本人填报的,不能绑定!");
- return;
- }else if(rowsLength > 1){
- top.Dialog.alert("一次只能对一条记录进行绑定操作!");
- return;
- }
- var id = rows[0].FD_OBJECTID394;
- // var name = encodeURI(encodeURI(rows[0].EVENT_NAME_394));
- $('#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 (real_name!=rows[0].WRITER_394) {
- top.Dialog.alert("不是本人填报的,不能删除!");
- return;
- }
- var ids = "";
- for ( var i = 0; i < rowsLength; i++) {
- ids += rows[i].FD_OBJECTID394 + ",";
- }
- if(ids!=""){
- ids = ids.substring(0,ids.length-1);
- }
- // var url = $.pathname() +"/ws/crud/CRUDService/delete/";
- var url = $.pathname() +"/ws/EventService/EventService/deleteEvent/";
- var params = {
- objectIDs : ids,
- classid : 394
- };
- 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_OBJECTID394;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventInfo.jsp?fd_id="+fd_id);
- }
- };
- //导出excel
- _this.exportData = function(){
- excelExport(394,_this.exportParams,"交接班管理",['IS_DEL']);
- };
- //查询
- function search(obj){
- $queryForm = $("#queryForm");
- if($("#EVENT_NAME_394").val()=="事件名称"){
- $("#EVENT_NAME_394").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();
- //_this.loadParams.condition= backCondition;
- }
- //更多
- function more(){
- $('#moreTable').toggle();
- }
- return {
- init : function() {
- $("#EVENT_NAME_394").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 : '394',
- condition : 'is_del=0',
- direction:'DESC',
- sort: 'UPDATEDATE'
- };
-
- _this.exportParams = _this.loadParams;
- var grid_option={
- columns : [
- {name : 'FD_OBJECTID394',display : '主键',align : 'center',hide : true},
- {name : 'EVENT_NAME_394',display : '事件名称',align : 'center',width : "30%",isPrimaryKey:true,
- render:function(rowdata, rowindex, value, column){
- return "<div><a href='javascript:void(0)' onclick='showPrimaryKey(\""+rowdata.FD_OBJECTID394+"\")'>" + value + "</a></div>";
- }
- },
- {name : 'TYPE_394_SHOW',display : '事件类型',align : 'center', width: "20%"},
- {name : 'LEVEL_394_SHOW',display : '事件级别',align : 'center', width: "15%"},
- {name : 'WRITER_394',display : '填报人',align : 'center', width: "15%"},
- {name : 'AREA_394',display : '属地',align : 'center', width: "20%"}],
- usePager:true,
- checkbox : true,
- /* width : '99.5%', */
- 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 : "showInfo",
- iconClass : 'view_tem'
- }, */{
- text : '绑定',
- click : "binding",
- iconClass : 'binding_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_OBJECTID394;
- }
- var url = $.pathname()+"/page/business/em/event/EventAllInfo.jsp?fd_id="+fd_id;
- window.open(url);
- }
|