var postOrgId;
var postUserId;
var workStateId;
//工作计划的整体查看（包括周例会／周例会详情页共同使用）
function weekWorkView(viewId) {
	$.ajax({
		url : "/weekWorkPlan/do_view",
		type : "get",
		data : {
			'id' : viewId
		},
		error : function(state) {
			new $.zui.Messager('请求发送失败', {
				type : 'danger',
				time : 1500
			}).show();
		},
		success : function(data) {
			var obj = data.data;
			if (data.success) {
				$("#myModal-viewweekwork .view-state").text(obj.workState.name);
				$("#myModal-viewweekwork .view-title").text(obj.title);
				$("#myModal-viewweekwork .view-urgent").text(obj.level);
				$("#myModal-viewweekwork .view-starttime").text(obj.workTime);
				$("#myModal-viewweekwork .view-content").text(obj.workContent);
				$("#myModal-viewweekwork .leftDialog").next().hide();
				if (obj.workState.code == "workState_continue_next_week") {
					$("#myModal-viewweekwork .leftDialog").removeClass("col-xs-12").addClass("col-xs-6");
					$("#myModal-viewweekwork").find(".modal-dialog").css('width','11rem')
				} else {
					$("#myModal-viewweekwork").find(".modal-dialog").css('width','7rem');
					$("#myModal-viewweekwork .leftDialog").css({"borderRight" : "0px dashed #ccc"}).removeClass("col-xs-6").addClass("col-xs-12")
				}

				if (obj.workState.code == "workState_continue_next_week") {
					if (obj.nextWeekWorkPlan) {
						$("#myModal-viewweekwork").find(".alreadyDelete").remove();
						$("#myModal-viewweekwork .view-nextstate").text(obj.nextWeekWorkPlan.workState.name);
						$("#myModal-viewweekwork .view-nexttitle").text(obj.nextWeekWorkPlan.title);
						var level;
						if (obj.nextWeekWorkPlan.level == "urgent") {
							level = "紧急"
						} else {
							level = "普通"
						}
						$("#myModal-viewweekwork .view-nexturgent").text(level);
						$("#myModal-viewweekwork .view-nextstarttime").text(obj.nextWeekWorkPlan.workTime);
						$("#myModal-viewweekwork .view-nextcontent").text(obj.nextWeekWorkPlan.workContent);
						$("#myModal-viewweekwork").find(".modal-dialog").css({"width" : "11rem"})
						$("#myModal-viewweekwork .leftDialog").removeClass("col-xs-12").addClass("col-xs-6").css({"borderRight" : "1px dashed #54c3fe"}).next().show()
					} else {
						$("#myModal-viewweekwork .leftDialog").removeClass("col-xs-12").addClass("col-xs-6").css({"borderRight" : "1px dashed #54c3fe"}).next().before('<div class="col-xs-6 alreadyDelete" style="text-align:center"><div class="plan-label">关联计划已被删除<div></div>');
					}
				}
				$("#myModal-viewweekwork").modal('show');
			}
		}
	});
}
$(function(){//'department.id':'','userId':1
	var topPartId;
	$.ajax({
		url:'/org/findOrgAndUserTreeNodeAndAdmin',
		type:'get',
		data:{},
		async:false,
		success:function(data){
			topPartId = data[0].id
		},
		error:function(status){
			new $.zui.Messager('获取最高部门id时出错'+status, {
			    type: 'danger',
			}).show();
		}
	});
	
	var fullyear='';
	function onload(ff){//初始数据
		var transferData = {};
		if( ff == 'firstenter' ){
			transferData['departmentList[0].id'] = topPartId;
		}else{
			// 部门 id 参数
			$(".lastWeekChooseDiv span[type='icon icon-folder-close']").each(function(i,ele){
				transferData['departmentList['+i+'].id'] = $(ele).attr('dataid');
			});
			// 人员 id 参数
			$(".lastWeekChooseDiv span[type='icon icon-user']").each(function(i,ele){
				transferData['userList['+i+'].id'] = $(ele).attr('dataid');
			});
		};
		$.ajax({//获取上周和本周的工作计划
			url:"/weekWorkPlan/do_findLastWeekWorkPlanList",
			cache:false,
			type:"POST",
			data:transferData,
			error:function(state){
				new $.zui.Messager('数据获取错误'+state, {
				    type: 'warning',
				    time:1500
				}).show();
			},
			success:function(data){
				if(data.success){
					fullyear=data.data.year;
					$(".header-fullyear").html(fullyear+"&nbsp;年");
					loadWeekWorkInfo(data.data);//填充当前周和下一周的工作任务
				}
			}
		});
		$.ajax({//获取图形数据
			url:"/weekWorkPlan/do_getLastWeekWorkPlanStatistics",
			cache:false,
			type:"POST",
			data:transferData,
			error:function(state){
				new $.zui.Messager("数据获取错误："+state, {
				    type: 'warning',
				    time:1500
				}).show();
			},
			success:function(data){
				if(data.success){
					initWeekWorkChart(data.data);//填充当前周和下一周的工作任务
				}
			}
		})
	}
	onload('firstenter');

	function loadWeekWorkInfo(data){
		// 添加头部
		$(".header-timeslot").text(data.startTime+'~'+data.endTime);
		$(".header-weeknum").html('第&nbsp;'+data.weekth+'&nbsp;周')
		// 添加上周本周工作计划
		var li='';
		for(var j=0;j<data.lastWeekWorkPlanList.length;j++){//上周
			var urgent="week_task_normal";
			if(data.lastWeekWorkPlanList[j].level=="urgent"){
				urgent="week_task_urgent"
			}
			li+='<li workid="'+data.lastWeekWorkPlanList[j].id+'" class="'+urgent+' '+data.lastWeekWorkPlanList[j].workState.code+'" style="top: 0px;"><p class="week-plan-title"><span>标题：</span><span class="content-span">'+data.lastWeekWorkPlanList[j].title+'</span></p><p class="week-plan-date"><span>时间：</span><span class="content-span">'+data.lastWeekWorkPlanList[j].workTime+'</span></p><p class="week-plan-content"><span>内容：</span><span class="content-span">'+data.lastWeekWorkPlanList[j].workContent+'</span></p><div class="week-plan-name">'+data.lastWeekWorkPlanList[j].user.name+'</div></li>'
		}
		// 判断上周工作计划是否为空
		if(data.lastWeekWorkPlanList.length){
			$(".work-plan-body .lastWeek-work-plan").find(".work-plan-title").html("上周工作计划");
			$(".work-plan-body .lastWeek-work-plan").find(".week-plan_taskul").empty().append(li);
		}else {
			$(".work-plan-body .lastWeek-work-plan").find(".work-plan-title").html("上周暂无工作计划").next().empty();
		}
		var li='';
		for(var i=0;i<data.thisWeekWorkPlanList.length;i++){//本周
			var urgent="week_task_normal";
			if(data.thisWeekWorkPlanList[i].level=="urgent"){
				urgent="week_task_urgent"
			}
			li+='<li workid="'+data.thisWeekWorkPlanList[i].id+'" class="'+urgent+' '+data.thisWeekWorkPlanList[i].workState.code+'" style="top: 0px;"><p class="week-plan-title"><span>标题：</span><span class="content-span">'+data.thisWeekWorkPlanList[i].title+'</span></p><p class="week-plan-date"><span>时间：</span><span class="content-span">'+data.thisWeekWorkPlanList[i].startTime+'</span></p><p class="week-plan-content"><span>内容：</span><span class="content-span">'+data.thisWeekWorkPlanList[i].workContent+'</span></p><div class="week-plan-name">'+data.thisWeekWorkPlanList[i].user.name+'</div></li>'
		}
		//判断本周工作计划是否为空
		if(data.thisWeekWorkPlanList.length){
			$(".work-plan-body .thisWeek-work-plan").find(".work-plan-title").html("本周工作计划")
			$(".work-plan-body .thisWeek-work-plan").find(".week-plan_taskul").empty().append(li);
		}else {
			$(".work-plan-body .thisWeek-work-plan").find(".work-plan-title").html("本周暂无工作计划").next().empty();
		}
	}
	//划入
	$('.work-plan-body .week-plan_taskul').on("mouseenter","li",function() {
		var str = $(this).attr("class");
		var pos = str.indexOf("workState_");
		if (!(str.indexOf("weekworkhover") + 1)) {
			var cla = "weekworkhover_"+ str.substring(pos);
			$(this).addClass(cla).find(".week-work-operation").css({"display" : "block"});
		}
	})
	//划出
	$('.work-plan-body .week-plan_taskul').on("mouseleave","li",function() {
		var str = $(this).attr("class");
		var pos = str.indexOf("weekworkhover");
		var cla = str.substring(pos);
		$(this).removeClass(cla).find(".week-work-operation").css({"display" : "none"});
	})
	//点击工作计划事件
	$(".work-plan-body").delegate(".week-plan_taskul li","click",function(){
		weekWorkView($(this).attr("workid"));
	})
	//圆环图的填充
	function initWeekWorkChart(obj){
		var circlechart = echarts.init($("[chart='homePage_OverviewcircleChart']").get(0));
		/* var piebymysef='<div class="week-overview"><ul class="week_key"><li><i class="workState_pause"></i>暂停</li><li><i class="workState_continue_next_week"></i>下周继续</li><li><i class="workState_finsh"></i>完成</li><li><i class="workState_overdue"></i>逾期</li><li><i class="workState_stop"></i>终止</li><li><i class="workState_working"></i>进行中</li></ul><div class="largediv"><div class="smalldiv"></div></div></div>'; */
		var loadcircleChart = function(obj){
			if(obj){
		    	var option={
				    color:["#83af6e","#a1a1a1","#fddf87","#d15a44","#000","#fff"],// 暂停#a1a1a1 完成#83af6e 终止#d15a44 下周继续#fddf87 进行中#3a87ad 逾期#000
				    tooltip : {// 提示信息
					    	showContent:false,// 是否显示
					    	textStyle:{// 提示文字样式
					    		align:"left",
					    		color:"#fff"
					    	},
					    	showDelay:10,// 显示延迟
					    	enterable:true,// 鼠标是否可提示信息框
					    	borderWidth:2,// 提示框边框
					    	borderColor:"#fff",
					        trigger: 'item',// 提示框触发方式.'item':数据项图形触发，主要在散点图，饼图等无类目轴的图表中使用.'axis':坐标轴触发，主要在柱状图，折线图等会使用类目轴的图表中使用
					        formatter: function(params,ticket,callback){	  
					        		return "计划状态:"+params.name+"<br/>所占比例:"+params.percent+"<br/>本周数量:"+params.value	
					        }
				    },
				    series : [
				        {
				            name: '工作状态',// 提示系列名称
				            type: 'pie',
				            radius : ['35%','70%'],// 内圈和外圈大小 环形图
				            avoidLabelOverlap: true,// ...
				            hoverOffset:5,
				            center: ['50%', '55%'],// 图(在容器中)的位置
				            data:(function(){
					            	if(obj.length!=0){			         
					            		return obj
					            	}else {
					            		return [{value:0,name:'完成',compare:"1",percent:"0%"},
					            				{value:0,name:'暂停',compare:"2",percent:"0%"},
					            				{value:0,name:'下周继续',compare:"3",percent:"0%"},
						    					{value:0,name:'终止',compare:"4",percent:"0%"},
						    					{value:0,name:'逾期',compare:"5",percent:"0%"},
						    					{value:1,name:'无计划',compare:"6",percent:"100%",
						    					itemStyle: 
						    						{normal: 
						    							{borderColor:'rgba(193,35,43,1)',
						    							backgroundColor:'white',
						    							label:{
						    								show:true,
						    								color:'rgba(193,35,43,1)',
						    								position:'center', 
															textStyle:{ 
																fontSize:16, 
																color:'black' 
															}, 
														}
													}
												},tooltip:{show:false}
											}
										]		
					            	}
				            })(),
				            label: {
				                normal: {
				                    show: true,
				                    position: 'outside',
				                    formatter: function(a) {
				                    		if( a.name=='无计划' ){
				                    			return a.name;
				                    		}else{
				                    			return a.name+'('+a.value+')'+' '+'{percent|'+a.percent+'%}';
				                    		}
				                    	},
				                    	rich: {
			                            percent: {
			                            		fontSize: 15,
			                            		//color:'#333',
			                            		lineHeight:25
			                            }
				                    	}
				                },
				                emphasis: {
				                    show: true,
				                    position: 'outside',
				                    formatter: function(a) {
				                    		if( a.name=='无计划' ){
				                    			return a.name;
				                    		}else{
				                    			return '{a|'+a.name+'}'+'({a|'+a.value+'})'+' '+'{percent|'+a.percent+'%}';
				                    		}
				                    	},
				                    	rich: {
				                    		percent: {
			                            		fontSize: 18,
			                            		//color:'#333',
			                            		lineHeight:25
			                            },
			                            a:{
			                            		fontSize: 15
			                            }
				                    	}
				                }
				            },
				            itemStyle: {
				                emphasis: {// 鼠标 hover 时的高亮样式
				                    shadowBlur: 10,
				                    shadowOffsetX: 0,
				                    shadowColor: 'rgba(0, 0, 0, 0.5)'
				                }
				            }
				        }
				    ]
			    };
		    	
			    circlechart.setOption(option);
			    var num=0;
			    var plandetail=['<div class="detail">完成：'+0+'</div>','<div class="detail">暂停：'+0+'</div>','<div class="detail">下周继续：'+0+'</div>','<div class="detail">终止：'+0+'</div>','<div class="detail">逾期：'+0+'</div>'];
			    for(var i=0;i<obj.length;i++){
				    	num+=obj[i].value;
				    	if(obj[i].name=="完成"){
				    		plandetail[0]='<div class="detail">完成：'+obj[i].value+'</div>'
				    	}
				    	if(obj[i].name=="暂停"){
				    		plandetail[1]='<div class="detail">暂停：'+obj[i].value+'</div>';
				    	}
				    	if(obj[i].name=="下周继续"){
				    		plandetail[2]='<div class="detail">下周继续：'+obj[i].value+'</div>';
				    	}
				    	if(obj[i].name=="终止"){
				    		plandetail[3]='<div class="detail">终止：'+obj[i].value+'</div>';
				    	}
				    	if(obj[i].name=="逾期"){
				    		plandetail[4]='<div class="detail">逾期：'+obj[i].value+'</div>';
				    	}
			    }
			    var plansum='<div class="plan-detail"><div class="detail">上周工作计划总量：'+num+'</div>';
			    $('.plan-statistics').find('.plan-detail').remove().end().append(plansum)
			    //$(".plan-statistics .plan-chart").find(".plan-detail").remove().end().append(plansum+plandetail[0]+plandetail[1]+plandetail[2]+plandetail[3]+plandetail[4]+'</div>');
			}else {
				alert("获取周任务列表失败");
				return;
			}
		}
		loadcircleChart(obj);
		circlechart.on('click', function (params) {//点圆环显示列表详情
		    if(params.data.stateId){
	    		//$(".week-overview").css({"display":"none"});
	    		/* $(".yk_rightcontent").load("/weekWorkPlan/weeklyMeetingPlanDetailList?workStateId="+params.data.stateId,function(){
	    			$("#userid").val(postUserId)
	    			$("#orgid").val(postOrgId)
	    		}) */
	    		workStateId = params.data.stateId;
	    		$("#meetingcircle").hide();
	    		$("#meetingdetai").show(function(){
	    			function enterpriseCNFmatter(cellvalue, options, rowObject){ 
	    			       return '<div class="operateIcon noHover"><p><span>查看</span><i class="operateIconfont operateIcon-chakan" onclick="weekWorkView('+rowObject.weekWorkPlanId+')"></i></p></div>';
	    			}; 
	    			/* 给部门列添加背景色 */
	    			function departmentFmatter(cellvalue, options, rowObject){
	    				var cellval=cellvalue.replace(/\s{1,}/g,",");
	    				var arr=cellval.split(',');
	    				var returndiv='';
	    				for(var i=0;i<arr.length-1;i++){
	    					if(arr[i].length){
	    						returndiv+='<span class="yk_DMbackground">'+arr[i]+' '+'</span>'
	    					}
	    				}
	    				returndiv = '<div style="white-space:normal;">'+returndiv+'</div>'
	    				return returndiv;
	    			};
	    			$(".weekmeeting-detail").on("mouseenter",'.yk_weekView',function(){
	    				$(this).find('i').removeClass("icon-search").text("查看")
	    			})
	    			$(".weekmeeting-detail").on("mouseleave",'.yk_weekView',function(){
	    				$(this).find('i').addClass("icon-search").text("")
	    			});
	    			//$('#weekMeetingList').clearGridData();
	    			sxUtil.jqGrid('#weekMeetingList',{
	    				colNames:['序号','计划id','员工姓名','部门','计划标题','操作'],
	    				colModel:[
	    					{name: 'orderNumber', label: ' 序号',  width:60,sortable:false},
	    					{name: 'weekWorkPlanId', label: '计划ID', hidedlg:true, hidden:true,sortable:false},
	    					{name: 'userName', label: '员工姓名',sortable:false,width:160,align:'center'},
	    		            {name: 'department', label: '部门',sortable:false,width:300,formatter:departmentFmatter},
	    		            {name: 'title', label: '计划标题',sortable:false,width:250},
	    		            {name: 'desc', label: '操作', formatter:enterpriseCNFmatter,width:120,sortable:false,align:'center'}
	    				], 
	    				height:'auto',
	    				url : '/weekWorkPlan/do_findLastWeekPlanDetailList',
	    				pager : "#weekMeetingListPage",
	    				multiselect: false,
	    				rownumbers:false,
	    				postData : {
	    					'workStateId':workStateId
	    				},
	    				loadError:function(){
	    					new $.zui.Messager('列表加载失败', {
	    					    type: 'warning',
	    					    time:1500
	    					}).show();
	    				},
	    				onPaging:function(pgButton){
	    					console.log(pgButton)
	    				}
	    			},true);
	    			//
	    			$('#weekMeetingList').setGridParam({
						url : '/weekWorkPlan/do_findLastWeekPlanDetailList',
						postData: { 'workStateId':workStateId },
						page : 1
					});
	    			$('#weekMeetingList').trigger('reloadGrid'); 
	    			
	    			//返回
	    			$(".yk_rightcontent").off('click').on("click",".icon-reply",function(){
	    				$("#meetingdetai").hide();
	    				$("#meetingcircle").show();
	    				echarts.init($("[chart='homePage_OverviewbarChart']").get(0)).resize();
	    				echarts.init($("[chart='homePage_OverviewcircleChart']").get(0)).resize();
	    				
	    				$('.weekmeeting-detail').empty().append('<table id="weekMeetingList" style="width:100%;"></table><div id="weekMeetingListPage"></div>')
	    			})
	    		});
	    		
		    }
		});
		$(window).resize(function(){
			circlechart.resize(); 
		})
	};
	
	// 获取上周业务进度统计
	function getLastWeekBusinessLoading(businessType){
		var lastWeekBusinessData = {
			'businessType':businessType	
		};
		// 部门 id 参数
		$(".lastWeekChooseDiv span[type='icon icon-folder-close']").each(function(i,ele){
			lastWeekBusinessData['orgIdList['+i+']'] = $(ele).attr('dataid');
		});
		// 人员 id 参数
		$(".lastWeekChooseDiv span[type='icon icon-user']").each(function(i,ele){
			lastWeekBusinessData['userIdList['+i+']'] = $(ele).attr('dataid');
		});
		$.ajax({
			url:'/weekWorkPlan/doWeeklyMeetingLastBusinessProcessingStatistics',
			type:'get',
			data:lastWeekBusinessData,
			success:function(data){
				if( data.success ){
					initBusinessProgressChart(data.data)
				}else{
					new $.zui.Messager('获取上周业务进度统计数据失败:'+data.msg, {
					    type: 'danger',
					}).show();
				}
			},
			error:function(status){
				new $.zui.Messager('获取上周业务进度统计数据时出错:'+status, {
				    type: 'danger',
				}).show();
			}
		})
	};
	getLastWeekBusinessLoading('');
	
	// 业务筛选变化时获取上周业务进度统计
	$('.lastWeekBusinessSelect').change(function(){
		getLastWeekBusinessLoading($(this).find('option:selected').attr('value'));
	});
	
	// 选择部门及人员
	$('.lastWeekChooseDiv').click(function(){
		chooseDepartOrPerson({
			dialogId:'.choosePersonDialog',//弹框的选择器
			chooseSure:'.chooseSure',//弹框确认按钮的选择器
			saveResultBox:'.lastWeekChooseDiv',//点确定后存放选择结果的容器的选择器
			ajaxurl:'/org/findOrgAndUserTreeNodeAndAdmin',//获取包括超管在内的部门和人员
			atLeastOne:true,//是否需要至少选择一个部门或成员, 默认为false
			chooseDepart:true,//是否选择部门
			choosePerson:true,//是否选择人员
			
			singleCheck:false,//是否单选(只能选一个)
			
			isCallback:false,//选择部门或人员后, 是否需要回调某个方法
			
			isSureCarry:false,//点击确定是否需要执行某方法,默认是不执行方法只把选择结果保存在设置的容器里,设置该参数为true时,saveResultBox参数将不生效
			
			useInWeek:true,
			chooseSureHide:'.chooseSureHide'
			
		})
	});
	
	// 选择部门及人员后  获取上周业务进度统计 / 获取上周工作进度统计
	$('.choosePersonDialog .chooseSureHide').bind('click',function(){
		getLastWeekBusinessLoading($('.lastWeekBusinessSelect option:selected').attr('value'));
		onload();
	});
	
	//柱状图的填充
	function initBusinessProgressChart(obj){
		var barChart = echarts.init($("[chart='homePage_OverviewbarChart']").get(0));
		var loadBarChart=function(obj){
			if(obj){
				var sum=0;
				var option={
				    color:["#199ed8","#00cc33","red","orange"],// 进行中#199ed8 已完成#00cc33 逾期中red 逾期完成orange
				    xAxis: {
				    		name:'(状态)',
				        data: ["进行中","已完成","逾期中","逾期完成"]
				    },
				    yAxis: {
				    		name:'(占比%)',
			            splitLine:{show: false},// 不显示网格线
			            minInterval:1
				    },
				    grid: {
		                top: '18%',
		                left: '3%',
		                right: '12%',
		                bottom: '0%',
		                containLabel: true
		            },
				    series: [{
				        name: '',
				        type: 'bar',
				        itemStyle: {
		                    normal: {
		                        color: function(params) {
		                            var colorList = ["#199ed8","#00cc33","red","orange"];
		                            return colorList[params.dataIndex]
		                        }
		                    }
		                },
				        data: (function(){
				        		sum = obj.all;
				        		var newObj = [
				        			{
				        				name:obj['processing'].statusName,
				        				code:'processing',
			        					value:obj['processing'].num,
			        					percent:obj['processing'].percent,
				        			},
				        			{
				        				name:obj['completed'].statusName,
				        				code:'completed',
			        					value:obj['completed'].num,
			        					percent:obj['completed'].percent,
				        			},
				        			{
				        				name:obj['overdue'].statusName,
				        				code:'overdue',
			        					value:obj['overdue'].num,
			        					percent:obj['overdue'].percent,
				        			},
				        			{
				        				name:obj['overdueCompleted'].statusName,
				        				code:'overdueCompleted',
			        					value:obj['overdueCompleted'].num,
			        					percent:obj['overdueCompleted'].percent,
				        			}
				        		];
				        		return newObj;
				        })(),
				        label: {
			                normal: {
			                    show: true,
			                    position: 'inside',
			                    formatter: function(a) {
			                    		return '{percent|'+a.data.percent+'} 数量:'+a.data.value;
			                    	},
			                    	rich: {
		                            percent: {
		                            		fontSize: 14,
		                            		color:'#fff'
		                            }
			                    	}
			                },
			                emphasis: {
			                    show: true,
			                    position: 'inside',
			                    formatter: function(a) {
			                    		return '{percent|'+a.data.percent+'}\n数量:'+a.data.value;
			                    	},
			                    	rich: {
			                    		percent: {
			                    			fontSize: 15,
		                            		color:'#fff',
		                            		lineHeight:30
		                            }
			                    	}
			                }
			            }
				    }]
			    };
				barChart.setOption(option);
				var plansum='<div class="plan-detail"><div class="detail">上周业务总量：'+sum+'</div>';
				$(".speed-statistics .plan-chart").find(".plan-detail").remove().end().append(plansum);
			}else{
				alert("获取上周业务统计数据失败");
				return;
			};
		}
		loadBarChart(obj);
		
		barChart.on('click', function (params) {//点柱状图显示列表详情
	    		$("#meetingcircle").hide();
	    		$("#meetingdetai").show(function(){
	    			var colNamesArray = [];
	    			var colModelArray = [];
	    			var colPostData = {
	    				'businessProcessingType':params.data.code,
	    				'businessType':$('.lastWeekBusinessSelect option:selected').attr('value')
	    			};
	    			// 部门 id 参数
	    			$(".lastWeekChooseDiv span[type='icon icon-folder-close']").each(function(i,ele){
	    				colPostData['orgIdList['+i+']'] = $(ele).attr('dataid');
	    			});
	    			// 人员 id 参数
	    			$(".lastWeekChooseDiv span[type='icon icon-user']").each(function(i,ele){
	    				colPostData['userIdList['+i+']'] = $(ele).attr('dataid');
	    			});
	    			if( params.data.code == 'processing' ){// 进行中
	    				colNamesArray = ['序号','员工姓名','部门','业务编号','处理阶段','流入时间','预计完成时间'];
	    				colModelArray = [
	    					{name: 'orderNumber', label: ' 序号',  width:60,sortable:false},
	    					{name: 'assigneeName', label: '员工姓名',sortable:false,width:160,},
	    		            {name: 'orgName', label: '部门',sortable:false,width:250,formatter:departmentFmatter},
	    		            {name: 'businessNo', label: '业务编号',sortable:false,width:160},
	    		            {name: 'processingStage', label: '处理阶段',sortable:false,width:160},
	    		            {name: 'startTime', label: '流入时间',sortable:false,width:160},
	    		            {name: 'planCompletedTime', label: '预计完成时间', width:160,sortable:false}
	    				];
	    			};
	    			if( params.data.code == 'completed' || params.data.code == 'overdueCompleted' ){// 已完成 / 逾期完成
	    				colNamesArray = ['序号','员工姓名','部门','业务编号','处理阶段','流入时间','预计完成时间','实际完成时间'];
	    				colModelArray = [
	    					{name: 'orderNumber', label: ' 序号',  width:60,sortable:false},
	    					{name: 'assigneeName', label: '员工姓名',sortable:false,width:160,},
	    		            {name: 'orgName', label: '部门',sortable:false,width:250,formatter:departmentFmatter},
	    		            {name: 'businessNo', label: '业务编号',sortable:false,width:160},
	    		            {name: 'processingStage', label: '处理阶段',sortable:false,width:160},
	    		            {name: 'startTime', label: '流入时间',sortable:false,width:160},
	    		            {name: 'planCompletedTime', label: '预计完成时间', width:160,sortable:false},
	    		            {name: 'actualCompletedTime', label: '实际完成时间', width:160,sortable:false}
	    				];
	    			};
	    			if( params.data.code == 'overdue' ){// 逾期中
	    				colNamesArray = ['序号','员工姓名','部门','业务编号','处理阶段','流入时间','预计完成时间','逾期时长'];
	    				colModelArray = [
	    					{name: 'orderNumber', label: ' 序号',  width:60,sortable:false},
	    					{name: 'assigneeName', label: '员工姓名',sortable:false,width:160},
	    		            {name: 'orgName', label: '部门',sortable:false,width:250,formatter:departmentFmatter},
	    		            {name: 'businessNo', label: '业务编号',sortable:false,width:160},
	    		            {name: 'processingStage', label: '处理阶段',sortable:false,width:160},
	    		            {name: 'startTime', label: '流入时间',sortable:false,width:160},
	    		            {name: 'planCompletedTime', label: '预计完成时间', width:160,sortable:false},
	    		            {name: 'overdue', label: '逾期时长', width:160,sortable:false}
	    				];
	    			};
	    			/* 给部门列添加背景色 */
	    			function departmentFmatter(cellvalue, options, rowObject){
	    				var arr=rowObject.orgName.split('、');
	    				var returndiv='';
	    				for(var i=0;i<arr.length;i++){
	    					if(arr[i].length){
	    						returndiv+='<span class="yk_DMbackground">'+arr[i]+' '+'</span>'
	    					}
	    				}
	    				returndiv = '<div style="white-space:normal;">'+returndiv+'</div>'
	    				return returndiv;
	    			};
	    			
	    			sxUtil.jqGrid('#weekMeetingList',{
	    				mtype:'get',
	    				colNames:colNamesArray,
	    				colModel:colModelArray, 
	    				height:'auto',
	    				url : '/weekWorkPlan/doWeeklyMeetingBusinessProcessingList',
	    				pager : "#weekMeetingListPage",
	    				multiselect: false,
	    				rownumbers:false,
	    				postData : colPostData,
	    				loadError:function(){
	    					new $.zui.Messager('列表加载失败', {
	    					    type: 'warning',
	    					    time:1500
	    					}).show();
	    				},
	    				onPaging:function(pgButton){
	    					console.log(pgButton)
	    				}
	    			},true);
	    			//
	    			$('#weekMeetingList').setGridParam({
	    					mtype:'get',
						url : '/weekWorkPlan/doWeeklyMeetingBusinessProcessingList',
						postData: colPostData,
						page : 1
					});
	    			$('#weekMeetingList').trigger('reloadGrid'); 
	    			
	    			//返回
	    			$(".yk_rightcontent").off('click').on("click",".icon-reply",function(){
	    				$("#meetingdetai").hide();
	    				$("#meetingcircle").show();
	    				echarts.init($("[chart='homePage_OverviewbarChart']").get(0)).resize();
	    				echarts.init($("[chart='homePage_OverviewcircleChart']").get(0)).resize();
	    				
	    				$('.weekmeeting-detail').empty().append('<table id="weekMeetingList" style="width:100%;"></table><div id="weekMeetingListPage"></div>')
	    			})
	    		});
		});
		
		
		$(window).resize(function(){
			barChart.resize();
		})
	}
})