123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- /**
- * 功能:
- *
- *
- * @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 real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //当前时间
- function getNowFormatDate() {
-
- var date = allGetServerTime();
- var seperator1 = "-";
- var seperator2 = ":";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- var hour=date.getHours();
- var minu=date.getMinutes();
- var sec=date.getSeconds();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- if(hour>=0 && hour<=9){
- hour="0"+hour;
- }
- if(minu>=0 && minu<=9){
- minu="0"+minu;
- }
- if(sec>=0 && sec<=9){
- sec="0"+sec;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate
- + " " + hour + seperator2 + minu;
- return currentdate;
- }
- var currdate = getNowFormatDate();
- /**私有方法**/
- /***新增信息***/
- _this.addForm = function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.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 (real_name!=rows[0].REPORTER_397) {
- top.Dialog.alert("不是本人填报的,不能修改!");
- return;
- } else {
- var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID397;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.jsp?fd_id="+fd_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].REPORTER_397) {
- top.Dialog.alert("不是本人填报的,不能删除!");
- return;
- }
- var ids = "";
- for ( var i = 0; i < rowsLength; i++) {
- ids += rows[i].FD_OBJECTID397 + ",";
- }
- 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 : 397
- };
- 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_OBJECTID397;
- var comp_id = _this.listGrid.getSelectedRow().EVENT_UNIT_ID_397;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickInfo_page.jsp?fd_id="+fd_id+"&comp_id="+comp_id);
- }
- };
- /** *发布** */
- _this.release = function() {
- // 取得选中的Grid行
- 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 row = _this.listGrid.getSelectedRow();
- // 判断选中的记录是否已经发布过
- if (row.RELEASE_STATE_397 == 1) {
- top.Dialog.alert("选中的记录有已经发布过的,请重新选择!");
- return;
- }
- var fd_id = row.FD_OBJECTID397; //
- var params = {classid : "397",FD_OBJECTID397:fd_id,RELEASE_STATE_397:"1"};
- top.Dialog.confirm("确定要发布吗?|发布", function() {
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- data : params,
- async:false,
- dataType : 'json',
- success : function(data){
- top.Dialog.alert("发布成功!");
- _this.listGrid.rend();
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- });
-
- }
- };
- /********收回********/
- _this.handOn = function(){
- // 取得选中的Grid行
- 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 row = _this.listGrid.getSelectedRow();
- var user_id = row.REPORTER_397;
- if (user_id != real_name) {
- top.Dialog.alert("须填写人本人才能收回,您没有权限收回该记录!");
- return;
- }
- if (row.RELEASE_STATE_397 == 0) {
- top.Dialog.alert("选中的记录未发布,请重新选择!");
- return;
- }
- var alertMsg = "确定要收回该条记录吗?";
- var fd_id = row.FD_OBJECTID397; //
- var params = {classid : "397",FD_OBJECTID397:fd_id,RELEASE_STATE_397:"0"};
- top.Dialog.confirm(alertMsg, function() {
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data){
- top.Dialog.alert('收回记录成功!', null, null, null, -1);
- _this.listGrid.rend();
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- });
-
- }
- };
-
- /***绑定***/
- _this.binding = function(){
- //alert(JSON.stringify(real_name));
-
- //取得选中的Grid行
- 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 comp_id = _this.listGrid.getSelectedRow().EVENT_UNIT_ID_397;
- if(corpId != comp_id){
- top.Dialog.alert("绑定用户部门不一致!");
- return;
- }
- var fd_id = rows[0].FD_OBJECTID397;
- var name = rows[0].EVENT_TITLE_397;
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/report/QuickReport_Add.html?fd_id="+fd_id+"?name="+name);
- };
-
- //打印
- function onPrint(){
-
- }
-
- //查询
- function search(obj){
- $queryForm = $("#queryForm");
- if($("#EVENT_NAME_397").val()=="事件简题"){
- $("#EVENT_NAME_397").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_TITLE_397").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 : '397',
- condition : "is_del=0 and (EVENT_UNIT='"+CorpArea+"' or EVENT_UNIT in (select dept_id from sys_department where parent_id='"+CorpArea+"'))",
- direction:'DESC',
- sort: 'OCCURRENCE_TIME_397'
- };
-
- _this.exportParams = _this.loadParams;
- var grid_option={
- columns : [
- {name : 'FD_OBJECTID397',display : '主键',align : 'center',hide : true},
- {name : 'EVENT_TITLE_397',display : '事件简题',align : 'center',width : "16%",isPrimaryKey:true,
- render:function(rowdata, rowindex, value, column){
- return "<div><a href='javascript:;' onclick='showPrimaryKey(\""+rowdata.FD_OBJECTID397+"\",\""+rowdata.EVENT_UNIT_ID_397+"\")'>" + value + "</a></div>";
- }
- },
- {name : 'EVENT_UNIT_397_SHOW',display : '事发单位',align : 'center', width: "8%"},
- {name : 'EVENT_TYPE_397_SHOW',display : '事件类型',align : 'center', width: "8%"},
- {name : 'OCCURRENCE_TIME_397',display : '发生时间',align : 'center', width: "8%"},
- {name : 'EVENT_DESCRIPTION_397',display : '事件简况',align : 'center', width: "8%"},
- {name : 'EVENT_CAUSE_397',display : '事件原因',align : 'center', width: "8%"},
- {name : 'EVENT_CONSEQUENCES_397',display : '事件后果',align : 'center', width: "8%"},
- {name : 'DEPARTMENT_MANAGER_397',display : '部门负责人',align : 'center', width: "8%"},
- {name : 'REPORTER_397',display : '填报人',align : 'center', width: "8%"},
- {name : 'TEL_397',display : '填报人电话号码',align : 'center', width: "12%"},
- {name : 'RELEASE_STATE_397_SHOW',display : '发布状态',align : 'center', width: "8%"}
- ],
- usePager:true,
- checkbox : true,
- pageSize : 10,
- percentWidthMode : true,
- rownumbers:true
- };
- 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 :'release',
- iconClass : 'release_tem'
- }, {
- text : '收回',
- click : 'handOn',
- iconClass : 'delete_tem'
- }, {
- text : '绑定',
- click : "binding",
- iconClass : 'binding_tem'
- }/*, {
- text : '打印',
- click : "print",
- iconClass : 'print_tem'
- }*/]
- };
- var options={
- url :'/nwyj/ws/crud/CRUDService/queryQui',
- params:_this.loadParams,
- width:960,
- gridOptions:grid_option,
- singleRecodeOptions:{a:""},
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBarOpt
- };
- /**grid载入数据**/
- g = gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
- }
- };
- }();
- $(function() {
- EventManager.init();
- });
- function showPrimaryKey(fd_id,comp_id){
- if(typeof fd_id =="object"){
- fd_id = fd_id.FD_OBJECTID397;
- }
- $('#frmright', window.parent.document).attr('src', $.pathname()+"/page/business/em/event/EventQuickInfo_page.jsp?fd_id="+fd_id+"&comp_id="+comp_id);
- //window.open($.pathname()+"/page/business/em/event/EventQuickAllInfo.jsp?fd_id="+fd_id);
- }
|