var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
var clickNum = 0;
//登陆用户的单位名称
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(){
// getCompName();
/** 下拉框加载 */
/** 绑定更多的按钮点击事件 */
$more = $("#more"); // 更多按钮
$more.bind('click', function() {
more();
});
// $searchButt = $("#searchButt");// 更多查询按钮
// $searchButt.live('click', function() {
// searchHandler();
// });
$searchOne = $("#searchOne");//查询图标绑定查询事件
$searchOne.bind('click', function() {
searchHandler2();
});
});
//查询单位条件加载
function getCompName(){
var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';
var params = {
id : deptId,
value:"UNITS"
};
$.ajax({
url : url,
type : 'post',
timeout : 60000,
data : params,
dataType : 'json',
success : function(data){
var conditionData3 = JSON.stringify(data);
var test = eval("("+conditionData3+")");
if(conditionData3!='{"list":[{"name":"查询单位","className":"UNITS","equalType":"equal","list":[]}]}'){
conditionData.list.push(test.list[0]);
}
createConditionsDom(conditionData);
$(".item").unbind("click").bind("click",bindSelectOne);
},
error : function(e){
$.messager.alert('系统提示信息', '访问服务失败!', 'error');
}
});
}
var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
var g;
//
//condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.PARENT_ID='"+deptName+"' OR A.DEPT_ID='"+deptName+"')))" ;
condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+deptName+"')))" ;
//列表加载参数
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: 'retract_tem' ,id:"10215"},
{ text: '查看本级单位演练', click: "showSameLevel", iconClass: 'poll_tem' ,id:"10007"}
],
roleCons:roleCons
};
/**
* 树形列
*/
var grid_option1 = {
columns: [
{ display: '演练名称', name: 'DRILL_NAME_299', align: 'left', width: "15%",isPrimaryKey:true,
render : function(rowdata, rowindex, value, column) {
return "" + value + "";
}
},
{ display: '填报单位', name: 'UNITS_299_SHOW', align: 'center', width: "10%",showTitle:true},
{ display: '主办单位', name: 'SPONSOR_COMP_299_SHOW', align: 'center', width: "10%",showTitle:true},
{ display: '演练类别', name: 'DRILL_TYPE_299_SHOW', align: 'center' , width: "10%",showTitle:true},
{ display: '演练形式', name: 'DRILL_FORM_299_SHOW', align: 'center', width: "10%",showTitle:true},
{ display: '是否计划', name: 'IS_PLAN_299_SHOW', align: 'center', width: "5%",showTitle:true},
{ display: '计划时间', name: 'PLAN_TIME_299', align: 'center' , width: "10%",showTitle:true},
{ display: '是否完成', name: 'IMPLEMENT_STAT_299_SHOW', align: 'center' , width: "5%",showTitle:true},
{ display: '计划填报人', name: 'PLAN_MAKER_299_SHOW', align: 'center', width: "10%" ,showTitle:true},
{ display: '附件', isAllowHide: false, align: 'center', width:"5%",
render: function (rowdata, rowindex, value, column){
//判断是否有上传附件
var fujian = '';
if(ontest(rowdata.FD_OBJECTID_299)){
fujian = '';
}else{
fujian = '没有附件';
}
return fujian;
}
},
{ display: '操作', isAllowHide: false, align: 'center', width:"5%",
render: function (rowdata, rowindex, value, column){
//判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09fashang_plan
var shangbao='';
//判断是否有上传附件
// var fujian = '';
// if(ontest(rowdata.FD_OBJECTID_299)){
// fujian = '';
// }else{
// fujian = '没有附件';
// }
if(rowdata.IS_SHANGBAO_299=="1"){
shangbao = '';
}else{
shangbao = '';
}
return shangbao/* + fujian*/;
}
}
],
rownumbers : true,
checkbox : true,
sortName : 'UPDATEDATE_299',
pageSize : 10,
percentWidthMode : true,
onAfterShowData:function(data){
setHt();
}
};
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 ontest(id){
var bean = false;
$.ajax({
url : $.pathname() +"/ws/DrillCount/DrillCountService/getIsNoFile/",
type : 'post',
timeout : 60000,
data : { fd_id : id },
dataType : 'json',
async:false,//返回值时注意同步异步问题,此时是同步状态
success : function(result){
if (result.Msg.sucsess == true) {
bean = true;
}
},
error : function(e){
$.messager.alert('系统提示信息', '访问服务失败!', 'error');
}
});
return bean;
}
// 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(data){
var row = g.getRow(data);
var fd_id = row.FD_OBJECTID299;
var diag = new top.Dialog();// 定义一个窗口对象
diag.Title = "附件信息";// 窗口标题
diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
diag.Height = 400;
diag.Width = 1000;
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' AND ( PLAN_MAKER='"+ getUser_id +"' or IS_SHANGBAO='1')",
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 searchHandler2(){
$queryForm = $("#queryForm");
if($("#DRILL_NAME_299").val()=="请输入演练的名称"){
$("#DRILL_NAME_299").val("");
}
var DRILL_NAME_299 = $("#DRILL_NAME_299").val();
var TAKE_DATE1 = $('#TAKE_DATE1').val();
var TAKE_DATE2 = $('#TAKE_DATE2').val();
var ISSUE_DATE1 = $('#ISSUE_DATE1').val();
var ISSUE_DATE2 = $('#ISSUE_DATE2').val();
var DRILL_LINKMAN = $('#DRILL_LINKMAN').val();
var LINKMENCALL = $('#LINKMENCALL').val();
var condition = "";
if(zTreeCompId=="" ||zTreeCompId==deptName){
if(clickNum % 2 !=0){
condition = "IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+deptName+"')))" ;
}else{
condition=" IS_DEL = '0' AND ( PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+deptName+"%' and dept_type='1'))) ";
}
}else{
if(clickNum % 2 !=0){
condition = "IS_DEL='0' AND (IS_SHANGBAO='1' and UNITS IN(SELECT A.DEPT_ID FROM SYS_DEPARTMENT A WHERE A.DEPT_ID='"+zTreeCompId+"'))" ;
}else{
condition =" IS_DEL='0' AND (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1')) ";
}
}
if(DRILL_NAME_299!=""){
condition += " AND DRILL_NAME LIKE '%" +DRILL_NAME_299+"%'";
}
/***************************************时间****************************************/
if((TAKE_DATE1!=""&&TAKE_DATE2=="")||(TAKE_DATE1==""&&TAKE_DATE2!="")){
top.Dialog.alert("填报时间的开始日期或结束日期不能为空");
return;
}else if(TAKE_DATE1>TAKE_DATE2){
top.Dialog.alert("填报时间的开始日期不能晚于结束日期");
return;
}else if(TAKE_DATE1!=""&&TAKE_DATE2!=""){
condition += " AND REPORT_DATE BETWEEN '"+TAKE_DATE1+"' AND '"+TAKE_DATE2+"' ";
}
if((ISSUE_DATE1!=""&&ISSUE_DATE2=="")||(ISSUE_DATE1==""&&ISSUE_DATE2!="")){
top.Dialog.alert("计划时间的开始日期或结束日期不能为空");
return;
}else if(ISSUE_DATE1>ISSUE_DATE2){
top.Dialog.alert("计划时间的开始日期不能晚于结束日期");
return;
}else if(ISSUE_DATE1!=""&&ISSUE_DATE2!=""){
condition += " AND PLAN_TIME BETWEEN '"+ISSUE_DATE1+"' AND '"+ISSUE_DATE2+"' ";
}
/************************************************************************/
if(DRILL_LINKMAN!=""){
condition += " AND DRILL_LINKMAN LIKE '%" +DRILL_LINKMAN+"%'";
}
if(LINKMENCALL!=""){
condition += " AND LINKMENCALL LIKE '%" +LINKMENCALL+"%'";
}
/****************************************复选框查询******************************************/
//实施状态
var IMPLEMENT_STAT = "";
$("input:checkbox[name=IMPLEMENT_STAT]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
IMPLEMENT_STAT += " IMPLEMENT_STAT = '1' or IMPLEMENT_STAT = '0' or ";
}else{
IMPLEMENT_STAT += "IMPLEMENT_STAT = '" + $(this).val() +"' or ";
}
}
});
if(IMPLEMENT_STAT!=""){
IMPLEMENT_STAT = IMPLEMENT_STAT.substring(0,IMPLEMENT_STAT.lastIndexOf("or"));
condition += " and ("+IMPLEMENT_STAT+") ";
}
//上报状态
var IS_SHANGBAO = "";
$("input:checkbox[name=IS_SHANGBAO]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
IS_SHANGBAO += " IS_SHANGBAO = '1' or IS_SHANGBAO = '0' or ";
}else{
IS_SHANGBAO += "IS_SHANGBAO = '" + $(this).val() +"' or ";
}
}
});
if(IS_SHANGBAO!=""){
IS_SHANGBAO = IS_SHANGBAO.substring(0,IS_SHANGBAO.lastIndexOf("or"));
condition += " and ("+IS_SHANGBAO+") ";
}
//演练类别
var DRILL_TYPE = "";
$("input:checkbox[name=DRILL_TYPE]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
DRILL_TYPE += " DRILL_TYPE = '10' or DRILL_TYPE = '11' or ";
}else{
DRILL_TYPE += "DRILL_TYPE = '" + $(this).val() +"' or ";
}
}
});
if(DRILL_TYPE!=""){
DRILL_TYPE = DRILL_TYPE.substring(0,DRILL_TYPE.lastIndexOf("or"));
condition += " and ("+DRILL_TYPE+") ";
}
//细化类别
var DRILL_REFINE_CATEGORY = "";
$("input:checkbox[name=DRILL_REFINE_CATEGORY]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
DRILL_REFINE_CATEGORY += " DRILL_REFINE_CATEGORY = '10' or DRILL_REFINE_CATEGORY = '11' or DRILL_REFINE_CATEGORY = '12' or DRILL_REFINE_CATEGORY = '13' or" +
" DRILL_REFINE_CATEGORY = '14' or DRILL_REFINE_CATEGORY = '15' or DRILL_REFINE_CATEGORY = '16' or DRILL_REFINE_CATEGORY = '17' or" +
" DRILL_REFINE_CATEGORY = '18' or DRILL_REFINE_CATEGORY = '19' or DRILL_REFINE_CATEGORY = '20' or DRILL_REFINE_CATEGORY = '21' or" +
" DRILL_REFINE_CATEGORY = '22' or DRILL_REFINE_CATEGORY = '23' or DRILL_REFINE_CATEGORY = '24' or DRILL_REFINE_CATEGORY = '25' or" +
" DRILL_REFINE_CATEGORY = '26' or DRILL_REFINE_CATEGORY = '27' or ";
}else{
DRILL_REFINE_CATEGORY += "DRILL_REFINE_CATEGORY = '" + $(this).val() +"' or ";
}
}
});
if(DRILL_REFINE_CATEGORY!=""){
DRILL_REFINE_CATEGORY = DRILL_REFINE_CATEGORY.substring(0,DRILL_REFINE_CATEGORY.lastIndexOf("or"));
condition += " and ("+DRILL_REFINE_CATEGORY+") ";
}
//演练形式
var DRILL_FORM = "";
$("input:checkbox[name=DRILL_FORM]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
DRILL_FORM += " DRILL_FORM = '10' or DRILL_FORM = '11' or DRILL_FORM = '12' or DRILL_FORM = '13' or ";
}else{
DRILL_FORM += "DRILL_FORM = '" + $(this).val() +"' or ";
}
}
});
if(DRILL_FORM!=""){
DRILL_FORM = DRILL_FORM.substring(0,DRILL_FORM.lastIndexOf("or"));
condition += " and ("+DRILL_FORM+") ";
}
//是否计划
var IS_PLAN = "";
$("input:checkbox[name=IS_PLAN]").each(function(){
if($(this).attr("checked")){
if($(this).val()=="0000"){
IS_PLAN += " IS_PLAN = '0' or IS_PLAN = '1' or ";
}else{
IS_PLAN += "IS_PLAN = '" + $(this).val() +"' or ";
}
}
});
if(IS_PLAN!=""){
IS_PLAN = IS_PLAN.substring(0,IS_PLAN.lastIndexOf("or"));
condition += " and ("+IS_PLAN+") ";
}
// $queryForm.serialize();
// var $comp_id = $("#selectConditions").find(".UNITS");
// var loadParams11;
// //判断是否有用单位做查询条件
// if(!!$comp_id.prop("outerHTML")){
//
// loadParams11 = {
// "listId" : '299',
// "condition" : " IS_DEL='0' AND ( PLAN_MAKER='"+ getUser_id +"' or IS_SHANGBAO='1')",
// 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.setOptions({//重置加载列表的参数
params : {
"listId" :'299' ,
"condition" : condition,
direction:'DESC',
sort: 'UPDATEDATE'
}
});
//加载数据
g.rend();
}
function resetSearch(){
$('#DRILL_NAME_299').val("");
$('#TAKE_DATE1').val("");
$('#TAKE_DATE2').val("");
$('#ISSUE_DATE1').val("");
$('#ISSUE_DATE2').val("");
$('#DRILL_LINKMAN').val("");
$('#LINKMENCALL').val("");
$("input:checkbox[name=IMPLEMENT_STAT]").attr("checked",false);
$("input:checkbox[name=IS_SHANGBAO]").attr("checked",false);
$("input:checkbox[name=DRILL_TYPE]").attr("checked",false);
$("input:checkbox[name=DRILL_REFINE_CATEGORY]").attr("checked",false);
$("input:checkbox[name=DRILL_FORM]").attr("checked",false);
$("input:checkbox[name=IS_PLAN]").attr("checked",false);
}
//新增
function addUnit(){
window.location.href="emc-drill-add.jsp";
//测试演练逾期window.location.href="emc-drillYuqi.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;
$.indexOpenNextWindow("/nwyj/page/business/am/drill/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;
$.indexOpenNextWindow("/nwyj/page/business/am/drill/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");
});
}
function showSameLevel(){
if(zTreeCompId == ""){
top.Dialog.alert("请在左侧菜单选择单位再查看演练信息!");
return;
}
var condition = "";
clickNum++;
if(zTreeCompId==deptName){//点击本单位时
if(clickNum % 2 !=0){
$("#10007").addClass("blue");
$("#10007 span").text("查看本级单位演练(含下级)");
condition = "IS_DEL='0' AND (PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN('"+zTreeCompId+"')))" ;
}else{
$("#10007").removeClass("blue");
$("#10007 span").text("查看本级单位演练");
condition = "IS_DEL='0' AND (PLAN_MAKER='"+ getUser_id +"' or (IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1')))" ;
}
}else{
if(clickNum % 2 !=0){
$("#10007").addClass("blue");
$("#10007 span").text("查看本级单位演练(含下级)");
condition = "IS_DEL='0' and IS_SHANGBAO='1' and UNITS IN('"+zTreeCompId+"') ";
}else{
$("#10007").removeClass("blue");
$("#10007 span").text("查看本级单位演练");
condition = "IS_DEL='0' and IS_SHANGBAO='1' and UNITS IN(select dept_id from sys_department where dept_path like '%"+zTreeCompId+"%' and dept_type='1') ";
}
}
g.setOptions({//重置加载列表的参数
params : {
"listId" :'299' ,
"condition" : condition,
direction:'DESC',
sort: 'UPDATEDATE'
}
});
g.rend();
}
//上报前先给上级单位公共消息库里插入一条记录
/**
* 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);
//setHt();
checkAndSetHeight();//changeFormat.js
});
}
function setHt(){
/* alert($("#layout1 .padding_right5").height())
alert($("#layout1 .selDiv").height());
alert($(".l-layout-left").height()); */
var leftHeight = $(".layout_content").height()+70;
var rightHeight = $("#layout1 .padding_right5").height()+$("#layout1 #moreDiv").height()+70;
var height = leftHeight>rightHeight?leftHeight:rightHeight;
$(top.document.body).find("#frmright").height($(window.document.body).height(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;