<%@ 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 type="text/javascript">
function userAdd(){
	iframeWindow("<s:url action='sysUserOperate'/>?oper=add",450,400,"添加系统用户",refreshWindow);
}
function userEdit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要修改的记录。");
		return;
	}
	iframeWindow("<s:url action='sysUserOperate'/>?oper=edit&user.id="+getCheckedValue("sid"),450,400,"修改系统用户",refreshWindow);
}

function rePwd(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一个您要重置密码的用户。");
		return;
	}
	msgConfirm("您确认要重置被选中用户的密码吗？",function(){
		iframeWindow("<s:url action='sysUserRepwd'/>?user.id="+getCheckedValue("sid"),450,200,"重置系统用户密码",refreshWindow);
	});
}

</script>
</head>

<body>
<div class="body_list">
<s:include value="../common/body.jsp" />
<s:form action="sysUserList" 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="5">查询条件</td>
    </tr>
    <tr class="form_item">
      <td width="23%">工号：<s:textfield name="user.emplInfo.emplNo" title="工号必须为数字。"  cssStyle="width:130px;"/></td>
      <td width="23%">姓名：<s:textfield name="user.emplInfo.name" cssStyle="width:130px;"/></td>
      <td width="22%">状态：<s:select cssStyle="width:130px;" name="user.status.id" list='#request.SysCodeFinder.find("SYS_USER_STATUS")' headerKey="" headerValue="" listKey="id" listValue="codeName"/></td>
      <td width="20%">角色：<s:select cssStyle="width:130px;" name="roleId" list='roleList' headerKey="" headerValue="" listKey="id" listValue="name"/></td>
      <td width="12%"><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="add" onclick="userAdd()" value="添 加"/>
		<input type="button" name="edit" onclick="userEdit()" value="修 改"/>
        <input type="button" name="edit" onclick="rePwd()" 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="9%">工号</td>
      <td width="13%">姓名</td>
      <td width="43%">角色</td>
      <td width="7%">状态</td>
      <td width="12%">最后登录IP</td>
      <td width="13%">最后登录时间</td>
    </tr>
    <s:iterator value="userList" 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"/></td>
          <td align="center"><s:property value="emplInfo.emplNo"/></td>
          <td align="center"><s:property value="emplInfo.name"/></td>
          <td align="center">
           <s:iterator value="sysRoleSet">
       		  <s:property value="name"/>&nbsp;&nbsp;
           </s:iterator>
          </td>
          <td align="center"><s:property value="status.codeName"/></td>
          <td align="center"><s:property value="lastLoginIp"/></td>
          <td align="center"><s:date name="lastLoginTime" format="yyyy-MM-dd HH:mm"/></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>