Commit f01343aa authored by 莫林毅's avatar 莫林毅

监控运营 ->告警关联诊断 '创建&修改指标' 页面

解决 偶尔出现 '权值和=!1' bug
parent dc21cad1
...@@ -163,7 +163,6 @@ ...@@ -163,7 +163,6 @@
<tr> <tr>
<td>渠道:</td> <td>渠道:</td>
<td> <td>
<%--<div class="checkbox-inline"><label><input type="checkbox" name="channelList" id="channelList" title="allSelect" checked />全选</label></div>--%>
<div id=""> <div id="">
<c:forEach items="${channelList}" var="channel"> <c:forEach items="${channelList}" var="channel">
<div class="checkbox-inline"> <div class="checkbox-inline">
...@@ -198,15 +197,12 @@ ...@@ -198,15 +197,12 @@
<tr> <tr>
<td></td> <td></td>
<%--<td><button type="button" id="selectAnaInfo" class="btn btn-primary btn-small">查找指标</button>--%>
<%--<button type="button" id="selectBusiness" class="btn btn-info- btn-small">查找业务</button></td>--%>
<%--<td><button type="button" id="addAnaInfo" class="btn btn-primary">添加指标</button></td>--%>
</tr> </tr>
<tr> <tr>
<td>权重(<font color="red">必填</font>):</td> <td>权重(<font color="red">必填</font>):</td>
<td><input type="number" step="0.01" class="form-control" name="descTd" <td><input type="number" step="0.01" class="form-control" name="descTd"
id="kpiWeightTd" value="1.00" style="display: inline;"/> id="kpiWeightTd" value="1" style="display: inline;"/>
<span id="writeWarningInfTd" <span id="writeWarningInfTd"
style="color:red;display: inline;padding-left:10px;"></span></td> style="color:red;display: inline;padding-left:10px;"></span></td>
</tr> </tr>
...@@ -273,8 +269,8 @@ ...@@ -273,8 +269,8 @@
} }
}); });
$("input[name='provinceDetail'][value='3000']").click(function () { $("input[name='provinceDetail'][value='3000']").click(function () {
alert($("input[name='provinceDetail'][value='32']").text()); /*alert($("input[name='provinceDetail'][value='32']").text());
alert($("input[name='provinceDetail'][value='32']").html()); alert($("input[name='provinceDetail'][value='32']").html());*/
if ($("input[name='provinceDetail'][value='32']").attr("checked") == "checked") { if ($("input[name='provinceDetail'][value='32']").attr("checked") == "checked") {
/*$("#provinceDetailAll").next().hide(); /*$("#provinceDetailAll").next().hide();
...@@ -384,28 +380,27 @@ ...@@ -384,28 +380,27 @@
function updateRow(e) { function updateRow(e) {
var initK = Number($(e).parent().prev()[0].innerHTML); var initK = Number($(e).parent().prev()[0].innerHTML);
var pro = prompt("请输入 0~"+initK, $(e).parent().prev()[0].innerHTML); var pro = prompt("请输入 ", $(e).parent().prev()[0].innerHTML);
pro = $.trim(pro); pro = $.trim(pro);
if ($.isNumeric(pro)) { if ($.isNumeric(pro)) {
pro = parseFloat(pro); pro = parseFloat(pro);
if (pro > 0) { if (pro > 0) {
if (initK >= pro) { if (initK >= pro) {
$(e).parent().prev()[0].innerHTML = parseFloat(pro).toFixed(2); $(e).parent().prev()[0].innerHTML = parseFloat(pro.toFixed(2));
sumkpiWeightTdVal -= initK; sumkpiWeightTdVal -= parseFloat(initK.toFixed(2));
sumkpiWeightTdVal += pro; sumkpiWeightTdVal += parseFloat(pro.toFixed(2));
var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV === '0.00'?'':maxV); $("#kpiWeightTd").val(maxV === '0.00'?'':parseFloat(maxV));
} }
else { else {
var k = sumkpiWeightTdVal - initK + pro; var k = sumkpiWeightTdVal - initK + pro;
if (k <= 1.00) { if (k <= 1.00) {
$(e).parent().prev()[0].innerHTML = parseFloat(pro).toFixed(2); $(e).parent().prev()[0].innerHTML = parseFloat(pro.toFixed(2));//.toFixed(2);
sumkpiWeightTdVal -= initK; sumkpiWeightTdVal -= parseFloat(initK.toFixed(2));
sumkpiWeightTdVal += pro; sumkpiWeightTdVal += parseFloat(pro.toFixed(2));
var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV === '0.00'?'':maxV); $("#kpiWeightTd").val(maxV === '0.00'?'':parseFloat(maxV));
}else{ }else{
$.alert("输入值过大,请输入0~"+initK); $.alert("输入值过大,请输入0~"+initK);
} }
...@@ -420,8 +415,8 @@ ...@@ -420,8 +415,8 @@
//删除一条参数 //删除一条参数
function deleteRow(e) { function deleteRow(e) {
var v = $(e).parent().prev().text(); var v = $(e).parent().prev().text();
sumkpiWeightTdVal = sumkpiWeightTdVal - v; sumkpiWeightTdVal = sumkpiWeightTdVal - parseFloat(Number(v).toFixed(2));
$("#kpiWeightTd").val((1.00 - sumkpiWeightTdVal) === 0?'':parseFloat(1.00 - sumkpiWeightTdVal).toFixed(2)); $("#kpiWeightTd").val((1.00 - sumkpiWeightTdVal) === 0?'':parseFloat((1.00 - sumkpiWeightTdVal).toFixed(2)));
var id = Number(e.title); var id = Number(e.title);
dimKpiSelected.splice($.inArray(id, dimKpiSelected), 1); dimKpiSelected.splice($.inArray(id, dimKpiSelected), 1);
$(e).parent().parent().remove(); $(e).parent().parent().remove();
...@@ -448,11 +443,7 @@ ...@@ -448,11 +443,7 @@
//form表单提交 //form表单提交
$("#modelSubmit").click(function () { $("#modelSubmit").click(function () {
/*sumkpiWeightTdVal=sumkpiWeightTdVal.toFixed(2);
sumkpiWeightTdVal =parseFloat(sumkpiWeightTdVal);*/
// alert("sumkpiWeightTdVal "+sumkpiWeightTdVal);
// alert("sumkpiWeightTdVal "+typeof sumkpiWeightTdVal);
// return;
if (sumkpiWeightTdVal < 1.00) { if (sumkpiWeightTdVal < 1.00) {
$.alert("权限总和需 为 1"); $.alert("权限总和需 为 1");
return; return;
...@@ -738,41 +729,41 @@ ...@@ -738,41 +729,41 @@
return; return;
} }
var kpiWeightTdVal = $.trim($("#kpiWeightTd").val()); var kpiWeightTdVal = $.trim($("#kpiWeightTd").val());
if (kpiWeightTdVal == "" || kpiWeightTdVal == 0) { if (kpiWeightTdVal == "" || parseFloat(Number(kpiWeightTdVal).toFixed(2)) == 0) {
$.alert("权重不能为空"); $.alert("权重不能为空");
var mmm_1 = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var mmm_1 = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mmm_1 === '0.00'?'':mmm_1); $("#kpiWeightTd").val(mmm_1 === '0.00'?'':parseFloat(mmm_1));
return; return;
} }
if (kpiWeightTdVal < 0) { if (kpiWeightTdVal < 0) {
$.alert("权重不能为负"); $.alert("权重不能为负");
var mmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var mmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mmm === '0.00'?'':mmm); $("#kpiWeightTd").val(mmm === '0.00'?'':parseFloat(mmm));
return; return;
} }
if (kpiWeightTdVal > 1.00) { if (kpiWeightTdVal > 1.00) {
$.alert("权重超值 1"); $.alert("权重超值 1");
var mmmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var mmmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mmmm); $("#kpiWeightTd").val(parseFloat(mmmm));
return; return;
} }
var tt = 0.00; var tt = 0.00;
for (var jj = 0; jj < arrDimKpiChecked.length; jj++) { for (var jj = 0; jj < arrDimKpiChecked.length; jj++) {
tt += Number(kpiWeightTdVal); tt += parseFloat(Number(kpiWeightTdVal).toFixed(2));
} }
var k = sumkpiWeightTdVal + tt; var k = sumkpiWeightTdVal + tt;
//var k=sumkpiWeightTdVal+Number(kpiWeightTdVal); //var k=sumkpiWeightTdVal+Number(kpiWeightTdVal);
if (k > 1.00) { if (k > 1.00) {
$.alert("权重和 超值 1"); $.alert("权重和 超值 1");
var mm = (1 - Number(sumkpiWeightTdVal)).toFixed(2); var mm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mm); $("#kpiWeightTd").val(parseFloat(mm));
return; return;
} }
// 勾选指标 的 名称 和 value // 勾选指标 的 名称 和 value
var arrDimKpiidAndNameChecked = getArrDimKpiidAndNameChecked(); var arrDimKpiidAndNameChecked = getArrDimKpiidAndNameChecked();
//向 已添加指标 添加 //向 已添加指标 添加
kpiWeightTdVal=Number(kpiWeightTdVal).toFixed(2); kpiWeightTdVal=parseFloat(Number(kpiWeightTdVal).toFixed(2));
for (var i = 0; i < arrDimKpiidAndNameChecked.length; i++) { for (var i = 0; i < arrDimKpiidAndNameChecked.length; i++) {
var id_name = arrDimKpiidAndNameChecked[i]; var id_name = arrDimKpiidAndNameChecked[i];
var addRow = $("<tr class='" + id_name.split("_")[0] + "_" + kpiWeightTdVal + "'><td>" + id_name.split("_")[1] + "</td><td>" + kpiWeightTdVal + "</td><td><a href='javascript:;' title='" + id_name.split("_")[0] + "' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>"); var addRow = $("<tr class='" + id_name.split("_")[0] + "_" + kpiWeightTdVal + "'><td>" + id_name.split("_")[1] + "</td><td>" + kpiWeightTdVal + "</td><td><a href='javascript:;' title='" + id_name.split("_")[0] + "' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
...@@ -792,8 +783,8 @@ ...@@ -792,8 +783,8 @@
}); });
sumkpiWeightTdVal += tt; sumkpiWeightTdVal += tt;
var maxV = 1 - Number(sumkpiWeightTdVal); var maxV = parseFloat((1 - Number(sumkpiWeightTdVal)).toFixed(2));
$("#kpiWeightTd").val(maxV === 0?'':maxV.toFixed(2)); $("#kpiWeightTd").val(maxV === 0?'':parseFloat(maxV));
}); });
dimKpiSelected = new Array(); dimKpiSelected = new Array();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html> <html>
<head> <head>
...@@ -148,7 +149,9 @@ ...@@ -148,7 +149,9 @@
<td>${dimKpi.name}</td> <td>${dimKpi.name}</td>
<c:forEach items="${anaInfo.items}" var="ite"> <c:forEach items="${anaInfo.items}" var="ite">
<c:if test="${ite.kpiId == dimKpi.kpiId}"> <c:if test="${ite.kpiId == dimKpi.kpiId}">
<td>${ite.kpiWeight}</td> <%--<td>${ite.kpiWeight}</td>--%>
<td><fmt:formatNumber type="number" value="${ite.kpiWeight}" pattern="0.00" maxFractionDigits="1"/></td>
</c:if> </c:if>
</c:forEach> </c:forEach>
<td><a href='javascript:void(0);' id="deleteRow" title='${dimKpi.kpiId}' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td> <td><a href='javascript:void(0);' id="deleteRow" title='${dimKpi.kpiId}' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td>
...@@ -276,7 +279,7 @@ ...@@ -276,7 +279,7 @@
$("#updateAnaInf").click(function () {//跟新指标按钮 $("#updateAnaInf").click(function () {//跟新指标按钮
$(this).hide(); $(this).hide();
// $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal)); // $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal));
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat(1-sumkpiWeightTdVal).toFixed(2)); $("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
$("#tr_id_dimkpi").show(); $("#tr_id_dimkpi").show();
$("#tr_id_weight").show(); $("#tr_id_weight").show();
$("#addAnaInfo").show(); $("#addAnaInfo").show();
...@@ -676,21 +679,24 @@ ...@@ -676,21 +679,24 @@
} }
$("#businessActivedListTd").append(strcheckBox); $("#businessActivedListTd").append(strcheckBox);
} }
}); });
} }
function deleteRow(e) { function deleteRow(e) {
var initK=Number($(e).parent().prev()[0].innerHTML).toFixed(2); var initK=Number($(e).parent().prev()[0].innerHTML).toFixed(2);
sumkpiWeightTdVal-=initK;
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)).toFixed(2)); sumkpiWeightTdVal-=parseFloat(Number(initK).toFixed(2));
var parseF=parseFloat((1-sumkpiWeightTdVal).toFixed(2));
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
// $("#kpiWeightTd").val(parseF === 0?'':parseF);
$(e).parent().parent().remove(); $(e).parent().parent().remove();
} }
// sumkpiWeightTdVal=1.00;
function updateRow(e){ function updateRow(e){
var initK=Number($(e).parent().prev()[0].innerHTML).toFixed(2); var initK=Number($(e).parent().prev()[0].innerHTML).toFixed(2);
var pro=prompt("请输入 0~"+initK,$(e).parent().prev()[0].innerHTML); var pro=prompt("请输入 ",$(e).parent().prev()[0].innerHTML);
pro=$.trim(pro); pro=$.trim(pro);
if($.isNumeric(pro)){ if($.isNumeric(pro)){
pro=Number(pro); pro=Number(pro);
...@@ -698,11 +704,12 @@ ...@@ -698,11 +704,12 @@
var k=sumkpiWeightTdVal-initK; var k=sumkpiWeightTdVal-initK;
k=k+pro; k=k+pro;
if(k <= 1.00){ if(k <= 1.00){
$(e).parent().prev()[0].innerHTML=pro.toFixed(2); // $(e).parent().prev()[0].innerHTML=pro.toFixed(2);
$(e).parent().prev()[0].innerHTML=parseFloat(pro.toFixed(2));
// alert("---"+pro.toFixed(2)); // alert("---"+pro.toFixed(2));
sumkpiWeightTdVal-=initK; sumkpiWeightTdVal-=initK;
sumkpiWeightTdVal+=pro; sumkpiWeightTdVal+=pro;
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)).toFixed(2)); $("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
}else{ }else{
$.alert("输入值过大,请输入0~"+initK); $.alert("输入值过大,请输入0~"+initK);
} }
...@@ -714,7 +721,6 @@ ...@@ -714,7 +721,6 @@
} }
// '添加勾选指标' 按钮 点击事件 // '添加勾选指标' 按钮 点击事件
$("#addAnaInfo").click(function () { $("#addAnaInfo").click(function () {
// $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal));
var arrdimKpiChecked=getValueOfNamedimKpiCheck(); var arrdimKpiChecked=getValueOfNamedimKpiCheck();
if(arrdimKpiChecked.length <= 0){ if(arrdimKpiChecked.length <= 0){
...@@ -723,7 +729,7 @@ ...@@ -723,7 +729,7 @@
} }
id_kpiWeightTd_value=getValueBykpiWeightTd(); id_kpiWeightTd_value=getValueBykpiWeightTd();
if(id_kpiWeightTd_value == 0||isNaN(id_kpiWeightTd_value)){ if(parseFloat(id_kpiWeightTd_value.toFixed(2)) == 0||isNaN(id_kpiWeightTd_value)){
$.alert("权值不能为空 或 0"); $.alert("权值不能为空 或 0");
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2))); $("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return; return;
...@@ -745,7 +751,7 @@ ...@@ -745,7 +751,7 @@
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2))); $("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return; return;
} }
id_kpiWeightTd_value=id_kpiWeightTd_value.toFixed(2); id_kpiWeightTd_value=parseFloat(id_kpiWeightTd_value.toFixed(2));
var kpiId_Name=getkpiid_NameOfNamedimKpiCheck(); var kpiId_Name=getkpiid_NameOfNamedimKpiCheck();
for(var i=0;i<kpiId_Name.length;i++){ for(var i=0;i<kpiId_Name.length;i++){
var id_name=kpiId_Name[i]; var id_name=kpiId_Name[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment