392 lines
16 KiB
Plaintext
392 lines
16 KiB
Plaintext
|
|
<%@ 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"%>
|
||
|
|
<style type="text/css">
|
||
|
|
.select2-container .select2-selection--single{
|
||
|
|
height:34px;
|
||
|
|
line-height: 34px;
|
||
|
|
}
|
||
|
|
.select2-selection__arrow{
|
||
|
|
margin-top:3px;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
<script type="text/javascript">
|
||
|
|
function dosave() {
|
||
|
|
doreckon();
|
||
|
|
//$("#subForm").bootstrapValidator('validate');//提交验证
|
||
|
|
//if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
|
|
|
||
|
|
$.post(ext.contextPath + "/evaluation/indexDay/dosave.do", {params:$("#subForm").serialize()}, function(data) {
|
||
|
|
if (data == 1){
|
||
|
|
swal('保存成功');
|
||
|
|
closeModal('subModal');
|
||
|
|
$("#table").bootstrapTable('refresh');
|
||
|
|
|
||
|
|
}else if(data == 0){
|
||
|
|
swal('保存失败');
|
||
|
|
}else{
|
||
|
|
swal(data);
|
||
|
|
}
|
||
|
|
},'json');
|
||
|
|
// }
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function doreckon() {
|
||
|
|
var json = JSON.parse('${evs}'.replace(/\ +/g,"").replace(/[\r\n]/g,""));
|
||
|
|
var Ci = [];
|
||
|
|
var Ii_gb = [];
|
||
|
|
var Ii_db = [];
|
||
|
|
var Ii_nk = [];
|
||
|
|
var Iie_gb = [];
|
||
|
|
var Iie_db = [];
|
||
|
|
var Iie_nk = [];
|
||
|
|
for(var i = 0; i < json.length; i++){
|
||
|
|
var v = $('#key_'+json[i].id).val();
|
||
|
|
if(v == null || v == ''){
|
||
|
|
swal('请全部填完!');
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
Ci.push(v);
|
||
|
|
var b_gb = $('#gb_'+json[i].id).val();
|
||
|
|
var b_db = $('#db_'+json[i].id).val();
|
||
|
|
var b_nk = $('#nk_'+json[i].id).val();
|
||
|
|
var dl = $('#dl_'+json[i].id).val();
|
||
|
|
var series = $('#series_'+json[i].id).val();
|
||
|
|
var name = $('#name_'+json[i].id).val();
|
||
|
|
var f_gb;
|
||
|
|
var f_db;
|
||
|
|
var f_nk;
|
||
|
|
if(json[i].condition == '1' || json[i].condition == '2'){
|
||
|
|
if(name == '总大肠菌群' || name == '耐热大肠菌群' || name == '大肠埃希氏菌'){
|
||
|
|
if(v -0 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = 0.1;
|
||
|
|
}else{
|
||
|
|
f_gb = f_db = f_nk = 1 + 0.5 * (v - 1);
|
||
|
|
}
|
||
|
|
}else if(name == '肉眼可见物'){
|
||
|
|
if(v -0 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = 0.1;
|
||
|
|
}else{
|
||
|
|
f_gb = f_db = f_nk = 1.5;
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
if(b_gb <= 0){
|
||
|
|
f_gb = v > 0 ? v : 0;
|
||
|
|
}else{
|
||
|
|
if(series == 'true'){
|
||
|
|
f_gb = v;
|
||
|
|
}else{
|
||
|
|
if(dl != null && dl != ''){
|
||
|
|
f_gb = (v - dl < Number.EPSILON) ? 0.1 : (v / b_gb < 0.1 ? 0.1 : (v / b_gb).toFixed(2));
|
||
|
|
}else{
|
||
|
|
//f_gb = (v / b_gb).toFixed(2);
|
||
|
|
f_gb = v / b_gb < 0.1 ? 0.1 : (v / b_gb).toFixed(2);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(b_db <= 0){
|
||
|
|
f_db = v > 0 ? v : 0;;
|
||
|
|
}else{
|
||
|
|
if(series == 'true'){
|
||
|
|
f_db = v;
|
||
|
|
}else{
|
||
|
|
if(dl != null && dl != ''){
|
||
|
|
f_db = (v - dl < Number.EPSILON) ? 0.1 : (v / b_db < 0.1 ? 0.1 : (v / b_db).toFixed(2));
|
||
|
|
}else{
|
||
|
|
//f_db = (v / b_db).toFixed(2);
|
||
|
|
f_db = v / b_db < 0.1 ? 0.1 : (v / b_db).toFixed(2);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(b_nk <= 0){
|
||
|
|
f_nk = v > 0 ? v : 0;;
|
||
|
|
}else{
|
||
|
|
if(series == 'true'){
|
||
|
|
f_nk = v;
|
||
|
|
}else{
|
||
|
|
if(dl != null && dl != ''){
|
||
|
|
f_nk = (v - dl < Number.EPSILON) ? 0.1 : (v / b_nk < 0.1 ? 0.1 : (v / b_nk).toFixed(2));
|
||
|
|
}else{
|
||
|
|
//f_nk = (v / b_nk).toFixed(2);
|
||
|
|
f_nk = v / b_nk < 0.1 ? 0.1 : (v / b_nk).toFixed(2);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if(series == 'true'){
|
||
|
|
if(v - f_gb < Number.EPSILON){
|
||
|
|
Ii_gb.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_gb.push(v);
|
||
|
|
}
|
||
|
|
if(v - f_db < Number.EPSILON){
|
||
|
|
Ii_db.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_db.push(v);
|
||
|
|
}
|
||
|
|
if(v - f_nk < Number.EPSILON){
|
||
|
|
Ii_nk.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_nk.push(v);
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
if(f_gb > 1){
|
||
|
|
if(b_gb <= 0){
|
||
|
|
Iie_gb.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_gb.push(Math.abs(v-b_gb) / b_gb +1);
|
||
|
|
}
|
||
|
|
}else {
|
||
|
|
Ii_gb.push(f_gb);
|
||
|
|
//Si_gb.push(b_gb);
|
||
|
|
}
|
||
|
|
if(f_db > 1){
|
||
|
|
if(b_db <= 0){
|
||
|
|
Iie_db.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_db.push(Math.abs(v-b_db) / b_db +1);
|
||
|
|
}
|
||
|
|
}else {
|
||
|
|
Ii_db.push(f_db);
|
||
|
|
//Si_db.push(b_db);
|
||
|
|
}
|
||
|
|
if(f_nk > 1){
|
||
|
|
if(b_nk <= 0){
|
||
|
|
Iie_nk.push(v);
|
||
|
|
}else{
|
||
|
|
Iie_nk.push(Math.abs(v-b_nk) / b_nk +1);
|
||
|
|
}
|
||
|
|
}else {
|
||
|
|
Ii_nk.push(f_nk);
|
||
|
|
//Si_nk.push(b_nk);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}else if(json[i].condition == '3'){
|
||
|
|
if(name == '总氯'){
|
||
|
|
//console.log(Number.parseFloat($('#date').val().substring(5,7)));
|
||
|
|
if(Number.parseFloat($('#date').val().substring(5,7)) > 4 & Number.parseFloat($('#date').val().substring(5,7)) < 11){//5-10月份
|
||
|
|
if(v > 0.85 & v < 1.25){
|
||
|
|
f_gb = f_db = f_nk = 0;
|
||
|
|
}else if(v >= 0.6 & v <= 0.85){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-0.85) / (0.85 - 0.6);
|
||
|
|
}else if(v - 1.25 > Number.EPSILON & v - 2 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-1.25) / (2 - 1.25);
|
||
|
|
}else if(v - 0.6 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-0.85) / 0.85 +1;
|
||
|
|
}else if(v - 2 > Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-2) / 2 +1;
|
||
|
|
}
|
||
|
|
}else{//1-4和11-12月份
|
||
|
|
if(v - 0.8 > Number.EPSILON & v - 1.2 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = 0;
|
||
|
|
}else if(v - 0.6 > Number.EPSILON & v - 0.8 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-0.8) / (0.8 - 0.6);
|
||
|
|
}else if(v - 1.2 > Number.EPSILON & v - 2 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-1.2) / (2 - 1.2);
|
||
|
|
}else if(v - 0.6 < Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-0.8) / 0.8 +1;
|
||
|
|
}else if(v - 2 > Number.EPSILON){
|
||
|
|
f_gb = f_db = f_nk = Math.abs(v-2) / 2 +1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(f_gb - 1 < Number.EPSILON){
|
||
|
|
Ii_gb.push(f_gb);
|
||
|
|
Ii_db.push(f_db);
|
||
|
|
Ii_nk.push(f_nk);
|
||
|
|
}else{
|
||
|
|
Iie_gb.push(f_gb);
|
||
|
|
Iie_db.push(f_db);
|
||
|
|
Iie_nk.push(f_nk);
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
f_gb = (v > json[i].nationCriterionMin & v < json[i].nationCriterionMax) ? 0 : 1;
|
||
|
|
f_db = (v > json[i].areaCriterionMin & v < json[i].areaCriterionMax) ? 0 : 1;
|
||
|
|
f_nk = (v > json[i].companyCriterionMin & v < json[i].companyCriterionMax) ? 0 : 1;
|
||
|
|
if(f_gb < 1){
|
||
|
|
Ii_gb.push(f_gb);
|
||
|
|
}else {
|
||
|
|
if(v < json[i].nationCriterionMin){
|
||
|
|
f_gb = Math.abs(v-json[i].nationCriterionMin) / json[i].nationCriterionMin +1;
|
||
|
|
Iie_gb.push(Math.abs(v-json[i].nationCriterionMin) / json[i].nationCriterionMin +1);
|
||
|
|
}else{
|
||
|
|
f_gb = Math.abs(v-json[i].nationCriterionMax) / json[i].nationCriterionMax +1;
|
||
|
|
Iie_gb.push(Math.abs(v-json[i].nationCriterionMax) / json[i].nationCriterionMax +1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(f_db < 1){
|
||
|
|
Ii_db.push(f_db);
|
||
|
|
}else {
|
||
|
|
if(v < json[i].areaCriterionMin){
|
||
|
|
f_db = Math.abs(v-json[i].areaCriterionMin) / json[i].areaCriterionMin +1;
|
||
|
|
Iie_db.push(Math.abs(v-json[i].areaCriterionMin) / json[i].areaCriterionMin +1);
|
||
|
|
}else{
|
||
|
|
f_db = Math.abs(v-json[i].areaCriterionMax) / json[i].areaCriterionMax +1;
|
||
|
|
Iie_db.push(Math.abs(v-json[i].areaCriterionMax) / json[i].areaCriterionMax +1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(f_nk < 1){
|
||
|
|
Ii_nk.push(f_nk);
|
||
|
|
}else {
|
||
|
|
if(v < json[i].companyCriterionMin){
|
||
|
|
f_nk = Math.abs(v-json[i].companyCriterionMin) / json[i].companyCriterionMin +1;
|
||
|
|
Iie_nk.push(Math.abs(v-json[i].companyCriterionMin) / json[i].companyCriterionMin +1);
|
||
|
|
}else{
|
||
|
|
f_nk = Math.abs(v-json[i].companyCriterionMax) / json[i].companyCriterionMax +1;
|
||
|
|
Iie_nk.push(Math.abs(v-json[i].companyCriterionMax) / json[i].companyCriterionMax +1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}else if(json[i].condition == '4'){
|
||
|
|
f_gb = (v < json[i].nationCriterionMin || v < json[i].nationCriterionMax) ? 0 : 1;
|
||
|
|
f_db = (v < json[i].areaCriterionMin || v < json[i].areaCriterionMax) ? 0 : 1;
|
||
|
|
f_nk = (v < json[i].companyCriterionMin || v < json[i].companyCriterionMax) ? 0 : 1;
|
||
|
|
}
|
||
|
|
$('#gbfzs_'+json[i].id).val(Number.parseFloat(f_gb).toFixed(2));
|
||
|
|
$('#dbfzs_'+json[i].id).val(Number.parseFloat(f_db).toFixed(2));
|
||
|
|
$('#nkfzs_'+json[i].id).val(Number.parseFloat(f_nk).toFixed(2));
|
||
|
|
// console.log(Iie_db);
|
||
|
|
// console.log(Ii_db);
|
||
|
|
// console.log(Ii_gb);
|
||
|
|
}
|
||
|
|
var qwi_gb = (Ii_gb.length<=0? 1 : Math.sqrt(sum(Ii_gb) / Ii_gb.length)) * Math.sqrt(_max(Ii_gb)) * product(Iie_gb);
|
||
|
|
$('#wqiDayNation').val(qwi_gb.toFixed(2));
|
||
|
|
var qwi_db = (Ii_db.length<=0? 1 : Math.sqrt(sum(Ii_db) / Ii_db.length)) * Math.sqrt(_max(Ii_db)) * product(Iie_db);
|
||
|
|
$('#wqiDayArea').val(qwi_db.toFixed(2));
|
||
|
|
var qwi_nk = (Ii_nk.length<=0? 1 : Math.sqrt(sum(Ii_nk) / Ii_nk.length)) * Math.sqrt(_max(Ii_nk)) * product(Iie_nk);
|
||
|
|
$('#wqiDayCompany').val(qwi_nk.toFixed(2));
|
||
|
|
}
|
||
|
|
|
||
|
|
function _max(arr){
|
||
|
|
if(arr instanceof Array && arr.length >0){
|
||
|
|
let max = arr[0];
|
||
|
|
for (let i = 0; i < arr.length - 1; i++) {
|
||
|
|
max = max < arr[i+1] ? arr[i+1] : max
|
||
|
|
}
|
||
|
|
return max;
|
||
|
|
}else{
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function sum(arr) {
|
||
|
|
if(arr instanceof Array && arr.length >0){
|
||
|
|
//console.log(eval(arr.join("+")));
|
||
|
|
if(eval(arr.join("+")) <= 0){
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
return eval(arr.join("+"));
|
||
|
|
}else{
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
function product(arr) {
|
||
|
|
|
||
|
|
if(arr instanceof Array && arr.length >0) {
|
||
|
|
var len = arr.length;
|
||
|
|
var result = len > 0 ? 1 : null;
|
||
|
|
for(var i = 0; i < arr.length; i++) {
|
||
|
|
result *= arr[i];
|
||
|
|
}
|
||
|
|
if(result <= 0){
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
$('#date').datepicker({
|
||
|
|
language: 'zh-CN',
|
||
|
|
autoclose: true,
|
||
|
|
todayHighlight: true,
|
||
|
|
format:'yyyy-mm-dd',
|
||
|
|
}).on('hide',function(e) {
|
||
|
|
$('#subForm').data('bootstrapValidator')
|
||
|
|
.updateStatus('date', 'NOT_VALIDATED',null)
|
||
|
|
.validateField('date');
|
||
|
|
});
|
||
|
|
$('#date').datepicker('setDate','${nowDate.substring(0, 10)}');
|
||
|
|
|
||
|
|
</script>
|
||
|
|
<div class="modal fade" id="subModal" >
|
||
|
|
<div class="modal-dialog" style="width: 1200px;">
|
||
|
|
<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">
|
||
|
|
<!-- 新增界面formid强制为subForm -->
|
||
|
|
<form class="form-horizontal" id="subForm">
|
||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
||
|
|
<div id="alertDiv"></div>
|
||
|
|
<div id="subDivSelect"></div>
|
||
|
|
<table style="width: 100%;">
|
||
|
|
<tr>
|
||
|
|
<td colspan="8"><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" autocomplete="off" style="width: 132px;">
|
||
|
|
</div></td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>指标名称</td>
|
||
|
|
<!-- <td>级数指标</td> -->
|
||
|
|
<td>检测值</td>
|
||
|
|
<td>检测限</td>
|
||
|
|
<td>国家标准</td>
|
||
|
|
<td>分指数(国标)</td>
|
||
|
|
<td>地区标准</td>
|
||
|
|
<td>分指数(地区)</td>
|
||
|
|
<td>内控标准</td>
|
||
|
|
<td>分指数(内控)</td>
|
||
|
|
</tr>
|
||
|
|
<c:forEach items="${evaluationCriterions}" var="evaluationCriterion">
|
||
|
|
<tr>
|
||
|
|
<td><input class="form-control" type="text" id="name_${evaluationCriterion.id}" value ="${evaluationCriterion.criterionName}" disabled></td>
|
||
|
|
<input class="form-control" type="hidden" value ="${evaluationCriterion.isSeries}" disabled id="series_${evaluationCriterion.id}">
|
||
|
|
<td><input class="form-control" type="text" name ="key_${evaluationCriterion.id}" id="key_${evaluationCriterion.id}" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,6})?).*$/g, '$1')" autocomplete="off"></td>
|
||
|
|
<td><input class="form-control" type="text" id="dl_${evaluationCriterion.id}" <c:if test="${evaluationCriterion.condition == '1' || evaluationCriterion.condition == '2'}"> value="${evaluationCriterion.detectionLimit}"</c:if> disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="gb_${evaluationCriterion.id}" <c:if test="${evaluationCriterion.condition == '1' || evaluationCriterion.condition == '2'}"> value="${evaluationCriterion.nationCriterionValue}"</c:if> <c:if test="${evaluationCriterion.condition == '3'}"> value="[${evaluationCriterion.nationCriterionMin}-${evaluationCriterion.nationCriterionMax}]"</c:if> disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="gbfzs_${evaluationCriterion.id}" readonly="readonly"></td>
|
||
|
|
<td><input class="form-control" type="text" id="db_${evaluationCriterion.id}" <c:if test="${evaluationCriterion.condition == '1' || evaluationCriterion.condition == '2'}"> value="${evaluationCriterion.areaCriterionValue}"</c:if> <c:if test="${evaluationCriterion.condition == '3'}"> value="[${evaluationCriterion.areaCriterionMin}-${evaluationCriterion.areaCriterionMax}]"</c:if> disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="dbfzs_${evaluationCriterion.id}" readonly="readonly"></td>
|
||
|
|
<td><input class="form-control" type="text" id="nk_${evaluationCriterion.id}" <c:if test="${evaluationCriterion.condition == '1' || evaluationCriterion.condition == '2'}"> value="${evaluationCriterion.companyCriterionValue}"</c:if> <c:if test="${evaluationCriterion.condition == '3'}"> value="[${evaluationCriterion.companyCriterionMin}-${evaluationCriterion.companyCriterionMax}]"</c:if> disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="nkfzs_${evaluationCriterion.id}" readonly="readonly"></td>
|
||
|
|
</tr>
|
||
|
|
</c:forEach>
|
||
|
|
<tr>
|
||
|
|
<td><input class="form-control" type="text" value ="" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" value ="" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" value ="" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" value ="日评指数(国标)" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="wqiDayNation" readonly="readonly" name="wqiDayNation"></td>
|
||
|
|
<td><input class="form-control" type="text" value ="日评指数(地标)" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="wqiDayArea" readonly="readonly" name="wqiDayArea"></td>
|
||
|
|
<td><input class="form-control" type="text" value ="日评指数(内控)" disabled></td>
|
||
|
|
<td><input class="form-control" type="text" id="wqiDayCompany" readonly="readonly" name="wqiDayCompany"></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
<div class="modal-footer">
|
||
|
|
<button type="button" class="btn btn-primary left" onclick="doreckon()" id="btn_save">计算</button>
|
||
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
|
|
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<!-- /.modal-content -->
|
||
|
|
</div>
|
||
|
|
<!-- /.modal-dialog -->
|
||
|
|
</div>
|