//父部门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 "" + value + "";
}
},
{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 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;i1){
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);
}