315 lines
12 KiB
Plaintext
315 lines
12 KiB
Plaintext
|
|
<!DOCTYPE html
|
|||
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|||
|
|
<%@ page language="java" pageEncoding="utf-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single {
|
|||
|
|
height: 34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.select2-selection__arrow {
|
|||
|
|
margin-top: 3px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.foot {
|
|||
|
|
display: flex;
|
|||
|
|
padding-left: 50px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-horizontal {
|
|||
|
|
padding-top: 20px;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.right {
|
|||
|
|
margin-left: 50px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
$(function () {
|
|||
|
|
|
|||
|
|
initDropDownStatus();
|
|||
|
|
// initDropDownequipmentId()
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function initDropDownequipmentId() {
|
|||
|
|
var select_Data = []
|
|||
|
|
try {
|
|||
|
|
select_Data = JSON.parse('${equipmentDropDown}');
|
|||
|
|
|
|||
|
|
}catch (e) {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
console.log('${equipmentDropDown}')
|
|||
|
|
var select_3 = $("#equipmentId").select2({
|
|||
|
|
data: select_Data,
|
|||
|
|
cache: false,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
// allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
multiple: true,
|
|||
|
|
formatResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
|||
|
|
select_3.val('').trigger('change');
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function initDropDownStatus() {
|
|||
|
|
var select_Data = jQuery.parseJSON('${enableDropDown}');
|
|||
|
|
var select_3 = $("#status").select2({
|
|||
|
|
data: select_Data,
|
|||
|
|
cache: false,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
// allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
formatResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
|||
|
|
select_3.val('1').trigger('change');
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function showUnit4SelectFun() {
|
|||
|
|
$.post(ext.contextPath + '/user/unit4SelectModalLimitedCheck.do', {
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "deptIds",
|
|||
|
|
textId: "deptNames",
|
|||
|
|
deptIds: $('#deptIds').val()
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#unit4SelectDiv").html(data);
|
|||
|
|
openModal("unit4SelectModal_Limited_Check");
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function saveFun() {
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("confirmUserName","NOT_VALIDATED", null).validateField("confirmUserName");
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("deptNames","NOT_VALIDATED", null).validateField("deptNames");
|
|||
|
|
$("#addForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
var formData = new FormData($("#addForm")[0]);
|
|||
|
|
$.ajax({
|
|||
|
|
url: ext.contextPath + "/whp/baseinfo/WhpTestItem/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');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '保存失败!' + data.msg);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function (data) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#addForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '检测项目不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
equipmentId: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '仪器设备不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
deptNames: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '检测部门不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
confirmUserName: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '检验复核人不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
testAddress: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '测定地点不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
status: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '状态不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
// 检查人员
|
|||
|
|
function selectdutyUser() {
|
|||
|
|
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
|||
|
|
{
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "confirmUserId",
|
|||
|
|
textId: "confirmUserName"
|
|||
|
|
},
|
|||
|
|
function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal('user4SelectModal');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 选择设备
|
|||
|
|
function selectEquipment() {
|
|||
|
|
$.post(ext.contextPath + '/whp/baseinfo/WhpEquipment/WhpEquipmentForOneSelect.do',
|
|||
|
|
{
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "equipmentId",
|
|||
|
|
textId: "equipmentName"
|
|||
|
|
},
|
|||
|
|
function (data) {
|
|||
|
|
$("#equ4SelectDiv").html(data);
|
|||
|
|
openModal('equ4SelectModal');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
</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">
|
|||
|
|
<div class="row">
|
|||
|
|
<div class="col-md-12 col-xs-13">
|
|||
|
|
<!-- 新增界面formid强制为addForm -->
|
|||
|
|
<form class="form-horizontal" id="addForm" enctype="multipart/form-data">
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
|||
|
|
<!-- 界面提醒div强制id为alertdiv -->
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">所属厂区</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input name="bizId" type="hidden" value="${company.id}"/>
|
|||
|
|
<p class="form-control-static" >${company.name}</p>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">* 使用试剂:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" name="reagent" id="reagent" class="form-control">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">* 检测项目名称:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" name="name" id="name" class="form-control"
|
|||
|
|
placeholder="">
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label">* 仪器设备:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input id="equipmentId" name="equipmentId" type="hidden" value=""/>
|
|||
|
|
<input class="form-control" id="equipmentName" name="equipmentName"
|
|||
|
|
onclick="selectEquipment();"
|
|||
|
|
placeholder="请先选择设备" autocomplete="off">
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">* 检测部门:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<%-- <input type="text" name="deptIds" id="deptIds" class="form-control"--%>
|
|||
|
|
<%-- placeholder="">--%>
|
|||
|
|
<input id="deptNames" name="deptNames" class="form-control" readonly
|
|||
|
|
onclick="showUnit4SelectFun();" placeholder="请点击选择检测部门"/>
|
|||
|
|
<input id="deptIds" name="deptIds" type="hidden" class="form-control" />
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label">* 检验复核人:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" id="confirmUserName" name="confirmUserName" class="form-control"
|
|||
|
|
placeholder="请选择.." readonly onclick="selectdutyUser()" >
|
|||
|
|
<input type="hidden" id="confirmUserId" name="confirmUserId" class="form-control"
|
|||
|
|
placeholder="请选择.." >
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">* 测定地点:</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" name="testAddress" id="testAddress" class="form-control">
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label ">* 状态:</label>
|
|||
|
|
<div class="col-sm-4 ">
|
|||
|
|
|
|||
|
|
<select class="form-control" name="status" id="status"
|
|||
|
|
style="width: 100%">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</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="saveFun()">保存
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|