Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/whp/plan/WhpSamplingPlanTaskEdit.jsp

533 lines
21 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<!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;
}
.form-checkbox {
height: 23px;
width: 23px;
display: block;
position: absolute;
margin-top: 6px;
margin-left: 13px;
z-index: 9999;
}
.table-hover > tbody > tr:hover {
cursor: pointer;
}
.input-clear-a {
color: white;
}
.input-content:hover + .input-clear-a {
color: #d4d4d4;
}
</style>
<script type="text/javascript">
$(function () {
$("#samplingTime").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
if('${bean.samplingTime.substring(0,10)}'=='')
{
$("#samplingTime").datepicker('setDate', new Date());
}
samplingEnvConditionDropDownList()
sampleAppearanceConditionDropDownList()
sampleSupernatantDropDownlist();
sampleNatureDropDownList();
conditionDropDowntype()
deptChange();
});
//样品状态
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${sampleStateDropDown}');
var selelct_1 = $("#sampleState").select2({
data: selelct_1Data,
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'});
if('${bean.sampleState}'!='')
{
selelct_1.val('${bean.sampleState}').trigger("change");
}else{
selelct_1.val('1').trigger("change");
}
selelct_1.on("change", function (e) {
deptChange();
});
// selelct_1.val(selelct_1Data[1].id).trigger("change")
}
//样品数量刷新
function deptChange() {
var type = $("#sampleState").val();
if (type==1){
$("#sampleAmountunit").text('ml')
$("#unit").val('ml')
} else {
$("#sampleAmountunit").text('g')
$("#unit").val('g')
}
}
//现场采样情况
function samplingEnvConditionDropDownList() {
var select_Data = jQuery.parseJSON('${samplingPlanTaskEnvDropDown}');
console.log(select_Data);
var select_3 = $("#samplingEnv").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'});
//单选赋值
if ('${bean.samplingEnv}'=='')
{
select_3.val('0').trigger("change");
}else{
select_3.val('${bean.samplingEnv}').trigger("change");
}
}
//样品外观
function sampleAppearanceConditionDropDownList() {
var select_Data = jQuery.parseJSON('${sampleAppearanceDropDown}');
console.log(select_Data);
var select_3 = $("#sampleAppearance").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'});
//单选赋值
if('${bean.sampleAppearance}'=='')
{
select_3.val('1').trigger("change");
}else{
select_3.val('${bean.sampleAppearance}').trigger("change");
}
}
//上清液
function sampleSupernatantDropDownlist() {
var select_Data = jQuery.parseJSON('${sampleSupernatantDropDown}');
var select_3 = $("#sampleSupernatant").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'});
//单选赋值
if('${bean.sampleSupernatant}'=='')
{
select_3.val('2').trigger("change");
}else{
select_3.val('${bean.sampleSupernatant}').trigger("change");
}
} //性质
function sampleNatureDropDownList() {
var select_Data = jQuery.parseJSON('${sampleNatureDropDown}');
var select_3 = $("#sampleNature").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'});
//单选赋值
if('${bean.sampleNature}'=='')
{
select_3.val('').trigger("change");
}else{
select_3.val('${bean.sampleNature}').trigger("change");
}
}
function updateFun() {
$("#editForm").data("bootstrapValidator").updateStatus("samplingUserName","NOT_VALIDATED", null).validateField("samplingUserName");
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/update.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) {
}
});
}
}
function submitFun() {
//console.log($("#editForm").serialize());
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/submit.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) {
if('${param.inSt}'!=null&&'${param.inSt}'=='homePage'){
$("#table4").bootstrapTable('refresh');
}else{
$("#table").bootstrapTable('refresh');
}
closeModal('subModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
$("#editForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
sampleCode: {
validators: {
notEmpty: {
message: '样品编号不能为空'
}
}
},
sampleAddress: {
validators: {
notEmpty: {
message: '地点不能为空'
}
}
},
samplingEnv: {
validators: {
notEmpty: {
message: '现场采样情况不能为空'
}
}
},
sampleAppearance: {
validators: {
notEmpty: {
message: '样品外观不能为空'
}
}
},
sampleAmount: {
validators: {
notEmpty: {
message: '样品数量不能为空'
}
}
},
samplingUserName: {
validators: {
notEmpty: {
message: '采样人不能为空'
}
}
},
samplingTime: {
trigger:"change",
validators: {
notEmpty: {
message: '采样时间不能为空'
}
}
}
}
});
// 采样人
function selectdutyUser() {
$.post(ext.contextPath + '/user/userForOneSelect.do',
{
formId: "editForm",
hiddenId: "samplingUserId",
textId: "samplingUserName"
},
function (data) {
$("#user4SelectDiv").html(data);
openModal('user4SelectModal');
});
};
</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">&times;</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">
<input type="text" name="sampleCode" id="sampleCode" class="form-control"
readonly value="${bean.sampleCode}">
<input type="hidden" name="id" id="id" class="form-control"
placeholder="" value="${bean.id}">
</div>
<label class="col-sm-2 control-label">* 地点:</label>
<div class="col-sm-4">
<input type="text" name="sampleAddress" id="sampleAddress" class="form-control"
value="${bean.sampleAddress} " placeholder="">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">* 现场采样情况:</label>
<div class="col-sm-4">
<select class="form-control" name="samplingEnv" id="samplingEnv"
style="width: 100%;height: 34px">
</select>
</div>
<label class="col-sm-2 control-label">* 样品外观:</label>
<div class="col-sm-4">
<select class="form-control" name="sampleAppearance" id="sampleAppearance"
style="width: 100%;height: 34px">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">* 上清液:</label>
<div class="col-sm-4">
<select class="form-control" name="sampleSupernatant" id="sampleSupernatant"
style="width: 100%;height: 34px">
</select>
</div>
<label class="col-sm-2 control-label">* 性质:</label>
<div class="col-sm-4">
<select class="form-control" name="sampleNature" id="sampleNature"
style="width: 100%;height: 34px">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label ">* 样品状态:</label>
<div class="col-sm-4 ">
<select class="form-control" name="sampleState" id="sampleState"
style="width: 100%;height: 34px">
</select>
</div>
<label class="col-sm-2 control-label ">* 样品数量:</label>
<div class="col-sm-4 " >
<input type="text" name="sampleAmount" id="sampleAmount"
<c:if test="${bean.sampleAmount!=null}">value="${bean.sampleAmount}" </c:if> <c:if test="${bean.sampleAmount==null}">value="1000" </c:if> style="width: 60%" placeholder="">
<input type="hidden" name="unit" id="unit" >
<label name="sampleAmountunit" id="sampleAmountunit"
style="position: absolute;float: right;margin-left: 10px;size: 18px;"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label ">* 采样人:</label>
<div class="col-sm-4 ">
<input type="text" id="samplingUserName" name="samplingUserName" class="form-control"
placeholder="请选择.." ondblclick="selectdutyUser()" value="${bean.samplingUserName}">
<input type="hidden" id="samplingUserId" name="samplingUserId" class="form-control"
placeholder="请选择.." value="${bean.samplingUserId}" >
</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="samplingTime" name="samplingTime"
value="${bean.samplingTime.substring(0,10)} " />
</div>
</div>
</div>
<div class="form-group">
<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>
<button type="button" class="btn btn-primary " style="margin-left: 10px"
onclick="submitFun()">提交样品登记
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>