Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/whp/test/WhpSamplingPlanTaskTestItemEdit.jsp

740 lines
33 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ 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" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.sipai.entity.base.ServerObject" %>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<%@ page import="java.math.BigDecimal" %>
<!DOCTYPE html>
<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;
}
.has-error .checkbox, .has-error .checkbox-inline, .has-error .control-label, .has-error .help-block, .has-error .radio, .has-error .radio-inline, .has-error.checkbox label, .has-error.checkbox-inline label, .has-error.radio label, .has-error.radio-inline labe {
color: #ffffff;
}
.form-group.has-error .help-block {
color: #ffffff;
}
.help-block {
color: #ffffff;
}
.select2-container--default .select2-selection--single {
border: none;
}
.select2-container--default .select2-selection--single, .select2-selection .select2-selection--single {
border: none;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border: none;
border-style: unset
}
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #FFFFFF;
}
.right {
margin-left: 50px;
}
.buttonclass {
background-color: #ffffff;
color: black;
border-color: gray;
/* height: 30px;*/
width: 58px;
}
.modal-footer {
padding: 0;
}
#progressBar {
width: 100%;
height: 10px;
background-color: #f2f2f2;
position: relative;
overflow: hidden;
}
#progressBar .bar {
height: 100%;
background: #007bff;
position: absolute;
width: 0;
transition: width 0.3s ease;
}
</style>
<script type="text/javascript">
var basiCurveslist;//基础描述
var processCurveslist;//过程公式
var contantCurveslist;//常量
var curve;//结果公式
var bean;//样品信息
var confirmStr;
var submitNum = 0;
$(function () {
initconfirm();
inittest();
});
function showWaitTipFn() {//显示加载进度条
$(".loadingWord").css({'display': 'block'});
$(".showbox").stop(true).animate({'margin-top': '300px', 'opacity': '1'}, 200);
}
function hideWaitTipFn() {//隐藏进度条
$(".loadingWord").css({'display': 'none'});
$(".showbox").stop(true).animate({'margin-top': '250px', 'opacity': '0'}, 400);
}
// 模拟长时间处理的操作
function simulateLongOperation() {
var progressBar = document.getElementById("progressBar");
var bar = progressBar.querySelector(".bar");
progressBar.style.display = "block";
bar.style.width = "0";
var totalProgress = 100; // 总进度
var currentProgress = 0; // 当前进度
var intervalId = setInterval(function () {
if (currentProgress >= totalProgress) {
progressBar.style.display = "none";
clearInterval(intervalId);
} else {
currentProgress++;
bar.style.width = (currentProgress / totalProgress * 100) + "%";
}
}, 5);
}
function loadData(dataId) {
var str = "< img src='WebRoot/IMG/img_v2_b66251dc-e249-45f3-b3c7-d47e709a52fg.gif'>&nbsp;&nbsp;<font color=red>数据加载中...</font>";
if (dataId != "") {
document.getElementById(dataId).innerHTML = str;
}
}
function initconfirm() {
confirmStr =
" <input type=\"hidden\" name=\"testDate\" id=\"testDate\" class=\"form-control\" value=\"${confirm.testDate}\">" +
" <input type=\"hidden\" name=\"temperature\" id=\"temperature\" class=\"form-control\" value=\"${confirm.temperature}\">" +
" <input type=\"hidden\" name=\"reagent\" id=\"reagent\" class=\"form-control\" value=\"${confirm.reagent}\">" +
" <input type=\"hidden\" name=\"equipmentId\" id=\"equipmentId\" class=\"form-control\" value=\"${confirm.equipmentId}\">" +
" <input type=\"hidden\" name=\"equipmentCode\" id=\"equipmentCode\" class=\"form-control\" value=\"${confirm.equipmentCode}\">" +
" <input type=\"hidden\" name=\"testConfirmId\" id=\"testConfirmId\" class=\"form-control\" value=\"${confirm.id}\">" +
" <input type=\"hidden\" name=\"testAddress\" id=\"testAddress\" class=\"form-control\" value=\"${confirm.testAddress}\">";
}
function initbtn(type) {
var btndtr = "";
// data-dismiss="modal"
btndtr += "<button type=\"button\" class=\"btn btn-default \" onclick='closeModel()' >关闭 </button> ";
if (type == 0) {
btndtr += " <button type=\"button\" class=\"btn btn-primary \" style=\"margin-left: 10px\" onclick=\"updataList7()\">保存并提交 </button> "
} else {
btndtr += " <button type=\"button\" class=\"btn btn-primary \" style=\"margin-left: 10px\" onclick=\"updataList6()\">保存 </button> "
}
$("#btndiv").html(btndtr);
}
var listcount;
function inittest() {
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/doNextedit.do?id=${itemid}&unitId=${unitId}",
type: 'POST',
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
if (data.code == 0) {
inintdata(data)
listcount = data.listcount;
initbtn(data.listcount)
} else {
// closeModal('subEdit');
}
},
error: function (data) {
// console.log(data+"fffff")
}
});
}
function nexttest() {
var formData = new FormData($("#editForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/doNextedit.do",
type: 'POST',
data: formData,
async: false,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
if (data.code == 0) {
inintdata(data)
listcount = data.listcount;
initbtn(data.listcount)
} else {
closeModal('subEdit');
}
},
error: function (data) {
// console.log(data+"fffff")
}
});
}
function inintdata(data) {
basiCurveslist = data.basiCurveslist;//基础描述
processCurveslist = data.processCurveslist;//过程公式
contantCurveslist = data.contantCurveslist;//常量
curve = data.curve;//结果公式
bean = data.bean;//样品信息
let htmlstr = "";
htmlstr += "<form class=\"form-horizontal\" id=\"editForm\" enctype=\"multipart/form-data\">" +
" <div id=\"alertDiv\"></div>" +
" <!-- 界面提醒div强制id为alertdiv -->" +
confirmStr +
" <input type=\"hidden\" name=\"id\" id=\"id\" class=\"form-control\" value=\"" + bean.id + "\">" +
" <input type=\"hidden\" name=\"planCode\" id=\"planCode\" class=\"form-control\"" +
" value=\"" + bean.planCode + "\">" +
" <input type=\"hidden\" name=\"sampleCode\" id=\"sampleCode\" class=\"form-control\"" +
" value=\"" + bean.sampleCode + "\">" +
" <input type=\"hidden\" name=\"testItemId\" id=\"testItemId\" class=\"form-control\"" +
" value=\"" + bean.testItemId + "\">" +
" <input type=\"hidden\" name=\"unitId\" id=\"unitId\" class=\"form-control\"" +
" value=\"" + unitId + "\">" +
" <div class=\"form-group\">" +
" <label class=\"col-sm-2 control-label\"> 采样单编号</label>" +
" <div class=\"col-sm-2\">" +
" <p class=\"form-control-static\">" + bean.planCode + "</p>" +
" </div>" +
" <label class=\"col-sm-2 control-label\"> 检测项目</label>" +
" <div class=\"col-sm-2\">" +
" <p class=\"form-control-static\">" + bean.testItemName + "</p>" +
" </div>" +
" <label class=\"col-sm-2 control-label\"> 结果公式</label>" +
" <div class=\"col-sm-2\">" +
" <p class=\"form-control-static\">" + bean.workCurveName + "</p>" +
" </div>" +
" </div>" +
" <div class=\"form-group\">" +
" <label class=\"col-sm-2 control-label\"> 样品编号</label>" +
" <div class=\"col-sm-2\">" +
" <p class=\"form-control-static\">" + bean.sampleCode + "</p>" +
" </div>" +
" </div>";
htmlstr += " <div class=\"form-group\" id=\"cont\">";
for (var i = 0; i < basiCurveslist.length; i++) {
htmlstr += " <label style=\"margin-top: 13px;\"" +
" class=\"col-sm-2 control-label\">" + basiCurveslist[i].name + "</label>" +
" <div class=\"col-sm-2\">" +
" <input id=\"contantid_" + basiCurveslist[i].id + "\"" +
" name=\"basicCurvelist[" + i + "].calculated_value\" type=\"text\"" +
" value=\"" + basiCurveslist[i].default_value + "\" required=\"true\"" +
" style=\"margin-top: 15px\" class=\"form-control\"/>" +
" <input id=\"contantvalue_" + basiCurveslist[i].id + "\"" +
" name=\"basicCurvelist[" + i + "].working_curve_id\" type=\"hidden\"" +
" style=\"margin-top: 1px\" value=\"" + basiCurveslist[i].id + "\" class=\"form-control\"/>" +
" <input id=\"contantvalue_" + basiCurveslist[i].id + "\" name=\"basicCurvelist[" + i + "].id\"" +
" type=\"hidden\"" +
" style=\"margin-top: 15px\" value=\"" + basiCurveslist[i].taskitemCureid + "\"" +
" class=\"form-control\"/>" +
" <span style=\"margin-left: 12em;margin-top: -2em;position: absolute\">" + basiCurveslist[i].unit + "</span>" +
" </div>";
}
// 有数据才显示
let length = contantCurveslist.length;
if (length > 0) {
htmlstr += " </div>" +
" <div class=\"form-group\" >" +
" <label class=\"col-sm-2 control-label\"> 常量:</label>" +
" </div>" +
" <div class=\"form-group\">";
}
console.log("contantCurveslistcontantCurveslistcontantCurveslist", contantCurveslist)
for (var i = 0; i < contantCurveslist.length; i++) {
contantCurveslist[i].default_value = contantCurveslist[i].defaultValue
htmlstr += " <label style=\"margin-top: 13px;\"" +
" class=\"col-sm-2 control-label\">" + contantCurveslist[i].mPoint.disname + "</label>" +
" <div class=\"col-sm-2\">" +
" <input id=\"contantid_" + contantCurveslist[i].id + "\"" +
" name=\"contantCurvelist[" + i + "].parmvalue\" type=\"text\"" +
" value=\"" + contantCurveslist[i].default_value + "\" required=\"true\"" +
" style=\"margin-top: 15px\" class=\"form-control\"/>" +
" <input id=\"contantvalue_" + contantCurveslist[i].id + "\"" +
" name=\"contantCurvelist[" + i + "].mpointcode\" type=\"hidden\"" +
" value=\"" + contantCurveslist[i].mPoint.mpointcode + "\" class=\"form-control\"/>" +
" <input id=\"contantvalue_" + contantCurveslist[i].id + "\" name=\"contantCurvelist[" + i + "].id\"" +
" type=\"hidden\" value=\"" + contantCurveslist[i].taskitemCureid + "\"" +
" class=\"form-control\"/>" +
contantCurveslist[i].mPoint.unit +
" </div>";
}
htmlstr += " </div>";
console.log("processCurveslist", processCurveslist)
for (var i = 0; i < processCurveslist.length; i++) {
htmlstr += // " <form class=\"form-horizontal\" id=\"processcurve"+i+"\" enctype=\"multipart/form-data\">" +
" <div class=\"form-group\">" +
" <label class=\"col-sm-4 control-label\"" +
" style=\"text-align: left\" >" + processCurveslist[i].mPoint.disname + "</label>" +
" <input type=\"hidden\" class=\"form-control\"" +
" name=\"processCurveslist[" + i + "].mpointcode\"" +
" value=\"" + processCurveslist[i].mPoint.mpointcode + "\"/>" +
" </div>" +
" <div class=\"form-group\">";
// 泥样取样体积
for (var j = 0; j < processCurveslist[i].mPoint.mPointPropSource.length; j++) {
var formuitem = processCurveslist[i].mPoint.mPointPropSource[j];
formuitem.mPoint.parmvalue = formuitem.mPoint.parmvalueStr
htmlstr += " <label class=\"col-sm-2 control-label\">" + formuitem.indexDetails + "</label>" +
" <div class=\"col-sm-2\">" +
" <input type=\"text\" class=\"form-control " + formuitem.mPoint.mpointid + " \" required=\"true\"" +
" id=\"processCurveslist[" + i + "].PointFormulalist[" + j + "].id\"" +
" name=\"processCurveslist[" + i + "].mPointFormulalist[" + j + "].MPoint.parmvalueStr\"" +
" value=\"" + formuitem.mPoint.parmvalueStr + "\" onchange=\"changeValue('processCurveslist[" + i + "].PointFormulalist[" + j + "].id','" + formuitem.mPoint.mpointid + "')\"/>" +
" <input type=\"hidden\" class=\"form-control\"" +
" name=\"processCurveslist[" + i + "].mPointFormulalist[" + j + "].mpid\"" +
" value=\"" + formuitem.mpid + "\"/>" +
" </div>";
}
htmlstr += " <label class=\"col-sm-2 control-label\" style=\"color: blue\"> " + processCurveslist[i].mPoint.disname + "</label>" +
" <div class=\"col-sm-2 modal-footer\" >" +
" <input type=\"text\" class=\"form-control\" id=\"" + processCurveslist[i].mPoint.mpointcode + "\"" +
// " required=\"true\"" +
" name=\"processCurveslist[" + i + "].default_value\" style=\"width: 64%;margin-left: 1em;\"" +
" value=\"" + processCurveslist[i].mPoint.remark + " \"/>" +
" </div>" +
" </div>";
}
console.log("curve", curve)
for (var i = 0; i < curve.length; i++) {
var item = curve[i];
htmlstr +=
" <div class=\"form-group\">" +
" <label class=\"col-sm-4 control-label\" style=\"text-align: left\">" + item.mPoint.disname + " </label>" +
" <input type=\"hidden\" class=\"form-control\"" +
" name=\"curves[" + i + "].mpointcode\"" +
" value=\"" + item.mPoint.mpointcode + "\"/>" +
" </div>" +
" <div class=\"form-group\">";
for (var j = 0; j < item.mPoint.mPointPropSource.length; j++) {
var formuitem = item.mPoint.mPointPropSource[j];
htmlstr += " <label class=\"col-sm-2 control-label\">" + formuitem.indexDetails + "</label>" +
" <div class=\"col-sm-2\">" +
" <input type=\"text\" class=\"form-control\"" +
" id=\"curves[" + i + "].PointFormulalist[" + j + "].id\"" +
" required=\"true\"" +
" name=\"curves[" + i + "].mPointFormulalist[" + j + "].MPoint.parmvalueStr\"" +
" value=\"" + formuitem.mPoint.parmvalueStr + "\"/>" +
" <input type=\"hidden\" class=\"form-control\"" +
" name=\"curves[" + i + "].mPointFormulalist[" + j + "].mpid\"" +
" value=\"" + formuitem.mpid + "\"/>" +
" </div>";
}
// 结果
htmlstr += " <label class=\"col-sm-2 control-label\" style=\"color: blue\"> " + item.mPoint.disname + "</label>" +
" <div class=\"col-sm-2 modal-footer\" >" +
" <input type=\"text\" class=\"form-control\" id=\"" + item.mPoint.mpointcode + "\" style=\"width: 64%;margin-left: 1em;\"" +
" name=\"curves[" + i + "].parmvalueStr\"" +
" value=\"" + item.mPoint.parmvalueStr + " \"/>" +
" <button id=\"jisuan\" + type=\"button\" onclick=\"formulaClick()\"" +
" class=\"btn btn-primary buttonclass\" style=\" margin-top: -4em;margin-left: 10em;\">计 算" +
" </button>" +
" </div>" +
" </div>";
}
htmlstr += " </form>";
//替换
var reg = new RegExp("undefined", "g");
htmlstr = htmlstr.replace(reg, "");
$("#contdiv").html(htmlstr);
// for (var j = 0; j < processCurveslist[i].mPoint.mPointPropSource.length; j++) {
// var formuitem = processCurveslist[i].mPoint.mPointPropSource[j];
// $("." + formuitem.mPoint.mpointid).on("change", function () {
// console.log($(this).val())
// })
// }
}
function changeValue(id, mpointid) {
// console.log(mpointid)
// console.log(id)
// console.log(document.getElementById(id).value)
$("."+mpointid).val(document.getElementById(id).value)
}
function closeModel() {
$("#tableFunList1").bootstrapTable('refresh');
closeModal('subEdit');
closeModal('subModal1');
$.post(ext.contextPath + '/whp/test/WhpSamplingPlanTaskTestConfirm/showTest.do', {id: bean.testConfirmId}, function (data) {
$("#subDiv").html(data);
// debugger;
openModal('subModal1');
});
}
function updataList6() {
//var process =processCurveslist;
//console.log(process);
// var jsonObj = $.parseJSON(process);
// var formids = "#editForm";
// var curves = curve;
// console.log("formids=="+formids);
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
/*for (var i = 0; i < process.length; i++) {
var datapre = new FormData($("#processcurve" + i)[0]);
for (var key of datapre.keys()) {
//console.log(datapre.get(key))
formData.set(key, datapre.get(key));
}
}
for (var i = 0; i < curves.length; i++) {
var datapre = new FormData($("#curveeditForm" + i)[0]);
for (var key of datapre.keys()) {
// console.log(datapre.get(key))
formData.set(key, datapre.get(key));
}
}
*/
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/updateResult.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
console.log(data)
},
error: function (data) {
// console.log(data+"fffff")
}
});
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/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) {
$("#tableFunList1").bootstrapTable('refresh');
// closeModal('subEdit');
nexttest();
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
// console.log(data+"fffff")
}
});
}
}
function updataList7() {
// var process =processCurveslist;
//console.log(process);
// var jsonObj = $.parseJSON(process);
// var formids = "#editForm";
//var curves = curve;
// console.log("formids=="+formids);
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
/* for (var i = 0; i < process.length; i++) {
var datapre = new FormData($("#processcurve" + i)[0]);
for (var key of datapre.keys()) {
//console.log(datapre.get(key))
formData.set(key, datapre.get(key));
}
}
for (var i = 0; i < curves.length; i++) {
var datapre = new FormData($("#curveeditForm" + i)[0]);
for (var key of datapre.keys()) {
// console.log(datapre.get(key))
formData.set(key, datapre.get(key));
}
}*/
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/updateResult.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
console.log(data)
},
error: function (data) {
// console.log(data+"fffff")
}
});
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/updatesubmint.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) {
//刷新样品 列表
//$("#tableFunList1").bootstrapTable('refresh');
closeModal('subEdit');
//刷新 我的任务列表
$("#tableTask").bootstrapTable('refresh');
closeModal('subModal1');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
// console.log(data+"fffff")
}
});
}
}
/* function calculateClick(formid) {
$("#"+formid).bootstrapValidator('validate');//提交验证
if ($("#"+formid).data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#"+formid)[0]);
// var formData1 = new FormData($("#editForm1")[0]);
// var formData2 = new FormData($("#editForm2")[0]);
// var forlist=formData+formData1+formData2
console.log(formData,'forlistforlist')
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/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) {
// $("#tableFunList1").bootstrapTable('refresh');
// closeModal('subEdit');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}*/
function formulaClick(val) {
// showWaitTipFn()
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
$('#jisuan').hide();
setTimeout(function () {
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/getJSResult.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
beforeSend: function () {
// simulateLongOperation()
},
success: function (data) {
console.log(data)
// hideWaitTipFn()
if (data.length > 0) {
for (let i = 0; i < data.length; i++) {
let content = data[i];
$("#" + content.mpid).val(content.value);
}
}
// $("#"+data.mpid).val(data.value)
$('#jisuan').show();
},
error: function (data) {
$('#jisuan').show();
}
});
}, 500);
$.ajax({
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskTestItem/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) {
// $("#tableFunList1").bootstrapTable('refresh');
// closeModal('subEdit');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
</script>
<div class="modal fade" id="subEdit">
<div class="modal-dialog " style="width: 75%">
<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-11 col-xs-13" id="contdiv">
<!-- 检测内容 -->
</div>
</div>
</div>
<div class="modal-footer" style="padding: 15px" id="btndiv">
<!-- 检测按钮 -->
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>