|
@@ -34,25 +34,25 @@
|
|
<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" type="text" value="" placeholder="请输入员工编号"/> </div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工姓名</span> <input class="my-input" name="employeeName" type="text" value="" placeholder="请输入员工姓名"/> </div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工电话</span> <input class="my-input" name="employeeTel" type="text" value="" placeholder="请输入员工手机号码"/> </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" 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">员工状态</span>
|
|
<div class="input-box"><span class="input-dic">员工状态</span>
|
|
- <input type="radio" id="employeeState1" name="employeeState" value="1"/><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>
|
|
<div class="input-box"><span class="input-dic">清空卡权限</span>
|
|
<input type="radio" id="employeeClearPower1" name="employeeClearPower" value="1" /><label for="employeeClearPower1">具有</label>
|
|
<input type="radio" id="employeeClearPower1" name="employeeClearPower" value="1" /><label for="employeeClearPower1">具有</label>
|
|
- <input type="radio" id="employeeClearPower2" name="employeeClearPower" value="0" /><label for="employeeClearPower2">不具有</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" value="" placeholder="请选择入职日期" onClick="WdatePicker()" readonly="readonly"/> </div>
|
|
|
|
- <div class="input-box" id="isDeparture"><span class="input-dic">离职日期</span> <input class="my-input-date" type="text" name="employeeDepartureDate" value="" placeholder="请选择离职日期" onClick="WdatePicker()" readonly="readonly"/> </div>
|
|
|
|
- <div class="input-box"><span class="input-dic">员工岗位</span> <input class="my-input" type="text" name="employeePost" value="" placeholder="请输入员工岗位"/> </div>
|
|
|
|
|
|
+ <div class="input-box"><span class="input-dic">入职日期</span> <input class="my-input-date" type="text" name="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" value="" placeholder="请选择离职日期" onclick="WdatePicker({skin:'whyGreen'})" readonly="readonly"/> </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"></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>
|
|
@@ -67,7 +67,7 @@
|
|
isSelectShow($(this).val())
|
|
isSelectShow($(this).val())
|
|
})
|
|
})
|
|
|
|
|
|
- $(function(){
|
|
|
|
|
|
+ /* $(function(){
|
|
$("#form-admin-addEmployee").validate({
|
|
$("#form-admin-addEmployee").validate({
|
|
rules:{
|
|
rules:{
|
|
subName:{
|
|
subName:{
|
|
@@ -92,8 +92,84 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ });*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $(function(){
|
|
|
|
+ //var validator = $("#form-admin-addEmployee").validate();
|
|
|
|
+ $("#form-admin-addProduce").submit(function(){
|
|
|
|
+ ajaxReq();
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ /* ajax请求*/
|
|
|
|
+ function ajaxReq(){
|
|
|
|
+ var data = formatJSON();
|
|
|
|
+ $.ajax({
|
|
|
|
+ cache: true,
|
|
|
|
+ type: "POST",
|
|
|
|
+ data: data,
|
|
|
|
+ url: "${path}/admin/employee/save_employee",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ if (data.returnCode == 200) {
|
|
|
|
+ window.location.href = '${path}//admin/employee/_employee_list'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //实时监听文本框-- 员工编号
|
|
|
|
+ document.getElementById("employeeNo").addEventListener("input", function(){
|
|
|
|
+ ptsValiDataEmNo(this.value);
|
|
|
|
+ });
|
|
|
|
+ //实时监听文本框-- 手机号码
|
|
|
|
+ document.getElementById("employeeTel").addEventListener("input", function(){
|
|
|
|
+ ptsValiDataTel(this.value);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /*验证编号*/
|
|
|
|
+ function ptsValiDataEmNo(thVal) {
|
|
|
|
+ $.ajax({
|
|
|
|
+ cache: true,
|
|
|
|
+ type: "POST",
|
|
|
|
+ data: {
|
|
|
|
+ employeeNo:thVal
|
|
|
|
+ },
|
|
|
|
+ url: "${path}/admin/employee/is_employee",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ if (data.returnCode == 200) {
|
|
|
|
+ $("#employeeNoMsg").html("该员工编号已存在");
|
|
|
|
+ return false;
|
|
|
|
+ }else{
|
|
|
|
+ $("#employeeNoMsg").html("");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*验证手机号码*/
|
|
|
|
+ function ptsValiDataTel(thVal) {
|
|
|
|
+ if(!(/^1[34578]\d{9}$/.test(thVal))){
|
|
|
|
+ $("#employeeTelMsg").html("手机号码错误");
|
|
|
|
+ return false;
|
|
|
|
+ }else{
|
|
|
|
+ $("#employeeTelMsg").html("");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/*将表单format为JSON*/
|
|
/*将表单format为JSON*/
|
|
function formatJSON() {
|
|
function formatJSON() {
|
|
debugger;
|
|
debugger;
|