|
@@ -11,16 +11,18 @@
|
|
<style>
|
|
<style>
|
|
.my-title{font-weight: 500;padding-left: 15px;position: relative;}
|
|
.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-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
|
|
- .my-input{padding: 5px 10px;width: 60%;}
|
|
|
|
- .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%;}
|
|
|
|
|
|
+ .my-input{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
|
|
|
|
+ .my-input-date{padding: 5px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(${path}/common/images/pts//rili-1.png) 98.5% center no-repeat; background-size:auto 80%;}
|
|
.input-box{margin: 18px 0;}
|
|
.input-box{margin: 18px 0;}
|
|
.input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
|
|
.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{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
|
|
.add-list>li{margin: 10px 0;}
|
|
.add-list>li{margin: 10px 0;}
|
|
- .my-textarea{padding: 5px 10px;width: 60%;}
|
|
|
|
|
|
+ .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
|
|
.my-btn-reset{padding: 6px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
|
|
.my-btn-reset{padding: 6px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
|
|
.my-btn-submit{padding: 6px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
|
|
.my-btn-submit{padding: 6px 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;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%;}
|
|
.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%;}
|
|
|
|
+ input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/rst/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(/rst/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
|
|
</style>
|
|
</style>
|
|
<title>添加员工- 员工管理 - RST</title>
|
|
<title>添加员工- 员工管理 - RST</title>
|
|
</head>
|
|
</head>
|
|
@@ -28,34 +30,34 @@
|
|
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
|
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
|
<span class="c-gray en">></span> 员工管理
|
|
<span class="c-gray en">></span> 员工管理
|
|
<span class="c-gray en">></span> 添加员工
|
|
<span class="c-gray en">></span> 添加员工
|
|
- <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"></i></a>
|
|
|
|
|
|
+ <a class="btn radius r" style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a>
|
|
</nav>
|
|
</nav>
|
|
<article class="page-container">
|
|
<article class="page-container">
|
|
<form class="form form-horizontal" id="form-admin-addEmployee">
|
|
<form class="form form-horizontal" id="form-admin-addEmployee">
|
|
<div style="padding: 10px;width: 600px;margin: 0 auto;">
|
|
<div style="padding: 10px;width: 600px;margin: 0 auto;">
|
|
<div class="my-title">员工信息</div>
|
|
<div class="my-title">员工信息</div>
|
|
- <div class="input-box"><span class="input-dic">员工编号</span> <input class="my-input" name="employeeNo" id="employeeNo" type="text" value="" placeholder="请输入员工编号" required maxlength="10" /> <span style="color: red;" id="employeeNoMsg"></span></div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工姓名</span> <input class="my-input" name="employeeName" id="employeeName" type="text" value="" 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="" placeholder="请输入11位的手机号码" required maxlength="11" minlength="11" /><span style="color: red;" id="employeeTelMsg"></span> </div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工状态</span>
|
|
|
|
|
|
+ <div class="input-box"><span class="input-dic">员工编号</span> <input class="my-input" name="employeeNo" id="employeeNo" type="text" value="" placeholder="请输入员工编号" required maxlength="10" /> <span style="color: red;" id="employeeNoMsg"></span></div>
|
|
|
|
+ <div class="input-box"><span class="input-dic">员工姓名</span> <input class="my-input" name="employeeName" type="text" value="" placeholder="请输入员工姓名" required maxlength="20" /> </div>
|
|
|
|
+ <div class="input-box"><span class="input-dic">员工电话</span> <input class="my-input" name="employeeTel" id="employeeTel" type="text" value="" placeholder="请输入员工手机号码" required maxlength="11" minlength="11" /><span style="color: red;" id="employeeTelMsg"></span> </div>
|
|
|
|
+ <div class="input-box"><span class="input-dic" style="margin-top: 0">员工状态</span>
|
|
<input type="radio" id="employeeState1" name="employeeState" value="1" checked/><label for="employeeState1">在职</label>
|
|
<input type="radio" id="employeeState1" name="employeeState" value="1" checked/><label for="employeeState1">在职</label>
|
|
- <input type="radio" id="employeeState2" name="employeeState" value="0"/><label for="employeeState2">在职</label>
|
|
|
|
|
|
+ <input type="radio" id="employeeState2" name="employeeState" value="0"/><label for="employeeState2">离职</label>
|
|
</div>
|
|
</div>
|
|
- <div class="input-box"><span class="input-dic">清空卡权限</span>
|
|
|
|
- <input type="radio" id="employeeClearPower1" name="employeeClearPower" value="0" /><label for="employeeClearPower1">具有</label>
|
|
|
|
- <input type="radio" id="employeeClearPower2" name="employeeClearPower" value="1" checked /><label for="employeeClearPower2">不具有</label>
|
|
|
|
|
|
+ <div class="input-box"><span class="input-dic" style="margin-top: 0">清空卡权限</span>
|
|
|
|
+ <input type="radio" id="employeeClearPower1" name="employeeClearPower" value="1" /><label for="employeeClearPower1">具有</label>
|
|
|
|
+ <input type="radio" id="employeeClearPower2" name="employeeClearPower" value="0" checked /><label for="employeeClearPower2">不具有</label>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="input-box"><span class="input-dic">入职日期</span> <input class="my-input-date" type="text" name="employeeEntryDate" id="employeeEntryDate" value="" placeholder="请选择入职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly" /> </div>
|
|
<div class="input-box"><span class="input-dic">入职日期</span> <input class="my-input-date" type="text" name="employeeEntryDate" id="employeeEntryDate" value="" placeholder="请选择入职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly" /> </div>
|
|
- <div class="input-box" id="isDeparture"><span class="input-dic">离职日期</span> <input class="my-input-date" type="text" name="employeeDepartureDate" id="employeeDepartureDate" value="" placeholder="请选择离职日期" onclick="WdatePicker({ dateFmt:'yyyy-MM-dd',skin:'whyGreen',minDate:'#F{$dp.$D(\'employeeEntryDate\')||\'%y-%M-%d\'}' })" readonly="readonly"/></div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工岗位</span> <input class="my-input" type="text" name="employeePost" id="employeePost" value="" placeholder="请输入2-20位中文、英文字符描述" required maxlength="20" /> </div>
|
|
|
|
|
|
+ <div class="input-box" id="isDeparture"><span class="input-dic">离职日期</span> <input class="my-input-date" type="text" name="employeeDepartureDate" id="employeeDepartureDate" value="" placeholder="请选择离职日期" onclick="WdatePicker({ dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'employeeEntryDate\')||\'%y-%M-%d\'}' })" readonly="readonly"/> <span style="color: red;" id="employeeDepartureDateMsg"></span></div>
|
|
|
|
+ <div class="input-box"><span class="input-dic">员工岗位</span> <input class="my-input" type="text" name="employeePost" value="" placeholder="请输入员工岗位" required maxlength="100"/> </div>
|
|
|
|
|
|
<div style="clear: both;"></div>
|
|
<div style="clear: both;"></div>
|
|
<div class="input-box"><span class="input-dic">员工备注</span>
|
|
<div class="input-box"><span class="input-dic">员工备注</span>
|
|
- <textarea rows="3" cols="20" class="my-textarea" name="employeeDesc" id="employeeDesc" maxlength="200" msg="员工备注" ></textarea>
|
|
|
|
|
|
+ <textarea rows="3" cols="20" class="my-textarea" name="employeeDesc" ></textarea>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <button type="reset" class="my-btn-reset">重置</button><button type="submit" class="my-btn-submit" >确认提交</button>
|
|
|
|
|
|
+ <button type="reset" class="my-btn-reset">重置</button><button type="submit" class="my-btn-submit">确认提交</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</form>
|
|
@@ -66,68 +68,43 @@
|
|
$(document).on('click', '.menuSubid input[type=radio]', function() {
|
|
$(document).on('click', '.menuSubid input[type=radio]', function() {
|
|
isSelectShow($(this).val())
|
|
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]+$/;
|
|
|
|
|
|
|
|
- $(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;
|
|
|
|
|
|
+ /* $(function(){
|
|
|
|
+ $("#form-admin-addEmployee").validate({
|
|
|
|
+ rules:{
|
|
|
|
+ subName:{
|
|
|
|
+ required:true,
|
|
|
|
+ minlength:4,
|
|
|
|
+ maxlength:30
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ onkeyup:false,
|
|
|
|
+ focusCleanup:true,
|
|
|
|
+ success:"valid",
|
|
|
|
+ submitHandler:function(form){
|
|
|
|
+ $.post(root_path + "/admin/employee/save_employee", formatJSON(),function(result){
|
|
|
|
+ if (result.returnCode != 200 || result.returnCode != 200) {
|
|
|
|
+ layer.msg('录入失败,请重试!',{icon: 5,time:3000});
|
|
|
|
+ } else {
|
|
|
|
+ layer.msg('录入成功!!',{icon: 1,time:2000}, function () {
|
|
|
|
+ // 关闭当前页面,并刷新父级页面
|
|
|
|
+ window.location.href= '${path}/admin/employee/list_employee';
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+ });
|
|
|
|
+ });*/
|
|
|
|
|
|
- var employeePost = $("#employeePost").val();
|
|
|
|
- if(!(cnen_name.test(employeePost))){
|
|
|
|
- layer.msg('员工岗位格式不正确', {icon: 5, time: 1000});
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var employeeDesc = $("#employeeDesc").val();
|
|
|
|
- if(!(check_name.test(employeeDesc))){
|
|
|
|
- layer.msg('员工备注格式不正确', {icon: 5, time: 1000});
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ $(function(){
|
|
|
|
+ //var validator = $("#form-admin-addEmployee").validate();
|
|
|
|
+ $("#form-admin-addEmployee").submit(function(){
|
|
ajaxReq();
|
|
ajaxReq();
|
|
return false;
|
|
return false;
|
|
})
|
|
})
|
|
- })
|
|
|
|
|
|
|
|
- function CompareDate(d1,d2)
|
|
|
|
- {
|
|
|
|
- return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
|
|
|
|
/* ajax请求*/
|
|
/* ajax请求*/
|
|
function ajaxReq(){
|
|
function ajaxReq(){
|
|
@@ -149,37 +126,17 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- /*实时监听文本框-- 员工编号*/
|
|
|
|
- document.getElementById("employeeNo").addEventListener("input", function(){
|
|
|
|
- ptsValiDataEmNo();
|
|
|
|
- });
|
|
|
|
-// /*实时监听文本框-- 手机号码*/
|
|
|
|
-// document.getElementById("employeeTel").addEventListener("input", function(){
|
|
|
|
-// ptsValiDataTel(this.value);
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// /*实时监听文本框-- 员工姓名*/
|
|
|
|
-// document.getElementById("employeeName").addEventListener("input", function(){
|
|
|
|
-// ptsValiDataTel(this.value);
|
|
|
|
-// });
|
|
|
|
-// /*实时监听文本框-- 手机号码*/
|
|
|
|
-// document.getElementById("employeeTel").addEventListener("input", function(){
|
|
|
|
-// ptsValiDataTel(this.value);
|
|
|
|
-// });
|
|
|
|
|
|
+ /*实时监听文本框-- 员工编号*/
|
|
|
|
+ document.getElementById("employeeNo").addEventListener("input", function(){
|
|
|
|
+ ptsValiDataEmNo(this.value);
|
|
|
|
+ });
|
|
|
|
+ /*实时监听文本框-- 手机号码*/
|
|
|
|
+ document.getElementById("employeeTel").addEventListener("input", function(){
|
|
|
|
+ ptsValiDataTel(this.value);
|
|
|
|
+ });
|
|
|
|
|
|
/*验证编号*/
|
|
/*验证编号*/
|
|
- function ptsValiDataEmNo() {
|
|
|
|
- var thVal = $("#employeeNo").val();
|
|
|
|
-
|
|
|
|
- if( thVal == null || thVal == "" || typeof(thVal) == "undefined"){
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(!(check_name.test(thVal))){
|
|
|
|
- layer.msg('员工编码格式不正确', {icon: 5, time: 1000});
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- var flag = false;
|
|
|
|
|
|
+ function ptsValiDataEmNo(thVal) {
|
|
$.ajax({
|
|
$.ajax({
|
|
cache: true,
|
|
cache: true,
|
|
type: "POST",
|
|
type: "POST",
|
|
@@ -190,37 +147,33 @@
|
|
async: false,
|
|
async: false,
|
|
success: function(data){
|
|
success: function(data){
|
|
if (data.returnCode == 200) {
|
|
if (data.returnCode == 200) {
|
|
- //$("#employeeNoMsg").html("该员工编号已存在");
|
|
|
|
- layer.msg('该员工编号已存在', {icon: 5, time: 1000});
|
|
|
|
- flag = false;
|
|
|
|
|
|
+ $("#employeeNoMsg").html("该员工编号已存在");
|
|
|
|
+ return false;
|
|
}else{
|
|
}else{
|
|
- //$("#employeeNoMsg").html("");
|
|
|
|
- flag = true;
|
|
|
|
|
|
+ $("#employeeNoMsg").html("");
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
- flag = false;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- return flag;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/*验证手机号码*/
|
|
/*验证手机号码*/
|
|
- function ptsValiDataTel() {
|
|
|
|
- var thVal = $("#employeeTel").val();
|
|
|
|
-
|
|
|
|
|
|
+ function ptsValiDataTel(thVal) {
|
|
if(!(/^1[34578]\d{9}$/.test(thVal))){
|
|
if(!(/^1[34578]\d{9}$/.test(thVal))){
|
|
- //$("#employeeTelMsg").html("手机号码错误");
|
|
|
|
- layer.msg('手机号码格式化不正确', {icon: 5, time: 1000});
|
|
|
|
|
|
+ $("#employeeTelMsg").html("手机号码错误");
|
|
return false;
|
|
return false;
|
|
}else{
|
|
}else{
|
|
- //$("#employeeTelMsg").html("");
|
|
|
|
|
|
+ $("#employeeTelMsg").html("");
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*将表单format为JSON*/
|
|
/*将表单format为JSON*/
|
|
function formatJSON() {
|
|
function formatJSON() {
|
|
|
|
+ debugger;
|
|
var serializeObj={};
|
|
var serializeObj={};
|
|
$($("#form-admin-addEmployee").serializeArray()).each(function(){
|
|
$($("#form-admin-addEmployee").serializeArray()).each(function(){
|
|
if (this.value != "" && this.value != null) {
|
|
if (this.value != "" && this.value != null) {
|