261 lines
9.6 KiB
Plaintext
261 lines
9.6 KiB
Plaintext
<%@page import="com.sipai.entity.sparepart.SparePartCommString" %>
|
||
<%@ page language="java" 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: 60px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
|
||
function dosave() {
|
||
$("#subForm").data("bootstrapValidator").updateStatus("username","NOT_VALIDATED", null).validateField("username");
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#subForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/safety/internalCertificate/save.do",
|
||
type: 'POST',
|
||
data: formData,
|
||
async: false,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
dataType: 'json',
|
||
success: function (data) {
|
||
// console.log(data)
|
||
if (data.code == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
|
||
// 初始化 作业类型
|
||
jobTypePulldown();
|
||
} else {
|
||
showAlert('d', '保存失败!' + data.msg);
|
||
}
|
||
},
|
||
error: function (data) {
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
username: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '姓名不能为空'
|
||
}
|
||
}
|
||
},
|
||
certificateName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '证书名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
certificateNo: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '证书编号不能为空'
|
||
}
|
||
}
|
||
},
|
||
issueDate: {
|
||
trigger: "change",
|
||
validators: {
|
||
notEmpty: {
|
||
message: '领证时间不能为空'
|
||
}
|
||
}
|
||
},
|
||
expirationDate: {
|
||
trigger: "change",
|
||
validators: {
|
||
notEmpty: {
|
||
message: '有效期至不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
$(function () {
|
||
//领证时间
|
||
$("#issueDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
|
||
//有效期至
|
||
$("#expirationDate").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: "",
|
||
userCardIdDom: "userCardId",
|
||
userId: userId
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
}
|
||
|
||
var fileinput = function () {
|
||
$('#file').click();
|
||
};
|
||
var fileSelected = function () {
|
||
var filename = $('#file').val();
|
||
$('#fileName').val(filename);
|
||
};
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-lg">
|
||
<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="username" name="username" value=""
|
||
placeholder="点击选择" readonly onclick="showUser4OneSelectFun();">
|
||
<input id="userid" name="userid" type="hidden" value=""/>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*工号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="userCardId" name="userCardId" placeholder="工号"
|
||
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="deptName" name="deptName" placeholder="所属部门"
|
||
disabled>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*证书名称</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="certificateName" name="certificateName"
|
||
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="certificateNo" name="certificateNo"
|
||
placeholder="证书编号" value="">
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">作业项目代码</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="jobCode" name="jobCode" 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="jobType" name="jobType" placeholder="作业类型"
|
||
value="">
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">发证部门</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="issuingAuthority" name="issuingAuthority"
|
||
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="issueDate" name="issueDate"
|
||
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="expirationDate" name="expirationDate"
|
||
placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">
|
||
<button type="button" class="btn btn-default btn-file" onclick="fileinput()"
|
||
id="btn_save"><i class="fa fa-paperclip"></i>上传附件
|
||
</button>
|
||
</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" name="fileName" id="fileName" style="width:350px;display:inline;border:none"/>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="form-group" style="margin:8px;">
|
||
<input type="file" name="file" id="file" multiple class="file-loading" onchange="fileSelected()"/>
|
||
</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" style="margin-left: 10px" onclick="dosave()">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|