var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //登陆用户的单位名称 var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names(); var parent_ids = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); /*******************************修改、删除信息 各级单位的超级管理员可以修改表单信息。湛江局许永山提的建议 2016-05-31** */ //登陆人角色 var Roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids() + ","; var roleidTemp =Roleid.split(","); var flag="0"; $(function(){ }); var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID var g; var dept_id = (window.location.href).split('?')[1]; //dept_id ="8F6F2D6B24494CB6B1F1E0931E7AF87D"; // condition = "DATEDIFF(MONTH,plan_time ,sysdate) >1 and IMPLEMENT_STAT='0' and is_del= '0' and UNITS ='"+dept_id+"'" ; //列表加载参数 var loadParams = { "listId" : '299', "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' }; function initComplete(){ /** * 工具条 */ var roleCons = roleButtonArr(); var toolBarOpt1 = { items:[ {text: '新增', click: "addUnit", iconClass: 'add1_tem',id:"rcxz"}, {text: '删除', click: "deleteUnit", iconClass: 'delete_tem',id:"rcsc"}, {text: '修改', click: "updateUnit", iconClass: 'update_tem',id:"rcxg"}, {text: '查看', click: "onView", iconClass: 'view_tem',id:"10003"}, {text: '统计', click: "sumUnit", iconClass: 'poll_tem',id:"10200"}, {text: '导入', click: "showImportDialog", iconClass: 'import_tem',id:"rcdr"}, {text: '导出', click: "exportTotalData", iconClass: 'export_tem',id:"10006"}, { text: '撤销', click: "noPublish", iconClass: 'release_tem' ,id:"10215"} ], roleCons:roleCons }; /** * 树形列 */ var grid_option1 = { columns: [ { display: '演练名称', name: 'DRILL_NAME_299', align: 'center', width: "14%",isPrimaryKey:true, render : function(rowdata, rowindex, value, column) { return "" + value + ""; } }, { display: '填报单位', name: 'UNITS_299_SHOW', align: 'center', width: "13%"}, { display: '主办单位', name: 'SPONSOR_COMP_299_SHOW', align: 'center', width: "13%"}, { display: '演练类别', name: 'DRILL_TYPE_299_SHOW', align: 'center' , width: "10%"}, { display: '演练形式', name: 'DRILL_FORM_299_SHOW', align: 'center', width: "10%"}, { display: '是否计划', name: 'IS_PLAN_299_SHOW', align: 'center', width: "10%"}, { display: '计划时间', name: 'PLAN_TIME_299', align: 'center' , width: "10%"}, { display: '计划填报人', name: 'PLAN_MAKER_299_SHOW', align: 'center', width: "10%" }, { display: '操作', isAllowHide: false, align: 'center', width:"10%", render: function (rowdata, rowindex, value, column){ //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09fashang_plan var shangbao=''; if(rowdata.IS_SHANGBAO_299=="1"){ shangbao = ''; }else{ shangbao = ''; } return shangbao; } } ], rownumbers : true, checkbox : true, sortName : 'UPDATEDATE_299', pageSize : 10, percentWidthMode : true }; var options1={ url :'/nwyj/ws/crud/CRUDService/queryQui', params:loadParams, gridOptions:grid_option1, singleRecodeOptions:{a:"aa"}, paperOpration:{showInput:"true"}, toolBarOptions:toolBarOpt1 }; g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1); } function onDownload(){ var rows = g.getSelectedRows(); if (rows.length == 0) { top.Dialog.alert("请选择一条记录"); return; } if (rows.length > 1) { top.Dialog.alert("只能选择一条记录"); return; } var fd_id = rows[0].FD_OBJECTID299; showFile(fd_id); } function showFile(fd_id){ var diag = new top.Dialog();// 定义一个窗口对象 diag.Title = "下载";// 窗口标题 diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面 diag.Height = 400; diag.ShowOkButton=false;// 不显示确认按钮 diag.ShowCancelButton=false;// 不显示取消按钮 diag.ButtonAlign="center";// 按钮居中 diag.show();// 显示窗口 } function searchHandler(){ $queryForm = $("#queryForm"); if($("#DRILL_NAME_299").val()=="请输入演练的名称"){ $("#DRILL_NAME_299").val(""); } $queryForm.serialize(); var $comp_id = $("#selectConditions").find(".UNITS"); var loadParams11; //判断是否有用单位做查询条件 if(!!$comp_id.prop("outerHTML")){ loadParams11 = { "listId" : '299', "condition" : " IS_DEL='0'", direction:'DESC', sort: 'UPDATEDATE' }; }else{ loadParams11 = $.extend({},loadParams,loadParams); } //获取选中的值 var searchCondition = getSelectCon(conditionData); var queryParams = getQueryFormParams($queryForm); var params=$.extend({},loadParams11,queryParams); //与之前参数条件拼接 params.condition = searchCondition.condition + params.condition; g.setOptions({"params":params}); //加载数据 g.rend(); } //新增 function addUnit(){ window.location.href="emc-drill-add.jsp"; } //修改 function updateUnit(rowid){ var rows = g.getSelectedRows(); if(rows.length==0){ top.Dialog.alert("请选择一条记录"); return; } if(rows.length>1){ top.Dialog.alert("只能选择一条记录"); return; } for(var i=0; i< roleidTemp.length; i++){ if(roleidTemp[i]=="R002105430200"){ flag="1"; } } var PLAN_MAKER_299 = rows[0].PLAN_MAKER_299;; var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){ top.Dialog.alert("不能修改别人上传的演练计划!"); return; } var fd_id= rows[0].FD_OBJECTID299; window.location.href="emc-drill-update.jsp?"+fd_id; } //删除 function deleteUnit(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要删除的记录!"); return; } for(var i=0; i< roleidTemp.length; i++){ if(roleidTemp[i]=="R002105430200"){ flag="1"; } } var ids = ""; var fd_sb =""; var PLAN_MAKER_299; var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID299 + ","; fd_sb = rows[i].IS_SHANGBAO_299; PLAN_MAKER_299 = rows[i].PLAN_MAKER_299; if(fd_sb=="1"&&flag=="0"){ top.Dialog.alert("上报的应急演练不能删除!"); return; } if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){ top.Dialog.alert("不能删除别人上传的演练计划!"); return; } } top.Dialog.confirm("确定要删除吗?|删除", function() { // 删除记录 $.post($.pathname() +"/ws/crud/CRUDService/delete/", { "objectIDs" : ids, classid : 299 }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("删除成功",null,null,null,1); // 刷新表格数据 g.rend(); } else { top.Dialog.alert("删除失败!"); } }, "json"); }); } //单个删除 function onDelete(rowid){ var row = g.getRow(rowid); var fd_shangbao = row.IS_SHANGBAO_299; if(fd_shangbao=="1"){ top.Dialog.alert("上报的应急演练不能删除!"); return; } var fd_id= row.FD_OBJECTID299; top.Dialog.confirm("确定要删除该记录吗?",function(){ //删除记录 $.post($.pathname() +"/ws/crud/CRUDService/delete/",{ "objectIDs" : fd_id, classid : 299 },function(result){ if(result.Msg.sucsess == true){ top.Dialog.alert("删除成功!",null,null,null,1); }else{ top.Dialog.alert("删除失败!"); } //刷新表格 g.loadData(); },"json"); }); } //导入 function showImportDialog(){ window.location.href="emc-drill-import.jsp"; } //导出 function exportTotalData(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.confirm("是否导出所有的应急演练计划?|确定", function() { excelExport(299,loadParams,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT");}); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += "'"+rows[i].FD_OBJECTID299+"'" + ","; } var temp = ids.substring(0,ids.length-1); var condition = " IS_DEL='0' "; condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%'; var sql = { "listId" :'299' , "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' }; excelExport(299,sql,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT"); } //点击查看 function jumpPage(id){ window.location.href="emc-drill-info.jsp?"+id; } //点击主键跳转详细信息页面 this.openDetail = function(rowindex) { var row = g.getRow(rowindex); var fd_id = row.FD_OBJECTID299; window.location.href="emc-drill-info.jsp?"+fd_id; }; function showPrimaryKey(obj,index){ var fd_id = obj.FD_OBJECTID299; window.location.href="emc-drill-info.jsp?"+fd_id; } //详情 function onView(rowid){ var rows = g.getSelectedRows(); if(rows.length==0){ top.Dialog.alert("请选择一条记录"); return; } if(rows.length>1){ top.Dialog.alert("只能选择一条记录"); return; } // var row = g.getRow(rowid); // var fd_id= row.FD_OBJECTID299; var fd_id= rows[0].FD_OBJECTID299; window.location.href="emc-drill-info.jsp?"+fd_id; } //上报(修改预案的状态) function shangbao(data){ var row = g.getRow(data); var fd_id = row.FD_OBJECTID299; var shangbao = row.IS_SHANGBAO_299; if(shangbao=="1"){ top.Dialog.alert("该演练计划已经上报!"); return; } top.Dialog.confirm("确定要上报吗?|上报", function() { // 上报 $.post($.pathname() +"/ws/DrillCount/DrillCountService/appear/", { //当前单位id comp_id : 299, fd_id : fd_id, }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("上报成功",null,null,null,-1); //推送 fillShangbao(data); // 刷新表格数据 上报成功后不能刷新表格 g.rend(); } else { top.Dialog.alert("上报失败!"); } }, "json"); }); } //上报前先给上级单位公共消息库里插入一条记录 /** * 1、取本级单位ID * 2、上报人ID * 3、上报消息主键 * 4、服务名称(URL) **/ function fillShangbao(data){ var row = g.getRow(data); var fd_id = row.FD_OBJECTID299; //向后台发送请求调用dwr var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/'; var msg = ""+corp_name+"的应急演练"; //var msg = "应急预案"; var params = { parentDeptName:parent_ids, msg:msg }; $.ajax({ url : url, type : 'post', data : params, dataType : 'text', timeout : 60000, success : function(data){ }, error : function(){ // $.messager.alert('操作失败'); } }); } function onReport(id){ top.Dialog.alert("上报"); } //统计 function sumUnit(){ window.location.href="emc-drill-poll.jsp"; } //短信 function sendMsg(){ window.location.href="NoticeTime.jsp"; } function more() { $('#moreDiv').toggle(400,function(){ $("#emptyCondition").click(); $(parent.document.body).find("#frmright").height($(window.document.body).height()+30); }); } //撤销 function noPublish(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要撤销的记录!"); return; } else if (rowsLength > 1) { top.Dialog.alert("请选中一条要撤销的记录!"); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID299 + ","; //判断是否包含已经上报的记录 if(rows[i].IS_SHANGBAO_299=="0"){ top.Dialog.alert("您选中的记录还未上报!"); return; } } top.Dialog.confirm("确定要撤销上报吗?|撤销", function() { $.post($.pathname() +"/ws/DrillCount/DrillCountService/noAppear/", { fd_id : ids, }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("撤销成功",null,null,null,-1); g.rend();// 刷新表格数据 } else { top.Dialog.alert("撤销失败!"); } }, "json"); }); } $.messager=top.Dialog;