7e983c505537b2475c794c92cac53160384d22e8.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title>用户信息表</title>
  6. <!--框架必需start-->
  7. <%@include file="../../include.jsp" %>
  8. <!--框架必需end-->
  9. <script type="text/javascript" src="../../../scripts/qui/libs/js/tree/ztree/ztree.js"></script>
  10. <link href="../../../scripts/qui/libs/js/tree/ztree/ztree.css" rel="stylesheet" type="text/css" />
  11. <script type="text/javascript" src = "/nwyj/scripts/business/am/org/maintenance/orgSel.js"></script>
  12. <script type="text/javascript" src="/nwyj/scripts/freamwork/com/sinosoft/system/md5/md5.js"></script>
  13. <script type="text/javascript" src="/nwyj/scripts/business/em/report/objOperate.js"></script>
  14. </head>
  15. <body>
  16. <div style="height: 50px;background: #F8F8F8;" align="center">
  17. <a href="/nwyj/page/system/user/User_List.jsp">
  18. <img id="back" align="left" alt="返回" title="返回" src="/nwyj/images/temp/back.png" />
  19. </a>
  20. <font style="font-weight: bold;font-size: 20px;line-height: 45px;" class="titleShow" id="userEditTitle"></font>
  21. </div>
  22. <form id="UserInfoForm" >
  23. <table class="tableStyle" formMode="line"">
  24. <input id="ROLE_ID" name="ROLE_ID" type="hidden"/>
  25. <input id="ROLE_ID_NAME" name="ROLE_ID_NAME" type="hidden"/>
  26. <tr><td colspan="4" align="right"><input value="保存" id="save" type="button"/>&nbsp;&nbsp;<input id="cancel" value="重置" type="button"/></tr>
  27. <tr style="display: none;">
  28. <td><input type="hidden" id="objectID" name="objectID"
  29. required="true" /></td>
  30. </tr>
  31. <tr>
  32. <td width="15%"><span class="star">*</span>登录名:</td>
  33. <td width="35%"><input name="LOGIN_NAME" id="LOGIN_NAME" type="text" maxlength="60" class="validate[required]" /></td>
  34. <td width="15%"><span class="star">*</span>显示名称:</td>
  35. <td width="35%"><input name="REAL_NAME" id="REAL_NAME" type="text" maxlength="60" class="validate[required]" /></td>
  36. </tr>
  37. <tr>
  38. <td width="15%"><span class="spanMsg star">*</span>密码:</td>
  39. <td width="35%"><input name="PASSWORD" id="PASSWORD" type="password" maxlength="20"
  40. class="validate[functionCall[required,funcvalidate|* 请安要求设置密码]]" ></br><span >密码必须从字符、数字、符号中至少选择两种进行组合设置8-20位</span></td>
  41. <td width="15%"><span class="spanMsg star">*</span>确认密码:</td>
  42. <td width="35%"><input type="password" id = "PASSWORD2" maxlength="20"
  43. class="validate[confirm[PASSWORD]]" ></br><span id="pwdErr" style="display: none;"></span></td>
  44. </tr>
  45. <tr>
  46. <td width="15%"><span class="spanMsg star">*</span>所属单位:</td>
  47. <td width="35%">
  48. <div id="DEPT_ID" ></div>
  49. </td>
  50. <td width="15%">用户应急角色:</td>
  51. <!-- <td width="35%"><select name="ROLE_ID" id="ROLE_ID" prompt="请选择" ></select></td> -->
  52. <td width="35%"><div class="selectTree" id="ROLE_ID_SHOW" multiMode="true" noGroup="true" ></div>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td width="15%">性别:</td>
  57. <td width="35%">
  58. <input type="radio" id="female-1" name="GENDER" value="0" /><label for="female-1" class="hand">女</label>
  59. <input type="radio" id="male-1" name="GENDER" checked="checked" value="1" /><label for="male-1" class="hand">男</label>
  60. </td>
  61. <td width="15%">Email:</td>
  62. <td width="35%"><input name="EMAIL" type="text" maxlength="30"class="validate[custom[email]]" ></td>
  63. </tr>
  64. <tr>
  65. <td width="15%">座机电话号码:</td>
  66. <td width="35%"><input name="OFFICE_PHONE" type="text" maxlength="15"class=" validate[custom[onlyNumber]],length[0,15]" /></td>
  67. <td width="15%">手机:</td>
  68. <td width="35%"><input name="MOBILE" type="text" maxlength="11" /></td>
  69. </tr>
  70. <!-- <tr>
  71. <td width="15%">Email:</td>
  72. <td width="35%"><input name="EMAIL_880" type="text" maxlength="30" style="width:90%" class="validate[custom[email]]" ></td>
  73. </tr>
  74. <tr>
  75. <td width="15%">描述:</td>
  76. <td width="35%" colspan="3" >
  77. <textarea name="DESCRIPTION_880" style="width:98%"></textarea>
  78. </td>
  79. </tr> -->
  80. </table>
  81. </form>
  82. <%
  83. String objectId = request.getParameter("objectId") == null ? "" : request.getParameter("objectId");
  84. %>
  85. <script type="text/javascript">
  86. $('#back').bind('click',function(){
  87. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/system/user/User_List.jsp");
  88. });
  89. var flagAdd_Edit = "";
  90. var fd_id="";
  91. var resetValue = {};
  92. $(function(){
  93. $("#LOGIN_NAME").focus();
  94. $("#PASSWORD2").on("click",function(){
  95. $("#pwdErr").hide();
  96. });
  97. //$("#LOGIN_NAME").css("width","80px");
  98. // 绑定表单提交按钮和重置按钮
  99. $("#save").bind("click", function() {
  100. submitInfo();
  101. });
  102. $("#cancel").bind("click", function() {
  103. reset_input();
  104. });
  105. $("#goback").bind("click", function() {
  106. goBack();
  107. });
  108. //给下拉框赋值--常量表中的
  109. /* $("#ROLE_ID").initCanstSelect('BM_EMERGENCY_ROLE'); */
  110. $.post('/nwyj/ws/sys/UserRoleRelService/getRoleSelect1',function(data){
  111. $("#ROLE_ID_SHOW").attr("data",JSON.stringify(data));
  112. $("#ROLE_ID_SHOW").render();
  113. }, "json");
  114. //加载部门组件
  115. $("#DEPT_ID").OrgSel();
  116. var iframe = window.parent.document.getElementById("frmright");
  117. var iframeUrl = iframe.src;
  118. // 根据地址信息进行判断是新增 还是修改
  119. if ((iframeUrl).indexOf('?') > -1) {
  120. $(".spanMsg").hide();
  121. //修改
  122. flagAdd_Edit = "edit";
  123. $("#userEditTitle").html("修改用户信息");
  124. //设置登录名的样式
  125. $loginName = $("#LOGIN_NAME");
  126. $loginName.attr("readOnly",true);
  127. fd_id = (iframeUrl).split('?')[1];
  128. var params = {objectID : fd_id};
  129. $.ajax({
  130. url : $.pathname() + '/ws/sys/UserService/getDataById/',
  131. type : 'post',
  132. timeout : 15000,
  133. data : params,
  134. dataType : 'json',
  135. success : function(data){
  136. //alert(JSON.stringify(data))
  137. data = removeNull(data);
  138. $('#UserInfoForm').ajaxWrite({data:data});
  139. resetValue = data;
  140. $("#show_DEPT_ID").val(data.DEPT_NAME);
  141. $("#DEPT_ID").val(data.DEPT_ID);
  142. //$("#ROLE_ID_SHOW").attr("selectedValue",data.ROLE_ID);
  143. //$("#ROLE_ID_SHOW").render();
  144. },
  145. error : function(e){
  146. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  147. }
  148. });
  149. }else{
  150. //设置登录名的样式
  151. $loginName = $("#LOGIN_NAME");
  152. var ajaxClass = "validate[ajax["+$.pathname()+"/ws/sys/UserService/validateLoginName/|* 用户名已存在!]]";
  153. $loginName.addClass(ajaxClass);
  154. //新增
  155. flagAdd_Edit = "add";
  156. $("#userEditTitle").html("新增新用户");
  157. }
  158. /*var url = $.pathname() + '/ws/sys/constantService/getQuiConstantByName/';
  159. $TYPE_880 =$('select[name=TYPE_880]');
  160. $.post(url,{name:'BM$_UserType'},function(result){
  161. //赋给data属性
  162. $TYPE_880.data("data",result);
  163. $TYPE_880.render();
  164. },"json");
  165. $USE_STATE_880 =$('select[name=USE_STATE_880]');
  166. $.post(url,{name:'BM$_YesNo'},function(result){
  167. //赋给data属性
  168. $USE_STATE_880.data("data",result);
  169. $USE_STATE_880.render();
  170. },"json")
  171. $VEDIO_STATE_880 =$('select[name=VEDIO_STATE_880]');
  172. $.post(url,{name:'BM$_YesNo'},function(result){
  173. //赋给data属性
  174. $VEDIO_STATE_880.data("data",result);
  175. $VEDIO_STATE_880.render();
  176. },"json") ; */
  177. });
  178. //自定义密码验证规则
  179. function funcvalidate(){
  180. var patt= /(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%\^&*?]{8,20}$/g;
  181. var pwd = $("input[name=PASSWORD]").val();
  182. if(patt.test(pwd)){
  183. return false;
  184. }
  185. return true;
  186. }
  187. // 设定新增与修改的界面和方法 --点击保存按钮后触发事件
  188. function submitInfo() {
  189. var pwd1 = $("#PASSWORD").val();
  190. var pwd2 = $("#PASSWORD2").val();
  191. if(pwd1!=pwd2){
  192. $("#pwdErr").addClass("star").text("密码输入不一致,请重新输入").css("font-size","14px").show();
  193. return;
  194. }
  195. addValidate();
  196. };
  197. // 新增表单验证
  198. function addValidate() {
  199. var valid = $("#UserInfoForm").validationEngine({
  200. returnIsValid : true
  201. });
  202. if (valid == true) {
  203. addfn();
  204. } else {
  205. top.Dialog.alert('表单填写不正确,请按要求填写!');
  206. }
  207. }
  208. // 修改表单验证
  209. function editValidate() {
  210. if($("#PASSWORD").val()==""){
  211. //设置密码样式
  212. $loginName = $("#PASSWORD");
  213. $loginName.attr("class","");
  214. $loginName2 = $("#PASSWORD2");
  215. $loginName2.attr("class","");
  216. }
  217. var valid = $("#UserInfoForm").validationEngine({
  218. returnIsValid : true
  219. });
  220. if (valid == true) {
  221. editfn();
  222. } else {
  223. top.Dialog.alert('表单填写不正确,请按要求填写!');
  224. }
  225. }
  226. // 修改事件
  227. function editfn() {
  228. $form = $("#UserInfoForm");
  229. //多角色
  230. $("#ROLE_ID").val($("#ROLE_ID_SHOW").attr("relValue"));
  231. $("#ROLE_ID_NAME").val($("#ROLE_ID_SHOW").attr("relText"));
  232. //新增用户前台md5加密
  233. var md5passWord=md5($("#PASSWORD").val());
  234. $("#PASSWORD").val(md5passWord);
  235. var formValue = $form.serialize();
  236. var url = $.pathname() + "/ws/sys/UserService/update/";
  237. $.ajax({
  238. url : url,
  239. type : "post",
  240. timeout : 60000,
  241. data : formValue,
  242. dataType : "json",
  243. async : false,
  244. success : function(data) {
  245. if (data.success == "true") {
  246. top.Dialog.alert("修改成功");
  247. goBack();
  248. }
  249. if (data.success == "false") {
  250. top.Dialog.alert("修改失败");
  251. }
  252. },
  253. error : function() {
  254. top.Dialog.alert("修改失败,稍后再试...");
  255. }
  256. });
  257. };
  258. // 新增事件
  259. function addfn() {
  260. $form = $("#UserInfoForm");
  261. //多角色
  262. $("#ROLE_ID").val($("#ROLE_ID_SHOW").attr("relValue"));
  263. $("#ROLE_ID_NAME").val($("#ROLE_ID_SHOW").attr("relText"));
  264. //新增用户前台md5加密
  265. var md5passWord=md5($("#PASSWORD").val());
  266. $("#PASSWORD").val(md5passWord);
  267. var formValue = $form.serialize();
  268. var url = $.pathname() + "/ws/sys/UserService/create/";
  269. $.ajax({
  270. url : url,
  271. type : "post",
  272. timeout : 60000,
  273. data : formValue,
  274. dataType : "json",
  275. async : false,
  276. success : function(data) {
  277. if (data.success == "true") {
  278. top.Dialog.alert("新增成功");
  279. goBack();
  280. }
  281. if (data.success == "false") {
  282. top.Dialog.alert("新增失败");
  283. }
  284. },
  285. error : function() {
  286. top.Dialog.alert("新增失败,稍后再试...");
  287. }
  288. });
  289. };
  290. // 返回按钮 返回到外部机构列表
  291. function goBack() {
  292. var url = $.pathname() + '/page/system/user/User_List.jsp';
  293. window.parent.document.getElementById("frmright").setAttribute("src", url);
  294. }
  295. // 重置按钮
  296. function reset_input() {
  297. if (fd_id!="") {
  298. var url = $.pathname() + '/page/system/user/UserEdit.jsp?'+fd_id;
  299. window.parent.document.getElementById("frmright")
  300. .setAttribute("src", url);
  301. }else{
  302. var url = $.pathname() + '/page/system/user/UserEdit.jsp';
  303. window.parent.document.getElementById("frmright")
  304. .setAttribute("src", url);
  305. }
  306. /* $("#LIAISON_NAME_210").val(resetValue.LIAISON_NAME_210);
  307. $("#PHONE_210").val(resetValue.PHONE_210);
  308. $("#ORG_TYPE_210").resetValue();
  309. $("#ORG_ADDRESS_210").val(resetValue.ORG_ADDRESS_210);
  310. $("#CODE_210").val(resetValue.CODE_210);
  311. $("#LANDLINE_210").val(resetValue.LANDLINE_210);
  312. $("#FAX_210").val(resetValue.FAX_210);
  313. $("#EMAIL_210").val(resetValue.EMAIL_210);
  314. $("#SITE_210").val(resetValue.SITE_210);
  315. // 重置联动部门
  316. $("#LINK_DEPT_210").attr("relValue", Dname);
  317. $("#LINK_DEPT_210").attr("relText", DnameShow);
  318. $("#LINK_DEPT_210").find("input:text").val(DnameShow);
  319. // 重置联动联系人
  320. $("#LINK_MAN_210").attr("relValue", Lname);
  321. $("#LINK_MAN_210").attr("relText", LnameShow);
  322. $("#LINK_MAN_210").find("input:text").val(LnameShow); */
  323. }
  324. </script>
  325. </body>