AddAsset.jsp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:14k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312"%>
  2. <%@ page import="com.gforce.gfoa.*,com.gforce.currency.*,java.util.*" %>
  3. <jsp:include page="/CheckLogin.jsp" flush="true"/> <% Session m_session = new Session(session); %>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
  7. <title>资产管理-- GForce OA 2.0</title>
  8. <link href="/css/txt.jsp" rel="stylesheet" type="text/css">
  9. <script language="JavaScript" src="/js/changestyle.js"></script>
  10. <SCRIPT language="JavaScript" src="/Calendar/PopUpCalendarDlg.js"></SCRIPT>
  11. <script language="JavaScript" type="text/javascript">
  12. function CheckAddAsset()
  13. {
  14.     if(document.AddAsset.AssetName.value=="")
  15.     {
  16.         alert("请输入名称!");
  17.         document.AddAsset.AssetName.focus();
  18.         return false;
  19.     }
  20. <%
  21. Request t_request = new Request(request);
  22. int iUserID = m_session.GetInt("UserID");
  23. int iTypesID = t_request.GetInt("TypesID");
  24. int iSysDirID = t_request.GetInt("SysDirID");
  25. Vector vtFields = AssetFieldsManager.getByAssetTypeRecord(iTypesID);
  26. if(vtFields.size()>0)
  27. {
  28.    for (int i=0; i<vtFields.size(); i++)
  29.    {
  30.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("STR"))
  31.         {
  32. //字符串类型输入框,表单输入框名称为字段ID。
  33.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  34.            {
  35.            out.println("if(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  36.            out.println("{");
  37.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  38.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  39.            out.println("return false;");
  40.            out.println("}");
  41.            }
  42.         }else
  43.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("NUM"))
  44.         {
  45. //数值类型输入框,表单输入框名称为字段ID。
  46.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  47.            {
  48.            out.println("if(isNaN(parseInt(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value,10)))");
  49.            out.println("{");
  50.            out.println("alert("请输入正确的"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  51.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".select();");
  52.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  53.            out.println("return false;");
  54.            out.println("}");
  55.            }
  56.           else
  57.            {
  58.            out.println("if(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value.length>0)");
  59.            out.println("if(isNaN(parseInt(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value,10)))");
  60.            out.println("{");
  61.            out.println("alert("请输入正确的"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  62.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  63.            out.println("return false;");
  64.            out.println("}");
  65.            }
  66.         }else
  67.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("DATE"))
  68.         {
  69. //日期类型输入框,表单输入框名称为字段ID。
  70.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  71.            {
  72.            out.println("if(!isDate(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value))");
  73.            out.println("{");
  74.            out.println("alert("日期格式错误,请按照“2002-02-18”重新输入!");");
  75.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  76.            out.println("return false;");
  77.            out.println("}");
  78.            }
  79.           else
  80.            {
  81.            out.println("if(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value.length>0)");
  82.            out.println("if(!isDate(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value))");
  83.            out.println("{");
  84.            out.println("alert("日期格式错误,请按照“2002-02-18”重新输入!");");
  85.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  86.            out.println("return false;");
  87.            out.println("}");
  88.            }
  89.         }else
  90.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("TEXT"))
  91.         {
  92. //备注类型输入框,表单输入框名称为字段ID。
  93.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  94.            {
  95.            out.println("if(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  96.            out.println("{");
  97.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  98.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  99.            out.println("return false;");
  100.            out.println("}");
  101.            }
  102.         }else
  103.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("ACC"))
  104.         {
  105. //附件类型输入框,表单输入框名称为字段ID。
  106.          if ((((Vector)vtFields.get(i)).get(1).toString()).indexOf("(必填)")>=0)
  107.            {
  108.            out.println("if(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  109.            out.println("{");
  110.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  111.            out.println("document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  112.            out.println("return false;");
  113.            out.println("}");
  114.            }
  115.         }else
  116.         {
  117. //未知类型。
  118.         out.println("未知类型");
  119.         }
  120.    }
  121. }
  122. %>
  123. }
  124. </script>
  125. </head>
  126. <body bgcolor="<%=m_session.GetString("BackColor")%>" leftmargin="0" topmargin="0">
  127.    <table width="100%" height="100%" border="0" align="center" cellspacing="0">
  128.     <tr>
  129.     <td align="center" valign="top">
  130.       <table width="100%" border="0" cellpadding="0" cellspacing="0">
  131.         <tr>
  132.           <td height="50" valign="top" background="../images/dy-back.gif">
  133.             <table width="100%" border="0" cellpadding="0" cellspacing="0">
  134.               <tr valign="middle">
  135.                 <td width="61" align="center" height="20"><img src="../images/dy-01.gif" width="38" height="36"></td>
  136.                 <td width="118" nowrap="nowrap" valign="middle"><strong><font color="#000000">会议新增</font></strong></td>
  137.                 <td align="right" nowrap="nowrap" valign="bottom">&nbsp;
  138.                    <!-- 群增<img src="../images/MulAdd.gif" onMouseOver="this.src='../images/MulAdd_a.gif';" onMouseOut="this.src='../images/MulAdd.gif';" border="0" height="22" width="59">&nbsp;-->
  139.                  <!--<img src="../images/Single.gif" onMouseOver="this.src='../images/Single_a.gif';" onMouseOut="this.src='../images/Single.gif';" border="0" height="22" width="59">&nbsp;-->
  140.                   <!-- 修改<img src="../images/Update.gif" onMouseOver="this.src='../images/Update_a.gif';" onMouseOut="this.src='../images/Update.gif';" border="0" height="22" width="59">&nbsp;-->
  141.                   <!-- 删除<img src="../images/Del.gif" onMouseOver="this.src='../images/Del_a.gif';" onMouseOut="this.src='../images/Del.gif';" border="0" height="22" width="59">&nbsp;-->
  142.                   <!-- 查看<img src="../images/Query.gif" onMouseOver="this.src='../images/Query_a.gif';" onMouseOut="this.src='../images/Query.gif';" border="0" height="22" width="59">&nbsp;-->
  143.                   <!-- 组合查询<img src="../images/GroupQuery.gif" onMouseOver="this.src='../images/GroupQuery_a.gif';" onMouseOut="this.src='../images/GroupQuery.gif';" border="0" height="22" width="79">&nbsp;-->
  144.                 </td>
  145.               </tr>
  146.             </table>
  147.           </td>
  148.         </tr>
  149.       </table>
  150. <table width="100%" height="100%" border="0" align="center" cellspacing="0">
  151.     <tr>
  152.         <td align="center" valign="top"><p>&nbsp;</p>
  153.             <form name="AddAsset" action="/Asset/AddAssetAction.jsp?SysDirID=<%=iSysDirID%>&TypesID=<%=iTypesID%>" method="post" onSubmit="javascript:return CheckAddAsset();">
  154.             <table  border="0" cellpadding="0" cellspacing="0" width="90%">
  155.                 <tr>
  156.                     <td align="right" valign="middle"><font color="#0A0A0A">名称:</font></td>
  157.                     <td align="left" valign="middle" nowrap>
  158.                         <input name="AddUserID" type="hidden" value="<%=iUserID%>">
  159.             <%java.util.Date t_Date = new java.util.Date();%>
  160.             <input name="AddTime" type="hidden" value="<%=StringNew.GetDateString(t_Date,"yyyy-MM-dd HH:mm:ss")%>">
  161.                         <input name="AssetTypeID" type="hidden" value="<%=iTypesID%>">
  162.                         <input name="AssetName" type="text" maxlength="150" size="37">
  163.                     </td>
  164.                 </tr>
  165.                 <tr>
  166.                     <td align="right" valign="middle"><font color="#0A0A0A">编号:</font></td>
  167.                     <td align="left" valign="middle" nowrap>
  168.                         <input name="AssetNumber" type="text" maxlength="50" size="37">
  169.                     </td>
  170.                 </tr>
  171. <%
  172. vtFields = AssetFieldsManager.getByAssetTypeRecord(iTypesID);
  173. if(vtFields.size()>0)
  174. {
  175.    for (int i=0; i<vtFields.size(); i++)
  176.    {
  177.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("STR"))
  178.         {
  179. //字符串类型输入框,表单输入框名称为字段ID。
  180.            out.println("<tr>");
  181.            out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  182.            out.println("<td align="left" valign="middle" nowrap>");
  183.            out.println("<input name="Name"+((Vector)vtFields.get(i)).get(0).toString()+"" type="text" maxlength="150" size="37" Title=""+((Vector)vtFields.get(i)).get(1).toString()+"">");
  184.            out.println("</td></tr>");
  185.            out.println("</td></tr>");
  186.         }else
  187.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("NUM"))
  188.         {
  189. //数值类型输入框,表单输入框名称为字段ID。
  190.            out.println("<tr>");
  191.            out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  192.            out.println("<td align="left" valign="middle" nowrap>");
  193.            out.println("<input name="Name"+((Vector)vtFields.get(i)).get(0).toString()+"" type="text" maxlength="50" size="5" Title=""+((Vector)vtFields.get(i)).get(1).toString()+"">");
  194.            out.println("</td></tr>");
  195.            out.println("</td></tr>");
  196.         }else
  197.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("DATE"))
  198.         {
  199. //日期类型输入框,表单输入框名称为字段ID。
  200.            out.println("<tr>");
  201.            out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  202.            out.println("<td align="left" valign="middle" nowrap>");
  203.            out.println("<input name="Name"+((Vector)vtFields.get(i)).get(0).toString()+"" type="text" maxlength="10" size="10" Title=""+((Vector)vtFields.get(i)).get(1).toString()+"" onFocus="JavaScript:this.value=fPopUpCalendarDlg(this.value,-10,+10);" maxlength="12" size="12" onDblClick="JavaScript:this.value=fPopUpCalendarDlg(this.value,-10,+10);">");
  204.            out.println("</td></tr>");
  205.            out.println("</td></tr>");
  206.         }else
  207.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("TEXT"))
  208.         {
  209. //备注类型输入框,表单输入框名称为字段ID。
  210.            out.println("<tr>");
  211.            out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  212.            out.println("<td align="left" valign="middle" nowrap>");
  213.            out.println("<textarea name="Name"+((Vector)vtFields.get(i)).get(0).toString()+"" cols="30" rows="2" Title=""+((Vector)vtFields.get(i)).get(1).toString()+""></textarea>");
  214.            out.println("</td></tr>");
  215.            out.println("</td></tr>");
  216.         }else
  217.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("ACC"))
  218.         {
  219. //附件类型输入框,表单输入框名称为字段ID。
  220.            out.println("<tr>");
  221.            out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  222.            out.println("<td align="left" valign="middle" nowrap>");
  223.            out.println("<input name="Name"+((Vector)vtFields.get(i)).get(0).toString()+"" type="text" maxlength="150" size="37" Title=""+((Vector)vtFields.get(i)).get(1).toString()+""><input type="button" value="添加" onclick="return uploadacc(document.AddAsset.Name"+((Vector)vtFields.get(i)).get(0).toString()+");"");
  224.            out.println("</td></tr>");
  225.            out.println("</td></tr>");
  226.         }else
  227.         {
  228. //未知类型。
  229.         out.println("未知类型");
  230.         }
  231.    }
  232. }
  233. %>
  234.                 <tr>
  235.                     <td align="right" valign="middle">&nbsp;</td>
  236.                     <td align="left" valign="middle" nowrap>
  237.                     </td>
  238.                 </tr>
  239.                 <tr>
  240.                     <td align="right" valign="middle">&nbsp;</td>
  241.                     <td align="left" valign="middle" nowrap>
  242.                         <input type="submit" value="添加">  &nbsp;&nbsp;&nbsp;
  243.                         <input type="reset" value="重填">  &nbsp;&nbsp;&nbsp;
  244.                         <input type="button" value="返回" onclick="window.location='AssetManage.jsp?SysDirID=<%=iSysDirID%>&TypesID=<%=iTypesID%>';">
  245.                     </td>
  246.                 </tr>
  247.             </table>
  248.             </form>
  249.         </td>
  250.     </tr>
  251. </table>
  252. </body>
  253. </html>