update_employee.ftl 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <#include "/base/add_base.ftl">
  10. <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css" />
  11. <style>
  12. .my-title{font-weight: 500;padding-left: 15px;position: relative;}
  13. .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
  14. .my-input{padding: 5px 10px;width: 60%;}
  15. .my-input-date{padding: 5px 10px;width: 60%;background: url(${path}/common/images/pts//rili-1.png) 98.5% center no-repeat; background-size:auto 80%;}
  16. .input-box{margin: 18px 0;}
  17. .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
  18. .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
  19. .add-list>li{margin: 10px 0;}
  20. .my-textarea{padding: 5px 10px;width: 60%;}
  21. .my-btn-reset{padding: 6px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
  22. .my-btn-submit{padding: 6px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
  23. .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;width: 60%; height: 34px;margin: 0 10px; -webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/select-1.png) right center no-repeat #fff;background-size:auto 100%;}
  24. </style>
  25. <title>添加员工- 员工管理 - RST</title>
  26. </head>
  27. <body>
  28. <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
  29. <span class="c-gray en">&gt;</span> 员工管理
  30. <span class="c-gray en">&gt;</span> 修改员工
  31. <a class="btn radius r" style="line-height:1.6em;margin-top:3px;background: #58d2ea;color: #fff;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
  32. </nav>
  33. <article class="page-container">
  34. <form class="form form-horizontal" id="form-admin-addEmployee">
  35. <div style="padding: 10px;width: 600px;margin: 0 auto;">
  36. <div class="my-title">员工信息</div>
  37. <input type="hidden" name="employeeId" value="${employee.employeeId!}">
  38. <div class="input-box"><span class="input-dic">员工编号</span>&nbsp;&nbsp;<input class="my-input" name="employeeNo" type="text" value="${employee.employeeNo!}" placeholder="请输入员工编号" required maxlength="10" /> </div>
  39. <div class="input-box"><span class="input-dic">员工姓名</span>&nbsp;&nbsp;<input class="my-input" name="employeeName" type="text" value="${employee.employeeName!}" placeholder="请输入员工姓名" required maxlength="20" /> </div>
  40. <div class="input-box"><span class="input-dic">员工电话</span>&nbsp;&nbsp;<input class="my-input" name="employeeTel" type="text" value="${employee.employeeTel!}" placeholder="请输入员工手机号码" required maxlength="11" minlength="11" /> </div>
  41. <div class="input-box"><span class="input-dic">员工状态</span>&nbsp;&nbsp;
  42. <input type="radio" id="employeeState1" name="employeeState" value="1" <#if employee.employeeState == 1>checked</#if>/><label for="employeeState1">在职</label>
  43. <input type="radio" id="employeeState2" name="employeeState" value="0" <#if employee.employeeState == 0>checked</#if>/><label for="employeeState2">离职</label>
  44. </div>
  45. <div class="input-box"><span class="input-dic">清空卡权限</span>
  46. <input type="radio" id="employeeClearPower1" name="employeeClearPower" value="1" <#if employee.employeeClearPower == 1>checked</#if>/><label for="employeeClearPower1">具有</label>
  47. <input type="radio" id="employeeClearPower2" name="employeeClearPower" value="0" <#if employee.employeeClearPower == 0>checked</#if>/><label for="employeeClearPower2">不具有</label>
  48. </div>
  49. <div class="input-box"><span class="input-dic">入职日期</span>&nbsp;&nbsp;<input class="my-input-date" type="text" name="employeeEntryDate" value="${(employee.employeeEntryDate?string("yyyy-MM-dd"))!''}" placeholder="请选择入职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly"/> </div>
  50. <div class="input-box" id="isDeparture" style="<#if employee.employeeState == 1>display: none</#if>"><span class="input-dic">离职日期</span>&nbsp;&nbsp;<input class="my-input-date" type="text" name="employeeDepartureDate" value="${(employee.employeeDepartureDate?string("yyyy-MM-dd"))!''}" placeholder="请选择离职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly"/> </div>
  51. <div class="input-box"><span class="input-dic">员工岗位</span>&nbsp;&nbsp;<input class="my-input" type="text" name="employeePost" value="${employee.employeePost!}" placeholder="请输入员工岗位" required maxlength="100"/> </div>
  52. <div style="clear: both;"></div>
  53. <div class="input-box"><span class="input-dic">员工备注</span>&nbsp;&nbsp;
  54. <textarea rows="3" cols="20" class="my-textarea" name="employeeDesc">${employee.employeeDesc!}</textarea>
  55. </div>
  56. <div>
  57. <button type="reset" class="my-btn-reset">重置</button><button type="submit" class="my-btn-submit">确认提交</button>
  58. </div>
  59. </div>
  60. </form>
  61. </article>
  62. <script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
  63. <script type="text/javascript">
  64. //动态显示隐藏所属菜单
  65. $(document).on('click', '.menuSubid input[type=radio]', function() {
  66. isSelectShow($(this).val())
  67. })
  68. /* $(function(){
  69. $("#form-admin-addEmployee").validate({
  70. rules:{
  71. subName:{
  72. required:true,
  73. minlength:4,
  74. maxlength:30
  75. }
  76. },
  77. onkeyup:false,
  78. focusCleanup:true,
  79. success:"valid",
  80. submitHandler:function(form){
  81. $.post(root_path + "/admin/employee/update_employee", formatJSON(),function(result){
  82. if (result.returnCode != 200 || result.returnCode != 200) {
  83. layer.msg('录入失败,请重试!',{icon: 5,time:3000});
  84. } else {
  85. layer.msg('录入成功!!',{icon: 1,time:2000}, function () {
  86. // 关闭当前页面,并刷新父级页面
  87. window.location.href= '${path}/admin/employee/list_employee';
  88. });
  89. }
  90. });
  91. }
  92. });
  93. });*/
  94. $(function(){
  95. //var validator = $("#form-admin-addEmployee").validate();
  96. $("#form-admin-addEmployee").submit(function(){
  97. ajaxReq();
  98. return false;
  99. })
  100. })
  101. function ajaxReq(){
  102. var data = formatJSON();
  103. $.ajax({
  104. cache: true,
  105. type: "POST",
  106. data: data,
  107. url: "${path}/admin/employee/update_employee",
  108. async: false,
  109. success: function(data){
  110. if (data.returnCode == 200) {
  111. window.location.href = '${path}//admin/employee/_employee_list'
  112. }
  113. },
  114. error: function(XmlHttpRequest, textStatus, errorThrown){
  115. }
  116. });
  117. }
  118. /*将表单format为JSON*/
  119. function formatJSON() {
  120. var serializeObj={};
  121. $($("#form-admin-addEmployee").serializeArray()).each(function(){
  122. if (this.value != "" && this.value != null) {
  123. serializeObj[this.name]=this.value;
  124. }
  125. });
  126. return serializeObj;
  127. }
  128. $(function(){
  129. //监听离职状态,离职的才有离职时间
  130. $("[name='employeeState']").change(function(){
  131. $("[name='employeeDepartureDate']").val("");
  132. var departureDate = $("[name='employeeState']:checked").val();
  133. if(departureDate == "0"){
  134. $("#isDeparture").show();
  135. }else{
  136. $("#isDeparture").hide();
  137. }
  138. })
  139. })
  140. </script>
  141. </body>
  142. </html>