//单位ID var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); //取得用户真实姓名 var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name(); //获取用户的Id var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); //登陆用户的单位名称 var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names(); //父部门id var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); //登录人ID var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; $(function(){ /* //下拉框加载 $("#FILE_CLASSIFY_230").initCanstSelect('BM_FILE_CLASSIFY'); $('#CHANGE_TYPE_230').initCanstSelect('BM_CHANGETYPE'); /** 绑定更多的按钮点击事件 */ $more = $("#more"); // 更多按钮 $more.bind('click', function() { more(); }); $searchButt = $("#searchButt");// 更多查询按钮 $searchButt.live('click', function() { searchHandler(); }); $searchOne = $("#searchOne");//查询图标绑定查询事件 $searchOne.bind('click', function() { searchHandler(); }); //清空条件 $("#emptyCondition").bind("click",function(){ $("#FILE_TITLE_230").val(""); var $selConditions = $("#selectConditions"); var $selCon = $selConditions.find(".selectCondi"); for(var i=0;i<$selCon.length;i++){ $selCon[i].click(); } }); }); //没有发布的文件别人不能看 var g; //列表加载参数 /* var condition = "IS_DEL='0' and ( PIGEONHOLE_MAN_ID='"+userId+"' or FABU='1')";*/ var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"'))"; //这个sql是对着的。 //var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and PUBLISH_COMP_ID='"+deptId+"'"; var loadParams = { "listId" : '230', "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' }; //初始化列表 function initComplete(){ //双视图不支持getRow()取行号的方法。 /** * 工具条 */ var roleCons = roleButtonArr(); var toolBarOpt1 = { items : [ { text: '新增' ,click:"onAdd",iconClass: 'add1_tem' ,id:"10000"},//OK { text: '删除' ,click:"onDelete",iconClass: 'delete_tem' , id:"10002"}, { text: '修改' ,click:"onEdit",iconClass: 'update_tem',id:"10001"}, { text: '查看' ,click:"onView",iconClass: 'view_tem' , id:"10003"}, { text: '历史版本' ,click:"onViewHistory",iconClass: 'history_tem',id:"10201" }, //{ text: '导入' ,click:"onImport",iconClass: 'import_tem',id:"10004"}, { text: '导出' ,click:"exportTotalData",iconClass: 'export_tem',id:"10006"}, { text: '下载' ,click:"onDownLoad",iconClass: 'download_tem',id:"10007" }, { text: '汇总统计', click: "sumUnit", iconClass: 'poll_tem' ,id:"10200"}, { text: '共享', click: "publicShare", iconClass: 'share_tem' ,id:"10200"}], roleCons:roleCons }; /** * 树形列 */ var grid_option1 = { columns: [ // {name : 'FD_OBJECTID',hide : true}, {display : '文件标题',name : 'FILE_TITLE_230', align : 'center',width : '20%',isPrimaryKey:true, render : function(rowdata, value) { return ''+ rowdata.FILE_TITLE_230 +''; } }, {display : '文件分类',name : 'FILE_CLASSIFY_230_SHOW', align : 'center',width : '10%'}, // {display : '发布状态',name : 'FILE_STATUS_230_SHOW', align : 'center',width : '10%'}, // {display : '上报状态',name : 'SHANGBAO_230_SHOW', align : 'center',width : '10%'}, {display : '发文日期',name : 'FILE_ADD_DATE_230', align : 'center',width : '10%'}, {display : '归档人',name : 'PIGEONHOLE_MAN_ID_230_SHOW', align : 'center',width : '10%'}, {display : '归档日期',name : 'PIGEONHOLE_DATE_230', align : 'center',width : '10%'}, {display : '变更说明',name : 'CHANGE_DETAIL_230', align : 'center',width : '10%'}, {display : '变更类型',name : 'CHANGE_TYPE_230_SHOW', align : 'center',width : '10%'}, {display : '文件摘要',name : 'FILE_CONTENT_230', align : 'center',width : '10%'}, { display: '操作', isAllowHide: false, align: 'center', width:'10%', render: function (rowdata, rowindex, value, column){ //判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0” var fabu='';//fabu if(rowdata.FABU_230=="1"){ fabu = ''; }else{ fabu = ''; } //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09 sendup_templan var shangbao=''; if(rowdata.SHANGBAO_230=="1"){ shangbao = ''; }else{ shangbao = ''; } return fabu + shangbao; } } ], rownumbers : true, checkbox : true, width:"100%", 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 onPublish1(){ top.Dialog.alert("该文件已经发布!"); } function shangbao1(){ top.Dialog.alert("该文件已经上报!"); } //点击查看 function jumpPage(id){ window.location.href="FileAMInfo.jsp?"+id; } //导出 function exportTotalData(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.confirm("是否导出所有的文件信息?|是", function() { excelExport(230,loadParams,"应急制度文件信息",['IS_DEL','UPDATEDATE','FD_OBJECTID','COLUMN_1','COLUMN_2','COLUMN_3','COLUMN_4','SHANGBAO','FABU','VERSION_ID','FILE_STATUS','PUBLISH_COMP_ID','REPORT_COMP_ID']); }); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += "'"+rows[i].FD_OBJECTID230+"'" + ","; } var temp = ids.substring(0,ids.length-1); // alert(temp); var condition = " IS_DEL='0' "; condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%'; var sql = { "listId" :'230' , "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' }; excelExport(230,sql,"应急制度文件信息",['IS_DEL','UPDATEDATE','FD_OBJECTID','COLUMN_1','COLUMN_2','COLUMN_3','COLUMN_4','SHANGBAO','FABU','VERSION_ID','FILE_STATUS','PUBLISH_COMP_ID','REPORT_COMP_ID']); } //查询 //function searchHandler() { // var title = $('#FILE_TITLE_230').val();//标题 // var classify = $('#FILE_CLASSIFY_230').val();//分类 // var type = $('#CHANGE_TYPE_230').val();//更新类别 // //时间区间 // var date1 = $('#DATE1').val(); // var date2 = $('#DATE2').val(); //// var condition = "IS_DEL='0' and PUBLISH_COMP_ID='"+dpids+"'"; // var condition = "IS_DEL='0' and ( PIGEONHOLE_MAN_ID='"+userId+"' or FABU='1')"; // // if(title!=""&&title!="请输入文件名称"){ // condition += " AND FILE_TITLE LIKE '%" +title+"%'"; // } // if(classify!=""){ // condition += " AND FILE_CLASSIFY = '" + classify + "' "; // } // if(type!=""){ // condition += " AND CHANGE_TYPE = '" + type + "' "; // } // //日期 // if(date1!="" && date2!=""){ // condition += " AND FILE_ADD_DATE BETWEEN '" + date1 +"' AND '" + date2 + "' "; // } // if(date1!="" && date2==""){ // condition += " AND FILE_ADD_DATE >= '" + date1 +"' " ; // } // if(date1=="" && date2!=""){ // condition += " AND FILE_ADD_DATE <= '" + date2 + "' "; // } // //PUBLISH_COMP_ID='"+dpids+" // // g.setOptions({// 重置加载列表的参数 // params : { // "listId" : '230', // "condition" : condition // } // }); // g.rend(); // //} function searchHandler(){ $queryForm = $("#queryForm"); if($("#FILE_TITLE_230").val()=="请输入文件名称"){ $("#FILE_TITLE_230").val(""); } $queryForm.serialize(); //获取选中的值 var searchCondition = getSelectCon(conditionData); var queryParams = getQueryFormParams($queryForm); var params=$.extend({},loadParams,queryParams); //与之前参数条件拼接 params.condition = searchCondition.condition + params.condition; g.setOptions({"params":params}); //加载数据 g.rend(); } //新增 function onAdd(){ window.location.href="FileAMAdd.jsp"; } //删除 function onDelete(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要删除的记录!"); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID230 + ","; if(rows[i].FABU_230=="1"||rows[i].SHANGBAO_230=="1"){ if(rows[i].FABU_230=="1"){ top.Dialog.alert("您选中的文件已经发布!"); }else if(rows[i].SHANGBAO_230){ top.Dialog.alert("您选中的文件已经上报!"); } return; } if(rows[i].PIGEONHOLE_MAN_ID_230!=userId){ top.Dialog.alert("只能刪除自己上传的文件!"); return; } } top.Dialog.confirm("确定要删除吗?|删除", function() { // 删除记录 $.post($.pathname() +"/ws/crud/CRUDService/delete/", { "objectIDs" : ids, classid : 230 }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("删除成功",null,null,null,-1); // 刷新表格数据 g.rend(); } else { top.Dialog.alert("删除失败!"); } }, "json"); }); } //修改 function onEdit(){ var rows = g.getSelectedRows(); if (rows.length == 0) { top.Dialog.alert("请选择一条记录"); return; } if (rows.length > 1) { top.Dialog.alert("只能选择一条记录"); return; } //只能修改自己上传的文件 var userId = rows[0].PIGEONHOLE_MAN_ID_230; if(userId!=getUser_id){ top.Dialog.alert("只能修改自己上传的文件!"); return; } //上报或发布的不能修改 var shangbao = rows[0].SHANGBAO_230; var fabu = rows[0].FABU_230; if(shangbao=="1"){ top.Dialog.alert("发布的文件不能修改!"); return; }else if(fabu=="1"){ top.Dialog.alert("上报的文件不能修改!"); return; } var fd_id = rows[0].FD_OBJECTID230; window.location.href="FileAMEdit.jsp?"+fd_id; //var url = "FileAMEdit.jsp?"+fd_id; // window.parent.document.getElementById("iframeChild2").setAttribute("src", "/nwyj/page/business/am/file/"+url); }; //查看详情 function onView(){ 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_OBJECTID230; var fd_id1 = rows[0].COLUMN_1_230; $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/file/FileAMInfo.jsp?"+fd_id+"?"+fd_id1); // window.parent.document.getElementById("iframeChild2").setAttribute("src", "/nwyj/page/business/am/file/"+url); } //上报 function onReport(data){ var row = g.getRow(data); var fd_id = row.FD_OBJECTID230; //只能上报自己上传的文件 var userId = row.PIGEONHOLE_MAN_ID_230; if(getUser_id!=userId){ top.Dialog.alert("只能上报自己上传的文件!"); return; } top.Dialog.confirm("确定要上报吗?|上报", function() { // 上报 $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/fileShangbao/", { //当前单位id comp_id : dpids, 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_OBJECTID230; //向后台发送请求调用dwr var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/'; var msg = ""+corp_name+"的日常制度文件"; //var msg = "应急预案"; var params = { parentDeptName:parentId, msg:msg }; $.ajax({ url : url, type : 'post', data : params, dataType : 'text', timeout : 60000, success : function(data){ }, error : function(){ $.messager.alert('操作失败'); } }); } //发布 function onPublish(data){ var row = g.getRow(data); var fd_id = row.FD_OBJECTID230; //只能上报自己上传的文件 var userId = row.PIGEONHOLE_MAN_ID_230; if(getUser_id!=userId){ top.Dialog.alert("只能发布自己上传的文件!"); return; } top.Dialog.confirm("确定要发布吗?|发布", function() { // 发布规范文件 $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/fileFabu/", { comp_id : dpids, fd_id : fd_id, }, function(result) { if (result.Msg.sucsess == true) { top.Dialog.alert("发布成功",null,null,null,1); // 刷新表格数据 g.rend(); } else { top.Dialog.alert("发布失败!"); } }, "json"); } ); } //撤回 function onCallBack(rowid){ top.Dialog.confirm("确定要撤回吗?|撤回", function() { if(status=="0"){ top.Dialog.alert("只能撤回已发布或已上报的文件"); return; } // 发布规范文件 $.post($.pathname() +"/ws/SystemFile/SystemFileService/callBack", { "fd_id" : rowid }, function(result) { if (result.Msg.sucsess == true) { top.Dialog.alert("撤回成功",null,null,null,1); // 刷新表格数据 g.rend(); } else { top.Dialog.alert("撤回失败!"); } }, "json"); }); } //下载 function onDownLoad(){ //批量打包下载 var FD_OBJECTID = ""; var rows = g.getSelectedRows(); for (var i = 0; i < rows.length; i++) { var FD_OBJECTID1= rows[i].FD_OBJECTID230;//预案的主键 var COLUMN_1_230 =rows[i].COLUMN_1_230;//预案的标识位(新的预案还是旧的预案) var COLUMN_3_230 =rows[i].COLUMN_3_230;//上传标识 var COLUMN_4_230 =rows[i].COLUMN_4_230;//修改预案后新增预案的情况,也必有附件 //新增文件,控制必传附件 纯新增 if(COLUMN_1_230=="0"&&COLUMN_4_230=="0"&&COLUMN_3_230=="1"){ //getFileList(fd_id,1); FD_OBJECTID += "'"+FD_OBJECTID1 +"'"+ ",";//文件的主键 } //修改文件后新增预案的情况,也必有附件 纯修编 if(COLUMN_1_230!="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="1"){ //getFileList(fd_bojectid,1); FD_OBJECTID += "'"+FD_OBJECTID1+"'" + ",";//文件的主键 } //纯修改 if(COLUMN_1_230=="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="0"){ //getFileList(PLAN_VERSION_REMARK,1); FD_OBJECTID += "'"+COLUMN_4_230+"'" + ",";//文件的主键 } //修编修改 if(COLUMN_1_230!="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="0"){ //getFileList(PLAN_VERSION_REMARK,1); FD_OBJECTID += "'"+COLUMN_4_230+"'" + ",";//文件的主键 } } var temp = FD_OBJECTID.substring(0,FD_OBJECTID.length-1); //发送请求,获取文件名的集合。 var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanFile/'; var params = { fileId : temp }; var SAVENAME1=""; var NAME1 = ""; var FILEEXT1=""; $.ajax({ url : url, type : 'post', timeout : 60000, data : params, dataType : 'json', success : function(data){ var dataLenth = data.rows.length; var filenames=""; var downfilename = ""; for (var i = 0; i < dataLenth; i++) { SAVENAME1= data.rows[i].SAVENAME; NAME1= data.rows[i].NAME; FILEEXT1= data.rows[i].FILEEXT; filenames +=SAVENAME1 + "." + FILEEXT1 + ";"; downfilename+=NAME1 + "." + FILEEXT1 + ";"; } var filenames1 = filenames.substring(0,filenames.length-1); filenames = decodeURI(filenames1); var downfilename1 = downfilename.substring(0,downfilename.length-1); downfilename = decodeURI(downfilename1); showFile(filenames1,downfilename1); //alert(downfilename1+"============"+filenames1); //返回回调打包下载的函数,拼传给回调函数的filenames,downfilename }, error : function(e){ $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } function showFile(downfilename,filenames){ var url = "/nwyj/page/business/am/org/query/getZipFile.jsp?downfilename="+downfilename+"&filenames="+filenames; window.open(url); } //共享 function onShare(){ alert("待定"); } //导入 function onImport(){ // window.location.href = "FileList_AM-import.jsp"; } //查看历史版本 function onViewHistory(){ var rows = g.getSelectedRows(); if(rows.length==0){ top.Dialog.alert("请选择一条记录"); return; } if(rows.length>1){ top.Dialog.alert("只能选择一条记录"); return; } //上一个版本的预案ID var fd_id = rows[0].COLUMN_1_230; var fd_id1 = rows[0].FD_OBJECTID230; //var url = "FileVersion.jsp?"+fd_id+"?"+fd_id1; $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/file/FileVersion.jsp?"+fd_id+"?"+fd_id1); // top.document.getElementById("iframeChild2").setAttribute("src", "/nwyj/page/business/am/file/"+url); } //更多 function more(){ $('#moreDiv').toggle(); // $("#FILE_CLASSIFY_230").resetValue(); // $("#CHANGE_TYPE_230").resetValue(); // $("#DATE1").val(""); $("#DATE2").val(""); $("#FILE_TITLE_230").val(""); } //汇总统计 function sumUnit(){ window.location.href="FileAM-poll.jsp"; } //共享 function publicShare(){ var rows = g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要分享的记录!"); return; } var REMARK1 = rows[0].PIGEONHOLE_MAN_ID_230; if(REMARK1!=getUser_id){ top.Dialog.alert("只能分享自己上传的文件!"); return; } var ids = ""; var sturtssb = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID230 + ","; sturtssb += rows[i].FABU_230 + ","; if(rows[i].FABU_230!="1"){ if(rowsLength==1){ top.Dialog.alert("您选中的记录未发布!"); }else{ top.Dialog.alert("您选中的记录有未发布的!"); } return; } } $("#BUSINE_ID_217").val(ids); var diag = new top.Dialog(); diag.Title = "文件共享"; diag.URL = $.pathname() + '/page/business/am/public/readDept.jsp'; diag.Width = 700; diag.Height = 500; diag.Top = "80%"; diag.Left = "50%"; diag.ShowButtonRow=true; diag.ButtonAlign = 'center'; diag.OkButtonText="确 定"; diag.OKEvent = function(){ Validate(diag); }; diag.show(); } function Validate(diag){ var zhh="";//总指挥 var fzhh="";//副总指挥 var yjbzr="";//应急办主任 var yjbfzr="";//应急办副主任 var yjbcy="";//应急办副成员 var zyglry="";//专业部门管理人员 var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID //分享单位的ID deptId var time1=diag.innerFrame.contentWindow.$("#time1").val(); var time2=diag.innerFrame.contentWindow.$("#time2").val(); //获取应急角色被勾选的值 if(diag.innerFrame.contentWindow.document.getElementById("football-1").checked){ //选中取值(可以取到这个值) zhh = "R002105430201"; }else{ zhh = ""; } if(diag.innerFrame.contentWindow.document.getElementById("football-2").checked){ //选中取值(可以取到这个值) fzhh = "R002105430202"; }else{ zyglry = ""; } if(diag.innerFrame.contentWindow.document.getElementById("football-3").checked){ //选中取值(可以取到这个值) yjbzr = "R002105430203"; }else{ yjbzr = ""; } if(diag.innerFrame.contentWindow.document.getElementById("football-4").checked){ //选中取值(可以取到这个值) yjbfzr = "R002105430204"; }else{ yjbfzr = ""; } if(diag.innerFrame.contentWindow.document.getElementById("football-5").checked){ //选中取值(可以取到这个值) yjbcy = "R002105430205"; }else{ yjbcy = ""; } if(diag.innerFrame.contentWindow.document.getElementById("football-6").checked){ //选中取值(可以取到这个值) zyglry = "R002105430206||R002105430207||R002105430208||R002105430209||R002105430210||R002105430211||R002105430212||R002105430213||R002105430214"; }else{ zyglry = ""; } //被分享查看的人 var RECEIVE_MAN = zhh + "||" + fzhh + "||" + yjbzr + "||" + yjbfzr + "||" + yjbcy + "||" + zyglry; //分享的单位 deptId //获取zTree对象 var zTree = diag.innerFrame.contentWindow.$.fn.zTree.getZTreeObj("tree-1"); //得到选中的数据集 var checkedNodes = zTree.getCheckedNodes(true); if(time1==""||time2==""){ $.messager.alert('请选择分享的起始时间!'); return; } if(time1>time2){ $.messager.alert('请选择正确的分享起始时间!'); return; } if(checkedNodes==""){ $.messager.alert('请选择要申请查看的单位!'); return; } var compValue=""; //var compValue2=""; for(var i = 0; i < checkedNodes.length; i++){ //机构名称 compValue += checkedNodes[i].id + ","; //compValue2 += checkedNodes[i].name+","; } var compid = compValue.substring(0,compValue.length-1); //var compname = compValue2.substring(0,compValue2.length-1); //给第二个form的字段设置值 $("#SHARE_MAN_217").val(getUser_id); //SHARE_MAN_217 分享人 $("#SHARE_UNITS_217").val(deptId); //SHARE_UNITS_217分享单位 $("#RECEIVE_UNITS_217").val(compid); //RECEIVE_UNITS_217 被分享单位 //SHARE_TYPE_217分享的业务类型 写死3 $("#SHARE_START_TIME_217").val(time1); //SHARE_START_TIME_217开始时间 $("#SHARE_END_TIME_217").val(time2); //SHARE_END_TIME_217结束时间 //BUSINE_ID_217业务ID 点击分享的时候已经赋值给页面了 $("#RECEIVE_MAN_217").val(RECEIVE_MAN); //RECEIVE_MAN_217接收的人 var $form = $('#fillForm1'); var url = $.pathname() + '/ws/crud/CRUDService/create'; $.ajax({ url : url, type : 'post', data : $form.serialize(), dataType : 'text', timeout : 60000, success : function(data){ $.messager.alert("共享成功",null,null,null,-1); }, error : function(){ $.messager.alert('操作失败'); } }); top.Dialog.close();//关闭新增窗口 } $.messager=top.Dialog;