first commit
This commit is contained in:
335
WebRoot/jsp/whp/baseinfo/WhpSampleCodeEdit.jsp
Normal file
335
WebRoot/jsp/whp/baseinfo/WhpSampleCodeEdit.jsp
Normal file
@ -0,0 +1,335 @@
|
||||
<!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;
|
||||
}
|
||||
|
||||
/*.layout{*/
|
||||
/* display: flex;*/
|
||||
/* padding-left: 15px;*/
|
||||
/*}*/
|
||||
.form-horizontal {
|
||||
padding-top: 20px;
|
||||
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 50px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
initDropDowntypeId()
|
||||
initDropDownStatus();
|
||||
initDropDowntestItemIds()
|
||||
});
|
||||
|
||||
function initDropDowntestItemIds() {
|
||||
var select_Data = []
|
||||
try{
|
||||
select_Data =JSON.parse('${whpTestItemDropDown}');
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
console.log('${whpTestItemDropDown}')
|
||||
var select_3 = $("#testItemIds").select2({
|
||||
data: select_Data,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
// allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
multiple: true,
|
||||
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'});
|
||||
|
||||
var itemsArr = [];
|
||||
var items = '${bean.testItemIds}';
|
||||
itemsArr = items.split(',');
|
||||
select_3.val(itemsArr).trigger("change");
|
||||
|
||||
|
||||
}
|
||||
function initDropDowntypeId() {
|
||||
console.log('${sampleTypeDropDownList}')
|
||||
var select_Data = []
|
||||
try {
|
||||
select_Data = JSON.parse('${sampleTypeDropDownList}');
|
||||
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
|
||||
var select_3 = $("#typeId").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('${bean.typeId}').trigger("change");
|
||||
}
|
||||
|
||||
function initDropDownStatus() {
|
||||
var select_Data = jQuery.parseJSON('${enableDropDown}');
|
||||
console.log(select_Data);
|
||||
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('${bean.status}').trigger("change");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function updateFun() {
|
||||
//console.log($("#editForm").serialize());
|
||||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
var formData = new FormData($("#editForm")[0]);
|
||||
$.ajax({
|
||||
url: ext.contextPath + "/whp/baseinfo/WhpSampleCode/update.do",
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
console.log(data.code)
|
||||
if (data.code == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal('subModal');
|
||||
} else {
|
||||
showAlert('d', '保存失败!' + data.msg);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data)
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var showUnit4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/unit4SelectModalLimitedCheck.do',
|
||||
{
|
||||
formId: "editForm",
|
||||
hiddenId: "deptIds",
|
||||
textId: "deptNames",
|
||||
deptIds: $('#deptIds').val()
|
||||
}, function (data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal_Limited_Check");
|
||||
});
|
||||
};
|
||||
$("#editForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
typeId: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '采样类型不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
prefix: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '前缀不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
address: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '地点人不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
addressCode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '地点编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
testItemIds: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '检测项目不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
status: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '状态不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</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强制为editForm -->
|
||||
<form class="form-horizontal" id="editForm" 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">
|
||||
<select class="form-control" name="typeId" id="typeId"
|
||||
style="width: 100%">
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">* 前缀:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="prefix" id="prefix" class="form-control"
|
||||
placeholder=""
|
||||
value="${bean.prefix}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">* 地点:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="address" id="address" class="form-control"
|
||||
value="${bean.address}">
|
||||
<input type="hidden" name="id" id="id" class="form-control"
|
||||
value="${bean.id}">
|
||||
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">* 地点编号:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="addressCode" id="addressCode" class="form-control"
|
||||
value="${bean.addressCode}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label ">* 检测项目:</label>
|
||||
<div class="col-sm-4 ">
|
||||
|
||||
<select class="form-control" name="testItemIds" id="testItemIds"
|
||||
style="width: 100%">
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">* 采样车间:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deptNames" name="deptNames" style="border-radius:4px;background-color: white"
|
||||
onclick="showUnit4SelectFun();" value="${bean.deptNames}" readonly placeholder="请点击选择采样车间"/>
|
||||
|
||||
<input id="deptIds" name="deptIds" type="hidden" value="${bean.deptIds}" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<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>
|
||||
<label class="col-sm-2 control-label">* 是否检测:</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control-isTest" name="isTest" id="isTest" style="width: 69%; height: 30px;border-radius: 5px;border: 1px solid gray;" >
|
||||
|
||||
<option value="1" <c:if test="${bean.isTest==true}"> selected="selected" </c:if> >检测</option>
|
||||
<option value="0" <c:if test="${bean.isTest==false}"> selected="selected" </c:if>>不检测</option>
|
||||
</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="updateFun()">保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user