laws = function() { /** 定义变量* */ var _this = this; _this.listGrid = null;// 数据列表 //_this.searchPanel = null; // 查询面板 $queryForm = null;// 查询区域表单 $searchButt = null;// 查询按钮 $more = null; // 更多 _this.loadParams = null;// 列表加载参数 //取登录人应急角色 var Roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids() + ","; var roleidTemp =Roleid.split(","); var flag="0"; /** *新增信息** */ _this.addForm = function() { $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_add.jsp"); }; /** *修改、删除信息 各级单位的超级管理员可以修改表单信息。湛江局许永山提的建议 2016-05-31** */ _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 { for(var i=0; i< roleidTemp.length; i++){ if(roleidTemp[i]=="R002105430200"){ flag="1"; } } if(rows[0].COLUMN_3_243=="1"&&flag=="0"){ top.Dialog.alert("发布后的记录不能够修改!"); return; } var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); if(getUser_id!=rows[0].TYPEIN_PEOPLE_243&&flag=="0"){ top.Dialog.alert("只能修改自己上传的文件!"); return; } var fd_id = rows[0].FD_OBJECTID243; $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_edit.jsp?"+fd_id); } }; /** *删除信息** */ _this.del = function(){ var rows = _this.listGrid.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 getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var flag1 = false; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID243 + ","; if(rows[i].COLUMN_3_243=="1"&&flag=="0"){ if(rowsLength==1){ top.Dialog.alert("您选中的记录已发布,不能删除!"); }else{ top.Dialog.alert("您选中的记录中有已发布的,不能删除!"); } return; } if(getUser_id!=rows[i].TYPEIN_PEOPLE_243&&flag=="0"){ if(rowsLength==1){ top.Dialog.alert("您只能删除您自己上传的文件记录!"); }else{ top.Dialog.alert("您只能删除您自己上传的文件记录!"); } return; } $.ajax({ url : $.pathname() + '/ws/crud/CRUDService/getDataById/', type : 'post', timeout : 60000, data : { classid : '800', objectID : rows[i].UNITE_243 }, async:false, //异步 dataType : 'json', success : function(data){ if(data.DEPT_LEVEL_800 1) { top.Dialog.alert("请选中一条要查看的记录!"); return; } else { var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID243; $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); } }; //点击主键跳转详细信息页面 _this.openDetail = function(rowindex) { var row = _this.listGrid.getRow(rowindex); var fd_id = row.FD_OBJECTID243; // $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); $.indexOpenNextWindow("/nwyj/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); }; /** **历史版本*** */ _this.onhistory = function() { var rows = _this.listGrid.getSelectedRows(); if(rows.length==0){ top.Dialog.alert("请选择一条记录"); return; } if(rows.length>1){ top.Dialog.alert("只能选择一条记录"); return; } //上一个版本的预案ID // var fd_id = rows[0].OBJ_FIRST_243; var fd_id = rows[0].FD_OBJECTID243; $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_version.jsp?"+fd_id); }; /** **导出*** */ _this.exportTotalData = function() { var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.confirm("是否导出所有的文件信息?|是", function() { var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); var loadParams ={ "listId" :'243' , // "condition" : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) ", "condition" : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' ", direction:'DESC', sort: 'UPDATEDATE' }; excelExport(243,loadParams,"应急制度文件信息","IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_2,COLUMN_3,COLUMN_4,OBJ_FIRST,VERSION,TYPEIN_PEOPLE_PHONE_NUM"); }); return; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += "'"+rows[i].FD_OBJECTID243+"'" + ","; } var temp = ids.substring(0,ids.length-1); var condition = " IS_DEL='0' "; condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%'; var sql = { "listId" :'243' , "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' }; excelExport(243,sql,"应急制度文件","IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_2,COLUMN_3,COLUMN_4,OBJ_FIRST,VERSION,TYPEIN_PEOPLE_PHONE_NUM"); }; /** 导入 */ _this.showImportDialog = function() { window.location.href="laws-import.jsp"; }; /************************************** **下载*** *************************************************/ _this.onDownLoad = function() { //批量打包下载 var FD_OBJECTID = ""; var rows = _this.listGrid.getSelectedRows(); if(rows.length==0){ top.Dialog.alert("请选择一条记录"); return; } for (var i = 0; i < rows.length; i++) { var FD_OBJECTID1= rows[i].FD_OBJECTID243;//预案的主键 FD_OBJECTID += "'"+FD_OBJECTID1+"'" + ",";//预案的主键(复数) } 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); } /****************************************************end******************************************************/ /** **统计*** */ _this.sum = function() { window.location.href="laws_poll.jsp"; }; // 查询 // function search() { // // if($("#LAWS_REGULATIONS_NAME_243").val()=="法律法规"){ // $("#LAWS_REGULATIONS_NAME_243").val(""); // } // $queryForm.serialize(); // var $comp_id = $("#selectConditions").find(".UNITE"); // var loadParams11; // //判断是否有用单位做查询条件 // if(!!$comp_id.prop("outerHTML")){ // // loadParams11 = { // "listId" : '243', // "condition" : " IS_DEL='0' AND COLUMN_3='1' ", // direction:'DESC', // sort: 'UPDATEDATE' // }; // }else{ // // loadParams11 = $.extend({},_this.loadParams,loadParams); // } // var searchCondition = getSelectCon(conditionData); // var queryParams = getQueryFormParams($queryForm); // var params=$.extend({},loadParams11,queryParams);// 默认 // params.condition = searchCondition.condition + params.condition; // _this.exportParams = params; // _this.listGrid.setOptions( { // params : params // }); // _this.listGrid.rend();//加载数据 // } function search(){ if($("#LAWS_REGULATIONS_NAME").val()=="法律法规"){ $("#LAWS_REGULATIONS_NAME").val(""); } var name = $("#LAWS_REGULATIONS_NAME").val(); //部门id var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //登录人ID var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //父部门id var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); $queryForm.serialize(); var $comp_id = $("#selectConditions").find(".UNITE"); var loadParams11; //判断是否有用单位做查询条件 if(!!$comp_id.prop("outerHTML")){ if(name!=""){ loadParams11 = { "listId" : '243', "condition" : " IS_DEL='0' AND (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')", direction:'DESC', sort: 'UPDATEDATE' }; }else{ loadParams11 = { "listId" : '243', "condition" : " IS_DEL='0' AND (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) ", direction:'DESC', sort: 'UPDATEDATE' }; } }else{ if(name==""){ loadParams11 = $.extend({},_this.loadParams,loadParams); }else{ loadParams11 = { "listId" : '243', "condition" : " is_del='0' and (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')", direction:'DESC', sort: 'UPDATEDATE' }; } } var searchCondition = getSelectCon(conditionData); var ff = searchCondition.condition.split("and"); var queryParams = getQueryFormParams($queryForm); var params=$.extend({},loadParams11,queryParams);// 默认 params.condition = searchCondition.condition + params.condition; _this.exportParams = params; _this.listGrid.setOptions( { params : params }); _this.listGrid.rend();//加载数据 }; _this.searchHandler2 = function(){ if($("#LAWS_REGULATIONS_NAME").val()=="请输入法律法规名称"){ $("#LAWS_REGULATIONS_NAME").val(""); } //部门id var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //登录人ID var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //父部门id var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); var name = $("#LAWS_REGULATIONS_NAME").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 ISSUE_ORGANIZATION = $("#ISSUE_ORGANIZATION").val(); var condition = ""; if(zTreeCompId=="" || zTreeCompId==dpids){ // condition = "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id)"; condition = "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' "; }else{ condition = "is_del='0' and COLUMN_3='1' and UNITE='"+zTreeCompId+"' "; } if(name!=""){ condition += " AND LAWS_REGULATIONS_NAME LIKE '%" +name+"%'"; } if(ISSUE_ORGANIZATION!=""){ condition += " AND ISSUE_ORGANIZATION LIKE '%" +ISSUE_ORGANIZATION+"%'"; } /***************时间*******************/ 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 ISSUE_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 IMPLEMENT_DATE BETWEEN '"+ISSUE_DATE1+"' AND '"+ISSUE_DATE2+"' "; } /****************复选框查询******************/ //分类 var CLASSES = ""; $("input:checkbox[name=CLASSES]").each(function(){ if($(this).attr("checked")){ if($(this).val()=="0000"){ CLASSES += " CLASSES = '1' or CLASSES = '2' or CLASSES = '3' or CLASSES = '4' or CLASSES = '5' or "; }else{ CLASSES += "CLASSES = '" + $(this).val() +"' or "; } } }); if(CLASSES!=""){ CLASSES = CLASSES.substring(0,CLASSES.lastIndexOf("or")); condition += " and ("+CLASSES+") "; } //状态 var STATE = ""; $("input:checkbox[name=STATE]").each(function(){ if($(this).attr("checked")){ if($(this).val()=="0000"){ STATE += " STATE = '1' or STATE = '2' or STATE = '3' or STATE = '4' or STATE = '5' or "; }else{ STATE += "STATE = '" + $(this).val() +"' or "; } } }); if(STATE!=""){ STATE = STATE.substring(0,STATE.lastIndexOf("or")); condition += " and ("+STATE+") "; } //发布情况 var COLUMN_3 = ""; $("input:checkbox[name=COLUMN_3]").each(function(){ if($(this).attr("checked")){ if($(this).val()=="0000"){ COLUMN_3 += " COLUMN_3 = '1' or COLUMN_3 = '0' or "; }else{ COLUMN_3 += "COLUMN_3 = '" + $(this).val() +"' or "; } } }); if(COLUMN_3!=""){ COLUMN_3 = COLUMN_3.substring(0,COLUMN_3.lastIndexOf("or")); condition += " and ("+COLUMN_3+") "; } // $queryForm.serialize(); // var $comp_id = $("#selectConditions").find(".UNITE"); // var loadParams11; // //判断是否有用单位做查询条件 // if(!!$comp_id.prop("outerHTML")){ // if(name!=""){ // loadParams11 = { // "listId" : '243', // "condition" : " IS_DEL='0' AND COLUMN_3='1' and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')", // direction:'DESC', // sort: 'UPDATEDATE' // }; // }else{ // loadParams11 = { // "listId" : '243', // "condition" : " IS_DEL='0' AND COLUMN_3='1' ", // direction:'DESC', // sort: 'UPDATEDATE' // }; // } // }else{ // if(name==""){ // loadParams11 = $.extend({},_this.loadParams,loadParams); // }else{ // loadParams11 = { // "listId" : '243', // "condition" : " is_del='0' and (COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id) and (ISSUE_ORGANIZATION like '%"+name+"%' or LAWS_REGULATIONS_NAME like '%"+name+"%' or ISSUE_ARTICLE_NUM like '%"+name+"%' or ISSUE_DATE like '%"+name+"%' or IMPLEMENT_DATE like '%"+name+"%' or DESCRIPTION like '%"+name+"%')", // direction:'DESC', // sort: 'UPDATEDATE' // }; // } // // } // var searchCondition = getSelectCon(conditionData); // var queryParams = getQueryFormParams($queryForm); // var params=$.extend({},loadParams11,queryParams);// 默认 // params.condition = searchCondition.condition + params.condition; // _this.exportParams = params; // _this.listGrid.setOptions( { // params : params // }); _this.listGrid.setOptions({//重置加载列表的参数 params : { "listId" :'243' , "condition" : condition, direction:'DESC', sort: 'UPDATEDATE' } }); _this.listGrid.rend();//加载数据 }; 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 more() { $('#moreDiv').toggle(); $(parent.document.body).find("#frmright").height($(window.document.body).height()); }*/ /*************************************************************************************************/ //发布 单一 _this.fabu = function(data) { var row = _this.listGrid.getRow(data); var fd_id = row.FD_OBJECTID243+","; //只能发布自己上传的文件 var userId = row.TYPEIN_PEOPLE_243; var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); if(getUser_id!=userId){ top.Dialog.alert("只能发布自己上传的文件!"); return; } top.Dialog.confirm("确定要发布吗?|发布", function() { // 发布规范文件 $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsFabu/", { fd_id : fd_id, }, function(result) { if (result.Msg.sucsess == true) { top.Dialog.alert("发布成功",null,null,null,1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("发布失败!"); } }, "json"); }); }; //发布 批量 _this.onPublish = function() { var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要发布的记录!"); return; } var ids = ""; var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID243 + ","; if(rows[i].COLUMN_3_243=="1"){ if(rowsLength==1){ top.Dialog.alert("您选中的记录已经发布!"); }else{ top.Dialog.alert("您选中的记录有已经发布的!"); } return; } if(getUser_id!=rows[i].TYPEIN_PEOPLE_243){ if(rowsLength==1){ top.Dialog.alert("您选中的记录不是您自己上传的文件记录,请选择您自己上传的文件记录!"); }else{ top.Dialog.alert("您选中的记录有不是您自己上传的文件记录,请选择您自己上传的文件记录!"); } return; } } top.Dialog.confirm("确定要发布吗?|发布", function() { $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsFabu/", { fd_id : ids, }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("发布成功",null,null,null,-1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("发布失败!"); } }, "json"); }); }; //共享 单一 _this.gongxiang = function(data) { var row = _this.listGrid.getRow(data); var fd_id = row.FD_OBJECTID243+","; //只能共享以及发布的文件 if(row.COLUMN_3_243!="1"){ top.Dialog.alert("只能共享已经发布的文件!"); return; } //只能共享自己上传的文件 // var userId = row.TYPEIN_PEOPLE_243; // var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); // if(getUser_id!=userId){ // top.Dialog.alert("只能共享自己上传的文件!"); // return; // } if(dept_level!="1"){ if(dept_level!="2"){ top.Dialog.alert("只有省级用户才能共享!"); return; }else{ var userDept_id = row.UNITE_243; var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); if(userDept_id==dpids){ top.Dialog.alert("省公司的文件只有网公司有权决定是否共享!"); return; } } } top.Dialog.confirm("确定要共享吗?|共享", function() { // 发布规范文件 $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsShare/", { fd_id : fd_id, }, function(result) { if (result.Msg.sucsess == true) { top.Dialog.alert("共享成功",null,null,null,1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("共享失败!"); } }, "json"); }); }; //共享 批量 _this.publicShare = function() { var rows = _this.listGrid.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要共享的记录!"); return; } var ids = ""; var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID243 + ","; if(rows[i].COLUMN_4_243=="1"){ if(rowsLength==1){ top.Dialog.alert("您选中的记录已经共享!"); }else{ top.Dialog.alert("您选中的记录有已经共享的!"); } return; } if(rows[i].COLUMN_3_243!="1"){ if(rowsLength==1){ top.Dialog.alert("您选中的记录还没有发布!"); }else{ top.Dialog.alert("您选中的记录中有还没有发布的!"); } return; } if(getUser_id!=rows[i].TYPEIN_PEOPLE_243){ if(rowsLength==1){ top.Dialog.alert("您选中的记录不是您自己上传的文件记录,请选择您自己上传的文件记录!"); }else{ top.Dialog.alert("您选中的记录有不是您自己上传的文件记录,请选择您自己上传的文件记录!"); } return; } } top.Dialog.confirm("确定要共享吗?|共享", function() { $.post($.pathname() +"/ws/LAWSPOLL/LawsService/LawsShare/", { fd_id : ids, }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("共享成功",null,null,null,-1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("共享失败!"); } }, "json"); }); }; //撤销共享 _this.gongxiang1 = function(data){ var row = _this.listGrid.getRow(data); var fd_id = row.FD_OBJECTID243+","; //只能撤销自己上传的文件 var userId = row.TYPEIN_PEOPLE_243; var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); if(getUser_id!=userId){ top.Dialog.alert("只能撤销自己上传的文件!"); return; } top.Dialog.confirm("确定要撤销共享吗?|撤销", function() { // 发布规范文件 $.post($.pathname() +"/ws/LAWSPOLL/LawsService/noLawsShare/", { fd_id : fd_id, }, function(result) { if (result.Msg.sucsess == true) { top.Dialog.alert("撤销成功",null,null,null,1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("撤销失败!"); } }, "json"); }); }; //撤销发布 _this.noPublish = 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; } var ids = ""; for ( var i = 0; i < rowsLength; i++) { ids += rows[i].FD_OBJECTID243 + ","; if(rows[i].COLUMN_3_243!="1"){ top.Dialog.alert("您选中的记录还没有发布!"); return; } } top.Dialog.confirm("确定要撤销发布吗?|撤销", function() { $.post($.pathname() +"/ws/LAWSPOLL/LawsService/noLawsFabu/", { fd_id : ids, }, function(result) { if (result.Msg.sucsess == true) { $.messager.alert("撤销成功",null,null,null,-1); // 刷新表格数据 _this.listGrid.rend(); } else { top.Dialog.alert("撤销失败!"); } }, "json"); }); }; /*************************************************************************************************/ return { init : function() { $queryForm = $("#queryForm"); /** 绑定查询面板的按钮点击事件* */ // $searchButt = $("#searchButt");// 查询按钮 // $searchButt.bind('click', function() { // search(); // }); // $searchButt = $("#searchButt");// 更多查询按钮 // $searchButt.live('click', function() { // search(); // }); $searchOne = $("#searchOne");//查询图标绑定查询事件 $searchOne.bind('click', function() { searchHandler2(); }); /** 绑定更多的按钮点击事件 */ $more = $("#more"); // 更多按钮 $more.bind('click', function() { more(); }); //部门id var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //取得用户真实姓名 var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name(); //登录人ID var getUser_id = 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(); $("body").eq(0).showLoading(); // 列表加载参数 _this.loadParams = { listId : '243', direction:'DESC', sort: 'EMC_AM_LAWS_REGULATIONS.UPDATEDATE', //sublist:' left join ECM_EM_TREATED_HUMAN', //subCondition:' on ECM_EM_PUBLISH_ALERT_NOTICE.FD_OBJECTID=ECM_EM_TREATED_HUMAN.BUSINESS_ID ', //condition : " EMC_AM_LAWS_REGULATIONS.is_del='0' " // condition : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE in (select dept_id from SYS_DEPARTMENT where is_del ='0' and dept_type='1' start with dept_id='"+dpids+"' connect by prior parent_id = dept_id)" condition : "is_del='0' and(COLUMN_3='1' or TYPEIN_PEOPLE = '"+getUser_id+"' ) and UNITE ='"+dpids+"' " }; var roleCons = roleButtonArr(); /** grid载入数据* */ var toolBarOpt1 = { items : [ {text : '新增',click : 'addForm',iconClass : 'add1_tem',id : 'wjxz'}, {text : '删除',click : 'del',iconClass : 'delete_tem',id : 'wjsc'}, {text : '修改',click : 'editForm',iconClass : 'update_tem',id : 'wjxg'}, // {text : '查看',click : 'show',iconClass : 'view_tem',id : '10003'}, // {text : '历史版本',click:"onhistory",iconClass: 'history_tem',id:"10201" }, {text : '导入', click: "showImportDialog", iconClass: 'import_tem' ,id:"wjdr"}, {text : '导出',click:"exportTotalData",iconClass: 'export_tem',id:"10006"}, // {text : '下载',click:"onDownLoad",iconClass: 'download_tem',id:"10007" }, {text : '汇总',click: "sum", iconClass: 'poll_tem' ,id:"10200"}, // {text : '发布',click: "onPublish", iconClass: 'release_tem' ,id:"wjfb"}, //{text : '共享',click: "publicShare", iconClass: 'share_tem' ,id:"10200"}, {text : '撤销',click: "noPublish", iconClass: 'retract_tem' ,id:"10215"} ], roleCons:roleCons }; var grid_option1={ columns : [ {display : '名称', name : 'LAWS_REGULATIONS_NAME_243', align : 'left',width : "15%",isPrimaryKey:true, // render : function(rowdata, value) { // return ''+ rowdata.LAWS_REGULATIONS_NAME_243 +''; // } render : function(rowdata, rowindex, value, column) { return "" + value + ""; } }, {display : '颁布机构', name : 'ISSUE_ORGANIZATION_243', align : 'center',width : "15%",showTitle:true}, {display : '颁布文号', name : 'ISSUE_ARTICLE_NUM_243', align : 'center',width : "10%",showTitle:true}, {display : '发布日期', name : 'ISSUE_DATE_243', align : 'center',width : "10%",showTitle:true}, {display : '填写人员', name : 'TYPEIN_PEOPLE_243_SHOW', align : 'center',width : "10%",showTitle:true}, // {display : '录入人联系方式', name : 'TYPEIN_PEOPLE_PHONE_NUM_243',align : 'center',width : "10%",showTitle:true}, {display : '实施日期', name : 'IMPLEMENT_DATE_243', align : 'center',width : "10%",showTitle:true} , {display : '单位', name : 'UNITE_243_SHOW', align : 'center',width : "10%",showTitle:true} , // {display : '部门', name : 'DEPT_243_SHOW', align : 'center',width : "10%",showTitle:true} , {display : '状态', name : 'STATE_243_SHOW', align : 'center',width : "10%",showTitle:true}, {display : '操作', isAllowHide: false, align : 'center', width:'10%', render: function (rowdata, rowindex, value, column){ //判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0” var fabu='';//fabu if(rowdata.COLUMN_3_243=="1"){ fabu = ''; }else{ fabu = ''; } //判断是否已经共享。取共享的状态,如果已经共享为“1”;未共享为“0” var gongxiang=''; if(rowdata.COLUMN_4_243=="1"){ gongxiang = ''; }else{ gongxiang = ''; } return fabu + gongxiang; } }], /* detail: { //onShowDetail: showFlow, height: 'auto' },*/ pageSize : 10, rownumbers : true, checkbox : true, percentWidthMode : true, onAfterShowData:function(data){ setHt(); } }; var options1={ url :'/nwyj/ws/crud/CRUDService/queryQui', params: _this.loadParams, height: '100%', width:"100%", gridOptions:grid_option1, singleRecodeOptions:{a:"aa"}, paperOpration:{showInput:"true"}, toolBarOptions:toolBarOpt1 }; _this.listGrid=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1); $("body").eq(0).hideLoading(); } }; }(); $(function() { laws.init(); // getCompName(); /*$("#UNITE").OrgSel({selectedMulti : true,loadCorp:"loadCorp",setMulti : { "Y" : "s", "N" : "" }});*/ getDeptLevel(); }); /**************2016-09-10 唐群胜 获取登陆人的级别*****************/ var dept_level=""; function getDeptLevel(){ var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); $.ajax({ url : $.pathname()+ "/ws/planService/PlanService/getDeptLevel", type : 'post', timeout : 60000, data : {id:dpids}, dataType : 'text', success : function(data){ dept_level=data; } }); } //单击跳转 function jumpPage(fd_id){ $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); } function showPrimaryKey(obj,index){ var fd_id = obj.FD_OBJECTID243; // $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); $.indexOpenNextWindow("/nwyj/page/business/am/fileManager/laws/laws_view.jsp?"+fd_id); } 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:"UNITE", flag:"1" }; $.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":"UNITE","equalType":"equal","list":[]}]}'){ conditionData.list.push(test.list[0]); } createConditionsDom(conditionData); $(".item").unbind("click").bind("click",bindSelectOne); }, error : function(e){ $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } function fabu1(){ top.Dialog.alert("该文件已经发布!"); } //清空 function resetSearch(){ $('#LAWS_REGULATIONS_NAME').val(""); $('#ISSUE_ORGANIZATION').val(""); $('#TAKE_DATE1').val(""); $('#TAKE_DATE2').val(""); $('#ISSUE_DATE1').val(""); $('#ISSUE_DATE2').val(""); $("input:checkbox[name=CLASSES]").attr("checked",false); $("input:checkbox[name=STATE]").attr("checked",false); $("input:checkbox[name=COLUMN_3]").attr("checked",false); } $.messager=top.Dialog;