editDept.jsp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  6. <title>编辑出库部门</title>
  7. <script type=text/javascript src="./liger/lib/jquery/jquery-1.5.2.min.js"></script>
  8. <script type="text/javascript" src="/shares/js/constant.js"></script>
  9. <script type="text/javascript" src="/shares/js/common.js"></script>
  10. <link href="main.css" rel="stylesheet" type="text/css" ></link>
  11. <link href="${pageContext.request.contextPath}/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  12. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  13. <script type="text/javascript">
  14. $(function (){
  15. $("input[type='text']:first").focus();
  16. });
  17. function checkForm(){
  18. var rs = $.validate({
  19. name : "dept_name",
  20. model : [ {
  21. type : "require",
  22. msg : "部门名称不能为空!"
  23. }, {
  24. type : "len",
  25. min : 1,
  26. max : 100,
  27. msg : "部门名称长度不能超过100个字!"
  28. } ]
  29. });
  30. rs = $.validate({
  31. name : "dept_num",
  32. model : [{
  33. type : "require",
  34. msg : "部门编号不能为空!"
  35. }]
  36. }) && rs;
  37. if (rs) {
  38. return true;
  39. }else{
  40. return false;
  41. }
  42. }
  43. function isCodeExists(){
  44. var code = $("#dept_num").val();
  45. var oldCode = "${requestScope.dept.dept_num}";
  46. $.ajax({
  47. type:"POST",
  48. url:"erpDeptAction.do?task=isCodeExixts",
  49. data : {"oldCode":oldCode,"code":code},
  50. timeout:10000,
  51. cache:false,
  52. dataType:"json",
  53. success:function(data){
  54. var success = data.success;
  55. if(success != undefined){
  56. if(success==0){
  57. $("#btnSave").attr({"disabled":"disabled"});
  58. $("#deptForm").submit();
  59. }else if(success==1){
  60. $.ligerDialog.warn("部门编号已存在!");
  61. }else{
  62. $.ligerDialog.error("判断部门编号是否存在失败!");
  63. }
  64. }else{
  65. showAjaxError(null, data.error);
  66. }
  67. },
  68. error:showAjaxError
  69. });
  70. }
  71. function refresh(obj){
  72. if(obj == "1"){
  73. refreshWindow();
  74. window.parent.loadTree();
  75. }
  76. }
  77. //表单提交
  78. function checkFormProType(){
  79. if(checkForm()){
  80. isCodeExists();
  81. }
  82. }
  83. </script>
  84. </head>
  85. <body onload="refresh(${msgEvent})">
  86. <%@ include file="/include/message.jsp"%>
  87. <form id="deptForm" action="erpDeptAction.do" method="post">
  88. <div id="title" class="form-button">
  89. <input id="btnSave" type="button" class="l-button" value="保存" onclick="checkFormProType();"/>
  90. </div>
  91. <div class="container-layout">
  92. <div class="forum-container">
  93. <center>
  94. <table class="l-table-edit line">
  95. <tr>
  96. <th colspan="2">
  97. <c:if test="${dept.universalid == '' or dept.universalid == null }">添加出库部门</c:if>
  98. <c:if test="${dept.universalid != null }">编辑出库部门</c:if>
  99. </th>
  100. </tr>
  101. <tr>
  102. <td class="l-table-edit-text">上级部门:</td>
  103. <td class="l-table-edit-td">
  104. ${parentDept.dept_name }
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="l-table-edit-text">上级编号:</td>
  109. <td class="l-table-edit-td">
  110. ${parentDept.dept_num }
  111. </td>
  112. </tr>
  113. <tr>
  114. <td class="l-table-edit-text">部门编号<FONT COLOR="red">*</FONT>:</td>
  115. <td class="l-table-edit-td">
  116. <input type="text" id="dept_num" name="dept_num" value="${requestScope.dept.dept_num}">
  117. </td>
  118. </tr>
  119. <tr>
  120. <td class="l-table-edit-text">部门名称<FONT COLOR="red">*</FONT>:</td>
  121. <td class="l-table-edit-td">
  122. <input type="text" id="dept_name" name="dept_name" value="${requestScope.dept.dept_name }" style="width:250px">
  123. </td>
  124. </tr>
  125. <tr>
  126. <td colspan="2" style="text-align: center;">
  127. &nbsp;
  128. </td>
  129. </tr>
  130. </table>
  131. <input type="hidden" id="universalid" name="universalid" value="${requestScope.dept.universalid }">
  132. <input type="hidden" id="dept_pid" name="dept_pid" value="${requestScope.dept.dept_pid }">
  133. <input type="hidden" id="unit_id" name="unit_id" value="${requestScope.dept.unit_id }">
  134. <%--<input type="hidden" id="ptype_level" name="ptype_level" value="${requestScope.erpDept.level }"> --%>
  135. <input type="hidden" id="task" name="task" value="update">
  136. </center>
  137. </div>
  138. </div>
  139. </form>
  140. </body>
  141. </html>