post-add.jsp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>岗位表</title>
  7. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  8. <style type="text/css">
  9. .combo_self{height: 22px !important;width: 150px !important;}
  10. .layout-header .btn {
  11. margin:0;
  12. float: none !important;
  13. }
  14. .btn-default {
  15. height: 35px;
  16. line-height: 35px;
  17. font-size:14px;
  18. }
  19. .clearTd input{
  20. border-radius: 3px;
  21. display: inline-block;
  22. letter-spacing: 3px;
  23. line-height: 1;
  24. margin-left: 6px;
  25. overflow: visible;
  26. padding: 3px 10px 3px 12px;
  27. text-align: center;
  28. /* text-shadow: 0 1px 1px rgba(255, 255, 255, 1); */
  29. transition: box-shadow 0.2s linear 0s;
  30. cursor: pointer;
  31. }
  32. .clearBtn{
  33. background: #5187c9 none repeat scroll 0 0;
  34. border: 1px solid #437ABD;
  35. color: #fff;
  36. text-shadow: 0 -1px 1px #1c6a9e;
  37. height: 30px;
  38. }
  39. </style>
  40. <script type="text/javascript">
  41. $(function(){
  42. $(".combo").removeClass("combo").addClass("combo combo_self");
  43. $(".combo").each(function(){
  44. $(this).parent().css("line-height","0px");
  45. });
  46. });
  47. /**树形列表数据转换**/
  48. function convertTreeData(rows, textField) {
  49. for(var i = 0; i < rows.length; i++) {
  50. var row = rows[i];
  51. row.text = row[textField];
  52. if(row.children) {
  53. row.state = "open";
  54. convertTreeData(row.children, textField);
  55. }
  56. }
  57. }
  58. /**树形列表加入子元素**/
  59. function joinTreeChildren(arr1, arr2) {
  60. for(var i = 0; i < arr1.length; i++) {
  61. var row1 = arr1[i];
  62. for(var j = 0; j < arr2.length; j++) {
  63. if(row1.id == arr2[j].id) {
  64. var children = arr2[j].children;
  65. if(children) {
  66. row1.children = children;
  67. }
  68. }
  69. }
  70. }
  71. }
  72. </script>
  73. <script type="text/javascript">
  74. //编写自定义JS代码
  75. </script>
  76. </head>
  77. <body>
  78. <t:formvalid formid="formobj" dialog="true" usePlugin="password" beforeSubmit="checkPostName" layout="table" action="postController.do?doAdd" >
  79. <input id="id" name="id" type="hidden" value="${postPage.id }"/>
  80. <table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
  81. <!-- <tr>
  82. <td align="right">
  83. <label class="Validform_label">
  84. 岗位编码:
  85. </label>
  86. </td>
  87. <td class="value">
  88. <input id="postCode" name="postCode" type="text" style="width: 150px" class="inputxt" datatype="s6-18" ignore="checked" />
  89. <span class="Validform_checktip"></span>
  90. <label class="Validform_label" style="display: none;">岗位编码</label>
  91. </td>
  92. </tr> -->
  93. <tr>
  94. <td align="right">
  95. <label class="Validform_label">
  96. 岗位名称:
  97. </label>
  98. </td>
  99. <td class="value">
  100. <input id="postName" name="postName" type="text" style="width: 150px" class="inputxt" onchange="checkPostName()" datatype="s1-18" ignore="checked" />
  101. <span class="Validform_checktip" id="vpostname"></span>
  102. <label class="Validform_label" style="display: none;">岗位名称</label>
  103. </td>
  104. </tr>
  105. <tr>
  106. <td align="right">
  107. <label class="Validform_label">
  108. 上级岗位:
  109. </label>
  110. </td>
  111. <td class="value">
  112. <input id="parentPostid" name="parentPostid" type="text" style="width: 150px" class="inputxt easyui-combotree" ignore="ignore"
  113. data-options="panelHeight:'220',
  114. url: 'postController.do?datagrid&field=id,postName',
  115. loadFilter: function(data) {
  116. var rows = data.rows || data;
  117. var win = frameElement.api.opener;
  118. var listRows = win.getDataGrid().treegrid('getData');
  119. joinTreeChildren(rows, listRows);
  120. convertTreeData(rows, 'postName');
  121. return rows;
  122. },
  123. onSelect:function(node){
  124. $('#parentPostid').val(node.id);
  125. },
  126. onLoadSuccess: function() {
  127. var win = frameElement.api.opener;
  128. var currRow = win.getDataGrid().treegrid('getSelected');
  129. if(!'${postPage.id}') {
  130. //增加时,选择当前父菜单
  131. if(currRow) {
  132. $('#parentPostid').combotree('setValue', currRow.id);
  133. }
  134. }else {
  135. //编辑时,选择当前父菜单
  136. if(currRow) {
  137. $('#parentPostid').combotree('setValue', currRow.parentPostid);
  138. }
  139. }
  140. }"/>
  141. <span class="Validform_checktip"></span>
  142. <label class="Validform_label" style="display: none;">上级岗位</label>
  143. <span class="clearTd">
  144. <a href="#" class="easyui-linkbutton" plain="true" icon="icon-clean" onclick="clearParentPostid()">清空</a>
  145. </span>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td align="right">
  150. <label class="Validform_label">
  151. 岗位津贴:
  152. </label>
  153. </td>
  154. <td class="value">
  155. <input id="money" name="money" type="text" style="width: 150px" class="inputxt" datatype="n" ignore="ignore" />
  156. <span class="Validform_checktip"></span>
  157. <label class="Validform_label" style="display: none;">岗位津贴</label>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td align="right">
  162. <label class="Validform_label">
  163. 岗位描述:
  164. </label>
  165. </td>
  166. <td class="value" >
  167. <textarea style="width:300px; height:100px;" class="inputxt" rows="6" id="postDesc" name="postDesc" maxlength="100" ignore="ignore" ></textarea>
  168. <span class="Validform_checktip"></span>
  169. <label class="Validform_label" style="display: none;">岗位描述</label>
  170. </td>
  171. </tr>
  172. </table>
  173. </t:formvalid>
  174. </body>
  175. <script src = "webpage/cn/com/lzt/post/post.js"></script>
  176. <script type="text/javascript">
  177. function clearParentPostid(){
  178. $(".combo-text").val("");
  179. $(".combo-value").val("");
  180. }
  181. function checkPostName(){
  182. var result =false;
  183. $.ajax({
  184. type : "post",
  185. url : "postController.do?checkPostName",
  186. data : {id:$("#id").val(),postName:$("#postName").val(),parentPostid:$(".combo-value").val()},
  187. dataType : "json",
  188. async : false,
  189. cache : false,
  190. success : function(json) {
  191. if(!json.flag){
  192. $("#vpostname").html("岗位名称重复");
  193. $("#vpostname").addClass("Validform_wrong");
  194. result = false;
  195. }else{
  196. result = true;
  197. }
  198. }
  199. });
  200. return result;
  201. }
  202. </script>