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

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