Commit 109d4a64 authored by 胡斌's avatar 胡斌

Merge remote-tracking branch 'origin/moly'

parents 57d67ef9 7bdffc50
...@@ -57,6 +57,7 @@ function getDetailProvinceCheckedValues(){ ...@@ -57,6 +57,7 @@ function getDetailProvinceCheckedValues(){
provinceArray[i]=$(this).val(); provinceArray[i]=$(this).val();
i++; i++;
}); });
console.log("provinceArray "+provinceArray):
return provinceArray; return provinceArray;
} }
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" /> <c:set var="ctx" value="${pageContext.request.contextPath}" />
<div id="timeLine" class="date">
<label for="">时间范围</label><!-- 最近3年 -->
<input id="d1" class="Wdate" type="text" style="width:137px;" value="" onFocus="var d2=$dp.$('d2');WdatePicker({onpicked:function(){d2.focus();},minDate:'{%y-3}-%M-%d %H:%m:%s',maxDate:'#F{$dp.$D(\'d2\')||\'%y-%M-%d %H:%m:%s\'}',dateFmt:'yyyy-MM-dd'})">
--
<input id="d2" class="Wdate" type="text" style="width:137px;" value="" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d1\')||\'{%y-3}-%M-%d %H:%m:%s\'}',maxDate:'%y-%M-%d %H:%m:%s',dateFmt:'yyyy-MM-dd'})">
</div>
<div id="more-option" class="slide-menu-option"> <div id="more-option" class="slide-menu-option">
<div class="slide-select"> <div class="slide-select">
<label for="">关联维度:</label> <label for="">关联维度:</label>
<select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;"> <select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;">
<option value="yewu">业务</option> <option value="c">业务</option>
<option value="qudao" selected>渠道</option> <option value="q" selected>渠道</option>
<%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}"> <%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}">
<option value="${workingOrderStatus}" id="xcdStatus"> <option value="${workingOrderStatus}" id="xcdStatus">
${workingOrderStatus} ${workingOrderStatus}
...@@ -95,6 +103,7 @@ ...@@ -95,6 +103,7 @@
//返回 关联维度 的 选择值 //返回 关联维度 的 选择值
function getDetailCheckeddDimension() { function getDetailCheckeddDimension() {
var checkedDimension=$("#xcdStatusSelect option:selected").val(); var checkedDimension=$("#xcdStatusSelect option:selected").val();
console.log("checkedDimension "+checkedDimension);
return checkedDimension; return checkedDimension;
} }
...@@ -171,6 +180,7 @@ ...@@ -171,6 +180,7 @@
provinceArray[i]=$(this).val(); provinceArray[i]=$(this).val();
i++; i++;
}); });
console.log("provinceArray "+provinceArray );
return provinceArray; return provinceArray;
} }
...@@ -195,7 +205,7 @@ ...@@ -195,7 +205,7 @@
function getDetailProvinceCheckedTitles(){ function getDetailProvinceCheckedTitles(){
var provinceArray=new Array(); var provinceArray=new Array();
var i=0; var i=0;
detailProvinceCheckedValues.each(function(){ $(".provinceDetail:checked").each(function(){
provinceArray[i]=$(this).attr("title"); provinceArray[i]=$(this).attr("title");
i++; i++;
}); });
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
<script src="${ctx}/static/artDialog4.1.7/artDialog.source.js?skin=default"></script> <script src="${ctx}/static/artDialog4.1.7/artDialog.source.js?skin=default"></script>
<script src="${ctx}/static/artDialog4.1.7/plugins/iframeTools.source.js"></script> <script src="${ctx}/static/artDialog4.1.7/plugins/iframeTools.source.js"></script>
<%--<script type="text/javascript" src="${ctx}/static/js/failureAnalysisDetailTable.js"></script>--%>
<script type="text/javascript" src="${ctx}/static/js/associatediagosisdetail.js"></script> <script type="text/javascript" src="${ctx}/static/js/associatediagosisdetail.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
...@@ -87,24 +86,14 @@ ...@@ -87,24 +86,14 @@
</button> </button>
<div class="slide-menu-tags"> <div class="slide-menu-tags">
<span id="detailPeriodTag" class="label label-info" data-placement="bottom">最近一个月</span> <span id="detailPeriodTag" class="label label-info" data-placement="bottom">最近一个月</span>
<span id="detailDataSourceTag" class="label label-info"
data-placement="bottom"></span> <span id="detailTimeTag" class="label label-info"
<span id="detailChannelTag" class="label label-info"
data-placement="bottom"></span> data-placement="bottom"></span>
<span id="detailBusinessTag" class="label label-info" <span id="detailDimensionTag" class="label label-info"
data-placement="bottom"></span> data-placement="bottom"></span>
<span id="detailProvinceTag" class="label label-info" <span id="detailProvinceTag" class="label label-info"
data-placement="bottom"></span> data-placement="bottom"></span>
<span id="detailProviderTag" class="label label-info"
data-placement="bottom"></span>
<span id="detailXcdStatusTag" class="label label-info"
data-placement="bottom"></span>
<span id="detailTitleTag" class="label label-info"
data-placement="bottom"></span>
<span id="detailWarningSourceTag" class="label label-info"
data-placement="bottom"></span>
<span id="detailFailureIdTag" class="label label-info"
data-placement="bottom"></span>
</div> </div>
<div class="bt-list-import"> <div class="bt-list-import">
<a href="#" id="gzfxDetailUpload" class=""> <a href="#" id="gzfxDetailUpload" class="">
...@@ -255,15 +244,35 @@ ...@@ -255,15 +244,35 @@
} }
//获取选取的时间段,返回结果为字符串数组
function getPeriod(){
var period=new Array();
period[0]=$("#d1").val();
period[1]=$("#d2").val();
return period;
}
//返回结果为以逗号分隔的字符串类型
function getPeriodString(){
var str="";
var period=getPeriod();
str=str+period[0]+"~"+period[1];
console.log("str "+str);
console.log("str leng "+str.length);
return str;
}
function detailSubmit(){ function detailSubmit(){
var detailProvinceSum = getDetailProvinceCheckedValues().length; var detailProvinceSum = getDetailProvinceCheckedValues().length;
var detailtime=getPeriodString();
if(detailProvinceSum==0) { if(detailtime == "" || detailtime == null||detailtime.length <2){
$.alert("时间范围不能为空");
}else if(detailProvinceSum==0) {
$.alert("省份的选择不能为空"); $.alert("省份的选择不能为空");
}else{ }else{
var detailProvince = getDetailProvinceCheckedValueString(); var detailProvince = getDetailProvinceCheckedValueString();
var dimension=getDetailCheckeddDimension(); var dimension=getDetailCheckeddDimension();
//alert(dimension+"-pi-"); //alert(dimension+"-pi-");
// alert(detailProvince); // alert(detailProvince);
//var href="${ctx}/MonitorOperation/FailureAnalysisDetail/changeTable?detailProvince="+detailProvince+"&detailProvider="+detailProvider+"&xcdStatus="+xcdStatus+"&detailDataSource="+detailDataSource+"&detailChannel="+detailChannel+"&detailBusiness="+detailBusiness+"&detailWarningSource="+detailWarningSource+"&failureTitle="+"-1"; //var href="${ctx}/MonitorOperation/FailureAnalysisDetail/changeTable?detailProvince="+detailProvince+"&detailProvider="+detailProvider+"&xcdStatus="+xcdStatus+"&detailDataSource="+detailDataSource+"&detailChannel="+detailChannel+"&detailBusiness="+detailBusiness+"&detailWarningSource="+detailWarningSource+"&failureTitle="+"-1";
...@@ -282,14 +291,33 @@ ...@@ -282,14 +291,33 @@
toggleMenu('slidePushMenus2');//隐藏筛选项 toggleMenu('slidePushMenus2');//隐藏筛选项
} }
});*/ });*/
$("#detailPeriodTag").empty();
$("#detailProvinceTag").text("省份").append($("<span class='badge'></span>").text(detailProvinceSum)).attr('data-original-title',getDetailProvinceTag()).tooltip();
$("#detailDimensionTag").text("关联维度").append($("<span class='badge'></span>").text()).attr('data-original-title',getdetailDemensionTagValue()).tooltip();
$("#detailTimeTag").text("时间范围").append($("<span class='badge'></span>").text()).attr('data-original-title',detailtime).tooltip();
toggleMenu('slidePushMenus2');//隐藏筛选项 toggleMenu('slidePushMenus2');//隐藏筛选项
} }
writeLable(); //writeLable();
} }
function getdetailDemensionTagValue(){
var checkedDimension=$("#xcdStatusSelect option:selected").text();
return checkedDimension;
}
function getDetailProvinceTag(){
var str="";
$(".provinceDetail:input:checkbox:checked").each(function(){
str+=$(this).attr("title")+" ";
});
return str;
}
//重置detail中的筛选项 //重置detail中的筛选项
function detailReset(){ function detailReset(){
$("#d1").val('');
$("#d2").val('');
detail_Province_Reset(); detail_Province_Reset();
detail_Dimension_Reset(); detail_Dimension_Reset();
judge = true; judge = true;
......
<%--
Created by IntelliJ IDEA.
User: molinyi
Date: 2017/11/25 0025
Time: 下午 2:04
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ 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" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>全网监控智能分析平台</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script src="${ctx}/static/artDialog4.1.7/artDialog.source.js?skin=default"></script>
<script src="${ctx}/static/artDialog4.1.7/plugins/iframeTools.source.js"></script>
<style>
.table-null .table {
margin-bottom: 0px;
}
.table-null .table > tbody > tr > td, .table-null .table > thead > tr > th {
text-align: center;
width: 25%;
}
.table-null td:first-child {
text-align: right;
width: 36%;
}
.table-null tr td:last-child .form-control, .table-null tr td:last-child table {
width: 400px;
}
.file-box {
position: relative;
}
.file {
position: absolute;
top: 0;
height: 30px;
filter: alpha(opacity:0);
opacity: 0;
width: 470px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<ol class="breadcrumb">
<li><a href="${ctx}/index">首页</a></li>
<li>监控运营</li>
<li class="active">告警关联诊断</li>
</ol>
</div>
<div id="main-container main-tab-container">
<div id="content" class="container">
<div class="section">
<div class="tab-content">
<div class="tab-pane fade in active" id="home">
<div class="row">
<div class="col-xs-12">
<div class="table-header">修改关联配置</div>
<form action="#" class="form-horizontal" id="modelMaintainForm" method="post"
enctype="multipart/form-data">
<table id="modelMaintainTable" class="table-null">
<input type="text" id="associationId" value="${anaInfo.associationId}">
<input type="hidden" id="dimKpiSelectedList" value="${dimKpiSelectedList}">
<tr>
<td>省份:</td>
<td>
<select class="form-control" name="proviceTd" id="proviceTd">
<c:forEach var="provice" items="${proviceList}">
<c:choose>
<c:when test="${provice.provinceId == anaInfo.provinceId}">
<option value="${provice.provinceId}"
selected>${provice.provinceName}</option>
</c:when>
<c:otherwise>
<option value="${provice.provinceId}">${provice.provinceName}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td>维度:</td>
<td><select class="form-control" name="dimensionTd" id="dimensionTd">
<c:forEach var="modelType" items="${dimensionList}">
<c:choose>
<c:when test="${modelType.value == anaInfo.associationType}">
<option value="${modelType.value}"
selected>${modelType.name}</option>
</c:when>
<c:otherwise>
<option value="${modelType.value}">${modelType.name}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select></td>
</tr>
<tr>
<td>描述(<font color="red">必填</font>):</td>
<td><input type="text" class="form-control" name="descTd" id="descTd"
style="display: inline;" value="${anaInfo.assoicationDesc}"/>
<span id="writeWarningInf"
style="color:red;display: inline;padding-left:10px;"></span></td>
</tr>
<tr>
<td>添加指标:</td>
<td><table class="table table-hover table-striped" id="displayParam">
<thead>
<tr>
<input type="hidden" class="btn btn-default" id="modelReset2"/>
<th>指标名称</th><th>权重值</th><th><a href="javascript:deleteAllTr()">删除所有</a></th>
</tr>
</thead>
<tbody id="addTr">
<c:forEach items="${dimKpiSelectedList}" var="dimKpi">
<tr class="${dimKpi.kpiId}" id='dimKpiCheck_${dimKpi.kpiId}'>
<td>${dimKpi.name}</td>
<c:forEach items="${anaInfo.items}" var="ite">
<c:if test="${ite.kpiId == dimKpi.kpiId}">
<td>${ite.kpiWeight}</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>
</tr>
</c:forEach>
</tbody>
</table>
</td>
</tr>
<tr>
<tr id="dataSourceTr">
<td>数据源:</td>
<td>
<c:forEach items="${dataSourceList}" var="dataSource">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="dataSourceRadio"
onclick="dataSourceRadioClick()" class="provinceDetail"
title="${dataSource.dataSourceName}"
value="${dataSource.dataSourceId}"/>${dataSource.dataSourceName}
</label>
</div>
</c:forEach>
</td>
</tr>
<tr id="channelTr">
<td>渠道:</td>
<td>
<%--<div class="checkbox-inline"><label><input type="checkbox" name="channelList" id="channelList" title="allSelect" checked />全选</label></div>--%>
<c:forEach items="${channelList}" var="channel">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channelRadio"
onclick="channelRadioClick()" class="provinceDetail"
title="${channel.channelId}"
value="${channel.channelId}"/>${channel.channelName}
</label>
</div>
</c:forEach>
</td>
</tr>
<tr id="businessTr">
<td>业务:</td>
<td id="businessActivedListTd">
</td>
</tr>
<tr id="tr_id_dimkpi">
<td>指标:</td>
<td id="dimKpiListTd">
</td>
</tr>
<tr id="tr_id_weight">
<td>权重(<font color="red">必填</font>):</td>
<td><input type="number" class="form-control" name="descTd" id="kpiWeightTd" style="display: inline;" />
<span id="writeWarningInfTd" style="color:red;display: inline;padding-left:10px;"></span></td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="button" id="addAnaInfo" class="btn btn-primary">添加勾选指标</button>
<button type="button" id="updateAnaInf" class="btn btn-info btn-small">
修改指标
</button>
<button type="button" id="updateAnaInfo" class="btn btn-primary">更新</button>
<button type="reset" class="btn btn-default" id="modelReset">取消</button>
<button type="button" id="deleteAnaInfo" class="btn btn-danger">删除</button>
<button type="reset" class="btn btn-warning" id="modelBack">返回</button>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
${anaInfo}
<script type="text/javascript">
$(document).ready(function () {
$("#tr_id_dimkpi").hide();
$("#tr_id_weight").hide();
$("#addAnaInfo").hide();
$("#modelReset").hide();
$("#modelReset2").hide();
$("#channelTr").hide();
$("#dataSourceTr").hide();
$("#businessTr").hide();
$("#selectAnaInfo").hide();
$("#selectBusiness").hide();
//权重 初始值
kpiWeightTdInitValue = $("#kpiWeightTd").val();
//描述 初始值
descTdInitValue = $("#descTd").val();
});
$("#updateAnaInf").click(function () {//跟新指标按钮
$(this).hide();
$("#tr_id_dimkpi").show();
$("#tr_id_weight").show();
$("#addAnaInfo").show();
$("#modelReset").show();
$("#channelTr").show();
$("#dataSourceTr").show();
$("#businessTr").show();
$("#selectAnaInfo").show();
$("#selectBusiness").show();
});
$("#selectBusiness").click(function () {//查找业务按钮
$("#businessActivedListTd").empty();
//渠道选择值
var channelArray = new Array();// 存放 所选 频道
$("input[name='channelRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
channelArray.push($(this).context.value);
}
});
//数据源选择值
var dataSourceArray = new Array();
$("input[name='dataSourceRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
dataSourceArray.push($(this).context.value);
}
});
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId=" + dataSourceArray + "&channelId=" + channelArray,
dataType: 'text',
success: function (data) {
var jsonDa = eval('(' + data + ')');
var strcheckBox = "";
for (var i = 0; i < jsonDa.length; i++) {
var strInput = "<input type='checkbox' id=BusinessCheck_" + jsonDa[i].businessId + " name='BusinessCheck' onClick='BusinessCheckClick()' class='provinceDetail' title='" + jsonDa[i].businessName + " value='" + jsonDa[i].businessId + "'/><font>" + jsonDa[i].businessName + "</font>" ;
strcheckBox += strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
});
// 查找 指标
$("#selectAnaInfo").click(function () {
//$("#dimKpiListTd").empty();
//获取选择的 业务
var businessSelectedArr = [];
$("input[name='BusinessCheck']").each(function (e) {
if ($(this).attr("checked")) {
businessSelectedArr.push($(this).context.id.split("_")[1]);
}
});
});
// 更新
$("#updateAnaInfo").click(function () {
var kpiId_weight=getkpiIDAndWeightShallSave();
var associationId = $("#associationId").val();
var proviceTdSelected = $("#proviceTd option:selected").val();
var dimensionTdSelected = $("#dimensionTd option:selected").val();//getArrDimensionTdSelected();
var arrDimKpiChecked = getArrDimKpiChecked();
var descTdV = $("#descTd").val();
//var kpiWeightTdV = $("#kpiWeightTd").val();
//var weightDimKpiChecked=getWeightDimKpiChecked(); // 指标 weight
//var arrIdAndWeightDimKpiChecked=getArrIdAndWeightDimKpiChecked();// 指标 id_weight
/* if(weightDimKpiChecked.length != arrIdAndWeightDimKpiChecked.length ){
$.alert("权重不能为空");
return;
}*/
if ($.trim(descTdV) == "") {
$.alert("描述不能为空");
return;
}
/*if ($.trim(kpiWeightTdV) == "") {
$.alert("权重不能为空");
return;
}*/
if(kpiId_weight.length <= 0){
$.alert("指标不能为空");
return;
}
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
data: {
associationId: associationId,
proviceTdSelected: proviceTdSelected,
dimensionTdSelected: dimensionTdSelected,
descTdV: descTdV,
},
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/updateAssociDigConfig?kpiId_weight=" + kpiId_weight,
dataType: 'text',
success: function (data) {
$.alert(data);
setTimeout(function () {
location.href = "${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
}, 2000);
}
});
/*$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
data: {
associationId: associationId,
proviceTdSelected: proviceTdSelected,
dimensionTdSelected: dimensionTdSelected,
descTdV: descTdV,
/!* kpiWeightTdV: kpiWeightTdV*!/
},
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/updateAssociDigConfig?arrIdAndWeightDimKpiChecked=" + arrIdAndWeightDimKpiChecked,
dataType: 'text',
success: function (data) {
$.alert(data);
setTimeout(function () {
location.href = "${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
}, 3000);
}
});*/
});
$("#deleteAnaInfo").click(function () {
$.dialog({
title: "提醒",
content: "真的要删除该配置项目?",
ok: function () {
var associationId = $("#associationId").val();
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
data: {associationId: associationId},
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/deleteAssociDigConfig",
dataType: 'text',
success: function (data) {
$.alert(data);
setTimeout(function () {
location.href = "${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
}, 2000);
}
});
},
okValue: "确定",
cancel: function () {
},
cancelValue: "取消",
lock: true
});
});
$("#modelBack").click(function () {
location.href = "${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
});
function getArrDimKpiChecked() {
var arrDimKpiChecked = [];
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
arrDimKpiChecked.push($(this).context.id.split("_")[1]);
}
});
return arrDimKpiChecked;
}
function getWeightDimKpiChecked() {
var weightDimKpiChecked = [];
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
var kpiWeight_="kpiWeight_"+$(this).context.id.split("_")[1];
var nu=Number($("input[name="+kpiWeight_+"]").val());
if(nu != 0){
weightDimKpiChecked.push(nu);
}
// weightDimKpiChecked.push(Number($("input[name="+kpiWeight_+"]").val()));
}
});
return weightDimKpiChecked;
}
// 指标 id_weight
function getArrIdAndWeightDimKpiChecked() {
var arrIdAndWeightDimKpiChecked = [];
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
var kpiWeight_="kpiWeight_"+$(this).context.id.split("_")[1];
arrIdAndWeightDimKpiChecked.push($(this).context.id.split("_")[1]+"_"+$("input[name="+kpiWeight_+"]").val());
}
});
return arrIdAndWeightDimKpiChecked;
}
function getArrDimensionTdSelected() {
var dimensionTdSelected = [];
$("input[name='dimensionTd']").each(function (e) {
if ($(this).attr("selected")) {
dimensionTdSelected.push($(this).context.id.split("_")[1]);
}
});
return dimensionTdSelected;
}
function BusinessCheckClick() {
//$("#dimKpiListTd").empty();
//获取选择的 业务
var businessSelectedArr =new Array();
$("input[name='BusinessCheck']").each(function (e) {
if ($(this).attr("checked")) {
businessSelectedArr.push($(this).context.id.split("_")[1]);
}
});
if (businessSelectedArr.length < 1) {
return;
}
var dimKpiHadSelectedArr = new Array();//原有的指标
$("#addTr").find("tr").each(function(){
var id=$(this).attr("id");
id=Number(id.split("_")[1]);
dimKpiHadSelectedArr.push(id);
});
// 重置 指标 一栏 筛选保留原有的 指标
$("input[name='dimKpiCheck']").each(function (e) {
if (!$(this).attr("checked")) {
$(this).next().remove();
$(this).remove();
}
});
var arrdimKpiChecked=getValueOfNamedimKpiCheck();
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getDimKpiListByBusinessIdList?businessIdList=" + businessSelectedArr,
dataType: 'text',
success: function (data) {
var jsonDa = eval('(' + data + ')');
for (var i = 0; i < jsonDa.length; i++) {
if (dimKpiHadSelectedArr.indexOf(jsonDa[i].kpiId) >= 0) {
continue;
}
if(arrdimKpiChecked.indexOf(jsonDa[i].kpiId) >= 0){
continue;
}
var strInput = "<input type='checkbox' id=dimKpiCheck_" + jsonDa[i].kpiId + " name='dimKpiCheck' class='provinceDetail' title='" + jsonDa[i].name + "' value=" + jsonDa[i].kpiId + "'/><font>" + jsonDa[i].name + "</font>";
$("#dimKpiListTd").append(strInput);
}
}
});
}
function getValueOfNamedimKpiCheck(){
var arr=new Array();
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
var dimKpiHadCheckId = Number($(this).attr("id").split("_")[1]);
arr.push(dimKpiHadCheckId);
}
});
return arr;
}
function getkpiid_NameOfNamedimKpiCheck(){
var arr=new Array();
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
var dimKpiHadCheckId = Number($(this).attr("id").split("_")[1]);
var dimKpiHadCheckName = $(this).attr("title");
arr.push(dimKpiHadCheckId+"_"+dimKpiHadCheckName);
}
});
return arr;
}
function doresetDimKpiArr() {
var arrDimKpiChecked = [];
$("input[name='dimKpiCheck']").each(function (e) {
if (!$(this).attr("checked")) {
arrDimKpiChecked.push($(this).context.id.split("_")[1]);
$(this).remove();
$(this).next().remove();
}
});
return arrDimKpiChecked;
}
function channelRadioClick() {
$("#businessActivedListTd").empty();
//渠道选择值
var channelArray = new Array();// 存放 所选 频道
$("input[name='channelRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
channelArray.push($(this).context.value);
}
});
//数据源选择值
var dataSourceArray = new Array();
$("input[name='dataSourceRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
dataSourceArray.push($(this).context.value);
}
});
if (dataSourceArray.length < 1 || channelArray.length < 1) {
return;
}
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId=" + dataSourceArray + "&channelId=" + channelArray,
dataType: 'text',
success: function (data) {
var jsonDa = eval('(' + data + ')');
var strcheckBox = "";
for (var i = 0; i < jsonDa.length; i++) {
var strInput = "<input type='checkbox' id=BusinessCheck_" + jsonDa[i].businessId + " name='BusinessCheck' onClick='BusinessCheckClick()' class='provinceDetail' title='" + jsonDa[i].businessName + " value='" + jsonDa[i].businessId + "'/>" + jsonDa[i].businessName;
strcheckBox += strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
}
function dataSourceRadioClick() {
$("#businessActivedListTd").empty();
//渠道选择值
var channelArray = new Array();// 存放 所选 频道
$("input[name='channelRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
channelArray.push($(this).context.value);
}
});
//数据源选择值
var dataSourceArray = new Array();
$("input[name='dataSourceRadio']:checked").each(function (e) {
if ($(this).attr("checked")) {
dataSourceArray.push($(this).context.value);
}
});
if (dataSourceArray.length < 1 || channelArray.length < 1) {
return;
}
$.ajax({
type: 'GET',
async: true,
contentType: 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId=" + dataSourceArray + "&channelId=" + channelArray,
dataType: 'text',
success: function (data) {
var jsonDa = eval('(' + data + ')');
var strcheckBox = "";
for (var i = 0; i < jsonDa.length; i++) {
var strInput = "<input type='checkbox' id=BusinessCheck_" + jsonDa[i].businessId + " name='BusinessCheck' onClick='BusinessCheckClick()' class='provinceDetail' title='" + jsonDa[i].businessName + " value='" + jsonDa[i].businessId + "'/>" + jsonDa[i].businessName;
strcheckBox += strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
}
function deleteRow(e) {
$(e).parent().parent().remove();
}
function updateRow(e){
var pro=prompt("请输入",$(e).parent().prev()[0].innerHTML);
pro=$.trim(pro);
if($.isNumeric(pro)){
pro=parseFloat(pro);
if(pro >0){
$(e).parent().prev()[0].innerHTML=parseFloat(pro);
}
}
}
// '添加勾选指标' 按钮 点击事件
$("#addAnaInfo").click(function () {
var arrdimKpiChecked=getValueOfNamedimKpiCheck();
if(arrdimKpiChecked.length <= 0){
$.alert("指标不能为空");
return;
}
id_kpiWeightTd_value=getValueBykpiWeightTd();
if(id_kpiWeightTd_value == 0){
$.alert("权值不能为空");
return;
}
var kpiId_Name=getkpiid_NameOfNamedimKpiCheck();
for(var i=0;i<kpiId_Name.length;i++){
var id_name=kpiId_Name[i];
var addRow = $("<tr class='"+id_name.split("_")[0]+"' id='dimKpiCheck_"+id_name.split("_")[0]+"'><td>"+id_name.split("_")[1]+"</td><td>"+id_kpiWeightTd_value+"</td><td><a href='javascript:;' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow);
$("input[name='dimKpiCheck']").each(function (e) {
if ($(this).attr("checked")) {
$(this).next().remove();
$(this).remove();
}
});
}
$("#kpiWeightTd").val("");
});
function getkpiIDAndWeightShallSave(){
var arr=new Array();
$("#addTr").find("tr").each(function(){
var id=$(this).attr("id");
id=Number(id.split("_")[1]);
var weight=$(this).children('td').eq(1).text();
weight=Number(weight);
var id_weight=id+"_"+weight;
arr.push(id_weight);
});
return arr;
}
function getValueBykpiWeightTd(){
var val=$("#kpiWeightTd").val();
return Number(val);
}
$("#modelReset").click(function(){
window.location.reload();
});
//删除所有参数
function deleteAllTr(){
$("#addTr").empty();
}
</script>
</body>
</html>
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