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

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

解决 偶尔出现 '权值和=!1' bug
parent dc21cad1
......@@ -163,7 +163,6 @@
<tr>
<td>渠道:</td>
<td>
<%--<div class="checkbox-inline"><label><input type="checkbox" name="channelList" id="channelList" title="allSelect" checked />全选</label></div>--%>
<div id="">
<c:forEach items="${channelList}" var="channel">
<div class="checkbox-inline">
......@@ -198,15 +197,12 @@
<tr>
<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>
<td>权重(<font color="red">必填</font>):</td>
<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"
style="color:red;display: inline;padding-left:10px;"></span></td>
</tr>
......@@ -273,8 +269,8 @@
}
});
$("input[name='provinceDetail'][value='3000']").click(function () {
alert($("input[name='provinceDetail'][value='32']").text());
alert($("input[name='provinceDetail'][value='32']").html());
/*alert($("input[name='provinceDetail'][value='32']").text());
alert($("input[name='provinceDetail'][value='32']").html());*/
if ($("input[name='provinceDetail'][value='32']").attr("checked") == "checked") {
/*$("#provinceDetailAll").next().hide();
......@@ -384,28 +380,27 @@
function updateRow(e) {
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);
if ($.isNumeric(pro)) {
pro = parseFloat(pro);
if (pro > 0) {
if (initK >= pro) {
$(e).parent().prev()[0].innerHTML = parseFloat(pro).toFixed(2);
sumkpiWeightTdVal -= initK;
sumkpiWeightTdVal += pro;
$(e).parent().prev()[0].innerHTML = parseFloat(pro.toFixed(2));
sumkpiWeightTdVal -= parseFloat(initK.toFixed(2));
sumkpiWeightTdVal += parseFloat(pro.toFixed(2));
var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV === '0.00'?'':maxV);
$("#kpiWeightTd").val(maxV === '0.00'?'':parseFloat(maxV));
}
else {
var k = sumkpiWeightTdVal - initK + pro;
if (k <= 1.00) {
$(e).parent().prev()[0].innerHTML = parseFloat(pro).toFixed(2);
sumkpiWeightTdVal -= initK;
sumkpiWeightTdVal += pro;
$(e).parent().prev()[0].innerHTML = parseFloat(pro.toFixed(2));//.toFixed(2);
sumkpiWeightTdVal -= parseFloat(initK.toFixed(2));
sumkpiWeightTdVal += parseFloat(pro.toFixed(2));
var maxV = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV === '0.00'?'':maxV);
$("#kpiWeightTd").val(maxV === '0.00'?'':parseFloat(maxV));
}else{
$.alert("输入值过大,请输入0~"+initK);
}
......@@ -420,8 +415,8 @@
//删除一条参数
function deleteRow(e) {
var v = $(e).parent().prev().text();
sumkpiWeightTdVal = sumkpiWeightTdVal - v;
$("#kpiWeightTd").val((1.00 - sumkpiWeightTdVal) === 0?'':parseFloat(1.00 - sumkpiWeightTdVal).toFixed(2));
sumkpiWeightTdVal = sumkpiWeightTdVal - parseFloat(Number(v).toFixed(2));
$("#kpiWeightTd").val((1.00 - sumkpiWeightTdVal) === 0?'':parseFloat((1.00 - sumkpiWeightTdVal).toFixed(2)));
var id = Number(e.title);
dimKpiSelected.splice($.inArray(id, dimKpiSelected), 1);
$(e).parent().parent().remove();
......@@ -448,11 +443,7 @@
//form表单提交
$("#modelSubmit").click(function () {
/*sumkpiWeightTdVal=sumkpiWeightTdVal.toFixed(2);
sumkpiWeightTdVal =parseFloat(sumkpiWeightTdVal);*/
// alert("sumkpiWeightTdVal "+sumkpiWeightTdVal);
// alert("sumkpiWeightTdVal "+typeof sumkpiWeightTdVal);
// return;
if (sumkpiWeightTdVal < 1.00) {
$.alert("权限总和需 为 1");
return;
......@@ -738,41 +729,41 @@
return;
}
var kpiWeightTdVal = $.trim($("#kpiWeightTd").val());
if (kpiWeightTdVal == "" || kpiWeightTdVal == 0) {
if (kpiWeightTdVal == "" || parseFloat(Number(kpiWeightTdVal).toFixed(2)) == 0) {
$.alert("权重不能为空");
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;
}
if (kpiWeightTdVal < 0) {
$.alert("权重不能为负");
var mmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mmm === '0.00'?'':mmm);
$("#kpiWeightTd").val(mmm === '0.00'?'':parseFloat(mmm));
return;
}
if (kpiWeightTdVal > 1.00) {
$.alert("权重超值 1");
var mmmm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mmmm);
$("#kpiWeightTd").val(parseFloat(mmmm));
return;
}
var tt = 0.00;
for (var jj = 0; jj < arrDimKpiChecked.length; jj++) {
tt += Number(kpiWeightTdVal);
tt += parseFloat(Number(kpiWeightTdVal).toFixed(2));
}
var k = sumkpiWeightTdVal + tt;
//var k=sumkpiWeightTdVal+Number(kpiWeightTdVal);
if (k > 1.00) {
$.alert("权重和 超值 1");
var mm = (1 - Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(mm);
$("#kpiWeightTd").val(parseFloat(mm));
return;
}
// 勾选指标 的 名称 和 value
var arrDimKpiidAndNameChecked = getArrDimKpiidAndNameChecked();
//向 已添加指标 添加
kpiWeightTdVal=Number(kpiWeightTdVal).toFixed(2);
kpiWeightTdVal=parseFloat(Number(kpiWeightTdVal).toFixed(2));
for (var i = 0; i < arrDimKpiidAndNameChecked.length; 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>");
......@@ -792,8 +783,8 @@
});
sumkpiWeightTdVal += tt;
var maxV = 1 - Number(sumkpiWeightTdVal);
$("#kpiWeightTd").val(maxV === 0?'':maxV.toFixed(2));
var maxV = parseFloat((1 - Number(sumkpiWeightTdVal)).toFixed(2));
$("#kpiWeightTd").val(maxV === 0?'':parseFloat(maxV));
});
dimKpiSelected = new Array();
......
......@@ -10,6 +10,7 @@
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ 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}"/>
<html>
<head>
......@@ -148,7 +149,9 @@
<td>${dimKpi.name}</td>
<c:forEach items="${anaInfo.items}" var="ite">
<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: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>
......@@ -276,7 +279,7 @@
$("#updateAnaInf").click(function () {//跟新指标按钮
$(this).hide();
// $("#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_weight").show();
$("#addAnaInfo").show();
......@@ -676,21 +679,24 @@
}
$("#businessActivedListTd").append(strcheckBox);
}
});
}
function deleteRow(e) {
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();
}
// sumkpiWeightTdVal=1.00;
function updateRow(e){
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);
if($.isNumeric(pro)){
pro=Number(pro);
......@@ -698,11 +704,12 @@
var k=sumkpiWeightTdVal-initK;
k=k+pro;
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));
sumkpiWeightTdVal-=initK;
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{
$.alert("输入值过大,请输入0~"+initK);
}
......@@ -714,7 +721,6 @@
}
// '添加勾选指标' 按钮 点击事件
$("#addAnaInfo").click(function () {
// $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal));
var arrdimKpiChecked=getValueOfNamedimKpiCheck();
if(arrdimKpiChecked.length <= 0){
......@@ -723,7 +729,7 @@
}
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");
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)) === 0?'':parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return;
......@@ -745,7 +751,7 @@
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return;
}
id_kpiWeightTd_value=id_kpiWeightTd_value.toFixed(2);
id_kpiWeightTd_value=parseFloat(id_kpiWeightTd_value.toFixed(2));
var kpiId_Name=getkpiid_NameOfNamedimKpiCheck();
for(var i=0;i<kpiId_Name.length;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