123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- //父部门id
- var firstdiag;
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
-
- var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- loadParams=null;
- $("#searchButt").bind("click",function(){
- searchHandler();
- });
-
- $("#searchButt").live('click', function() {
- searchHandler();
- });
-
- //列表加载参数
- var statusDate={"list":[{"value":"0","key":"未上报"},{"value":"1","key":"已上报"}]};
- var releaseDate={"list":[{"value":"0","key":"未发布"},{"value":"1","key":"已发布"}]};
- //当前时间
- function getNowFormatDate() {
-
- var date = allGetServerTime();
- var seperator1 = "-";
- var seperator2 = ":";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- var hour=date.getHours();
- var minu=date.getMinutes();
- var sec=date.getSeconds();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- if(hour>=0 && hour<=9){
- hour="0"+hour;
- }
- if(minu>=0 && minu<=9){
- minu="0"+minu;
- }
- if(sec>=0 && sec<=9){
- sec="0"+sec;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate
- + " " + hour + seperator2 + minu;
- return currentdate;
- }
- var currdate = getNowFormatDate();
- var g;
- var grid_option={ columns:[
- {name:'FD_OBJECTID335',hide:true},
- {display:'名称',name:'NAME_335',align:'center',width:"32%",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:'OPER_DEPT_335_SHOW',align:'center',width:"16%",showTitle:true},
- {display:'填报部门',name:'DEPT_NAMES_335_SHOW',align:'center',width:"16%",showTitle:true},
- {display:'填报人员',name:'OPER_NAME_335',align:'center',width:"10%",showTitle:true},
- {display:'填报时间',name:'OPER_TIME_335',align:'center',width:"16%",showTitle:true},
- /* {display:'上报状态',name:'STATE_335',align:'center',width:"13%", editor: { type: 'select',data:statusDate,selWidth:103 },render:function (item){
- for (var i = 0; i < statusDate["list"].length; i++)
- {
- if (statusDate["list"][i]['value'] == item.STATE_335)
- return statusDate["list"][i]['key'];
- }
- return item.duty_way;
- }},*/
- {display:'发布状态',name:'RELEASE_335_SHOW',align:'center',width:"10%",showTitle:true}
- ],
-
- rownumbers:true,
- checkbox:true,
- usePager:true,
- pageSize : 10,
- percentWidthMode : true
-
-
- };
-
- loadParams={
- listId:'335',
- direction:'DESC',
- sort: 'UPDATEDATE',
- // condition:"IS_DEL=0 and DUTY_TYPE=1 and ((RELEASE=1 and OPER_DEPT='"+ parentId +"') or (RELEASE=1 and OPER_DEPT='"+ parentId +"') or(RELEASE=0 and OPER_NAME_ID='"+userId+"'))",
- condition:"IS_DEL=0 and DUTY_TYPE=1 and ((RELEASE=1 and OPER_DEPT in (select parent_id from sys_department where dept_id='"+CorpArea+"')) or (RELEASE=0 and OPER_NAME_ID='"+userId+"') or (RELEASE=1 and OPER_NAME_ID='"+userId+"'))",
- };
-
- //点击主键跳转详细信息页面
-
- var roleCons = roleButtonArr();
- var toolBarOpt={
- items: [
- {text : '新增',click : 'onAdd',iconClass : 'add1_tem' ,id:"05xz"},
- {text : '删除',click : 'onDelete',iconClass : 'delete_tem',id:"05sc"},
- {text : '修改',click : 'onEdit',iconClass : 'update_tem',id:"05xg"},
- // {text : '查看',click : 'onView',iconClass : 'view_tem',id:"05ck"},
- {text : '撤回',click : 'onRecall',iconClass : 'retract_tem',id:"05ch"},
- {text : '发布',click : 'onPublish',iconClass : 'release_tem',id:"05fb"},
- /*{text : '上报',click : 'onUpside',iconClass : 'sendup_tem',id:"10005"},
- {text : '回退',click : 'onRollback',iconClass : 'rollback_tem',id:"10007"},*/
- // {text : '导入',click : 'onImport',iconClass : 'import_tem',id:"05dr"},
- {text : '导出',click : 'onExport',iconClass : 'export_tem',id:"05dc"},
- {text : '汇总',click : 'onHuiZong',iconClass : 'view_tem',id:"05ck"}],
- //{text : '打印',click : 'print',iconClass : 'print_tem',id:"10010"}],
-
-
- roleCons:roleCons};
- var options={
- url :'/nwyj/ws/crud/CRUDService/queryQui',
- params: loadParams,
- width:960,
- gridOptions:grid_option,
- singleRecodeOptions:{a:"aa"},
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBarOpt
- };
- /*****************************************初始化实例 加载实例*********************************************************/
- $(function(){
- $("#NAME_335").keydown(function(event){
- if(event.keyCode == 13){
- searchHandler();
- }
- });
- //gridAndSingleRecode.rendPaper();
- //详细列表时,点击内容弹出窗口查看里面所有的内容,用于内容比较多时点击复制其中的内容
- // $("#singleRecode_id ul").find("a").live("click",openthis);
- $.post(deptUrl,{id:parentId,name:''},function(data){
- $("#DEPT_NAMES_335").data("data",data);
- $("#DEPT_NAMES_335").render();
- $("#OPER_DEPT_335").data("data",data);
- $("#OPER_DEPT_335").render();
- }, "json");
-
- g=gridAndSingleRecode=$("#content").quickgridAndSingleRecode(options);
- //g.rend();
- //var _this = this;
-
- });
- function openDetail(rowindex) {
- var row = g.getRow(rowindex);
- var fd_id = row.FD_OBJECTID335;
- $('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/em/alert/duty/resp_alert_DutyInfo.jsp?'+fd_id);
- }
- function more(){
- $('#moreDiv').toggle();
- var is_show = $('#moreDiv').css("display");
- if(is_show == "none"){
- document.getElementById("queryUserForm").reset(); //重置一下表单
- }else{
- $("#DEPT_NAMES_335").render();
- $("#OPER_DEPT_335").render();
- $("#STATE_335").render();
- $("#RELEASE_335").render();
- }
- $(parent.document.body).find("#frmright").height($(window.document.body).height());
- }
-
-
-
- /*function sendMsg(data){
-
-
- //短信
- $.ajax({
- url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getMyInfo/',
- type : 'post',
- data : data,
- async:false,
- dataType : 'json',
- success : function(data){
- for(var i=0;i<data.length;i++){
- receiver+=data[i].LEADER+",";
- receiver+=data[i].WATCH_MAN+",";
- telephine+=data[i].LEADER_TEL+",";
- telephine+=data[i].WATCH_TEL+",";
- };
- addMsg(
- receiver,//data.list.split("|")[0],//要发送的人
- telephine,//data.list.split("|")[1],//要发送的手机号
- "新发布了一个保供电值班安排表,请及时填报!"//要发送的信息内容
- );
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }*/
- /*function getNameTel(data){
- $.ajax({
- url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getNameTel/',
- type : 'post',
- data : data,
- async:false,
- dataType : 'json',
- success : function(data){
- var receiver = ""; //接收人员 + 领导
- var telephine = "";
- var arr = data.rows;
- for(var i=0;i<arr.length;i++){
- //值班成员
- receiver+=arr[i].DUTY_NAME+";";
- //电话
- telephine+=arr[i].DUTY_NAME_TEL+";";
- };
- addMsg(receiver,telephine,"新发布了一个预警值班安排表,请及时查看!");
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }*/
- function getNameTel(data){
- $.ajax({
- url : $.pathname() + '/ws/alertduty/RespAlertDutyService/sendDutyMsg/',
- type : 'post',
- data : {dept_id:data},
- async:false,
- dataType : 'text',
- success : function(data){
- if(data=="true"){
- top.Dialog.alert("发送短信成功!");
- }else{
- top.Dialog.alert("发送短信失败!");
- }
- },
- error : function(e){
- top.Dialog.alert("发送短信失败!");
- }
- });
- }
- //发布
- function onPublish(){
-
- 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_OBJECTID335+",";
- if(rows[i].RELEASE_335==1){
- top.Dialog.alert("存在已发布的记录,请检查后再操作!");
- return;
- }
- }
- top.Dialog.confirm("确定要发布吗?|发布", function() {
-
- $.post($.pathname() + '/ws/duty/DutyRecordsService/updateStat', {
- "objectIDs" : ids,
- "svalue":"0",
- "rvalue":"1",
- "time":currdate
- }, function(result) {
- if (result.Msg.sucsess == true) {
- // 刷新表格数据
- g.rend();
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
- getNameTel(ids);
- });
- } else {
- top.Dialog.alert("发布失败!");
- }
- }, "json");
-
- });
-
- }
- /*//回退
- function onRollback(){
- 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_OBJECTID335+",";
- if(rows[i].RELEASE_335==0){
- top.Dialog.alert("存在未发布的记录,请检查后再操作!!");
- return;
- }
- }
- // alert(ids);
- top.Dialog.confirm("确定要回退吗?|回退", function() {
- $.post($.pathname() + '/ws/duty/DutyRecordsService/updateStat', {
- "objectIDs" : ids,
- "svalue":"0",
- "rvalue":"0"
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("回退成功!");
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("回退失败!");
- }
- }, "json");
-
- });
- };*/
- /**回退**/
- function onRollback() {
- // 取得选中的Grid行
- var rows=g.getSelectedRows();
- // 选中的行数
- var rowsLength=rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要撤回的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert('请选中一条要撤回的记录!');
- return;
- } else if (rows[0].RELEASE_335 == 1) {
- var fd_id = rows[0].FD_OBJECTID335;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/duty/resp_rollback.jsp?'+fd_id);
- } else {
- top.Dialog.alert('未上报不可回退!');
- return;
- }
- };
- //打印
- function onPrint(){
-
- }
- //填报
- function onAdd(){
- window.location.href="resp__alert_DutyEdit.jsp";
- }
- //查看
- function onView(){
- //$.pathname() + '/page/business/em/response/duty/resp_duty_info.jsp?'+fd_id;
- var rows=g.getSelectedRows();
- var rowsLength=rows.length;
- if(rowsLength==0){
- top.Dialog.alert("请选择一条记录!");
- return;
- }
- if(rowsLength>1){
- top.Dialog.alert("只能选择一条记录!");
- return;
- }
- var fd_id=rows[0].FD_OBJECTID335;
-
- window.location.href="resp_alert_DutyInfo.jsp?"+fd_id;
- }
-
- /**************************************************************************************************************************************************/
- //汇总
- function onHuiZong(){
-
- // var userInfoStr = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
- // var opener=window.open("/nwyj/page/frameWork.html");
- // opener.fatherParam={"name":userInfoStr,"idxWorkUrl":"/nwyj/page/business/em/alert/duty/resp_alert_DutyHuiZong.jsp"};
- $.indexOpenNextWindow("/nwyj/page/business/em/alert/duty/resp_alert_DutyHuiZong.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_OBJECTID335 + ",";
- if(rows[i].OPER_NAME_335!=realName){
- top.Dialog.alert("只可以删除本人新增的值班记录!");
- return;
- }
- }
- var url =$.pathname() + '/ws/alertduty/RespAlertDutyService/deDutyDetail';
- top.Dialog.confirm("确定要删除吗?|删除", function(){
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : ids,
- dataType : 'json',
- success : function(data) {
- top.Dialog.alert('删除成功!',null,null,null,1);
- g.rend();
- },
- error : function() {
- $.messager.alert('删除失败!');
- }
- });
- });
- }
- //修改
- function onEdit(){
- $.pathname() + '/page/business/em/response/duty/resp_alert_DutyInfo.jsp?'+fd_id;
- var rows=g.getSelectedRows();
- var rowsLength=rows.length;
- if(rowsLength==0){
- top.Dialog.alert("请选择一条记录!");
- return;
- }
- if(rowsLength>1){
- top.Dialog.alert("只能选择一条记录!");
- return;
- }
- if(rows[0].OPER_NAME_335 != realName){
- top.Dialog.alert("只可以修改本人填报的值班安排表!");
- return;
- }
- var fd_id=rows[0].FD_OBJECTID335;
-
- window.location.href="resp_alert_Duty_Editor.jsp?"+fd_id;
-
- // window.location.href="resp_duty_editor.jsp?objectId="+fd_id;
- }
- //上报
- function onUpside(){
- var flag=false;
- var flag1=false;
- var rows=g.getSelectedRows();
- var rowsLength=rows.length;
- if(rowsLength==0){
- top.Dialog.alert("请选中要上报的记录!");
- return;
- }
- var ids="";
- for(var i=0;i<rowsLength;i++){
- if(rows[i].STATE_335==1){
- top.Dialog.alert("存在已上报的记录,请检查后再操作!!");
- return;
- }
- }
- for(var i=0;i<rowsLength;i++){
- ids+=rows[i].FD_OBJECTID335+",";
- if(rows[i].RELEASE_335==0){
- flag1=true;
- }
- }
-
- if(flag1)
- { top.Dialog.confirm("存在未发布的记录,确定要上报吗?|上报", function() {
- // 删除记录 url: $.pathname() + '/ws/duty/DutyRecordsService/queryDetailByDutyId',
- //$.pathname() +"/ws/crud/CRUDService/delete/"
-
- $.post($.pathname() + '/ws/duty/DutyRecordsService/updateStat', {
- //$.post($.pathname() + '/ws/crud/CRUDService/delete/', {
- "objectIDs" : ids,
- "svalue":"1",
- "rvalue":"1",
- "time":currdate
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("上报成功!");
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("上报失败!");
- }
- }, "json");
-
- },function(){
- return;
- });
- flag=true;
-
- }
- // alert(ids);
- if(!flag){
- top.Dialog.confirm("确定要上报吗?|上报", function() {
- // 删除记录 url: $.pathname() + '/ws/duty/DutyRecordsService/queryDetailByDutyId',
- //$.pathname() +"/ws/crud/CRUDService/delete/"
- $.post($.pathname() + '/ws/duty/DutyRecordsService/updateStat', {
- //$.post($.pathname() + '/ws/crud/CRUDService/delete/', {
- "objectIDs" : ids,
- "svalue":"1",
- "rvalue":"1",
- "time":currdate
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("上报成功!");
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("上报失败!");
- }
- }, "json");
- });
- }
- }
- //撤回
- function onRecall(){
-
- 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_OBJECTID335+",";
- if(rows[i].RELEASE_335==0){
- top.Dialog.alert("存在未发布的记录,请检查后再操作!!");
- return;
- }
- if(rows[i].OPER_NAME_335!=realName){
- top.Dialog.alert("只能撤回本人发布的值班信息记录!!");
- return;
- }
- }
- // alert(ids);
- top.Dialog.confirm("确定要撤回吗?|撤回", function() {
- $.post($.pathname() + '/ws/duty/DutyRecordsService/updateStat', {
- "objectIDs" : ids,
- "svalue":"0",
- "rvalue":"0"
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("撤回成功!");;
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("撤回失败!");
- }
- }, "json");
-
- });
- }
- //导入
- function onImport(){
- var ifmHeight = $(parent.document.body).find("#frmright").height();
- firstdiag = new top.Dialog();
- firstdiag.Title = "导入应急预警值班表信息";
- firstdiag.Width=600;
- firstdiag.Height=250;
- firstdiag.URL = "/nwyj/page/business/em/alert/duty/resp_slert_DutyImport.jsp?ifmHeight="+ifmHeight;
- firstdiag.ShowButtonRow=false;
- // diag.OKEvent = function(){
- // var inputValue = diag.innerFrame.contentWindow.document.getElementById('test').value;
- // var inputValue2 = diag.innerFrame.contentWindow.document.getElementById('fileData2').value;
- // top.Dialog.alert(inputValue);
- // top.Dialog.alert(inputValue2); //js中获取不到 file的路径, 此路径受保护
- //
- // diag.close();
- // };
- firstdiag.show();
- }
-
- function closediag(){
- firstdiag.close();
- }
-
- //导出
- function onExport(){
- var rows=g.getSelectedRows();
- var rowsLength=rows.length;
- if(rowsLength==0){
- top.Dialog.alert("请选择一条记录!");
- return;
- }
- if(rowsLength>1){
- top.Dialog.alert("只能选择一条记录!");
- return;
- }
- var fd_id=rows[0].FD_OBJECTID335;
- // alert(ids);
- top.Dialog.confirm("确定要导出吗?|导出", function() {
- $.ajax({
- url : $.pathname() + '/ws/alertduty/RespAlertDutyService/exportAlertExcel',
- type : 'post',
- timeout : 15000,
- data : {objectID:fd_id},
- dataType : 'text',
- async:false,
- success : function(data){
- var url = $.pathname() +"/page/common/getExcel.jsp?exportContent="
- + data + "&destFileName=" + encodeURI(encodeURI('应急预警值班表'));
- var w = window.open(url, "_blank");
- w.location.href = url;
- },
- error : function(e){
- top.Dialog.alert("导出Excel失败");
- }
-
- });
- });
- }
- //数据查询
- function searchHandler(obj){
- $queryUserForm = null;
- //去掉水印
- if($("#NAME_335").val()!="" && $("#NAME_335").val()=="请输入名称"){
- $("#NAME_335").val("");
- }
- $("#queryUserForm").serialize();
- //获取选中的值
- var searchCondition = getSelectCon(conditionData);
- var queryParams = getQueryFormParams($("#queryUserForm"));
- var params=$.extend({},loadParams,queryParams);
- //与之前参数条件拼接
- params.condition = searchCondition.condition + params.condition;
- g.setOptions({"params":params});
- //加载数据
- g.rend();
-
- }
- function showPrimaryKey(obj,index){
- var fd_id = obj.FD_OBJECTID335;
- $('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/em/alert/duty/resp_alert_DutyInfo.jsp?'+fd_id);
- }
|