first commit

This commit is contained in:
2026-01-16 14:13:44 +08:00
commit 903ff8d495
34603 changed files with 8585054 additions and 0 deletions

View File

@ -0,0 +1,461 @@
<!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;
}
.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;
}
.table-hover > tbody > tr:hover {
cursor: pointer;
}
.input-clear-a {
color: white;
}
.input-content:hover + .input-clear-a {
color: #d4d4d4;
}
.labb::after{
width: 10px;
height: 10px;
background: red;
}
.labb {
border: 1px solid gray;
padding: 5px;
border-radius: 5px;
}
</style>
<script type="text/javascript">
$(function () {
initTime()
$('#AutomaticTime').val('');
//计划采样日期
$("#date").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
//要求报告日期
$("#reportDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
conditionDropDowntype()
initTable2()
});
//浏览列表内容刷新
function tableChange() {
$("#tableFun").bootstrapTable('refresh');
}
//采样车间刷新
function deptChange() {
var type = $("#sampleTypeId").val();
$.get(ext.contextPath + "/whp/baseinfo/WhpSampleType/getOne?id=" + type, function (data) {
$("#deptIds").val(data.result.deptIds);
$("#deptNames").val(data.result.deptNames);
}, 'json');
}
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${type}');
var selelct_1 = $("#sampleTypeId").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'});
// selelct_1.val('').trigger("change");
selelct_1.on("change", function (e) {
deptChange();
tableChange();
});
selelct_1.val(selelct_1Data[0].id).trigger("change")
}
function saveFun() {
$("#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/plan/WhpSamplingPlan/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: {
sampleTypeId: {
validators: {
notEmpty: {
message: '采样类型不能为空'
}
}
},
deptNames: {
validators: {
notEmpty: {
message: '采样车间不能为空'
}
}
},
date: {
trigger:"change",
validators: {
notEmpty: {
message: '计划采样日期不能为空'
}
}
},
reportDate: {
trigger:"change",
validators: {
notEmpty: {
message: '要求报告日期不能为空'
}
}
}
}
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function initTime() {
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
strDate = oldreservationtime1.substring(0, 16);
endDate = oldreservationtime1.substring(19, 36);
$('#AutomaticTime').val(oldreservationtime1);
} else {
strDate = moment().subtract(3, 'days').format('YYYY-MM-DD HH:mm');
endDate = moment().subtract(0, 'days').format('YYYY-MM-DD HH:mm');
$('#AutomaticTime').val(strDate + locale.separator + endDate);
}
$('#AutomaticTime').daterangepicker({
"timePicker": true,
"timePicker24Hour": true,
"linkedCalendars": false,
"autoUpdateInput": false,
"timePickerIncrement": 10,
"locale": locale,
//汉化按钮部分
// ranges: {
// // '今日': [moment(), moment().subtract(-1, 'days')],
// '昨日': [moment().subtract(1, 'days'), moment()],
// '最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')],
// '本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')],
// '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')]
// },
startDate: strDate,
endDate: endDate
}, function (start, end, label) {
strDate = start.format(this.locale.format);
endDate = end.format(this.locale.format);
if (!this.startDate) {
this.element.val('');
} else {
this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
}
});
};
var datedel = function () {
$('#AutomaticTime').val('');
strDate = null;
endDate = null;
};
function initTable2() {
var type = $("#sampleTypeId").val();
if (type == null || type === '') {
return;
}
$("#tableFun").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/baseinfo/WhpSampleCode/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
typeId: $("#sampleTypeId").val(),
status: 1
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
field: 'sampleTypeName', // 返回json数据中的name
title: '样品类别', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'prefix', // 返回json数据中的name
title: '前缀', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'address', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'addressCode', // 返回json数据中的name
title: '地点编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'isTest', // 返回json数据中的name
title: '是否检测', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if (value == true) {
return '检测';
} else {
return '不检测';
}
}
}, {
field: 'testItemNames', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
},
{
field: 'deptNames', // 返回json数据中的name
title: '采样车间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function timedelete() {
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 70%">
<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强制为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">
<select class="form-control" name="sampleTypeId" id="sampleTypeId"
style="width: 100%">
</select>
</div>
<%-- <label class="col-sm-2 control-label">* 采样车间:</label>--%>
<%-- <div class="col-sm-4">--%>
<%-- <input type="text" name="deptNames" id="deptNames" class="form-control"--%>
<%-- placeholder="">--%>
<%-- <input type="hidden" name="deptIds" id="deptIds" class="form-control"--%>
<%-- placeholder="">--%>
<%-- </div>--%>
</div>
<div class="form-group">
<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="date" name="date"
placeholder="请选择.." autocomplete="off"/>
</div>
</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="reportDate" name="reportDate"
placeholder="请选择.." autocomplete="off"/>
</div>
</div>
</div>
</form>
<table id="tableFun"></table>
</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>

View File

@ -0,0 +1,707 @@
<!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-clear-b {
color: grey;
}
.input-content:hover + .input-clear-a {
color: #d4d4d4;
}
.input-content:hover + .input-clear-b {
color: #d4d4d4;
}
.labb {
border: 1px solid gray;
padding: 5px;
border-radius: 5px;
display: block;
padding-right: 25px;
}
</style>
<script type="text/javascript">
$(function () {
conditionDropDowntype();
$("#date").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
$("#reportDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
// 自动下发截止日期
$("#autoplanEndDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
initTable2();
$('#table2').bootstrapTable({
onClickCell: function (field, value, row, $element) {
selectFun()
}
});
});
function showPeriodNo() {
var type = $("#type").val();
$.post(ext.contextPath + "/whp/plan/WhpSamplingPlan/periodNoList.do?typeId=" + type, function (data) {
var dataVal = []
for (var i = 0; i < data.length; i++) {
dataVal.push(data[i].text)
}
$("#dept").val(dataVal)
}, 'json');
}
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${type}');
var selelct_1 = $("#sampleTypeId").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'});
selelct_1.val('${bean.sampleTypeId}').trigger("change");
selelct_1.on("change", function (e) {
deptChange();
tableChange();
});
// selelct_1.val(selelct_1Data[0].id).trigger("change")
}
//采样车间刷新
function deptChange() {
var type = $("#sampleTypeId").val();
$.get(ext.contextPath + "/whp/baseinfo/WhpSampleType/getOne?id=" + type, function (data) {
$("#deptIds").val(data.result.deptIds);
$("#deptNames").val(data.result.deptNames);
}, 'json');
}
//浏览列表内容刷新
function tableChange() {
$("#table2").bootstrapTable('refresh');
}
var selectChange1 = function (val, id, index) {
let values = $('.form-control-isTest').eq(index).val()
console.log(values)
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/isTest.do?id=" + id + '&isTest=' + $('.form-control-isTest').eq(index).val(),
type: 'POST',
data: values,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
// console.log(data)
// if (data.code == 1) {
// showAlert('S', '修改成功!' + data.msg);
// } else {
// showAlert('d', '修改失败!' + data.msg);
// }
},
error: function (data) {
}
});
};
var deleteDFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanTask/dodeletes.do', {ids: id}, function (data) {
$("#table2").bootstrapTable('refresh');
});
}
});
};
function initTable2() {
var type = $("#sampleTypeId").val();
if (type == null || type === '') {
return;
}
$("#table2").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlanTask/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
planCode: '${bean.code}',
status: 0
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
checkbox: true, // 显示一个勾选框
},
{
field: 'sampleCode', // 返回json数据中的name
title: '样品编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'sampleAddress', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'deptNames', // 返回json数据中的name
title: '采样车间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'isTest', // 返回json数据中的name
title: '是否检测', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return '<select class="form-control-isTest select2" name="isTest" id="isTest\'' + index + '\'" onchange="selectChange1(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 69%; width: 69%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="' + value + '" > ' +
'<option value="1" ' + (value === true ? 'selected' : '') + '>检测</option> <option value="0" ' + (value === false ? 'selected' : '') + '>不检测</option>' +
'</select>'
}
}, {
field: 'testItemJson', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return '<select class="form-controlSE-testItemJson select2" name="testItemJson" onchange="selectChange(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 100%" value=""></select>'
}
},
{
title: "操作",
align: 'center',
valign: 'middle',
width: 60, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = '';
// buts += '<button class="btn btn-default btn-sm" title="平行飞样" onclick="addPXFY(\'' + row.id + '\')"><i class="fa fa-plus"></i><span class="hidden-md hidden-lg"> 平行飞样</span></button>';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteDFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function (data) { //加载成功时执行
adjustBootstrapTableView("table");
if (data.rows) {
data.rows.forEach((row, index) => {
var select_Data = []
try {
select_Data = JSON.parse('${whpTestItemDropDown}');
} catch (e) {
}
$('.form-controlSE-testItemJson').eq(index).select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
allowClear: true,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
multiple: true,
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
})
console.log("row.testItemIds", row.testItemIds)
$('.form-controlSE-testItemJson').eq(index).val(row.testItemIds.split(',')).trigger("change");
$('.form-controlSE-testItemJson').eq(index).on('change', (data) => {
let testTtemIds = $('.form-controlSE-testItemJson').eq(index).val();
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/testItems.do?id=" + row.id + '&testItemIds=' + (testTtemIds ? testTtemIds.join(',') : ''),
type: 'POST',
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
// console.log(data)
// if (data.code == 1) {
// showAlert('S', '保存成功!' + data.msg);
// } else {
// showAlert('d', '保存失败!' + data.msg);
// }
},
error: function (data) {
}
});
})
})
}
// selectFun()
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function addPXFY(id) {
$.ajax({
type: 'GET',
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/addPXFY.do",
async: false,
globle: false,
data: {
id: id
},
dataType: 'json',
error: function () {
return false;
},
success: function (data) {
if (data.code == 1) {
$("#table2").bootstrapTable('refresh');
} else if (data.code == 0) {
showAlert('d', data.msg);
}
}
});
}
function updateFun() {
$("#editForm").data("bootstrapValidator").updateStatus("deptNames", "NOT_VALIDATED", null).validateField("deptNames");
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlan/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() {
$("#editForm").data("bootstrapValidator").updateStatus("deptNames", "NOT_VALIDATED", null).validateField("deptNames");
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
if (!formData.get("isAutoPlan")) {
formData.set("isAutoPlan", 0)
} else {
formData.set("isAutoPlan", 1)
}
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlan/submit.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
$("#editForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
code: {
validators: {
notEmpty: {
message: '采样单编号不能为空'
}
}
},
sampleTypeId: {
validators: {
notEmpty: {
message: '采样类型不能为空'
}
}
},
date: {
trigger: "change",
validators: {
notEmpty: {
message: '计划采样日期不能为空'
}
}
},
reportDate: {
trigger: "change",
validators: {
notEmpty: {
message: '要求报告日期不能为空'
}
}
},
deptNames: {
validators: {
notEmpty: {
message: '采样车间不能为空'
}
}
}
}
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function deletesFunD() {
var checkedItems = $("#table2").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanTask/dodeletes.do', {ids: datas}, function (data) {
if (data.code == 1) {
$("#table2").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, "json");
}
});
}
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 70%">
<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="code" id="code" class="form-control"
readonly value="${bean.code}">
<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">
<select class="form-control" name="sampleTypeId" id="sampleTypeId" readonly
disabled="true" 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">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="date" name="date"
value="${bean.date.substring(0,10)} " autocomplete="off"/>
</div>
</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="reportDate" name="reportDate"
value="${bean.reportDate.substring(0,10)}" placeholder="请选择.."
autocomplete="off"/>
</div>
</div>
</div>
<%-- <div class="form-group">--%>
<%-- <label class="col-sm-2 control-label ">* 采样车间:</label>--%>
<%-- <div class="col-sm-4 ">--%>
<%-- <input type="text" name="deptNames" id="deptNames" class="form-control"--%>
<%-- value="${bean.deptNames} " placeholder="">--%>
<%-- <input type="hidden" name="deptIds" id="deptIds" class="form-control"--%>
<%-- value="${bean.deptIds} " placeholder="">--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="form-group">
<input type="checkbox" class="form-checkbox" value="1" name="isAutoPlan" id="isAutoPlan"
style="margin-left: 19px;margin-top: 7px;"/>
<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="autoplanEndDate"
name="autoplanEndDate"
placeholder="请选择.." autocomplete="off"/>
</div>
</div>
<label class="col-sm-2 control-label">间隔类型: </label>
<div class="col-sm-4">
<div class="input-group">
<input type="text" readonly value="${bean.samplingPeriodName}"
class="form-control"/>
<input type="hidden" readonly value="${bean.samplingPeriodCode}"
class="form-control" id="amplingPeriod" name="amplingPeriod"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">间隔时间: </label>
<div class="col-sm-4">
<div class="input-group">
<input type="text" readonly value="${bean.intervalDay}" class="form-control"/>
</div>
</div>
</div>
</form>
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
<button type="button" class="btn btn-default btn-sm" onclick="deletesFunD();"><i
class="fa fa-trash-o"></i> 删除
</button>
</div>
<table id="table2"></table>
</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>

View File

@ -0,0 +1,653 @@
<%@ 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="com.sipai.entity.sparepart.SparePartCommString" %>
<%request.setAttribute("AUDIT", SparePartCommString.STATUS_STOCK_AUDIT); %>
<%request.setAttribute("START", SparePartCommString.STATUS_STOCK_START); %>
<%request.setAttribute("FINISH", SparePartCommString.STATUS_STOCK_FINISH); %>
<%request.setAttribute("FAIL", SparePartCommString.STATUS_STOCK_FAIL); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<!--bootstrap-edittable 表格行内编辑 -->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-editable/css/bootstrap-editable.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-editable/js/bootstrap-editable.js"
charset="utf-8"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-editable/js/bootstrap-table-editable.js"
charset="utf-8"></script>
<style type="text/css">
.main-header {
display: none;
}
.content-header {
display: none;
}
.main-footer {
display: none;
}
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
.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">
var timeEnd;
var timeBegin;
var timeRangeEnd;
var timeRangeBegin;
$(function () {
conditionDropDowntype();
conditionDropDownstatus();
conditionDropDownisAutoPlanStatus();
initTableList();
initDate1();
initDate2();
$('#reservationtimeD').val('');
$('#repotDateFun').val('');
timeEnd = null;
timeBegin = null;
timeRangeEnd = null;
timeRangeBegin = null;
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function initDate2() {
var locale = {
"format": 'YYYY-MM-DD ',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
timeBegin = oldreservationtime1.substring(0, 16);
timeEnd = oldreservationtime1.substring(19, 36);
$('#repotDateFun').val(oldreservationtime1);
} else {
timeBegin = moment().subtract(3, 'days').format('YYYY-MM-DD');
timeEnd = moment().subtract(0, 'days').format('YYYY-MM-DD');
// $('#repotDateFun').val(timeBegin + locale.separator + timeEnd);
}
// $('#repotDateFun').daterangepicker({
// "timePicker": true,
// "timePicker24Hour": true,
// "linkedCalendars": false,
// "autoUpdateInput": false,
// "timePickerIncrement": 10,
// "locale": locale,
// //汉化按钮部分
// // ranges: {
// // // '今日': [moment(), moment().subtract(-1, 'days')],
// // '昨日': [moment().subtract(1, 'days'), moment()],
// // '最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')],
// // '本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')],
// // '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')]
// // },
// startDate: timeBegin,
// endDate: timeEnd
// }, function (start, end, label) {
//
// timeBegin = start.format(this.locale.format);
// timeEnd = end.format(this.locale.format);
// if (!this.startDate) {
// this.element.val('');
// } else {
// this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
// }
// });
// $('#repotDateFun').on('apply.daterangepicker', function(ev, picker) {
// console.log(11111111111,ev, picker)
// });
$('#repotDateFun').daterangepicker({
"locale": locale,
"startDate": timeBegin,
"endDate": timeEnd
}, function (start, end, label) {
timeBegin = start.format(this.locale.format);
timeEnd = end.format(this.locale.format);
});
};
var timedelete = function () {
$('#repotDateFun').val('');
timeEnd = null;
timeBegin = null;
};
function initDate1() {
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
timeRangeBegin = oldreservationtime1.substring(0, 16);
timeRangeEnd = oldreservationtime1.substring(19, 36);
$('#reservationtimeD').val(oldreservationtime1);
} else {
timeRangeBegin = moment().subtract(3, 'days').format('YYYY-MM-DD');
timeRangeEnd = moment().subtract(0, 'days').format('YYYY-MM-DD');
$('#reservationtimeD').val(timeRangeBegin + locale.separator + timeRangeEnd);
}
$('#reservationtimeD').daterangepicker({
// "timePicker": true,
// "timePicker24Hour": true,
// "linkedCalendars": false,
// "autoUpdateInput": false,
// "timePickerIncrement": 10,
"locale": locale,
startDate: timeRangeBegin,
endDate: timeRangeEnd
}, function (start, end, label) {
timeRangeBegin = start.format(this.locale.format);
timeRangeEnd = end.format(this.locale.format);
});
};
var timedel = function () {
$('#reservationtimeD').val('');
timeRangeEnd = null;
timeRangeBegin = null;
};
var addFun = function () {
$("#searchForm").bootstrapValidator('validate');//提交验证
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/add.do', {unitId: unitId}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//详情弹窗
var viewFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/view.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//样品列表
var settingFun = function (id) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanItem/showList.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//编辑页面
var editFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/edit.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
// 打印
var printFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/print.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/deletes.do', {ids: id}, function (data) {
if (data.code === 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, "json");
}
});
};
var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/deletes.do', {ids: datas}, function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, "json");
}
});
}
};
var dosearch = function () {
$("#table").bootstrapTable('refresh');
};
var companyId_rawMaterial = "";
var initTableList = function () {
timeEnd = null;
timeBegin = null;
timeRangeEnd = null;
timeRangeBegin = null;
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlan/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
dateBegin: timeRangeBegin,
dateEnd: timeRangeEnd,
reportDateBegin: timeBegin,
reportDateEnd: timeEnd,
status: $('#status').val(),
isAutoPlan: $('#isAutoPlanStatus').val(),
sampleTypeId: $('#sampleTypeIdForListQuery').val()
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
checkbox: true, // 显示一个勾选框
},
{
field: 'isAutoPlan', // 返回json数据中的name
title: '是否自动下发', // 表格表头显示文字
width: 50,
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
if (value == 1) {
return '√';
} else {
return '';
}
}
},
{
field: 'code', // 返回json数据中的name
title: '采样单编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',// 上下居中
formatter: function (value, row) {
if (row.playType == 1) {
return '(车间)' + value;
} else {
return value;
}
}
}, {
field: 'date', // 返回json数据中的name
title: '计划采样日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return value.substring(0, 10);
}
}, {
field: 'sampleTypeName', // 返回json数据中的name
title: '采样类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'reportDate', // 返回json数据中的name
title: '要求报告日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return value.substring(0, 10);
}
}, {
field: 'statusName', // 返回json数据中的name
title: '计划状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
if (row.statusName.includes("超时预警")) {
return '<span style="color:red">' + value + '</span>'
} else {
return value
}
}
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: 160, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = '';
if (row.status == 1) {
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
} else {
buts += '<button class="btn btn-default btn-sm" title="详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 详情</span></button>';
buts += '<button class="btn btn-default btn-sm" title="打印" onclick="printFun(\'' + row.id + '\')"><i class="glyphicon glyphicon-print"></i><span class="hidden-md hidden-lg"> 打印</span></button>';
}
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function conditionDropDownstatus() {
var select_Data = jQuery.parseJSON('${status}');
var select_3 = $("#status").select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
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('').trigger('change');
}
function conditionDropDownisAutoPlanStatus() {
var select_Data = jQuery.parseJSON('${isAutoPlanStatus}');
var select_3 = $("#isAutoPlanStatus").select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
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('').trigger('change');
}
function conditionDropDowntype() {
var select_Data = jQuery.parseJSON('${type}');
var select_3 = $("#sampleTypeIdForListQuery").select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
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('').trigger('change');
}
</script>
</head>
<body class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<div class="content-wrapper">
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="TtemWorking"></div>
<div id="subEditDiv"></div>
<div id="subDetailDiv"></div>
<div id="PRDetail4SelectsDiv"></div>
<div id="user4SelectDiv"></div>
<div id="Goods4SelectsDiv"></div>
<div id="fileInputDiv"></div>
<div id="goodsAddDiv"></div>
<div id="equ4SelectDiv"></div>
<div id="fault4SelectDiv"></div>
<div id="unit4SelectDiv"></div>
<form id="searchForm">
<div>
<div class="form-group" style="padding:0;">
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"
style="margin-right: 15px"><i
class="fa fa-plus"></i> 新增
</button>
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
class="fa fa-trash-o"></i> 删除
</button>
</div>
<div class="form-group pull-right form-inline">
<div class="form-group">
<label class="form-label">采样类型:</label>
<select class="form-control select2" name="sampleTypeIdForListQuery"
id="sampleTypeIdForListQuery"
style="width:150px;height: 30px">
</select>
<label class="form-label">计划状态:</label>
<select class="form-control select2" name="status" id="status"
style="width:150px;height: 30px">
</select>
<label class="form-label">自动下发:</label>
<select class="form-control select2" id ="isAutoPlanStatus" name="isAutoPlanStatus"
style="width:150px;height: 30px">
</select>
</div>
<div class="form-group">
<label class="form-label">计划采样日期:</label>
<div class="input-group input-group-sm" style="width: 200px;">
<input type="text" autocomplete="off" class="form-control pull-left"
style="height: 30px; width: 240px; border-radius: 4px;" id="reservationtimeD"
placeholder="请选择计划采样日期范围">
<a class="glyphicon glyphicon-remove btn form-control-feedback input-clear-a"
style="pointer-events: auto;"
onclick="timedel()"></a>
</div>
<label class="form-label">要求报告日期:</label>
<div class="input-group input-group-sm" style="width: 200px;">
<input type="text" autocomplete="off" class="form-control pull-left"
style="height: 30px; width: 240px; border-radius: 4px;" id="repotDateFun"
placeholder="请选择要求报告日期范围">
<a class="glyphicon glyphicon-remove btn form-control-feedback input-clear-a"
style="pointer-events: auto;"
onclick="timedelete()"></a>
</div>
</div>
<div class="input-group input-group-sm">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<table id="table"></table>
</section>
<!-- /.content -->
</div>
</div>
</body>
<!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/commonFileUpload.js" charset="utf-8"></script>
<!-- 引入daterangepicker-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
charset="utf-8"></script>
</html>

View File

@ -0,0 +1,283 @@
<%--<%String serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();%>--%>
<%--<%String contextPath = request.getContextPath();%>--%>
<!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" %>
<%String serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();%>
<%String contextPath = request.getContextPath();%>
<style type="text/css">
table.wTable {
margin-top: 15px;
/*border-collapse:collapse;*/
/*border:1px solid #aaa;*/
width: 100%;
margin: 0 auto;
}
table.wTable th {
vertical-align: baseline;
padding: 5px 15px 5px 6px;
background-color: #3F3F3F;
border: 1px solid #3F3F3F;
text-align: left;
color: #fff;
}
table.wTable td {
vertical-align: text-top;
padding: 6px 15px 6px 6px;
border: 1px solid #aaa;
}
table.wTable tr:nth-child(odd) {
background-color: #F5F5F5;
}
table.wTable tr:nth-child(even) {
background-color: #fff;
}
</style>
<script type="text/javascript">
$(function () {
});
function updateSaveFun() {
console.log(11111)
var paramString = ""
// paramString = "liquidWasteType=" + $('#typeCondition').val()
paramString = "liquidWasteType=" + "全部";
// var status = $('#statusCondition').val();
var status = 1;
if (status != null) {
paramString = "&status=" + status
}
// var likeString = "$('#likeString').val();"
var likeString = "";
if (likeString != null && likeString != '') {
paramString = "&likeString=" + likeString
}
// window.open(ext.contextPath + "/whp/liquidWasteDispose/WhpLiquidWasteDispose/export.do?" + paramString);
$.ajax({
url: ext.contextPath + '/whp/liquidWasteDispose/WhpLiquidWasteDispose/export.do?' + paramString,
type: 'POST',
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 printSaveFun(myDiv) {
$('#printContext').show();
/* var printHtml = document.getElementById(myDiv).innerHTML;
var wind = window.open("", "newwin", "width=1550,height=565,top=80,left=80,toolbar=no,scrollbars=yes,menubar=no");
var link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = '
<%=serverPath%><%=contextPath%>/plugins/bootstrap-ext/dist/bootstrap.min.css';
wind.document.head.appendChild(link);
wind.document.body.innerHTML = printHtml;
wind.print();
wind.close();
*/
var win = window.open('', 'printwindow', "width=1550,height=565,top=80,left=80,toolbar=no,scrollbars=yes,menubar=no");
win.document.write('<html><head><link rel="stylesheet" type="text/css" href="<%=serverPath%><%=contextPath%>/plugins/bootstrap-ext/dist/bootstrap.min.css"></head><body>');
win.document.write($("#printContext").html());
win.document.write('</body></html>');
win.print();
win.close();
// $('#printContext').hide();
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog" style="width: 85%">
<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 id="printContext">
<style type="text/css">
.main-header {
display: none;
}
/*.content-header{display:none;}*/
.main-footer {
display: none;
}
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
/*.select2-selection__arrow{*/
/*margin-top:3px;*/
/*}*/
.sampling {
margin: 0 auto;
border-collapse: collapse;
/* border: 0.5px solid black; */
width: 1000px;
}
.sampling th {
text-align: center;
font-size: 32px;
line-height: 80px;
}
.sampling td {
border: 0.5px solid black;
line-height: 2em;
word-wrap: break-word;
word-break: break-all;
}
.sampling .content {
text-align: center;
}
.sampling .title {
font-weight: bold;
}
.sampling .indent {
/* text-indent: 1em; */
padding: 2px 5px;
}
</style>
<div class="modal-body">
<%--  --%>
<h2 style="text-align: center">${data.header}</h2>
<h3 style="text-align: center">采样单</h3>
<h4 style="text-align: right;padding-right: 8em">编号:${data.sn}</h4>
<table>
<table class="sampling">
<tr>
<td colspan="4" class="title">采样单编号</td>
<td colspan="4" class="indent">${bean.code}</td>
<td colspan="4" class="hidden" style="display: none;">${bean.id}</td>
<td colspan="4" class="title">采样类型</td>
<td colspan="4" class="indent">${bean.sampleTypeName}</td>
</tr>
<tr>
<td colspan="4" class="title">计划采样日期</td>
<td colspan="4" class="indent">${bean.date.substring(0,10)}</td>
<td colspan="4" class="title">要求报告日期</td>
<td colspan="4" class="indent">${bean.reportDate.substring(0,10)}</td>
</tr>
<tr>
<td colspan="4" class="title">采样人</td>
<td colspan="4" class="indent">${data.samplingUserNameStr}</td>
<td colspan="4" class="title">收样人</td>
<td colspan="4" class="indent">${bean.acceptUserName}</td>
</tr>
<tr class="content title">
<td colspan="1">序号</td>
<td colspan="3">样品编号</td>
<td colspan="2">地点</td>
<td colspan="2">是否检测</td>
<td colspan="4">检测项目</td>
<%-- <td colspan="2">采样人</td>--%>
<td colspan="2">采样日期</td>
</tr>
<c:forEach items="${taskList}" var="item" varStatus="status">
<tr>
<td class="content" colspan="1" width="6.25%">${status.count}</td>
<td class="content" colspan="3" width="18.75%">${item.sampleCode}</td>
<td class="indent" colspan="2" width="12.5%">${item.sampleAddress}</td>
<td class="content" colspan="2"
width="12.5%">${item.isTest ? '√' : '×'}</td>
<td class="indent" colspan="4" width="25%">${item.testItemIds}</td>
<%-- <td class="content" colspan="2" width="12.5%">${item.samplingUserName}</td>--%>
<td class="content" colspan="2"
width="12.5%">${item.samplingTime.substring(0,10)}</td>
</tr>
</c:forEach>
</table>
<table class="sampling" id="wTable" bordercolor="black"
border="1" cellpadding="0" cellpadding="2" width="70%" style="border-top: none">
<%-- <thead>--%>
<%-- <tr>--%>
<%-- <th><h4 style="text-align: left;"> 备注:</h4></th>--%>
<%-- </tr>--%>
<%-- </thead>--%>
<tbody>
<tr>
<td>
<div contenteditable="true">${data.remark}</div>
</td>
</tr>
</tbody>
</table>
</table>
</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="printSaveFun('printContext')">打印
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

View File

@ -0,0 +1,533 @@
<!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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,211 @@
<!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;
}
.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;
}
</style>
<script type="text/javascript">
$(function () {
initTable2();
});
function initTable2() {
$("#table2").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlanTask/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
planCode: '${bean.planCode}',
status: 1
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
field: 'sampleCode', // 返回json数据中的name
title: '样品编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'sampleAddress', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'isTest', // 返回json数据中的name
title: '是否检测', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if (value == true) {
return '√';
} else {
return '×';
}
}
}, {
field: 'testItemNames', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}
],
onLoadSuccess: function (data) { //加载成功时执行
adjustBootstrapTableView("table");
// selectFun()
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function SavedataFun() {
// console.log($("#addForm").serialize());
$("#addForm").bootstrapValidator('validate');//提交验证
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#addForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/confirm.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 65%">
<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="addForm" enctype="multipart/form-data">
<div id="alertDiv"></div>
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
<!-- 界面提醒div强制id为alertdiv -->
<input type="hidden" name="id" id="id" class="form-control" value="${bean.id}">
<div class="form-group">
<label class="col-sm-2 control-label">* 样品编号:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.sampleCode}</p>
</div>
<label class="col-sm-2 control-label">* 采样车间:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.deptNames}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">* 计划采样日期:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.planDate.substring(0,10)}</p>
</div>
<label class="col-sm-2 control-label">* 要求报告日期:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.reportDate.substring(0,10)}</p>
</div>
</div>
</form>
<table id="table2"></table>
</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="SavedataFun()">确定
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

View File

@ -0,0 +1,324 @@
<!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;
}
.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;
}
</style>
<script type="text/javascript">
$(function () {
samplingEnvConditionDropDownList()
sampleAppearanceConditionDropDownList()
sampleSupernatantDropDownlist();
sampleNatureDropDownList();
conditionDropDowntype()
});
//样品状态
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'});
selelct_1.val('${bean.sampleState}').trigger("change");
selelct_1.on("change", function (e) {
deptChange();
});
}
//样品数量刷新
function deptChange() {
var type = $("#sampleState").val();
if (type==1){
$("#sampleAmountunit").text('ml')
} else {
$("#sampleAmountunit").text('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'});
//单选赋值
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'});
//单选赋值
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('').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");
}
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 65%">
<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 -->
<input type="hidden" name="id" id="id" class="form-control" value="${bean.id}">
<div class="form-group">
<label class="col-sm-2 control-label">* 样品编号:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.sampleCode}</p>
</div>
<label class="col-sm-2 control-label">* 地点:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.sampleAddress}</p>
</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"
disabled="true" 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"
disabled="true" 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"
disabled="true" 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"
disabled="true" 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"
disabled="true" style="width: 100%;height: 34px">
</select>
</div>
<label class="col-sm-2 control-label">* 样品数量:</label>
<div class="col-sm-4">
<p class="form-control-static" style="width: 13%; float: left;">${bean.sampleAmount}</p>
<label name="sampleAmountunit" id="sampleAmountunit"
style="padding-top: 7px;">${bean.unit} </label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">* 采样人:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.samplingUserName}</p>
</div>
<label class="col-sm-2 control-label">* 采样时间:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.samplingTime.substring(0,10)}</p>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default " data-dismiss="modal">关闭
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

View File

@ -0,0 +1,278 @@
<!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;
}
.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;
}
</style>
<script type="text/javascript">
var plan;
$(function () {
<%--plan = ${bean}--%>
conditionDropDowntype();
initTable3()
});
var cancelFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要撤销此采样任务?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (val) {
if (val) {
console.log()
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/docancel.do', {id: '${bean.id}'}, function (data) {
if (data.code === 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
} else {
showAlert('d', '撤销失败', + data.msg);
}
}, "json");
}
});
};
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${type}');
var selelct_1 = $("#sampleTypeId").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'});
selelct_1.val('${bean.sampleTypeId}').trigger("change");
selelct_1.on("change", function (e) {
/*if (data99.deptId !== undefined) {
$("#rhistorytable").bootstrapTable('refresh');
}*/
});
//selelct_1.val('${bean.code}').trigger("change")
}
function initTable3() {
// var type = $("#sampleTypeId").val();
// if (type == null || type === '') {
// return;
// }
$("#table3").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlanTask/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
planCode: '${bean.code}'
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
field: 'sampleCode', // 返回json数据中的name
title: '样品编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'sampleAddress', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
},{
field: 'deptNames', // 返回json数据中的name
title: '采样车间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'isTest', // 返回json数据中的name
title: '是否检测', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if (value == true) {
return '√';
} else {
return '×';
}
}
}, {
field: 'testItemNames', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center' // 左右居中
}
],
onLoadSuccess: function (data) { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 65%">
<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 -->
<input type="hidden" name="id" id="id" class="form-control" value="${bean.id}">
<div class="form-group">
<label class="col-sm-2 control-label">* 采样单编号:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.code}</p>
</div>
<label class="col-sm-2 control-label">* 计划采样日期:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.date.substring(0,10)}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">* 采样类型:</label>
<div class="col-sm-4">
<select class="form-control" name="sampleTypeId" id="sampleTypeId"
disabled="true" style="width: 100%;height: 34px">
</select>
</div>
<label class="col-sm-2 control-label">* 要求报告日期:</label>
<div class="col-sm-4">
<p class="form-control-static">${bean.reportDate.substring(0,10)}</p>
</div>
</div>
<div class="form-group">
<%-- <label class="col-sm-2 control-label">* 采样车间:</label>--%>
<%-- <div class="col-sm-4">--%>
<%-- <p class="form-control-static">${bean.deptNames}</p>--%>
<%-- </div>--%>
<label class="col-sm-2 control-label"></label>
<div class="col-sm-4">
<c:if test='${bean.isAutoPlan == 1}'>
<button type="button" class="btn btn-default " data-dismiss="modal"
onclick="cancelFun()">采样任务撤销
</button>
</c:if>
</div>
</div>
</form>
<table id="table3"></table>
</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="updateSaveFun()">保存
</button>--%>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

View File

@ -0,0 +1,446 @@
<!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;
}
.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;
}
.table-hover > tbody > tr:hover {
cursor: pointer;
}
.input-clear-a {
color: white;
}
.input-content:hover + .input-clear-a {
color: #d4d4d4;
}
.labb::after{
width: 10px;
height: 10px;
background: red;
}
.labb {
border: 1px solid gray;
padding: 5px;
border-radius: 5px;
}
</style>
<script type="text/javascript">
$(function () {
initTime()
$('#AutomaticTime').val('');
//计划采样日期
$("#date").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
//要求报告日期
$("#reportDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
conditionDropDowntype()
initTable2()
});
//浏览列表内容刷新
function tableChange() {
$("#tableFun").bootstrapTable('refresh');
}
//采样车间刷新
function deptChange() {
var type = $("#sampleTypeId").val();
$.get(ext.contextPath + "/whp/baseinfo/WhpSampleType/getOne?id=" + type, function (data) {
$("#deptIds").val(data.result.deptIds);
$("#deptNames").val(data.result.deptNames);
}, 'json');
}
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${type}');
var selelct_1 = $("#sampleTypeId").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'});
// selelct_1.val('').trigger("change");
selelct_1.on("change", function (e) {
deptChange();
tableChange();
});
selelct_1.val(selelct_1Data[0].id).trigger("change")
}
function saveFun() {
$("#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/plan/WhpSamplingPlan/workSave.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: {
sampleTypeId: {
validators: {
notEmpty: {
message: '采样类型不能为空'
}
}
},
deptNames: {
validators: {
notEmpty: {
message: '采样车间不能为空'
}
}
},
date: {
trigger:"change",
validators: {
notEmpty: {
message: '计划采样日期不能为空'
}
}
},
reportDate: {
trigger:"change",
validators: {
notEmpty: {
message: '要求报告日期不能为空'
}
}
}
}
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function initTime() {
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
strDate = oldreservationtime1.substring(0, 16);
endDate = oldreservationtime1.substring(19, 36);
$('#AutomaticTime').val(oldreservationtime1);
} else {
strDate = moment().subtract(3, 'days').format('YYYY-MM-DD HH:mm');
endDate = moment().subtract(0, 'days').format('YYYY-MM-DD HH:mm');
$('#AutomaticTime').val(strDate + locale.separator + endDate);
}
$('#AutomaticTime').daterangepicker({
"timePicker": true,
"timePicker24Hour": true,
"linkedCalendars": false,
"autoUpdateInput": false,
"timePickerIncrement": 10,
"locale": locale,
//汉化按钮部分
// ranges: {
// // '今日': [moment(), moment().subtract(-1, 'days')],
// '昨日': [moment().subtract(1, 'days'), moment()],
// '最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')],
// '本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')],
// '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')]
// },
startDate: strDate,
endDate: endDate
}, function (start, end, label) {
strDate = start.format(this.locale.format);
endDate = end.format(this.locale.format);
if (!this.startDate) {
this.element.val('');
} else {
this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
}
});
};
var datedel = function () {
$('#AutomaticTime').val('');
strDate = null;
endDate = null;
};
function initTable2() {
var type = $("#sampleTypeId").val();
if (type == null || type === '') {
return;
}
$("#tableFun").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/baseinfo/WhpSampleCode/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
typeId: $("#sampleTypeId").val(),
status: 1
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
field: 'sampleTypeName', // 返回json数据中的name
title: '样品类别', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'prefix', // 返回json数据中的name
title: '前缀', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'address', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'addressCode', // 返回json数据中的name
title: '地点编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'testItemNames', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function timedelete() {
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 70%">
<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强制为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">
<select class="form-control" name="sampleTypeId" id="sampleTypeId"
style="width: 100%">
</select>
<input type="hidden" name="playType" id="playType" class="form-control"
value="1">
</div>
<label class="col-sm-2 control-label">* 采样车间:</label>
<div class="col-sm-4">
<input type="text" name="deptNames" id="deptNames" class="form-control"
placeholder="">
<input type="hidden" name="deptIds" id="deptIds" class="form-control"
placeholder="">
</div>
</div>
<div class="form-group">
<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="date" name="date"
placeholder="请选择.." autocomplete="off"/>
</div>
</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="reportDate" name="reportDate"
placeholder="请选择.." autocomplete="off"/>
</div>
</div>
</div>
</form>
<table id="tableFun"></table>
</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>

View File

@ -0,0 +1,655 @@
<!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-clear-b {
color: grey;
}
.input-content:hover + .input-clear-a {
color: #d4d4d4;
}
.input-content:hover + .input-clear-b {
color: #d4d4d4;
}
.labb {
border: 1px solid gray;
padding: 5px;
border-radius: 5px;
display: block;
padding-right: 25px;
}
</style>
<script type="text/javascript">
$(function () {
conditionDropDowntype();
$("#date").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
$("#reportDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
initTable2();
$('#table2').bootstrapTable({
onClickCell: function (field, value, row, $element) {
selectFun()
}
});
});
function showPeriodNo() {
var type = $("#type").val();
$.post(ext.contextPath + "/whp/plan/WhpSamplingPlan/periodNoList.do?typeId=" + type, function (data) {
var dataVal = []
for (var i = 0; i < data.length; i++) {
dataVal.push(data[i].text)
}
$("#dept").val(dataVal)
}, 'json');
}
function conditionDropDowntype() {
var selelct_1Data = jQuery.parseJSON('${type}');
var selelct_1 = $("#sampleTypeId").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'});
selelct_1.val('${bean.sampleTypeId}').trigger("change");
selelct_1.on("change", function (e) {
deptChange();
tableChange();
});
// selelct_1.val(selelct_1Data[0].id).trigger("change")
}
//采样车间刷新
function deptChange() {
var type = $("#sampleTypeId").val();
$.get(ext.contextPath + "/whp/baseinfo/WhpSampleType/getOne?id=" + type, function (data) {
$("#deptIds").val(data.result.deptIds);
$("#deptNames").val(data.result.deptNames);
}, 'json');
}
//浏览列表内容刷新
function tableChange() {
$("#table2").bootstrapTable('refresh');
}
var selectChange1 = function (val, id, index) {
let values = $('.form-control-isTest').eq(index).val()
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/isTest.do?id=" + id + '&isTest=' +$('.form-control-isTest').eq(index).val(),
type: 'POST',
data: values,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
// console.log(data)
// if (data.code == 1) {
// showAlert('S', '修改成功!' + data.msg);
// } else {
// showAlert('d', '修改失败!' + data.msg);
// }
},
error: function (data) {
}
});
};
/*var deleteFun = function(id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete){
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanTask/dodeletes.do', {ids : id}, function(data) {
if(data==1){
$("#table").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','mainAlertdiv');
}
});
}
});
};
*/
function initTable2() {
var type = $("#sampleTypeId").val();
if (type == null || type === '') {
return;
}
$("#table2").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlanTask/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
planCode: '${bean.code}',
planType:1 //,
//status: 0
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
field: 'sampleCode', // 返回json数据中的name
title: '样品编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' ,// 上下居中
formatter:function(value,row,index,field){
var span=document.createElement('span');
span.setAttribute('title',"采样人:"+row.samplingUserName+"(采样时间:"+row.samplingTime.substring(0,10)+";备注:"+row.notes+")");
span.innerHTML=value;
return span.outerHTML;
}
}, {
field: 'sampleAddress', // 返回json数据中的name
title: '地点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'isTest', // 返回json数据中的name
title: '是否检测', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return '<select class="form-control-isTest select2" name="isTest" id="isTest\'' + index + '\'" onchange="selectChange1(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 69%; width: 69%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="'+value+'" > ' +
'<option value="1" '+(value===true?'selected':'')+'>检测</option> <option value="0" '+ (value===false?'selected':'')+'>不检测</option>' +
'</select>'
}
}, {
field: 'isSample', // 返回json数据中的name
title: '是否采样', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter:function (value,row,index) {
if (value==1)
{
return '<a class="btn btn-primary btn-sm btn-flat" onclick="editFun1(\'' + row.id + '\')">已采样</a>';
// return '<a claass="btn btn-default btn-sm" title="" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 已采样</span></>';
}else{
return '<a class="btn btn-primary btn-sm btn-flat" onclick="editFun1(\'' + row.id + '\')">未采样</a>';
/* return '<a class="btn btn-default btn-sm" title="" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 未采样</span></a>';*/
}
}
}, {
field: 'testItemJson', // 返回json数据中的name
title: '检测项目', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return '<select class="form-controlSE-testItemJson select2" name="testItemJson" onchange="selectChange(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 100%" value=""></select>'
}
}
],
onLoadSuccess: function (data) { //加载成功时执行
adjustBootstrapTableView("table");
if(data.rows){
data.rows.forEach((row,index)=>{
var select_Data = []
try{
select_Data =JSON.parse('${whpTestItemDropDown}');
}catch (e) {
}
$('.form-controlSE-testItemJson').eq(index).select2({
data:select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
allowClear: true,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
multiple: true,
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
})
console.log("row.testItemIds",row.testItemIds)
$('.form-controlSE-testItemJson').eq(index).val(row.testItemIds.split(',')).trigger("change");
$('.form-controlSE-testItemJson').eq(index).on('change',(data)=>{
let testTtemIds = $('.form-controlSE-testItemJson').eq(index).val();
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/testItems.do?id=" + row.id + '&testItemIds='+(testTtemIds?testTtemIds.join(','):''),
type: 'POST',
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
// console.log(data)
// if (data.code == 1) {
// showAlert('S', '保存成功!' + data.msg);
// } else {
// showAlert('d', '保存失败!' + data.msg);
// }
},
error: function (data) {
}
});
})
})
}
// selectFun()
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function updateFun() {
$("#editForm").data("bootstrapValidator").updateStatus("deptNames","NOT_VALIDATED", null).validateField("deptNames");
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlan/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() {
$("#editForm").data("bootstrapValidator").updateStatus("deptNames","NOT_VALIDATED", null).validateField("deptNames");
$("#editForm").bootstrapValidator('validate');//提交验证
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editForm")[0]);
var allrows = $("#table2").bootstrapTable('getData');
var falg=true;
for(let i=0;i<allrows.length;i++)
{
if(allrows[i].isSample==0&&allrows[i].isTest==true)
{
falg=false;
break;
}
}
if(!falg)
{
swal({
text: "还有未采样的样品, 确定需要提交采样计划吗?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
}) .then(function (willDelete) {
console.log("willDelete",willDelete)
if (willDelete) {
submint(formData);
}
});
}else{
submint(formData);
}
}
}
var submint=function(formData){
stopBubbleDefaultEvent();
console.log("提交")
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlan/workSubmit.do",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
$("#editForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
code: {
validators: {
notEmpty: {
message: '采样单编号不能为空'
}
}
},
sampleTypeId: {
validators: {
notEmpty: {
message: '采样类型不能为空'
}
}
},
date: {
trigger:"change",
validators: {
notEmpty: {
message: '计划采样日期不能为空'
}
}
},
reportDate: {
trigger:"change",
validators: {
notEmpty: {
message: '要求报告日期不能为空'
}
}
},
deptNames: {
validators: {
notEmpty: {
message: '采样车间不能为空'
}
}
}
}
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//编辑弹窗
var editFun1 = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanTask/workEdit.do', {id: id}, function (data) {
$("#taskEidtsub").html(data);
openModal('subSampModal');
});
};
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog " style="width: 70%">
<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="code" id="code" class="form-control"
readonly value="${bean.code}">
<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">
<select class="form-control" name="sampleTypeId" id="sampleTypeId" readonly
disabled="true" 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">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="date" name="date"
value="${bean.date.substring(0,10)} "/>
</div>
</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="reportDate" name="reportDate"
value="${bean.reportDate.substring(0,10)}" placeholder="请选择.."/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label ">* 采样车间:</label>
<div class="col-sm-4 ">
<input type="text" name="deptNames" id="deptNames" class="form-control"
value="${bean.deptNames} " placeholder="">
<input type="hidden" name="deptIds" id="deptIds" class="form-control"
value="${bean.deptIds} " placeholder="">
</div>
</div>
</form>
<table id="table2"></table>
</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>

View File

@ -0,0 +1,604 @@
<%@ 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="com.sipai.entity.sparepart.SparePartCommString" %>
<%request.setAttribute("AUDIT", SparePartCommString.STATUS_STOCK_AUDIT); %>
<%request.setAttribute("START", SparePartCommString.STATUS_STOCK_START); %>
<%request.setAttribute("FINISH", SparePartCommString.STATUS_STOCK_FINISH); %>
<%request.setAttribute("FAIL", SparePartCommString.STATUS_STOCK_FAIL); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<!--bootstrap-edittable 表格行内编辑 -->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-editable/css/bootstrap-editable.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-editable/js/bootstrap-editable.js"
charset="utf-8"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-editable/js/bootstrap-table-editable.js"
charset="utf-8"></script>
<style type="text/css">
.main-header {
display: none;
}
.content-header {
display: none;
}
.main-footer {
display: none;
}
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
.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">
var timeEnd;
var timeBegin;
var timeRangeEnd;
var timeRangeBegin;
$(function () {
conditionDropDowntype();
conditionDropDownstatus();
initTableList();
initDate1();
initDate2();
$('#reservationtimeD').val('');
$('#repotDateFun').val('');
timeEnd = null;
timeBegin = null;
timeRangeEnd = null;
timeRangeBegin = null;
});
//对Date的扩展将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function initDate2() {
var locale = {
"format": 'YYYY-MM-DD ',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
timeBegin = oldreservationtime1.substring(0, 16);
timeEnd = oldreservationtime1.substring(19, 36);
$('#repotDateFun').val(oldreservationtime1);
} else {
timeBegin = moment().subtract(3, 'days').format('YYYY-MM-DD');
timeEnd = moment().subtract(0, 'days').format('YYYY-MM-DD');
// $('#repotDateFun').val(timeBegin + locale.separator + timeEnd);
}
// $('#repotDateFun').daterangepicker({
// "timePicker": true,
// "timePicker24Hour": true,
// "linkedCalendars": false,
// "autoUpdateInput": false,
// "timePickerIncrement": 10,
// "locale": locale,
// //汉化按钮部分
// // ranges: {
// // // '今日': [moment(), moment().subtract(-1, 'days')],
// // '昨日': [moment().subtract(1, 'days'), moment()],
// // '最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')],
// // '本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')],
// // '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')]
// // },
// startDate: timeBegin,
// endDate: timeEnd
// }, function (start, end, label) {
//
// timeBegin = start.format(this.locale.format);
// timeEnd = end.format(this.locale.format);
// if (!this.startDate) {
// this.element.val('');
// } else {
// this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
// }
// });
// $('#repotDateFun').on('apply.daterangepicker', function(ev, picker) {
// console.log(11111111111,ev, picker)
// });
$('#repotDateFun').daterangepicker({
"locale": locale,
"startDate": timeBegin,
"endDate": timeEnd
}, function(start, end, label) {
timeBegin = start.format(this.locale.format);
timeEnd = end.format(this.locale.format);
});
};
var timedelete = function () {
$('#repotDateFun').val('');
timeEnd = null;
timeBegin = null;
};
function initDate1() {
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
var oldreservationtime1 = "${param.oldreservationtime1}";
if (oldreservationtime1 != "" && oldreservationtime1.length > 0) {
timeRangeBegin = oldreservationtime1.substring(0, 16);
timeRangeEnd = oldreservationtime1.substring(19, 36);
$('#reservationtimeD').val(oldreservationtime1);
} else {
timeRangeBegin = moment().subtract(3, 'days').format('YYYY-MM-DD');
timeRangeEnd = moment().subtract(0, 'days').format('YYYY-MM-DD');
$('#reservationtimeD').val(timeRangeBegin + locale.separator + timeRangeEnd);
}
$('#reservationtimeD').daterangepicker({
// "timePicker": true,
// "timePicker24Hour": true,
// "linkedCalendars": false,
// "autoUpdateInput": false,
// "timePickerIncrement": 10,
"locale": locale,
startDate: timeRangeBegin,
endDate: timeRangeEnd
}, function (start, end, label) {
timeRangeBegin = start.format(this.locale.format);
timeRangeEnd = end.format(this.locale.format);
});
};
var timedel = function () {
$('#reservationtimeD').val('');
timeRangeEnd = null;
timeRangeBegin = null;
};
var addFun = function () {
$("#searchForm").bootstrapValidator('validate');//提交验证
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/doWorkadd.do', {unitId: unitId}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//详情弹窗
var viewFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/view.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//样品列表
var settingFun = function (id) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlanItem/showList.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
//编辑页面
var editFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/workEdit.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
// 打印
var printFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/print.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/deletes.do', {ids: id}, function (data) {
if (data.code === 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, "json");
}
});
};
var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/whp/plan/WhpSamplingPlan/deletes.do', {ids: datas}, function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, "json");
}
});
}
};
var dosearch = function () {
$("#table").bootstrapTable('refresh');
};
var companyId_rawMaterial = "";
var initTableList = function () {
timeEnd = null;
timeBegin = null;
timeRangeEnd = null;
timeRangeBegin = null;
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/whp/plan/WhpSamplingPlan/getWorkList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
dateBegin: timeRangeBegin,
dateEnd: timeRangeEnd,
reportDateBegin: timeBegin,
reportDateEnd: timeEnd,
status: $('#status').val(),
sampleTypeId: $('#sampleTypeIdForListQuery').val()
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
//detailView: true,//父子表
columns: [
{
checkbox: true, // 显示一个勾选框
}, {
field: 'code', // 返回json数据中的name
title: '采样单编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return '(车间)'+value;
}
}, {
field: 'date', // 返回json数据中的name
title: '计划采样日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return value.substring(0, 10);
}
},
{
field: 'sampleTypeName', // 返回json数据中的name
title: '采样类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'reportDate', // 返回json数据中的name
title: '要求报告日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return value.substring(0, 10);
}
}, {
field: 'statusName', // 返回json数据中的name
title: '计划状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
if (row.statusName.includes("超时预警")) {
return '<span style="color:red">' + value + '</span>'
} else {
return value
}
}
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: 160, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = '';
if (row.status == 3) {
buts += '<button class="btn btn-default btn-sm" title="采样登记" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 采样登记</span></button>';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
} else {
buts += '<button class="btn btn-default btn-sm" title="详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 详情</span></button>';
buts += '<button class="btn btn-default btn-sm" title="打印" onclick="printFun(\'' + row.id + '\')"><i class="glyphicon glyphicon-print"></i><span class="hidden-md hidden-lg"> 打印</span></button>';
}
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function conditionDropDownstatus() {
var select_Data = jQuery.parseJSON('${status}');
var select_3 = $("#status").select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
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('').trigger('change');
}
function conditionDropDowntype() {
var select_Data = jQuery.parseJSON('${type}');
var select_3 = $("#sampleTypeIdForListQuery").select2({
data: select_Data,
cache: false,
placeholder: '请选择',//默认文字提示educationTypeCondition
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('').trigger('change');
}
</script>
</head>
<body class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<div class="content-wrapper">
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="TtemWorking"></div>
<div id="subEditDiv"></div>
<div id="subDetailDiv"></div>
<div id="PRDetail4SelectsDiv"></div>
<div id="user4SelectDiv"></div>
<div id="Goods4SelectsDiv"></div>
<div id="fileInputDiv"></div>
<div id="goodsAddDiv"></div>
<div id="equ4SelectDiv"></div>
<div id="fault4SelectDiv"></div>
<div id="unit4SelectDiv"></div>
<div id="taskEidtsub"></div>
<form id="searchForm">
<div>
<div class="form-group" style="padding:0;">
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"
style="margin-right: 15px"><i
class="fa fa-plus"></i> 新增
</button>
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
class="fa fa-trash-o"></i> 删除
</button>
</div>
<div class="form-group pull-right form-inline">
<div class="form-group">
<label class="form-label">采样类型:</label>
<select class="form-control select2" name="sampleTypeIdForListQuery" id="sampleTypeIdForListQuery"
style="width:180px;height: 30px">
</select>
<label class="form-label">计划状态:</label>
<select class="form-control select2" name="status" id="status"
style="width:180px;height: 30px">
</select>
</div>
<div class="form-group">
<label class="form-label">计划采样日期:</label>
<div class="input-group input-group-sm" style="width: 200px;">
<input type="text" autocomplete="off" class="form-control pull-left"
style="height: 30px; width: 240px; border-radius: 4px;" id="reservationtimeD"
placeholder="请选择计划采样日期范围">
<a class="glyphicon glyphicon-remove btn form-control-feedback input-clear-a"
style="pointer-events: auto;"
onclick="timedel()"></a>
</div>
<label class="form-label">要求报告日期:</label>
<div class="input-group input-group-sm" style="width: 200px;">
<input type="text" autocomplete="off" class="form-control pull-left"
style="height: 30px; width: 240px; border-radius: 4px;" id="repotDateFun"
placeholder="请选择要求报告日期范围">
<a class="glyphicon glyphicon-remove btn form-control-feedback input-clear-a"
style="pointer-events: auto;"
onclick="timedelete()"></a>
</div>
</div>
<div class="input-group input-group-sm">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<table id="table"></table>
</section>
<!-- /.content -->
</div>
</div>
</body>
<!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/commonFileUpload.js" charset="utf-8"></script>
<!-- 引入daterangepicker-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
charset="utf-8"></script>
</html>

View File

@ -0,0 +1,497 @@
<!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 updateFun1() {
$("#editSampleForm").data("bootstrapValidator").updateStatus("samplingUserName","NOT_VALIDATED", null).validateField("samplingUserName");
$("#editSampleForm").bootstrapValidator('validate');//提交验证
if ($("#editSampleForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#editSampleForm")[0]);
$.ajax({
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/workUpdate.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) {
$("#table2").bootstrapTable('refresh');
closeModal('subSampModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
$("#editSampleForm").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: "editSampleForm",
hiddenId: "samplingUserId",
textId: "samplingUserName"
},
function (data) {
$("#user4SelectDiv").html(data);
openModal('user4SelectModal');
});
};
</script>
<div class="modal fade" id="subSampModal">
<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强制为editSampleForm -->
<form class="form-horizontal" id="editSampleForm" 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}">
<input type="hidden" name="isSample" id="isSample" class="form-control"
placeholder="" value="1" >
</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 ">
<input type="text" class="form-control" id="notes" name="notes"
value="${bean.notes} " />
</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="updateFun1()">保存
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>