123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599 |
- //父部门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 corp_ids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //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_OBJECTID235',hide:true,},
- {display:'名称',name:'NAME_235',align:'left',width:"20%",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_235_SHOW',align:'center',width:"16%",showTitle:true},
- {display:'填报部门',name:'DEPT_NAMES_235_SHOW',align:'center',width:"16%",showTitle:true},
- {display:'填报人员',name:'OPER_NAME_235',align:'center',width:"16%",showTitle:true},
- {display:'填报时间',name:'OPER_TIME_235',align:'center',width:"16%",showTitle:true},
- /* {display:'上报状态',name:'STATE_235',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_235)
- return statusDate["list"][i]['key'];
- }
- return item.duty_way;
- }},*/
- {display:'发布状态',name:'RELEASE_235_SHOW',align:'center',width:"16%",showTitle:true}
- ],
- rownumbers:true,
- checkbox:true,
- usePager:true,
- pageSize : 10,
- percentWidthMode : true
- };
-
- loadParams={
- listId:'235',
- direction:'DESC',
- sort: 'UPDATEDATE',
- //condition:"IS_DEL= '0' and DUTY_TYPE= '1' and (RELEASE= '1' or(RELEASE= '0' and OPER_NAME_ID='"+userId+"'))",
- //condition:"IS_DEL=0 and DUTY_TYPE=1 and (RELEASE=1 or (RELEASE=0 and OPER_NAME_ID='"+userId+"' and OPER_DEPT='"+ parentId +"'))",
- condition:"IS_DEL=0 and DUTY_TYPE=1 and ((RELEASE=1 and (OPER_DEPT='"+ corp_ids +"' or OPER_DEPT in (select dept_id from SYS_DEPARTMENT where parent_id ='"+corp_ids+"') )) or (RELEASE=0 and OPER_NAME_ID='"+userId+"'))",
- };
-
- //点击主键跳转详细信息页面
-
- var roleCons = roleButtonArr();
- var toolBarOpt={
- items: [
- {text : '新增',click : 'onAdd',iconClass : 'add1_tem' ,id:"yjxz"},
- {text : '删除',click : 'onDelete',iconClass : 'delete_tem',id:"yjsc"},
- {text : '修改',click : 'onEdit',iconClass : 'update_tem',id:"yjxg"},
- {text : '撤回',click : 'onRecall',iconClass : 'retract_tem',id:"10105"},
- {text : '发布',click : 'onPublish',iconClass : 'release_tem',id:"yjfb"},
- {text : '导出',click : 'onExport',iconClass : 'export_tem',id:"10006"}],
- 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_235").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_235").data("data",data);
- $("#DEPT_NAMES_235").render();
- $("#OPER_DEPT_235").data("data",data);
- $("#OPER_DEPT_235").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_OBJECTID235;
- // $('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/am/duty/DutyInfo.jsp?'+fd_id);
- $.indexOpenNextWindow("/nwyj/page/business/am/duty/DutyInfo.jsp?"+fd_id);
- }
- function more(){
- $('#moreDiv').toggle(200,function(){
- checkAndSetHeight($("._content_box").parent());
- if($("#hztitle")){
- checkAndSetHeight($("#hztitle"));
- }
- });
- var is_show = $('#moreDiv').css("display");
- if(is_show == "none"){
- document.getElementById("queryUserForm").reset(); //重置一下表单
- }else{
- $("#DEPT_NAMES_235").render();
- $("#OPER_DEPT_235").render();
- $("#STATE_235").render();
- $("#RELEASE_235").render();
- }
- }
- function getNameTel(data,table_name){
- $.ajax({
- url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getNameTel1/',
- type : 'post',
- data : data,
- timeout : 15000,
- async:false,
- dataType : 'json',
- success : function(result){
- var receiver = ""; //接收人员 + 领导
- var telephine = "";
- var arr = result.rows;
- var names = "";
- var tels = "";
- for(var i=0;i<arr.length;i++){
- //alert(arr[i].LEADER_NAME);
- //值班成员
- var name1 = arr[i].LEADER_NAME;
- var tel1 = arr[i].LEADER_TEL;
- var name2 = arr[i].ADMINISTRATION_DUTY;
- var tel2 = arr[i].ADMINISTRATION_DUTY_TEL;
- var name3 = arr[i].EVERYDAY_DUTY;
- var tel3 = arr[i].EVERYDAY_DUTY_TEL;
-
- if(telephine.indexOf(tel1, "0")==-1){
- telephine +=tel1+";";
- receiver+=name1+";";
- }
- if(telephine.indexOf(tel2, "0")==-1){
- telephine +=tel2+";";
- receiver+=name2+";";
- }
- // alert(telephine+"======"+receiver);
- // if(name1==name2){
- // names=name1;
- // tels = tel1
- // }else{
- // names=name1+name2;
- // tels = tel1+","+tel2
- // }
- // //names = name1+","+name2+","+name3;
- // //tels = tel1+","+tel2+","+tel3;
- // receiver+=names+";";
- // telephine +=tels+";";
- /*//值班领导
- receiver+=arr[i].LEADER_NAME;
- //领导电话
- telephine+=arr[i].LEADER_TEL+";";*/
- };
- // alert(receiver+"======="+telephine);
- addMsg(receiver,telephine,"日常值班“"+table_name+"”中有您的值班信息,请及时查看,并按时值班!");
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
- //发布
- function onPublish(){
-
- var rows=g.getSelectedRows();
- var rowsLength=rows.length;
- if(rowsLength==0 || rowsLength==0){
- top.Dialog.alert("请选中一条要发布的记录!");
- return;
- }
- var ids="";
-
- for(var i=0;i<rowsLength;i++){
- ids+=rows[i].FD_OBJECTID235+",";
- if(rows[i].RELEASE_235==1){
- top.Dialog.alert("存在已发布的记录,请检查后再操作!");
- return;
- }
- }
- top.Dialog.confirm("确定要发布吗?|发布", function() {
-
- $.post($.pathname() + '/ws/duty1/DutyRecordsService1/updateStat', {
- "objectIDs" : ids,
- "svalue":"0",
- "rvalue":"1",
- "time":currdate
- }, function(result) {
- if (result.Msg.sucsess == true) {
- // 刷新表格数据
- g.rend();
- top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {
- getNameTel(ids,rows[0].NAME_235);
- });
- } 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_235 == 1) {
- var fd_id = rows[0].FD_OBJECTID235;
- $('#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="/nwyj/page/business/am/duty/DutyAdd.jsp";
- $('#frmright', window.parent.document).attr("src","/nwyj/page/business/am/duty/DutyAdd.jsp");
- //$(top.document.body).find("iframe").attr("src","/nwyj/page/business/am/duty/DutyAdd.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_OBJECTID235;
-
- window.location.href="/nwyj/page/business/am/duty/DutyInfo.jsp?"+fd_id;
- // window.location.href=$.pathname() + '/page/business/em/response/duty/resp_duty_info.jsp?'+fd_id;
-
- }
- //删除
- function onDelete(){
- var rows = g.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要删除的记录!");
- return;
- }
- if(rows[0].OPER_NAME_235 != realName){
- top.Dialog.alert("只可以删除本人填报的值班安排表!");
- return;
- }
- if(rows[0].RELEASE_235 =='1'){
- top.Dialog.alert("只可以删除未发布的值班安排表!");
- return;
- }
- var ids = "";
- for ( var i = 0; i < rowsLength; i++) {
- ids += rows[i].FD_OBJECTID235 + ",";
- /* if(rows[i].RELEASE_235==1){
- top.Dialog.alert("存在已发布的记录,不能删除!");
- return;
- }*/
- }
- var url =$.pathname() + '/ws/duty1/DutyRecordsService1/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/am/duty/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_235 != realName){
- top.Dialog.alert("只可以修改本人填报的值班安排表!");
- return;
- }
- if(rows[0].RELEASE_235 == 1){
- top.Dialog.alert("只可以修改未发布的值班安排表!");
- return;
- }
- var fd_id=rows[0].FD_OBJECTID235;
- // $(top.document.body).find("iframe").attr("src","/nwyj/page/business/am/duty/DutyEditor.jsp?objectId="+fd_id);
- // window.location.href="/nwyj/page/business/am/duty/DutyEditor.jsp?objectId="+fd_id;
- window.location.href="/nwyj/page/business/am/duty/DutyEditor.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_235==1){
- top.Dialog.alert("存在已上报的记录,请检查后再操作!!");
- return;
- }
- }
- for(var i=0;i<rowsLength;i++){
- ids+=rows[i].FD_OBJECTID235+",";
- if(rows[i].RELEASE_235==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_OBJECTID235+",";
- if(rows[i].RELEASE_235==0){
- top.Dialog.alert("存在未发布的记录,请检查后再操作!!");
- return;
- }
- if(rows[i].OPER_NAME_235!=realName){
- top.Dialog.alert("只能撤回本人发布的值班信息记录!!");
- return;
- }
- }
- // alert(ids);
- top.Dialog.confirm("确定要撤回吗?|撤回", function() {
- $.post($.pathname() + '/ws/duty1/DutyRecordsService1/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/am/duty/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_OBJECTID235;
- // alert(ids);
- top.Dialog.confirm("确定要导出吗?|导出", function() {
- $.ajax({
- url : $.pathname() + '/ws/duty1/DutyRecordsService1/exportAlertExcel',
- type : 'post',
- timeout : 15000,
- data : {objectID:fd_id},
- dataType : 'text',
- async:false,
- success : function(data){
- var url = $.pathname() +"/page/business/am/duty/DutyGetExcel.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;
- $queryForm = $("#queryUserForm");
- //去掉水印
- if($("#NAME_235").val()!="" && $("#NAME_235").val()=="请输入名称"){
- $("#NAME_235").val("");
- }
- // $("#queryUserForm").serialize();
- $queryForm.serialize();
- var $comp_id = $("#selectConditions").find(".OPER_DEPT");
- var loadParams11;
- //判断是否有用单位做查询条件
- if(!!$comp_id.prop("outerHTML")){
-
- loadParams11 = {
- listId : '235',
- condition:"IS_DEL=0 and DUTY_TYPE=1 and ( RELEASE=1 or (RELEASE=0 and OPER_NAME_ID='"+userId+"'))",
- 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 showPrimaryKey(obj,index){
- var fd_id = obj.FD_OBJECTID235;
- // $('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/am/duty/DutyInfo.jsp?'+fd_id);
- $.indexOpenNextWindow("/nwyj/page/business/am/duty/DutyInfo.jsp?"+fd_id);
- }
|