123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="renderer" content="webkit|ie-comp|ie-stand">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
- <meta http-equiv="Cache-Control" content="no-siteapp" />
- <#include "/base/add_base.ftl">
- <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css" />
- <style>
- .my-title{font-weight: 500;padding-left: 15px;position: relative;}
- .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
- .my-input{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
- .my-input-date{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);background: url(${path}/common/images/pts//rili-1.png) 98.5% center no-repeat; background-size:auto 80%;}
- .input-box{margin: 18px 0;}
- .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
- .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
- .add-list>li{margin: 10px 0;}
- .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
- .my-btn-reset{padding: 8px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
- .my-btn-submit{padding: 8px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
- .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
- input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
- input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
- </style>
- <title>修改员工- 员工管理 - RST</title>
- </head>
- <body>
- <nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
- <span class="c-gray en">/</span> 员工管理
- <span class="c-gray en">/</span> 修改员工
- <a class="btn radius r" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a>
- </nav>
- <article class="page-container">
- <form class="form form-horizontal" id="form-admin-addEmployee">
- <div style="padding: 10px;width: 600px;margin: 0 auto;">
- <div class="my-title">员工信息</div>
- <input type="hidden" name="employeeId" value="${employee.employeeId!}">
- <input type="hidden" id="oldNo" value="${employee.employeeNo!}" >
- <div class="input-box"><span class="input-dic">员工编号</span> <input class="my-input" name="employeeNo" id="employeeNo" type="text" value="${employee.employeeNo!}" placeholder="请输入员工编号" required maxlength="10" /> </div>
- <div class="input-box"><span class="input-dic">员工姓名</span> <input class="my-input" name="employeeName" id="employeeName" type="text" value="${employee.employeeName!}" placeholder="请输入2-10位中文" required maxlength="10" minlength="2" /> </div>
- <div class="input-box"><span class="input-dic">手机号码</span> <input class="my-input" name="employeeTel" id="employeeTel" type="text" value="${employee.employeeTel!}" placeholder="请输入11位的手机号码" /> </div>
- <div class="input-box"><span class="input-dic" style="margin-top: 0">员工状态</span>
- <input type="radio" id="employeeState1" name="employeeState" value="1" <#if employee.employeeState == 1>checked</#if>/><label for="employeeState1">在职</label>
- <input type="radio" id="employeeState2" name="employeeState" value="0" <#if employee.employeeState == 0>checked</#if>/><label for="employeeState2">离职</label>
- </div>
- <div class="input-box"><span class="input-dic" style="margin-top: 0">清空卡权限</span>
- <input type="radio" id="employeeClearPower1" name="employeeClearPower" value="0" <#if employee.employeeClearPower == 0>checked</#if>/><label for="employeeClearPower1">具有</label>
- <input type="radio" id="employeeClearPower2" name="employeeClearPower" value="1" <#if employee.employeeClearPower == 1>checked</#if>/><label for="employeeClearPower2">不具有</label>
- </div>
- <div class="input-box"><span class="input-dic">入职日期</span> <input class="my-input-date" type="text" name="employeeEntryDate" id="employeeEntryDate" value="${(employee.employeeEntryDate?string("yyyy-MM-dd"))!''}" placeholder="请选择入职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly"/> </div>
- <div class="input-box" id="isDeparture" style="<#if employee.employeeState == 1>display: none</#if>"><span class="input-dic">离职日期</span> <input class="my-input-date" type="text" name="employeeDepartureDate" id="employeeDepartureDate" value="${(employee.employeeDepartureDate?string("yyyy-MM-dd"))!''}" placeholder="请选择离职日期" onclick="WdatePicker({ dateFmt:'yyyy-MM-dd',skin:'whyGreen' })" readonly="readonly"/> </div>
- <div class="input-box"><span class="input-dic">员工岗位</span> <input class="my-input" type="text" name="employeePost" id="employeePost" value="${employee.employeePost!}" placeholder="请输入2-20位中文、英文字符描述" required maxlength="20" minlength="2" /> </div>
- <div class="input-box"><span class="input-dic"> 拉线</span> <input class="my-input" type="text" name="employeeLine" id="employeeLine" value="${employee.employeeLine!}" placeholder="请输入2-30位中文、英文、数字字符描述" required maxlength="30" minlength="2" /> </div>
- <div style="clear: both;"></div>
- <div class="input-box"><span class="input-dic">员工备注</span>
- <textarea rows="3" cols="20" class="my-textarea" name="employeeDesc" id="employeeDesc" maxlength="200">${employee.employeeDesc!}</textarea>
- </div>
- <div>
- <#--<button type="reset" class="my-btn-reset">重置</button>--><button type="submit" class="my-btn-submit">确认提交</button>
- </div>
- </div>
- </form>
- </article>
- <script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
- <script type="text/javascript">
- //动态显示隐藏所属菜单
- $(document).on('click', '.menuSubid input[type=radio]', function() {
- isSelectShow($(this).val())
- })
- var check_name = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/;
- var cnen_name = /^[a-zA-Z\u4e00-\u9fa5]+$/;
- var china_name = /^[\u4e00-\u9fa5]+$/;
- var en_name = /^[a-zA-Z0-9]+$/;
- $(function(){
- //var validator = $("#form-admin-addEmployee").validate();
- $("#form-admin-addEmployee").submit(function(){
- if(!ptsValiDataEmNo()){
- return false;
- };
- var employeeName = $("#employeeName").val();
- if(!(china_name.test(employeeName))){
- layer.msg('员工姓名格式不正确', {icon: 5, time: 1000});
- return false;
- }
- if(!ptsValiDataTel()){
- return false;
- };
- if($("#employeeEntryDate").val() == null || $("#employeeEntryDate").val() == ""){
- layer.msg('入职日期不能为空', {icon: 5, time: 1000});
- return false;
- };
- //离职日期
- var employeeState = $("[name='employeeState']:checked").val();
- if(employeeState == 0){
- if($("#employeeDepartureDate").val() == null || $("#employeeDepartureDate").val() == ""){
- layer.msg('离职日期不能为空', {icon: 5, time: 1000});
- return false;
- }
- var employeeEntryDate = $("[name='employeeEntryDate']").val();
- var employeeDepartureDate = $("[name='employeeDepartureDate']").val();
- if(!CompareDate(employeeDepartureDate,employeeEntryDate)){
- layer.msg('离职日期不能在入职日期之前', {icon: 5, time: 1000});
- return false;
- }
- }
- var employeePost = $("#employeePost").val();
- if(!(cnen_name.test(employeePost))){
- layer.msg('员工岗位格式不正确', {icon: 5, time: 1000});
- return false;
- }
- var employeeLine = $("#employeeLine").val();
- if(!(check_name.test(employeeLine))){
- layer.msg('拉线格式不正确', {icon: 5, time: 1000});
- return false;
- }
- // var employeeDesc = $("#employeeDesc").val();
- // if( employeeDesc != null && employeeDesc != "" && typeof(employeeDesc) != "undefined"){
- // alert("++"+employeeDesc+"+++");
- // if(!(check_name.test(employeeDesc))){
- // layer.msg('员工备注格式不正确', {icon: 5, time: 1000});
- // return false;
- // }
- // }
- ajaxReq();
- return false;
- })
- })
- /*比较时间*/
- function CompareDate(d1,d2)
- {
- return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
- }
- /*实时监听文本框-- 员工编号*/
- // document.getElementById("employeeNo").addEventListener("input", function(){
- // ptsValiDataEmNo();
- // });
- function ajaxReq(){
- var data = formatJSON();
- $.ajax({
- cache: true,
- type: "POST",
- data: data,
- url: "${path}/admin/employee/update_employee",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- window.location.href = '${path}/admin/employee/_employee_list'
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /*验证编号*/
- function ptsValiDataEmNo() {
- var thVal = $("#employeeNo").val();
- if( thVal == null || thVal == "" || typeof(thVal) == "undefined"){
- return false;
- }
- if($("#oldNo").val() == thVal){
- return true;
- }
- if(!(en_name.test(thVal))){
- layer.msg('员工编码格式不正确', {icon: 5, time: 1000});
- return false;
- }
- var flag = false;
- $.ajax({
- cache: true,
- type: "POST",
- data: {
- employeeNo:thVal
- },
- url: "${path}/admin/employee/is_employee",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- layer.msg('该员工编号已存在', {icon: 5, time: 1000});
- flag = false;
- }else{
- flag = true;
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- flag = false;
- }
- });
- return flag;
- }
- /*验证手机号码*/
- function ptsValiDataTel() {
- var thVal = $("#employeeTel").val();
- if(!(/^(\s*|1[34578]\d{9})$/.test(thVal))){
- layer.msg('手机号码格式化不正确', {icon: 5, time: 1000});
- return false;
- }else{
- return true;
- }
- }
- /*将表单format为JSON*/
- function formatJSON() {
- var serializeObj={};
- $($("#form-admin-addEmployee").serializeArray()).each(function(){
- if (this.value != "" && this.value != null) {
- serializeObj[this.name]=this.value;
- }
- });
- return serializeObj;
- }
- $(function(){
- //监听离职状态,离职的才有离职时间
- $("[name='employeeState']").change(function(){
- $("[name='employeeDepartureDate']").val("");
- var departureDate = $("[name='employeeState']:checked").val();
- if(departureDate == "0"){
- $("#isDeparture").show();
- }else{
- $("#isDeparture").hide();
- }
- })
- })
- </script>
- </body>
- </html>
|