<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:include flush="true" page="error.jsp"/>
<%@ include file="header.jsp"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
      <jsp:include page="cssoa.jsp"></jsp:include>
    <title></title>
 

  </head>
  <body>
  <%@ include file="menuoperate.jsp"%>
  <form name="user" method="post" action="user_save">
  <input name="method" type="hidden" value="<s:property value='#parameters.method[0]'/>"/>
  <input name="myzd_id" type="hidden" value="<s:property value='#parameters.myzd_id[0]'/>"/>
  <input name="pageNo" type="hidden" value="<s:property value='#parameters.pageNo'/>"/>
  <input name="pageSize" type="hidden" value="<s:property value='#parameters.pageSize'/>"/>
  <table width="680" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
    <tr bgcolor="#c0c0c0" class="clickable_t">
      <td align="left" colspan="2">&nbsp;&nbsp;用户--编辑</td>
    </tr>
    <tr bgcolor="#ffffff">
      <td width="62" align="center">机器码</td>
      <td width="615">
       <input name="FIELD_CODE" type="text" <s:if test='#parameters.method[0]=="update"'>readonly style="background:#c0c0c0;"</s:if>  value="<s:property value="editdata['CODE']"/>"/>
      </td>
    </tr>
    <tr bgcolor="#ffffff">
    <td align="center">单位</td>
    <td>
     <select name="FIELD_EMDEPART" onchange="g_add();">
          <option value="">--请选择--</option>
          <s:iterator value="depart" var="dpt">
          <option value="<s:property value="#dpt.DPT_NO"/>" <s:if test="editdata['EMDEPART']==#dpt.DPT_NO">selected</s:if>>
              <s:property value="#dpt.DPT_NAME"/>
          </option>
          </s:iterator>
     </select>
    </td>
  </tr>
    <tr bgcolor="#ffffff">
    <td align="center">登陆码</td>
    <td>
      <input name="FIELD_EMID" type="text"   maxlength="20" style="width:100px;" value="<s:property value="editdata['EMID']"/>"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">姓名</td>
    <td>
     <input name="FIELD_EMNAME" type="text"   maxlength="50" style="width:100px;" value="<s:property value="editdata['EMNAME']"/>"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">性别</td>
    <td>
     <input type="radio" name="FIELD_EMSEX" value="M" <s:if test='editdata["EMSEX"]=="M"'>checked='checked'</s:if>/>男
     <input type="radio" name="FIELD_EMSEX" value="F" <s:if test='editdata["EMSEX"]=="F"'>checked='checked'</s:if>/>女
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">注册时间</td>
    <td>
     <input name="FIELD_REGDATE"  type="text" readonly="readonly" style="background:#c0c0c0;width:200px;" value="<s:date name="editdata['REGDATE']" format="yyyy-MM-dd HH:mm:ss"/>" maxlength="4"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">Email</td>
    <td>
     <input name="FIELD_EMAIL"  type="text" maxlength="100" style="width:200px;" value="<s:property value="editdata['EMAIL']"/>" maxlength="4"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">身份证号</td>
    <td>
     <input name="FIELD_ID_CODE"  type="text" maxlength="100" style="width:200px;" value="<s:property value="editdata['ID_CODE']"/>" maxlength="4"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">注册IP</td>
    <td>
     <input name="FIELD_REMOTE_IP"  type="text" maxlength="100" style="width:200px;" value="<s:property value="editdata['REMOTE_IP']"/>" maxlength="4"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">每页最多获取记录</td>
    <td>
     <input name="FIELD_PAGESIZE"  type="text" maxlength="100" style="width:200px;" value="<s:property value="editdata['PAGESIZE']"/>" maxlength="4"/>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">是否有效</td>
    <td>
     <select name="FIELD_STATE">
          <option value="0" <s:if test="editdata['STATE']==0">selected</s:if>>有效</option>
          <option value="1" <s:if test="editdata['STATE']==1">selected</s:if>>失效</option>
     </select>
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">类型</td>
    <td>
     <input type="radio" name="FIELD_TYPE" value="O" <s:if test='editdata["TYPE"]=="O"'>checked='checked'</s:if>/>员工
     <input type="radio" name="FIELD_TYPE" value="W" <s:if test='editdata["TYPE"]=="W"'>checked='checked'</s:if>/>客户
     <input type="radio" name="FIELD_TYPE" value="S" <s:if test='editdata["TYPE"]=="S"'>checked='checked'</s:if>/>停用
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">接口调用</td>
    <td>
     <input type="radio" name="FIELD_O_ENABLE" value="Y" <s:if test='editdata["O_ENABLE"]=="Y"'>checked='checked'</s:if>/>允许
     <input type="radio" name="FIELD_O_ENABLE" value="N" <s:if test='editdata["O_ENABLE"]=="N"'>checked='checked'</s:if>/>禁止
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">外网登陆</td>
    <td>
     <input type="radio" name="FIELD_W_ENABLE" value="Y" <s:if test='editdata["W_ENABLE"]=="Y"'>checked='checked'</s:if>/>允许
     <input type="radio" name="FIELD_W_ENABLE" value="N" <s:if test='editdata["W_ENABLE"]=="N"'>checked='checked'</s:if>/>禁止
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">密码</td>
    <td>
     <input type="checkbox" name="FIELD_EMPASS" value="Y"/>设初始密码(0000)
    </td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="left" colspan="2"><span style="margin-left:5px;">推送注册</span></td>
  </tr>
  <tr bgcolor="#ffffff">
    <td align="center">是否推送</td>
    <td>
     <input type="radio" name="FIELD_ISPUSH" value="0" <s:if test='editdata["O_ENABLE"]=="Y"'>checked='checked'</s:if>/>允许
     <input type="radio" name="FIELD_ISPUSH" value="1" <s:if test='editdata["O_ENABLE"]=="N"'>checked='checked'</s:if>/>禁止
    </td>
  </tr>
  </table>
  </form>
  </body>
  <script type="text/javascript">
  
    document.getElementById("g_list").style.display='none';
    document.getElementById("g_password").style.display='none';
    document.getElementById("g_add").style.display='none';
    document.getElementById("g_open").style.display='none';
    document.getElementById("g_copy").style.display='none';
    document.getElementById("g_delete").style.display='none';
    document.getElementById("g_preview").style.display='none';
    document.getElementById("g_taoda").style.display='none';
    document.getElementById("g_refresh").style.display='none';
    document.getElementById("g_save").style.display='';
    document.getElementById("g_return").style.display='none';
    document.getElementById("g_groupCmodule").style.display='none';
    document.getElementById("g_groupCuser").style.display='none';
    document.getElementById("g_userCuser").style.display='none';
    var ls_code;
    var ls_old,ls_new
    var page="<s:property value='pageNo'/>";
    var pageSize="<s:property value='pageSize'/>";
    
    function g_preview(){
      alert("预览!");
    }
    
    function g_add(){
       $.post(
          "userAjax_getNewCode",
          {FIELD_EMDEPART:document.all.item('FIELD_EMDEPART').value,method:"<s:property value='#parameters.method[0]'/>"},
          function(result){
              if(result.ajaxdata.NEWCODE!=null)document.all.item('FIELD_CODE').value=result.ajaxdata.NEWCODE;
              if(result.ajaxdata.NEWEMID!=null)document.all.item('FIELD_EMID').value=result.ajaxdata.NEWEMID;
          },"json");
    }
    
    function g_save(){
     if(gtrim('FIELD_EMDEPART')==true){
       document.all.item('user').submit();
       alert('已保存!');
     }else{
       alert('部门不能为空！');
     }
    }
    function g_return(){
     window.location="user_grid?pageNo="+page+"&pageSize="+pageSize;
    }
    function gtrim(ck){
      var temp=document.all.item(ck);
      if(temp.value.replace(/(^\s*)|(\s*$)/g,'').length==0){
        temp.value="";
        temp.focus();
        
        return false;
      }else{
        temp.value=temp.value.replace(/(^\s*)|(\s*$)/g,'');
        return true;
     }
}
  </script>
</html>
