864 lines
37 KiB
Plaintext
864 lines
37 KiB
Plaintext
<!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;
|
||
}
|
||
|
||
.sampleAmountView {
|
||
color: black;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
$(function () {
|
||
initTableViewList();
|
||
$("#acceptDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
$("#acceptDate").datepicker('setDate',new Date());
|
||
$('#repotDateFun').val('');
|
||
conditionDropDowntestOrgId()
|
||
|
||
$("#uAccord").hide();
|
||
$("#nAccord").hide();
|
||
$("#Accord").hide();
|
||
if ('${bean.sampleTypeName}'==="外送样"){
|
||
$("#uAccord").show();
|
||
$("#nAccord").show();
|
||
$("#Accord").show();
|
||
}
|
||
initdata();
|
||
});
|
||
|
||
function initdata() {
|
||
if ('${bean.acceptUserName}'=='')
|
||
{
|
||
$("#acceptUserName").val('${cu.caption}');
|
||
$("#acceptUserId").val('${cu.id}');
|
||
}
|
||
|
||
}
|
||
function initTableViewList() {
|
||
|
||
$("#tableView").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', // 上下居中
|
||
formatter:function(value,row,index,field){
|
||
var span=document.createElement('span');
|
||
if(row.playType==1)
|
||
{
|
||
span.setAttribute('title',"采样人:"+row.samplingUserName+"(采样时间:"+row.samplingTime.substring(0,10)+")");
|
||
|
||
}else{
|
||
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: 'sampleState',
|
||
title: '样品状态',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return '<select class="form-control-sampleState select2" name="sampleState" id="sampleState\'' + index + '\'" onchange="selectChange1(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 99%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="' + value + '" /> '
|
||
}
|
||
}, {
|
||
field: 'sampleAppearance',
|
||
title: '样品外观',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return '<select class="form-control-sampleAppearance select2" name="sampleAppearance" id="sampleAppearance\'' + index + '\'" onchange="selectChange1(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 99%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="' + value + '" /> '
|
||
}
|
||
|
||
}, {
|
||
field: 'sampleSupernatant',
|
||
title: '样品上清液',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return '<select class="form-control-sampleSupernatant select2" name="sampleSupernatant" id="sampleSupernatant\'' + index + '\'" onchange="selectChange2(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 99%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="' + value + '" /> '
|
||
}
|
||
|
||
}, {
|
||
field: 'sampleNature',
|
||
title: '样品性质',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return '<select class="form-control-sampleNature select2" name="sampleNature" id="sampleNature\'' + index + '\'" onchange="selectChange3(\'' + value + '\',\'' + row.id + '\',' + index + ')" style="width: 99%;height: 30px;border-radius: 5px;border: 1px solid gray;" value="' + value + '" /> '
|
||
}
|
||
|
||
},{
|
||
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: 'sampleAmount',
|
||
title: '样品数量',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
|
||
return initCell(row.id, "sampleAmount", "text", "样品数量", value);
|
||
}
|
||
}, {
|
||
field: 'unit',
|
||
title: '单位',
|
||
align: 'center',
|
||
valign: 'middle'
|
||
|
||
}, {
|
||
field: 'statusName',
|
||
title: '状态',
|
||
align: 'center',
|
||
valign: 'middle'
|
||
},
|
||
{
|
||
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: 160, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
if (row.status == 4) {
|
||
buts += '<button class="btn btn-default btn-sm" title="回退" onclick="combackFun(\'' + row.id + '\')"><span > 回退 </span></button>';
|
||
}
|
||
|
||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||
return buts;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function (data) { //加载成功时执行
|
||
adjustBootstrapTableView("table");
|
||
|
||
if (data.rows) {
|
||
multipleChoice(data.rows)
|
||
sampleStateChoice(data.rows)
|
||
sampleAppearanceChoice(data.rows)
|
||
sampleSupernatantChoice(data.rows)
|
||
sampleNatureChoice(data.rows)
|
||
tableAContent(data.rows)
|
||
}
|
||
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
};
|
||
|
||
function multipleChoice(rows) {
|
||
rows.forEach((row, index) => {
|
||
console.log(JSON.parse(row.testItemJson))
|
||
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;
|
||
} // 函数用于呈现当前的选择
|
||
})
|
||
|
||
|
||
$('.form-controlSE-testItemJson').eq(index).val(row.testItemIds.split(",")).trigger("change");
|
||
$('.form-controlSE-testItemJson').eq(index).on('change', (data) => {
|
||
console.log($('.form-controlSE-testItemJson').eq(index).val())
|
||
// console.log(row)
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
})
|
||
})
|
||
}
|
||
|
||
function sampleStateChoice(rows) {
|
||
rows.forEach((row, index) => {
|
||
console.log(JSON.parse('${sampleStateDropDown}'))
|
||
$('.form-control-sampleState').eq(index).select2({
|
||
data: JSON.parse('${sampleStateDropDown}'),
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示educationTypeCondition
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
multiple: false,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
})
|
||
|
||
|
||
$('.form-control-sampleState').eq(index).val(JSON.parse(row.sampleState)).trigger("change");
|
||
$('.form-control-sampleState').eq(index).on('change', (data) => {
|
||
console.log($('.form-control-sampleState').eq(index).val())
|
||
// console.log(row)
|
||
let sampleStateIds = $('.form-control-sampleState').eq(index).val()
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/state.do?id=" + row.id + '&state=' + (sampleStateIds ? sampleStateIds : ''),
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
})
|
||
})
|
||
|
||
}
|
||
|
||
function sampleAppearanceChoice(rows) {
|
||
rows.forEach((row, index) => {
|
||
console.log(JSON.parse('${sampleAppearanceDropDown}'))
|
||
$('.form-control-sampleAppearance').eq(index).select2({
|
||
data: JSON.parse('${sampleAppearanceDropDown}'),
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示educationTypeCondition
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
multiple: false,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
})
|
||
|
||
|
||
$('.form-control-sampleAppearance').eq(index).val(JSON.parse(row.sampleAppearance)).trigger("change");
|
||
$('.form-control-sampleAppearance').eq(index).on('change', (data) => {
|
||
console.log($('.form-control-sampleAppearance').eq(index).val())
|
||
// console.log(row)
|
||
let sampleAppearanceIds = $('.form-control-sampleAppearance').eq(index).val()
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/appearance.do?id=" + row.id + '&appearance=' + (sampleAppearanceIds ? sampleAppearanceIds : ''),
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
})
|
||
})
|
||
|
||
}
|
||
function sampleSupernatantChoice(rows) {
|
||
rows.forEach((row, index) => {
|
||
console.log(JSON.parse('${sampleSupernatantDropDown}'))
|
||
$('.form-control-sampleSupernatant').eq(index).select2({
|
||
data: JSON.parse('${sampleSupernatantDropDown}'),
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示educationTypeCondition
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
multiple: false,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
})
|
||
|
||
|
||
$('.form-control-sampleSupernatant').eq(index).val(JSON.parse(row.sampleSupernatant)).trigger("change");
|
||
$('.form-control-sampleSupernatant').eq(index).on('change', (data) => {
|
||
console.log($('.form-control-sampleSupernatant').eq(index).val())
|
||
|
||
let sampleSupernatantIds = $('.form-control-sampleSupernatant').eq(index).val()
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/supernatant.do?id=" + row.id + '&supernatant=' + (sampleSupernatantIds ? sampleSupernatantIds : ''),
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
})
|
||
})
|
||
|
||
}
|
||
function sampleNatureChoice(rows) {
|
||
rows.forEach((row, index) => {
|
||
console.log(JSON.parse('${sampleNatureDropDown}'))
|
||
$('.form-control-sampleNature').eq(index).select2({
|
||
data: JSON.parse('${sampleNatureDropDown}'),
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示educationTypeCondition
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
multiple: false,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
})
|
||
|
||
// console.log(JSON.parse(row.testItemJson).map(item => item.id).join(','))
|
||
console.log(JSON.parse(row.sampleNature), "sampleNature")
|
||
// console.log(JSON.parse(row.testItemJson).map(item=>item.id),'4444444444')
|
||
// return
|
||
$('.form-control-sampleNature').eq(index).val(JSON.parse(row.sampleNature)).trigger("change");
|
||
$('.form-control-sampleNature').eq(index).on('change', (data) => {
|
||
console.log($('.form-control-sampleNature').eq(index).val())
|
||
// console.log(row)
|
||
let sampleNatureIds = $('.form-control-sampleNature').eq(index).val()
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/nature.do?id=" + row.id + '&nature=' + (sampleNatureIds ? sampleNatureIds : ''),
|
||
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) {
|
||
}
|
||
});
|
||
|
||
|
||
})
|
||
})
|
||
|
||
}
|
||
|
||
// 编辑表格
|
||
function initCell(id, name, dataTyp, dataTitle, value) {
|
||
|
||
if (value === undefined || value == null || value == "") {
|
||
value = '';
|
||
}
|
||
|
||
return '<a href="#" class="tableAClass" name="' + name + '" sample-amount="' + dataTyp + '" sample-pk="' + id + '" sample-title="' + dataTitle + '" style="text-decoration: none;border: none;outline: none;line-height: 47px">' + value + '</a>'
|
||
// return "<a href=\"#\" name=\""+name+"\" data-type=\""+dataType+"\" data-pk=\"" + id + "\" data-title=\""+dataTitle+"\">" + value + "</a>"
|
||
}
|
||
|
||
function tableAContent(rows) {
|
||
console.log(rows, "table")
|
||
rows.forEach((row, index) => {
|
||
$("#tableView a").editable({
|
||
emptytext: '点击开始填写',
|
||
emptyclass: 'sampleAmountView',
|
||
url: function (params) {
|
||
console.log(params, "sample")
|
||
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: ext.contextPath + '/whp/plan/WhpSamplingPlanTask/amount.do?id=' + row.id + "&amount=" + params.value,
|
||
dataType: 'JSON',
|
||
success: function (data, textStatus, jqXHR) {
|
||
|
||
// alert('保存成功!');
|
||
},
|
||
error: function (res) {
|
||
// alert("error");
|
||
|
||
if (res.status == 400) {
|
||
showAlert('d', '输入有误,请检查输入', 'mainAlertdiv')
|
||
}
|
||
}
|
||
});
|
||
},
|
||
type: 'text'
|
||
});
|
||
})
|
||
|
||
|
||
}
|
||
|
||
|
||
function selectChange2(val, id, index) {
|
||
}
|
||
function selectChange3(val, id, index) {
|
||
}
|
||
|
||
// 检验审核人
|
||
function selectdutyUser() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{
|
||
formId: "editForm",
|
||
hiddenId: "auditUserId",
|
||
textId: "auditUserName"
|
||
},
|
||
function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
};
|
||
|
||
function selectdutyUser1() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{
|
||
formId: "editForm",
|
||
hiddenId: "acceptUserId",
|
||
textId: "acceptUserName"
|
||
},
|
||
function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
};
|
||
var combackFun = function (id) {
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/plan/WhpSamplingPlanTask/reject.do?id=" + id,
|
||
type: 'POST',
|
||
async: false,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
dataType: 'json',
|
||
success: function (data) {
|
||
if (data.code == 1) {
|
||
$("#tableView").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '回退失败!' + data.msg);
|
||
}
|
||
},
|
||
error: function (data) {
|
||
}
|
||
});
|
||
}
|
||
|
||
function updateSaveFun() {
|
||
$("#editForm").data("bootstrapValidator").updateStatus("auditUserName","NOT_VALIDATED", null).validateField("auditUserName");
|
||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#editForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskAudit/update.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) {
|
||
}
|
||
});
|
||
}
|
||
|
||
}
|
||
|
||
function issueSaveFun() {
|
||
$("#editForm").data("bootstrapValidator").updateStatus("auditUserName","NOT_VALIDATED", null).validateField("auditUserName");
|
||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#editForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/whp/test/WhpSamplingPlanTaskAudit/submit.do?id=" + $("#id").val(),
|
||
type: 'POST',
|
||
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: {
|
||
auditUserName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '检验审核人不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
function conditionDropDowntestOrgId() {
|
||
var select_Data = jQuery.parseJSON('${sampleTestOrgDropDown}');
|
||
console.log(select_Data);
|
||
var select_3 = $("#testOrgId").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.on("change", function (e) {
|
||
deptChange();
|
||
});
|
||
select_3.val(select_Data[0].id).trigger("change")
|
||
|
||
}
|
||
|
||
//采样车间刷新
|
||
function deptChange() {
|
||
var type = $("#testOrgId").val();
|
||
console.log(type,'+++++++++++++++')
|
||
$.get(ext.contextPath + "/whp/baseinfo/WhpTestOrg/getById.do?id=" + type, function (data) {
|
||
if (type!=null){
|
||
$("#address").val(data.result.address);
|
||
$("#contactPerson").val(data.result.contactPerson);
|
||
$("#contactPhone").val(data.result.contactPhone);
|
||
}else {
|
||
$("#address").val('');
|
||
$("#contactPerson").val('');
|
||
$("#contactPhone").val('');
|
||
}
|
||
|
||
}, 'json');
|
||
}
|
||
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog " style="width: 80%">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">检测任务下发</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="row">
|
||
<div class="col-md-12 col-xs-13">
|
||
<!-- 新增界面formid强制为editForm -->
|
||
<form class="form-horizontal" id="editForm" enctype="multipart/form-data">
|
||
<div id="alertDiv"></div>
|
||
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
|
||
<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" id="sampleTypeName">${bean.sampleTypeName}</p>
|
||
<%-- <input type="text" name="sampleTypeName" id="sampleTypeName" class="form-control"--%>
|
||
<%-- value="${bean.sampleTypeName}" readonly >--%>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">* 需求报告日期:</label>
|
||
<div class="col-sm-4">
|
||
<p class="form-control-static">${fn:substring(bean.reportDate,0,10)}</p>
|
||
</div>
|
||
<label class="col-sm-2 control-label">* 检验审核人:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="auditUserName" name="auditUserName" class="form-control"
|
||
placeholder="请选择.." readonly onclick="selectdutyUser()"
|
||
value="${bean.auditUserName}">
|
||
<input type="hidden" id="auditUserId" name="auditUserId" class="form-control"
|
||
placeholder="请选择.." value="${bean.auditUserId}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">* 收样人:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="acceptUserName" name="acceptUserName" class="form-control"
|
||
placeholder="请选择.." readonly onclick="selectdutyUser1()"
|
||
value="${bean.acceptUserName}">
|
||
<input type="hidden" id="acceptUserId" name="acceptUserId" class="form-control"
|
||
placeholder="请选择.." value="${bean.acceptUserId}">
|
||
</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="acceptDate" name="acceptDate"
|
||
value="${bean.acceptDate.substring(0,10)}" placeholder="请选择.."/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group" id="uAccord" >
|
||
<label class="col-sm-2 control-label">* 委派检测机构:</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control" name="testOrgId" id="testOrgId"
|
||
style="width: 100%">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group" id="nAccord" >
|
||
<label class="col-sm-2 control-label">* 机构地址:</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" id="address" name="address" class="form-control"
|
||
placeholder="" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="form-group" id="Accord" >
|
||
<label class="col-sm-2 control-label">* 机构联系人:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="contactPerson" name="contactPerson" class="form-control"
|
||
placeholder="" readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">* 机构电话:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="contactPhone" name="contactPhone" class="form-control"
|
||
placeholder="" readonly>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<table id="tableView"></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>
|
||
<button type="button" class="btn btn-primary " style="margin-left: 10px"
|
||
onclick="issueSaveFun()">下发
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|
||
|
||
|
||
|
||
|