equipment_add.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:17k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="java.lang.*"%>
  3. <%@ page import="java.util.Collection"%>
  4. <%@ page import="java.util.Iterator"%>
  5. <%@ page import="java.util.Vector"%>
  6. <%@ page import="com.vnex.intranet.util.FieldUtil"%>
  7. <%@ page import="com.vnex.intranet.equipment.value.UserValueBean"%>
  8. <%@ taglib uri="/vnex.tld" prefix="vnex" %>
  9. <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
  10. <%@ taglib uri="/vnex_hr.tld" prefix="hr" %>
  11. <jsp:useBean id="equipmentProxy" class="com.vnex.intranet.equipment.proxy.EquipmentProxyBean" scope="session" /> 
  12. <jsp:useBean id="equipmentValue" class="com.vnex.intranet.equipment.value.EquipmentValueBean" scope="session" /> 
  13. <jsp:useBean id="equipmentValueAdd" class="com.vnex.intranet.equipment.value.EquipmentValueBean" scope="session" /> 
  14. <jsp:setProperty name="equipmentValue" property="*" />
  15. <%!
  16. Collection list = null;
  17. Collection list2 = null;
  18. Collection listUsePerson = null;
  19. Collection listBuyPerson = null;
  20. Iterator ite = null;
  21. UserValueBean user = null;
  22. int i = -1;
  23. %> 
  24. <%
  25. if (equipmentValue.getTerm() == -1)
  26. equipmentValue.setTerm(0);
  27. if (equipmentValue.getQuantity() == -1)
  28. equipmentValue.setQuantity(0);
  29. if (request.getParameter("categoryId") != null )
  30. equipmentValue.setCategoryId(new Integer(request.getParameter("categoryId")).intValue());
  31. if (request.getParameter("categoryName") != null)
  32. equipmentValue.setCategoryName(request.getParameter("categoryName"));
  33. if (request.getParameter("ctn") != null)
  34. {
  35. if (request.getParameter("ctn").equals("1"))
  36. equipmentValue = equipmentValueAdd;
  37. }
  38. String deptId = equipmentValue.getUseDeptId()+"";
  39. if (request.getParameter("useDeptId") == null)
  40. {
  41. equipmentValue.setUseDeptId(-2);
  42. }
  43. if (request.getParameter("buyDeptId") == null)
  44. {
  45. equipmentValue.setBuyDeptId(-2);
  46. }
  47. %> 
  48. <script Language="JavaScript" src="/vnex/util/Popup.js"></script>
  49. <script language="JavaScript" src="/vnex/util/validate.js"></script>
  50. <script language=JavaScript>
  51. function isNumberValid()
  52. {
  53. if (!(isFloat(myForm.price.value)))
  54. {
  55. alert("价格必须必须是数字!");
  56. myForm.price.focus();
  57. return false;
  58. }
  59. else
  60. {
  61. if (Number(myForm.price.value) > 99999999.99 || Number(myForm.price.value)< 0)
  62.     {
  63.      alert("价格必须在0和99999999.99之间")
  64.      myForm.price.focus();
  65.      return false;
  66.     }
  67. }
  68. if (!(isInteger(myForm.term.value)))
  69. {
  70. alert("使用期限必须是整数!");
  71. myForm.term.focus();
  72. return false;
  73. }
  74. else
  75. {
  76. if (Number(myForm.term.value) > 99999 || Number(myForm.term.value)< 0)
  77.     {
  78.      alert("使用期限必须在0和99999之间");
  79.      myForm.term.focus();
  80.      return false;
  81.     }
  82. }
  83. return true;
  84. }
  85. function isDataValid()
  86. {
  87. if (! isNumberValid())
  88. return false;
  89. if ( myForm.categoryId.value.length <= 0 || myForm.categoryName.value.length == 0)
  90. {
  91. alert("请选择分类!");
  92. myForm.categoryId.value = "";
  93. myForm.categoryName.value = "";
  94. return false;
  95. }
  96. if (myForm.equipmentName.value.length <= 0 || myForm.equipmentName.value.length > 25||!stripWhitespace(myForm.equipmentName.value))
  97. {
  98. alert("固定资产的名称是1-25个字符且不能为空!");
  99. myForm.equipmentName.focus();
  100. return false;
  101. }
  102. if (myForm.purpose.value.length > 50)
  103. {
  104. alert("固定资产的用途应少于50个字符!");
  105. myForm.purpose.focus();
  106. return false;
  107. }
  108. if (myForm.model.value.length > 50)
  109. {
  110. alert("固定资产的型号应少于50个字符!");
  111. myForm.model.focus();
  112. return false;
  113. }
  114. if (myForm.equipmentCode.value.length > 25 || myForm.equipmentCode.value.length < 1)
  115. {
  116. alert("固定资产的编号应该是1-25个字符!");
  117. myForm.equipmentCode.focus();
  118. return false;
  119. }
  120. if (myForm.configure.value.length > 125)
  121. {
  122. alert("固定资产的配置应少于125个字符!");
  123. myForm.configure.focus();
  124. return false;
  125. }
  126. if (myForm.supplier.value.length > 50)
  127. {
  128. alert("固定资产的提供者应少于50个字符!");
  129. myForm.supplier.focus();
  130. return false;
  131. }
  132. if (myForm.place.value.length > 50)
  133. {
  134. alert("固定资产的地点应少于50个字符!");
  135. myForm.place.focus();
  136. return false;
  137. }
  138. if (myForm.remark.value.length > 125)
  139. {
  140. alert("固定资产的说明应少于125个字符!");
  141. myForm.remark.focus();
  142. return false;
  143. }
  144. if (myForm.useDeptId.value == "-2")
  145. {
  146. alert ("请选择使用部门!");
  147. myForm.useDeptId.focus();
  148. return false;
  149. }
  150. if (myForm.usePersonId.value == "-1")
  151. {
  152. alert ("请选择使用人!");
  153. myForm.usePersonId.focus();
  154. return false;
  155. }
  156. if (myForm.buyDeptId.value == "-2")
  157. {
  158. alert ("请选择购买部门!");
  159. myForm.buyDeptId.focus();
  160. return false;
  161. }
  162. if (myForm.buyPersonId.value == "-1")
  163. {
  164. alert ("请选择购买人!");
  165. myForm.buyPersonId.focus();
  166. return false;
  167. }
  168. var price=0.0;
  169. price = myForm.price.value;
  170. if (price <= 0)
  171. {
  172. alert("价格必须大于0");
  173. myForm.price.focus();
  174. return false;
  175. }
  176. if (myForm.beginDay.value == "")
  177. {
  178. alert("请选择购买日期!");
  179. return false;
  180. }
  181. return true;
  182. }
  183. function change(select)
  184. {
  185. if (isNumberValid())
  186. {
  187. myForm.action="/mainctrl/equipmentAdd";
  188. myForm.submit();
  189. }
  190. }
  191. function toSuccess()
  192. {
  193. if (isDataValid())
  194. {
  195. myForm.action="/mainctrl/equipmentAddSuccess?ctn=0";
  196. myForm.submit();
  197. }
  198. }
  199. function toContinueAdd()
  200. {
  201. if (isDataValid())
  202. {
  203. myForm.action="/mainctrl/equipmentAddSuccess?ctn=1";
  204. myForm.submit();
  205. }
  206. }
  207. function toCategory()
  208. {
  209. if (isNumberValid())
  210. {
  211. <%
  212. session.removeAttribute("equipmentValue");
  213. %>
  214. myForm.action="/mainctrl/equipmentSave?pageName=equipmentAdd";
  215. myForm.submit();
  216. }
  217. }
  218. function includeInvalid(str)
  219. {
  220. if (str.indexOf("'") == -1)
  221. {
  222. return false;
  223. }
  224. else
  225. {
  226. alert("包括非法字符’" );
  227. return true;
  228. }
  229. }
  230. function toSearch()
  231. {
  232. if (!(includeInvalid(searchForm.keyword.value)))
  233. {
  234. searchForm.action="/mainctrl/equipmentSearchResult";
  235. searchForm.submit();
  236. }
  237. }
  238. </script>
  239. <HTML>
  240. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  241. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  242. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_office.js"></script>
  243. <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
  244. <DIV align=center>
  245. <form name="myForm" method="post" action="">
  246.     <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  247.     <TBODY>
  248.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  249.     <TR> 
  250.         <TD colSpan=3 align="center"><br>
  251.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  252.             <tr bgcolor="#FAFAFA"> 
  253.               <td> 
  254.                 <table width="600" border="0" cellspacing="0" cellpadding="2">
  255.                   <tr>
  256.                     <td colspan="3" height="15" bgcolor="#666666"><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;<a href="/mainctrl/office/main"><font color="#FFFFFF">办公室管理</font></a>&gt;&gt;<a href="/mainctrl/equipmentSearchResult"><font color="#FFFFFF">固定资产管理</font></a>&gt;&gt;固定资产增加</font>
  257.                     </td>
  258.                   </tr>
  259.                 </table>
  260.                 <table class=title width="600" border="0" cellspacing="1" cellpadding="2">
  261.                   <tr bgcolor="#fafafa">
  262.                     <td width="131"> 
  263.                       <font class="strong" >&nbsp;资产类别:</font>
  264.                     </td>
  265.                     <td width="463"> 
  266.                       <input type="hidden"  name="categoryId" size="8" class="file" value="<%= equipmentValue.getCategoryId()%>">                      
  267.                       <input type="text" name="categoryName" size="24" class="file" readonly value="<%= FieldUtil.filterQuotTag(equipmentValue.getCategoryName())%>">
  268.                       <input type="button" name="Submit3" value="选择" class="file" onClick= toCategory()>&nbsp;*&nbsp;(注:带*为必填内容)
  269.                     </td>
  270.                   </tr>
  271.                   <tr bgcolor="#e0e0e0"> 
  272.                     <td width="131"> 
  273.                       <font class="strong" >&nbsp;名称:</font>
  274.                     </td>
  275.                     <td width="463"> 
  276.                       <input type="text" name="equipmentName" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getEquipmentName())%>">&nbsp;*
  277.                     </td>
  278.                   </tr>
  279.                   <tr bgcolor="#fafafa"> 
  280.                     <td width="131"> 
  281.                       <font  class="strong">&nbsp;用途: </font>
  282.                     </td>
  283.                     <td width="463">
  284.                       <input type="text" name="purpose" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getPurpose())%>">
  285.                       </td>
  286.                   </tr>
  287.                   <tr bgcolor="#e0e0e0"> 
  288.                     <td width="131"> 
  289.                       <font  class="strong">&nbsp;型号:</font>
  290.                     </td>
  291.                     <td width="463">
  292.                       <input type="text" name="model" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getModel())%>">
  293.                       </td>
  294.                   </tr>
  295.                   <tr bgcolor="#fafafa"> 
  296.                     <td width="131"><font  class="strong">&nbsp;资产编号:</font></td>
  297.                     <td width="463">
  298.                       <input type="text" name="equipmentCode" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getEquipmentCode())%>">&nbsp;*
  299.                       </td>
  300.                   </tr>
  301.                   <tr bgcolor="#e0e0e0"> 
  302.                     <td width="131"><font  class="strong">&nbsp;配置:</font></td>
  303.                     <td width="463">
  304.                       <input type="text" name="configure" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getConfigure())%>">
  305.                       </td>
  306.                   </tr>
  307.                   <tr bgcolor="#fafafa"> 
  308.                     <td width="131"> 
  309.                       <font  class="strong">&nbsp;使用者:</font>
  310.                     </td>
  311.                     <td width="463"> 
  312.                     <select name="useDeptId" class=choice onChange=change(this)>
  313.                     <option value=-2>-请选择-</option>
  314.                     <org:DivisionList noRoot="false">
  315.                     <vnex:items select='<%=deptId%>' >
  316.                     <option value=<org:DivisionAttribute attribute="id"/> <org:DivisionAttribute attribute="isSelected"/> >
  317.                     <org:DivisionAttribute attribute="levelStr"/>+<org:DivisionAttribute attribute="name"/>
  318.                     </option>
  319.                     </vnex:items>
  320.                     </org:DivisionList>
  321.                     </select>&nbsp;*
  322.                     
  323.                     <select name="usePersonId">
  324.                     <option value=-1>-请选择-</option>
  325.                     <hr:EmployeeList divisionId='<%= equipmentValue.getUseDeptId()%>'>
  326.             <vnex:items  select ='<%= equipmentValue.getUsePersonId()+""%>'>
  327.             <option value="<hr:EmployeeAttribute attribute="id" />" <hr:EmployeeAttribute attribute="isSelected"/> >
  328.             <hr:EmployeeAttribute attribute='<%= null %>' />
  329.             </option>
  330.             </vnex:items>            
  331.             </hr:EmployeeList>
  332.             </select>&nbsp;*
  333.  
  334.                     </td>
  335.                   </tr>
  336.                   <tr bgcolor="#e0e0e0"> 
  337.                     <td width="131"> 
  338.                       <font  class="strong">&nbsp;购买价格:</font>
  339.                     </td>
  340.                     <td width="463">
  341.                       <input type="text" name="price" class="file" size="24" value="<%= equipmentValue.getPrice()%>">&nbsp;*
  342.                       元</td>
  343.                   </tr>
  344.                   <tr bgcolor="#fafafa"> 
  345.                     <td width="131"> 
  346.                       <font  class="strong">&nbsp;购买日期:</font>
  347.                     </td>
  348.                     <td width="463"> 
  349.                       <div align="left">
  350.                           <input type="text" name="beginDay" readonly size="24" class="text" value="<%= equipmentValue.getBeginDay()%>" >
  351.                           <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择日期" onClick="fPopUpCalendarDlg(beginDay);return false">&nbsp;*
  352.                       </div> 
  353.                     </td>
  354.                   </tr>
  355.                   <tr bgcolor="#e0e0e0"> 
  356.                     <td width="131"><font  class="strong">&nbsp;购买者:</font></td>
  357.                     <td width="463"> 
  358.                     <select name="buyDeptId" class=choice onChange=change(this)>
  359.                     <option value="-2">-请选择-</option>
  360.                     <org:DivisionList noRoot="false">
  361.                     <vnex:items select='<%= equipmentValue.getBuyDeptId()+"" %>' >
  362.                     <option value=<org:DivisionAttribute attribute="id"/> <org:DivisionAttribute attribute="isSelected"/> >
  363.                     <org:DivisionAttribute attribute="levelStr"/>+<org:DivisionAttribute attribute="name"/>
  364.                     </option>
  365.                     </vnex:items>
  366.                     </org:DivisionList>
  367.                     </select>&nbsp;*
  368.                     
  369.                     <select name="buyPersonId">
  370.             <option value=-1>-请选择-</option>
  371.                     <hr:EmployeeList divisionId='<%= equipmentValue.getBuyDeptId()%>'>
  372.             <vnex:items  select ='<%= equipmentValue.getBuyPersonId()+""%>'>
  373.             <option value="<hr:EmployeeAttribute attribute="id" />" <hr:EmployeeAttribute attribute="isSelected"/> >
  374.             <hr:EmployeeAttribute attribute='<%= null %>' />
  375.             </option>
  376.             </vnex:items>            
  377.            </hr:EmployeeList>
  378.            </select>&nbsp;*
  379.            
  380.                     </td>
  381.                   </tr>
  382.                   <tr bgcolor="#fafafa"> 
  383.                     <td width="131"><font  class="strong">&nbsp;供应者:</font></td>
  384.                     <td width="463">
  385.                       <input type="text" name="supplier" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getSupplier())%>">
  386.                       </td>
  387.                   </tr>
  388.                   
  389.                   <tr bgcolor="#e0e0e0"> 
  390.                     <td width="131"> 
  391.                       <font  class="strong">&nbsp;放置地点:</font>
  392.                     </td>
  393.                     <td width="463">
  394.                       <input type="text" name="place" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue.getPlace())%>">
  395.                       </td>
  396.                   </tr>
  397.                   <tr bgcolor="#fafafa"> 
  398.                     <td width="131"> 
  399.                       <font  class="strong">&nbsp;估计使用年限:</font>
  400.                     </td>
  401.                     <td width="463"><font size="2"><font face="宋体"> 
  402.                       </font><font size="2"><font  class="strong"><font  class="strong"> 
  403.                       <input type="text" name="term" class="file" size="24" value="<%= equipmentValue.getTerm()%>">
  404.                       </font></font><font face="宋体">月</font></font><font face="宋体"> 
  405.                       </font></font></td>
  406.                   </tr>
  407.                   <tr bgcolor="#e0e0e0"> 
  408.                     <td width="131"> 
  409.                       <font  class="strong">&nbsp;其他说明:</font>
  410.                     </td>
  411.                     <td width="463">
  412.                         <textarea name="remark" cols="59" rows="5"><%= FieldUtil.filterQuotTag(equipmentValue.getRemark())%></textarea>
  413.                     </td>
  414.                   </tr>
  415.                   <tr bgcolor="#fafafa" align="center"> 
  416.                     <td colspan="2" height="30"> 
  417.                         <input type="button" name="Button" value="保存" class="file" onclick=toSuccess() >                                                                        
  418.                         &nbsp;&nbsp;<input type="reset" name="reset" value="重置" class="file" >
  419.                         &nbsp;&nbsp;<input type="button" name="Button3" value="放弃" class="file" onClick="location='/mainctrl/equipmentSearchResult'">
  420.                     </td>
  421.                   </tr>
  422.                 </table>
  423.               </td>
  424.             </tr>
  425.           </table>
  426.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  427.        </TD>
  428.      </TR>
  429.      <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  430.     </TBODY> 
  431.   </TABLE>
  432.     <BR>
  433.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  434. </form>
  435. </DIV>
  436. </BODY>
  437. </HTML>