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

监控运营->告警关联诊断->关联诊断配置 界面

增加 '参数权值总和必为 1.00' 设置
parent 72f8079e
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
<tr> <tr>
<td>权重(<font color="red">必填</font>):</td> <td>权重(<font color="red">必填</font>):</td>
<td><input type="number" class="form-control" name="descTd" id="kpiWeightTd" style="display: inline;" /> <td><input type="number" class="form-control" name="descTd" id="kpiWeightTd" value="1.00" style="display: inline;" />
<span id="writeWarningInfTd" style="color:red;display: inline;padding-left:10px;"></span></td> <span id="writeWarningInfTd" style="color:red;display: inline;padding-left:10px;"></span></td>
</tr> </tr>
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
} }
//修改一条参数 //修改一条参数
function updateRow(elementTag){ /* function updateRow(elementTag){
$("#addParam").text("修改参数"); $("#addParam").text("修改参数");
$("#addTr").find("tr").removeClass("orange-tr"); $("#addTr").find("tr").removeClass("orange-tr");
$(elementTag).parents("tr").eq(0).addClass("orange-tr"); $(elementTag).parents("tr").eq(0).addClass("orange-tr");
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
$("#paramDataType").change(); $("#paramDataType").change();
$("#paramName").val(paramName); $("#paramName").val(paramName);
$("#paramValue").val(paramValue); $("#paramValue").val(paramValue);
} }*/
//添加/修改参数 //添加/修改参数
$("#addParam").click(function(){ $("#addParam").click(function(){
...@@ -318,24 +318,37 @@ ...@@ -318,24 +318,37 @@
function updateRow(e){ function updateRow(e){
var pro=prompt("请输入",$(e).parent().prev()[0].innerHTML); var pro=prompt("请输入",$(e).parent().prev()[0].innerHTML);
var initK=Number($(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){
$(e).parent().prev()[0].innerHTML=parseFloat(pro);
sumkpiWeightTdVal-=initK;
sumkpiWeightTdVal+=pro;
var maxV=(1-Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV);
}else{
var k=sumkpiWeightTdVal-initK+pro;
if(k <=1.00){
$(e).parent().prev()[0].innerHTML=parseFloat(pro); $(e).parent().prev()[0].innerHTML=parseFloat(pro);
sumkpiWeightTdVal-=initK;
sumkpiWeightTdVal+=pro;
var maxV=(1-Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV);
}
}
} }
} }
} }
//删除一条参数 //删除一条参数
function deleteRow(e){ function deleteRow(e){
var v=$(e).parent().prev().text();
sumkpiWeightTdVal=sumkpiWeightTdVal-v;
$("#kpiWeightTd").val( (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();
...@@ -363,21 +376,23 @@ ...@@ -363,21 +376,23 @@
//form表单提交 //form表单提交
$("#modelSubmit").click(function(){ $("#modelSubmit").click(function(){
sumkpiWeightTdVal=sumkpiWeightTdVal.toFixed(2);
if(sumkpiWeightTdVal <1.00){
$.alert("权限总和需 为 1");
return;
}
var anainfoShallSaveArr= getAnainfoShallSave(); var anainfoShallSaveArr= getAnainfoShallSave();
var arrDimKpiChecked=getArrDimKpiChecked(); var arrDimKpiChecked=getArrDimKpiChecked();
var provinceDetailChecked=getDetailProvinceCheckedValues(); var provinceDetailChecked=getDetailProvinceCheckedValues();
if(provinceDetailChecked.length < 1){ if(provinceDetailChecked.length < 1){
$.alert("省份需选"); $.alert("省份需选");
return;
}else if($.trim($("#descTd").val())==""){ }else if($.trim($("#descTd").val())==""){
$.alert("描述不能为空"); $.alert("描述不能为空");
} return;
/*else if ($.trim($("#kpiWeightTd").val())==""){ }else if(anainfoShallSaveArr.length < 1){
$.alert("权重不能为空");
}*//*else if (arrDimKpiChecked.length < 1){
$.alert("指标需选");
}*/else if(anainfoShallSaveArr.length < 1){
$.alert("指标需选"); $.alert("指标需选");
return;
} }
else{ else{
...@@ -399,6 +414,7 @@ ...@@ -399,6 +414,7 @@
success: function(data){ success: function(data){
$.alert(data); $.alert(data);
sumkpiWeightTdVal=0.00;
setTimeout(function () { setTimeout(function () {
location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration"; location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
},2000); },2000);
...@@ -407,7 +423,6 @@ ...@@ -407,7 +423,6 @@
}); });
} }
}); });
...@@ -638,7 +653,7 @@ ...@@ -638,7 +653,7 @@
}); });
sumkpiWeightTdVal=0.00;
// 添加 '勾选指标指标'按钮 点击事件 // 添加 '勾选指标指标'按钮 点击事件
$("#addAnaInfo").click(function(){ $("#addAnaInfo").click(function(){
var arrDimKpiChecked=getArrDimKpiChecked(); var arrDimKpiChecked=getArrDimKpiChecked();
...@@ -655,6 +670,15 @@ ...@@ -655,6 +670,15 @@
$.alert("权重不能为负"); $.alert("权重不能为负");
return; return;
} }
if(kpiWeightTdVal >1.00){
$.alert("权重超值 1");
return ;
}
var k=sumkpiWeightTdVal+Number(kpiWeightTdVal);
if(k > 1.00){
$.alert("权重和 超值 1");
return;
}
// 勾选指标 的 名称 和 value // 勾选指标 的 名称 和 value
var arrDimKpiidAndNameChecked=getArrDimKpiidAndNameChecked(); var arrDimKpiidAndNameChecked=getArrDimKpiidAndNameChecked();
...@@ -677,8 +701,10 @@ ...@@ -677,8 +701,10 @@
} }
}); });
$("#kpiWeightTd").val(''); sumkpiWeightTdVal+=Number(kpiWeightTdVal);
var maxV=(1-Number(sumkpiWeightTdVal)).toFixed(2);
$("#kpiWeightTd").val(maxV);
//$("#kpiWeightTd").attr("max",maxV);
}); });
dimKpiSelected=new Array(); dimKpiSelected=new Array();
......
...@@ -272,7 +272,8 @@ ...@@ -272,7 +272,8 @@
$("#updateAnaInf").click(function () {//跟新指标按钮 $("#updateAnaInf").click(function () {//跟新指标按钮
$(this).hide(); $(this).hide();
// $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal));
$("#kpiWeightTd").val(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();
...@@ -343,7 +344,14 @@ ...@@ -343,7 +344,14 @@
// 更新 // 更新
$("#updateAnaInfo").click(function () { $("#updateAnaInfo").click(function () {
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
var kk=parseFloat((sumkpiWeightTdVal).toFixed(2));
if( kk <1.00){
$.alert("权值总和必须为1");
return;
}
return;
var kpiId_weight=getkpiIDAndWeightShallSave(); var kpiId_weight=getkpiIDAndWeightShallSave();
var associationId = $("#associationId").val(); var associationId = $("#associationId").val();
...@@ -696,24 +704,37 @@ ...@@ -696,24 +704,37 @@
} }
function deleteRow(e) { function deleteRow(e) {
var initK=Number($(e).parent().prev()[0].innerHTML).toFixed(2);
sumkpiWeightTdVal-=initK;
// $("#kpiWeightTd").val(1-Number(sumkpiWeightTdVal));
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
$(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 pro=prompt("请输入",$(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=Number(pro);
if(pro >0){ if(pro >0){
var k=sumkpiWeightTdVal-initK;
k=k+pro;
if(k <= 1.00){
$(e).parent().prev()[0].innerHTML=parseFloat(pro); $(e).parent().prev()[0].innerHTML=parseFloat(pro);
sumkpiWeightTdVal-=initK;
sumkpiWeightTdVal+=pro;
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
//$("#kpiWeightTd").text((1-Number(sumkpiWeightTdVal)).toFixed(2));
}
} }
} }
} }
// '添加勾选指标' 按钮 点击事件 // '添加勾选指标' 按钮 点击事件
$("#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){
...@@ -721,11 +742,18 @@ ...@@ -721,11 +742,18 @@
return; return;
} }
id_kpiWeightTd_value=getValueBykpiWeightTd(); id_kpiWeightTd_value=getValueBykpiWeightTd();
if(id_kpiWeightTd_value == 0){ if(id_kpiWeightTd_value == 0){
$.alert("权值不能为空"); $.alert("权值不能为空");
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return;
}
id_kpiWeightTd_value=Number(id_kpiWeightTd_value);
if(id_kpiWeightTd_value+Number(sumkpiWeightTdVal) > 1.00){
$.alert("权值总和 不能大于 1");
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
return; return;
} }
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++){
...@@ -740,7 +768,8 @@ ...@@ -740,7 +768,8 @@
} }
}); });
} }
$("#kpiWeightTd").val(""); sumkpiWeightTdVal=Number(id_kpiWeightTd_value)+Number(sumkpiWeightTdVal);
$("#kpiWeightTd").val(parseFloat((1-sumkpiWeightTdVal).toFixed(2)));
}); });
...@@ -762,7 +791,7 @@ ...@@ -762,7 +791,7 @@
} }
function getValueBykpiWeightTd(){ function getValueBykpiWeightTd(){
var val=$("#kpiWeightTd").val(); var val=$("#kpiWeightTd").val();
return Number(val); return parseFloat(val);
} }
$("#modelReset").click(function(){ $("#modelReset").click(function(){
window.location.reload(); window.location.reload();
...@@ -770,6 +799,8 @@ ...@@ -770,6 +799,8 @@
}); });
//删除所有参数 //删除所有参数
function deleteAllTr(){ function deleteAllTr(){
sumkpiWeightTdVal=0.00;
$("#kpiWeightTd").val(1.00);
$("#addTr").empty(); $("#addTr").empty();
} }
......
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