277 lines
10 KiB
Plaintext
277 lines
10 KiB
Plaintext
<%@page import="com.sipai.entity.sparepart.SparePartCommString" %>
|
||
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
||
|
||
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 30px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
.form-horizontal {
|
||
padding-top: 20px;
|
||
padding-right: 40px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
|
||
function dosave() {
|
||
$('#subForm').data('bootstrapValidator').updateStatus('userCardId', 'NOT_VALIDATED', null).validateField('userCardId');
|
||
$('#subForm').data('bootstrapValidator').updateStatus('username', 'NOT_VALIDATED', null).validateField('username');
|
||
$('#subForm').data('bootstrapValidator').updateStatus('birthday', 'NOT_VALIDATED', null).validateField('birthday');
|
||
$('#subForm').data('bootstrapValidator').updateStatus('workTime', 'NOT_VALIDATED', null).validateField('workTime');
|
||
$('#subForm').data('bootstrapValidator').updateStatus('hiredate', 'NOT_VALIDATED', null).validateField('hiredate');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/safety/staffArchives/save.do", $("#subForm").serialize(), function (data) {
|
||
if (data.code == 1) {
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
|
||
//初始化 从事岗位下拉
|
||
postPulldown();
|
||
} else {
|
||
showAlert('d', data.msg);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
userCardId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '工号不能为空'
|
||
}
|
||
}
|
||
},
|
||
username: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '姓名不能为空'
|
||
}
|
||
}
|
||
},
|
||
sex: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '性别不能为空'
|
||
}
|
||
}
|
||
},
|
||
birthday: {
|
||
trigger: "change",
|
||
validators: {
|
||
notEmpty: {
|
||
message: '出生日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
idcard: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '身份证号不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
|
||
message: '身份证号格式错误'
|
||
}
|
||
}
|
||
},
|
||
workTime: {
|
||
trigger: "change",
|
||
validators: {
|
||
notEmpty: {
|
||
message: '参加工作时间不能为空'
|
||
}
|
||
}
|
||
},
|
||
hiredate: {
|
||
trigger: "change",
|
||
validators: {
|
||
notEmpty: {
|
||
message: '入职本司时间不能为空'
|
||
}
|
||
}
|
||
},
|
||
post: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '从事岗位不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
// 初始化
|
||
$(function () {
|
||
//出生日期
|
||
$("#birthday").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
|
||
//参加工作时间
|
||
$("#workTime").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
|
||
//入职时间
|
||
$("#hiredate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
|
||
});
|
||
|
||
//选择姓名
|
||
function showUser4OneSelectFun() {
|
||
var userId = $("#userid").val();
|
||
$.post(ext.contextPath + '/user/userForOneSelectByStructure.do', {
|
||
formId: "subForm",
|
||
hiddenId: "userid",
|
||
textId: "username",
|
||
deptNameDom: "deptName",
|
||
sexDom: "sex",
|
||
userCardIdDom: "userCardId",
|
||
userId: userId
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
}
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog" style="width: 53%">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
<h4 class="modal-title">新增人员信息</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*工号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="userCardId" name="userCardId"
|
||
placeholder="点击选择" readonly onclick="showUser4OneSelectFun();"/>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*姓名</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="username" name="username" placeholder="点击选择"
|
||
readonly onclick="showUser4OneSelectFun();"/>
|
||
<input id="userid" name="userid" type="hidden" value=""/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*性别</label>
|
||
<div class="col-sm-4">
|
||
<select id="sex" name="sex" class="form-control select2" disabled>
|
||
<option value="1" selected>男</option>
|
||
<option value="0">女</option>
|
||
</select>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*身份证号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="idcard" name="idcard" placeholder="身份证号"
|
||
value="">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*出生日期</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="birthday" name="birthday"
|
||
placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*参加工作时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="workTime" name="workTime"
|
||
placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*入职本司时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="hiredate" name="hiredate"
|
||
placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*所属部门:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="deptName" name="deptName" placeholder="所属部门"
|
||
value="" disabled>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*从事岗位</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="post" name="post" placeholder="从事岗位"
|
||
value="">
|
||
</div>
|
||
<label class="col-sm-2 control-label">职务</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="duty" name="duty" placeholder="职务"
|
||
value="">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">职称</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="jobTitle" name="jobTitle" placeholder="职称"
|
||
value="">
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|