123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473 |
- 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 "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
- }
- },
- { 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 = '<span class="sendup_templan hand" title="上报" onclick="shangbao(' + rowindex + ')"></span>';
- }else{
- shangbao = '<span class="fashang_plan hand" title="上报" onclick="shangbao(' + rowindex + ')"></span>';
- }
- 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 = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/public/emc-drill-info.jsp?"+fd_id+"')\">"+corp_name+"的应急演练</a>";
- //var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/contingencyPlan/PlanAdd.jsp')\">应急预案</a>";
- 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;
|