<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>周例会中周计划详情页面</title>
</head>
<style type="text/css">
	.weekmeeting-detail {
		padding: 20px;
	}
	.weekmeeting-detail .ui-jqgrid {
		background-color:#fff;
	}
</style>
<body>
	<ol class="breadcrumb" style="padding-left:15px;">
		  	<li>办公管理</li>
		  	<li>五十二周管理</li>
		  	<li>周例会</li>
	</ol>
	
	<div class="weekmeeting-detail col-xs-12">
		<table id="weekMeetingList" style="width:100%;"></table>
		<div id="weekMeetingListPage"></div>
	</div>
	<div class="modal fade" id="viewMeetingDialog">
		<div class="modal-dialog">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">
					<i aria-hidden="true" class="icon icon-times" style="font-size:18px"></i><span class="sr-only">关闭</span>
				</button>
				<h4 class="modal-title">查看计划</h4>
			</div>
			<div class="modal-content form-horizontal">
				<div class="row">
					<div class="col-xs-12 leftweek">
						<div class="form-group">
							<label class="col-xs-2">状态:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-state"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">标题:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-title"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">优先级:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-urgent"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">开始时间:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-starttime"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">工作内容:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-content"></label>
							</div>
						</div>
					</div>
					<div class="col-xs-6 nextweekwork-content" style="display: none;">
						<div class="form-group">
							<label class="col-xs-2">状态:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-nextstate"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">标题:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-nexttitle"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">优先级:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-nexturgent"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">开始时间:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-nextstarttime"></label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-xs-2">工作内容:</label>
							<div class="col-xs-10">
								<label class="radio-inline view-nextcontent"></label>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
	<input type="hidden" id="workStateId" th:value="${workStateId}"/>
	<script type="text/javascript">
	function viewMeetingWork(id){
		$.ajax({
			url:'/weekWorkPlan/do_view',
			type:'get',
			data:{
				'id':id
			},
			dataType:'json',
			success:function(data){
				if( data.success ){
					$("#viewMeetingDialog").modal('show');
					$("#viewMeetingDialog .view-state").text(data.data.workState.name);
					$("#viewMeetingDialog .view-title").text(data.data.title);
					$("#viewMeetingDialog .view-urgent").text(data.data.level);
					$("#viewMeetingDialog .view-starttime").text(data.data.startTime);
					$("#viewMeetingDialog .view-content").text(data.data.workContent);
					if( data.data.workState.code=='workState_continue_next_week' ){
						if( data.data.nextWeekWorkPlan ){
							$("#viewMeetingDialog .view-nextstate").text(data.data.nextWeekWorkPlan.workState.name);
							$("#viewMeetingDialog .view-nexttitle").text(data.data.nextWeekWorkPlan.title);
							if( data.data.nextWeekWorkPlan.level=='normal'||data.data.nextWeekWorkPlan.level=='普通' ){
								$("#viewMeetingDialog .view-nexturgent").text('普通');
							}else{
								$("#viewMeetingDialog .view-nexturgent").text('紧急');
							}
							$("#viewMeetingDialog .view-nextstarttime").text(data.data.nextWeekWorkPlan.startTime);
							$("#viewMeetingDialog .view-nextcontent").text(data.data.nextWeekWorkPlan.workContent);
						}else{
							$(".nextweekwork-content").empty().append('<div style="text-align:center;width:100%;font-size:16px;margin-top:20px;">关联计划已被删除</div>')
						}
						$(".modal-dialog").width("1100");
						$(".leftweek").removeClass('col-xs-12').addClass("col-xs-6")
						$(".leftweek").css("border-right","1px dashed #ccc")
						$(".nextweekwork-content").show();
					}
				}else{
					new $.zui.Messager('获取计划详情失败'+status, {
					    type: 'warning',
					    time:2000
					}).show();
				}
			},
			error:function(status){
				new $.zui.Messager('获取计划详情时发生错误'+status, {
				    type: 'error',
				    time:2000
				}).show();
			}
		}) 
	}
	
	$(function(){
		function enterpriseCNFmatter(cellvalue, options, rowObject){ 
		       return '<div class="yk_weekView noHover" onclick="viewMeetingWork('+rowObject.weekWorkPlanId+')"><i class="icon-search"></i></div>';
		}; 
		$(".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("")
		})
		sxUtil.jqGrid('#weekMeetingList',{
			colNames:['计划id','员工姓名','部门','计划标题','操作'],
			colModel:[
				{name: 'weekWorkPlanId', label: '计划ID', hidedlg:true, hidden:true,sortable:false,title:false},
				{name: 'userName', label: '员工姓名',sortable:false,align:'center',title:false},
	            {name: 'department', label: '部门',sortable:false,title:false},
	            {name: 'title', label: '计划标题',sortable:false,title:false},
	            {name: 'desc', label: '操作', formatter:enterpriseCNFmatter,sortable:false,align:'center',title:false}
			], 
			height:'auto',
			url : '/weekWorkPlan/do_findLastWeekPlanDetailList',
			pager : "#weekMeetingListPage",
			multiselect: false,
			postData : {
				'workStateId':$("#workStateId").val()
			},
			loadError:function(){
				new $.zui.Messager('列表加载失败', {
				    type: 'warning',
				    time:1500
				}).show();
			},
			onPaging:function(pgButton){
				console.log(pgButton)
			}
		},true);
		//给序号列添加列头
		jQuery("#weekMeetingList").jqGrid('setLabel','rn', '序号', {  
           	'color' : 'white'  
       	});
	})
	</script>
</body>
</html>