<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="cm" uri="/commons-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>请假单审批</title>
<link href="../resources/style/base.css" rel="stylesheet" type="text/css"/>
<s:include value="../common/head.jsp" />
<script language="javascript" src="../code/vm/ExtCodeJs.htm"></script>
<script language="javascript" src="../resources/js/calendar/calendar.js"></script>
<script type="text/javascript">
function applyApprove(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要审批的记录。");
		return;
	}
	//判断审批人
	iframeWindow("<s:url action='attLeaveApplyApprove'/>?apply.id="+getCheckedValue("sid"),550,550,"请假单审批",refreshWindow);
}

function applyDetail(id){
	iframeWindow("<s:url action='attLeaveApplyDetail'/>?apply.id="+id,550,300,"请假时间明细");
}

function flowDetail(nodeId){
	iframeWindow("<s:url action='attApproveFlowDetail'/>?node.id="+nodeId,550,300,"审批流程");
}
</script>
</head>

<body>
<div class="body_list">
  <s:include value="../common/body.jsp" />
  <s:form action="attLeaveApplyApproveList" id="queryForm"  onsubmit="return checkForm(this)">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="form_title">
        <td colspan="7">查询条件</td>
      </tr>
      <tr class="form_item">
        <td>工号：
          <s:textfield name="apply.applyEmplInfo.emplNo"  title="工号必须为数字。"  cssStyle="width:100px;"/></td>
        <td>部门：
          <s:textfield name="apply.applyEmplInfo.emplOrg.name" readonly="true" onClick="codeTree('emplOrgTree',gi('eimpOrgId'),this)" cssStyle="width:100px;" cssClass="find_input"/>
          <s:hidden name="apply.applyEmplInfo.emplOrg.id" id="eimpOrgId"/></td>
        <td>请假类型：
          <s:textfield name="apply.attLeaveType.name" readonly="true" cssClass="find_input" onClick="codeTable('attLeaveTypeTable',gn('apply.attLeaveType.id'),this)" cssStyle="width:100px;"/>
          <s:hidden name="apply.attLeaveType.id"/></td>
        <td colspan="2">请假时间：
          <s:textfield name="apply.beginTime" readonly="true" onClick="showDate(this)" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="apply.beginTime" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield>
          至
          <s:textfield name="apply.endTime" readonly="true" onClick="showDate(this)" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="apply.endTime" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield></td>
      </tr>
      <tr class="form_item1">
        <td width="21%">姓名：
          <s:textfield name="apply.applyEmplInfo.name" cssStyle="width:100px;"/></td>
        <td width="20%">状态：
          <s:select cssStyle="width:100px;" name="apply.status.id" list='#request.SysCodeFinder.find("ATT_LEAVE_APPLY_STATUS")' headerKey="" headerValue="" listKey="id" listValue="codeName"/></td>
        <td width="26%">请假事由：
          <s:textfield name="apply.cause" cssStyle="width:100px;"/></td>
        <td width="22%">　创建人：
          <s:textfield name="apply.createEmplInfo.name" cssStyle="width:100px;"/></td>
        <td width="11%" align="center" class="center"><input name="q" value="查 询" onclick="query()" type="button" /></td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  style="margin:15px 0 5px 0;" >
      <tr>
        <td>
        <input type="button" name="delete" onclick="applyApprove()" value="审 批"/>
        <input type="button" name="delete" onclick="sysOperLog()" value="查看日志"/>
        </td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="list_title">
        <td width="3%" align="center"><input type="radio" name="array" onclick="checkedAll(this)" value="checkbox" /></td>
        <td width="7%">工号</td>
        <td width="6%">姓名</td>
        <td width="10%">部门</td>
        <td width="7%">请假类型</td>
        <td width="22%">请假时间段 | 小时数</td>
        <td width="21%">请假事由</td>
        <td width="8%">申请时间</td>
        <td width="6%">创建人</td>
        <td width="10%">状态</td>
      </tr>
      <s:iterator value="applyList" status="st">
        <s:set name="row_cls" value=""/>
        <s:if test="#st.Even">
          <s:set name="row_cls" value="%{'row_a'}"/>
        </s:if>
        <tr class="list_data <s:property value='#row_cls'/>">
          <td align="center">
          	<input type="radio" name="array" value="<s:property value='id'/>" lang="sid"/>
            <s:hidden name="log_%{id}" value="%{#request.SysOperLogID.format('ATT_LEAVE_APPLY',id)}" />
          </td>
          <td class="center"><s:property value="applyEmplInfo.emplNo"/></td>
          <td class="center"><s:property value="applyEmplInfo.name"/></td>
          <td class="center"><s:property value="applyEmplInfo.emplOrg.name"/></td>
          <td class="center"><s:property value="attLeaveType.name"/></td>
          <td class="center"><a href="javascript:applyDetail('<s:property value='id'/>')" title="点击查看请假时间明细">
            <s:date name="beginTime" format="MM-dd HH:mm"/>
            至
            <s:date name="endTime" format="MM-dd HH:mm"/>
            &nbsp;
            <s:property value="totalTimes"/>
            小时</a></td>
          <td><s:property value="cause"/></td>
          <td class="center"><s:date name="createTime" format="MM-dd HH:mm"/></td>
          <td class="center"><s:property value="createEmplInfo.name"/></td>
          <td class="center" title="">
          	<s:property value="status.codeName"/>
		    <s:if test="attApproveLog!=null"> 
			 <br />
             <span style="color:#666; font-size:12px;" 
                	title="等待【<s:property value='attApproveLog.approver.name'/>】审批...">
					<a href="javascript:flowDetail('<s:property value='attApproveLog.attApproveFlowNode.id'/>');">（<s:property value='attApproveLog.approver.name'/>）</a>
			 </span>
			</s:if>
			</td>
        </tr>
      </s:iterator>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="list_page">
      <tr>
        <td><cm:pager/></td>
      </tr>
    </table>
  </s:form>
</div>
</body>
</html>