first commit
This commit is contained in:
202
WebRoot/jsp/whp/SamplingManagement/WhpSamolePlanAdd.jsp
Normal file
202
WebRoot/jsp/whp/SamplingManagement/WhpSamolePlanAdd.jsp
Normal file
@ -0,0 +1,202 @@
|
||||
<!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 () {
|
||||
initDropDowntestItemIds()
|
||||
console.log("${param.testItemId}",'2222222222')
|
||||
});
|
||||
|
||||
|
||||
function savedatalist() {
|
||||
//console.log($("#addFormlist").serialize());
|
||||
$("#addFormlist").bootstrapValidator('validate');//提交验证
|
||||
if ($("#addFormlist").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
var formData = new FormData($("#addFormlist")[0]);
|
||||
|
||||
$.ajax({
|
||||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanItem/save.do",
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#tablelist").bootstrapTable('refresh');
|
||||
closeModal('workingModal');
|
||||
} else {
|
||||
showAlert('d', '保存失败!' + data.msg);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#addFormlist").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
code: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '样品编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
address: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '地点不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
testing: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '是否检测不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
itemId: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '检测项目不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
function initDropDowntestItemIds() {
|
||||
var select_Data = []
|
||||
try{
|
||||
select_Data =JSON.parse('${whpTestItemDropDown}');
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
var select_3 = $("#itemId").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'});
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<div class="modal fade" id="workingModal">
|
||||
<div class="modal-dialog" style="width: 40%">
|
||||
<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强制为addFormlist -->
|
||||
<form class="form-horizontal" id="addFormlist" 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 type="text" name="code" id="code" class="form-control"
|
||||
placeholder="">
|
||||
<input type="hidden" name="testItemId" id="testItemId" class="form-control"
|
||||
placeholder="" value="${param.testItemId}">
|
||||
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">* 地点:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="address" id="address" class="form-control"
|
||||
placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">* 是否检测:</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="testing" name="testing" class="form-control select2">
|
||||
<option value="1" selected>是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
<%-- <input type="text" name="testing" id="testing" class="form-control"--%>
|
||||
<%-- placeholder="">--%>
|
||||
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label ">* 检测项目:</label>
|
||||
<div class="col-sm-4 ">
|
||||
|
||||
<select class="form-control" name="itemId" id="itemId"
|
||||
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="savedatalist()">保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user