|
|
//告警策略
|
|
|
layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','table','xmSelect'], function (exports) {
|
|
|
layui.define(['form', 'admin', 'laydate', 'common', 'sessions', 'reskpilist', 'table', 'xmSelect'], function (exports) {
|
|
|
var $ = layui.$;
|
|
|
var form = layui.form;
|
|
|
var laydate = layui.laydate;
|
...
|
...
|
@@ -12,7 +12,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
exports('alarmpolicyAdd', function (data) {
|
|
|
var sessions = layui.sessions;
|
|
|
var accessToken = sessions.getToken()['access_token'];
|
|
|
var seriousInkeySelect ;
|
|
|
var seriousInkeySelect;
|
|
|
var options = '';
|
|
|
var defaultoptions = '';
|
|
|
var conditionoptions = "<option value=\"6\">等于</option>\n" +
|
...
|
...
|
@@ -31,35 +31,38 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
var importantInkeys = '';
|
|
|
var commonlyInkeys = '';
|
|
|
var policyConfigItems = [];
|
|
|
var devTypeOption = [];
|
|
|
var logjoinList = [];
|
|
|
var joinTypeOption = [];
|
|
|
form.render(null, 'add-alarmpolicy-form');
|
|
|
//初始化日期组件
|
|
|
laydate.render({
|
|
|
elem: '#seriousTimes'
|
|
|
,type: 'time'
|
|
|
,range: true
|
|
|
, type: 'time'
|
|
|
, range: true
|
|
|
});
|
|
|
laydate.render({
|
|
|
elem: '#importantTimes'
|
|
|
,type: 'time'
|
|
|
,range: true
|
|
|
, type: 'time'
|
|
|
, range: true
|
|
|
});
|
|
|
laydate.render({
|
|
|
elem: '#commonlyTimes'
|
|
|
,type: 'time'
|
|
|
,range: true
|
|
|
, type: 'time'
|
|
|
, range: true
|
|
|
});
|
|
|
//编辑
|
|
|
if(data && data.id){
|
|
|
if (data && data.id) {
|
|
|
admin.req({
|
|
|
url:domainName + '/api-web/alarmPolicy/getbyId/'+data.id
|
|
|
,done:function (res){
|
|
|
url: domainName + '/api-web/alarmPolicy/getbyId/' + data.id
|
|
|
, done: function (res) {
|
|
|
exprToChar(res.object, 'alarmContentExpr');
|
|
|
exprToChar(res.object, 'cleanPolicy');
|
|
|
exprToChar(res.object, 'commonlyExpr');
|
|
|
exprToChar(res.object, 'importantExpr');
|
|
|
exprToChar(res.object, 'seriousExpr');
|
|
|
form.val("add-alarmpolicy-form",res.object);
|
|
|
$("#alarm-policy-kpiName").val(res.object.kpiId +" "+ res.object.kpiName);
|
|
|
form.val("add-alarmpolicy-form", res.object);
|
|
|
$("#alarm-policy-kpiName").val(res.object.kpiId + " " + res.object.kpiName);
|
|
|
$("#serious_policy_param_val").val(res.object.kpiId);
|
|
|
$("#important_policy_param_val").val(res.object.kpiId);
|
|
|
$("#commonly_policy_param_val").val(res.object.kpiId);
|
...
|
...
|
@@ -67,31 +70,31 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
$("#importantTimes").val(res.object.importantTimes);
|
|
|
$("#commonlyTimes").val(res.object.commonlyTimes);
|
|
|
$("#alarmPolicyType").val(res.object.policyType);
|
|
|
if(res.data && res.data.length>0){
|
|
|
let seriousItems = res.data.filter(item=>item.policyFlag === 'serious');
|
|
|
let importantItems = res.data.filter(item=>item.policyFlag === 'important');
|
|
|
let commonlyItems = res.data.filter(item=>item.policyFlag === 'commonly');
|
|
|
seriouspolicyItems =seriousItems;
|
|
|
if (res.data && res.data.length > 0) {
|
|
|
let seriousItems = res.data.filter(item => item.policyFlag === 'serious');
|
|
|
let importantItems = res.data.filter(item => item.policyFlag === 'important');
|
|
|
let commonlyItems = res.data.filter(item => item.policyFlag === 'commonly');
|
|
|
seriouspolicyItems = seriousItems;
|
|
|
importantpolicyItems = importantItems;
|
|
|
commonlypolicyItems = commonlyItems;
|
|
|
if(seriousItems && seriousItems.length>0){
|
|
|
if (seriousItems && seriousItems.length > 0) {
|
|
|
|
|
|
var timeobj ={}
|
|
|
var timeobj = {}
|
|
|
for (let i = 0; i < seriousItems.length; i++) {
|
|
|
var times = new Date().getTime();
|
|
|
timeobj['time'+i] =times;
|
|
|
timeobj['time' + i] = times;
|
|
|
var cond = '';
|
|
|
if(seriousItems[i].relationSymbol && seriousItems[i].relationSymbol == '0'){
|
|
|
if (seriousItems[i].relationSymbol && seriousItems[i].relationSymbol == '0') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="serious-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" checked><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" >
|
|
|
</div>`;
|
|
|
}else if(seriousItems[i].relationSymbol && seriousItems[i].relationSymbol == '1'){
|
|
|
} else if (seriousItems[i].relationSymbol && seriousItems[i].relationSymbol == '1') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="serious-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" ><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" checked>
|
|
|
</div>`;
|
|
|
}
|
|
|
var clone = ""
|
|
|
if(i<seriousItems.length-1) {
|
|
|
if (i < seriousItems.length - 1) {
|
|
|
clone = $(`#serious-policy-box`).clone();
|
|
|
clone.attr("id", "serious-policy-box-" + times).find("i.policy-input-add").addClass("hide")
|
|
|
.parent().parent().find("i.policy-input-del").attr("data-id", "serious-policy-box-" + times).removeClass("hide")
|
...
|
...
|
@@ -101,39 +104,39 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
clone.find("select.condition").html(conditionoptions);
|
|
|
clone.find("input[type=tel]").val('');
|
|
|
}
|
|
|
if(i==0) {
|
|
|
if (i == 0) {
|
|
|
$(`#serious-policy-box`).after(clone).after(cond);
|
|
|
$("#serious-policy-box select.condition").val(seriousItems[0].operatorSymbol);
|
|
|
$("#serious-policy-box input[type=tel]").val(seriousItems[0].operatorValue);
|
|
|
}else{
|
|
|
var timestr =timeobj['time'+(i-1)];
|
|
|
} else {
|
|
|
var timestr = timeobj['time' + (i - 1)];
|
|
|
$(`#serious-policy-box-${timestr}`).after(clone).after(cond);
|
|
|
$(`#serious-policy-box-${timestr} select.policyparam`).val(seriousItems[i].confNo);
|
|
|
$(`#serious-policy-box-${timestr} select.condition`).val(seriousItems[i].operatorSymbol);
|
|
|
$(`#serious-policy-box-${timestr} input[type=tel]`).val(seriousItems[i].operatorValue);
|
|
|
$(`#serious-policy-box-${timestr} input[type=tel]`).attr("style","width:480px");
|
|
|
$(`#serious-policy-box-${timestr} input[type=tel]`).parent().attr("style","width:490px");
|
|
|
$(`#serious-policy-box-${timestr} input[type=tel]`).attr("style", "width:480px");
|
|
|
$(`#serious-policy-box-${timestr} input[type=tel]`).parent().attr("style", "width:490px");
|
|
|
}
|
|
|
form.render();
|
|
|
}
|
|
|
}
|
|
|
if(importantItems && importantItems.length>0){
|
|
|
var timeobj ={}
|
|
|
if (importantItems && importantItems.length > 0) {
|
|
|
var timeobj = {}
|
|
|
for (let i = 0; i < importantItems.length; i++) {
|
|
|
var times = new Date().getTime();
|
|
|
timeobj['time'+i] =times;
|
|
|
timeobj['time' + i] = times;
|
|
|
var cond = '';
|
|
|
if(importantItems[i].relationSymbol && importantItems[i].relationSymbol == '0'){
|
|
|
if (importantItems[i].relationSymbol && importantItems[i].relationSymbol == '0') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="important-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" checked><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" >
|
|
|
</div>`;
|
|
|
}else if(importantItems[i].relationSymbol && importantItems[i].relationSymbol == '1'){
|
|
|
} else if (importantItems[i].relationSymbol && importantItems[i].relationSymbol == '1') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="important-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" ><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" checked>
|
|
|
</div>`;
|
|
|
}
|
|
|
var clone = ""
|
|
|
if(i<importantItems.length-1) {
|
|
|
if (i < importantItems.length - 1) {
|
|
|
clone = $(`#important-policy-box`).clone();
|
|
|
clone.attr("id", "important-policy-box-" + times).find("i.policy-input-add").addClass("hide")
|
|
|
.parent().parent().find("i.policy-input-del").attr("data-id", "important-policy-box-" + times).removeClass("hide")
|
...
|
...
|
@@ -143,39 +146,39 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
clone.find("select.condition").html(conditionoptions);
|
|
|
clone.find("input[type=tel]").val('');
|
|
|
}
|
|
|
if(i==0) {
|
|
|
if (i == 0) {
|
|
|
$(`#important-policy-box`).after(clone).after(cond);
|
|
|
$("#important-policy-box select.condition").val(importantItems[0].operatorSymbol);
|
|
|
$("#important-policy-box input[type=tel]").val(importantItems[0].operatorValue);
|
|
|
}else{
|
|
|
var timestr =timeobj['time'+(i-1)];
|
|
|
} else {
|
|
|
var timestr = timeobj['time' + (i - 1)];
|
|
|
$(`#important-policy-box-${timestr}`).after(clone).after(cond);
|
|
|
$(`#important-policy-box-${timestr} select.policyparam`).val(importantItems[i].confNo);
|
|
|
$(`#important-policy-box-${timestr} select.condition`).val(importantItems[i].operatorSymbol);
|
|
|
$(`#important-policy-box-${timestr} input[type=tel]`).val(importantItems[i].operatorValue);
|
|
|
$(`#important-policy-box-${timestr} input[type=tel]`).attr("style","width:480px");
|
|
|
$(`#important-policy-box-${timestr} input[type=tel]`).parent().attr("style","width:490px");
|
|
|
$(`#important-policy-box-${timestr} input[type=tel]`).attr("style", "width:480px");
|
|
|
$(`#important-policy-box-${timestr} input[type=tel]`).parent().attr("style", "width:490px");
|
|
|
}
|
|
|
form.render();
|
|
|
}
|
|
|
}
|
|
|
if(commonlyItems && commonlyItems.length>0){
|
|
|
var timeobj ={}
|
|
|
if (commonlyItems && commonlyItems.length > 0) {
|
|
|
var timeobj = {}
|
|
|
for (let i = 0; i < commonlyItems.length; i++) {
|
|
|
var times = new Date().getTime();
|
|
|
timeobj['time'+i] =times;
|
|
|
timeobj['time' + i] = times;
|
|
|
var cond = '';
|
|
|
if(commonlyItems[i].relationSymbol && commonlyItems[i].relationSymbol == '0'){
|
|
|
if (commonlyItems[i].relationSymbol && commonlyItems[i].relationSymbol == '0') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="commonly-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" checked><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" >
|
|
|
</div>`;
|
|
|
}else if(commonlyItems[i].relationSymbol && commonlyItems[i].relationSymbol == '1'){
|
|
|
} else if (commonlyItems[i].relationSymbol && commonlyItems[i].relationSymbol == '1') {
|
|
|
cond = `<div class="layui-form-item cont-base" id="commonly-policy-box-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且"><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" checked>
|
|
|
</div>`;
|
|
|
}
|
|
|
var clone = ""
|
|
|
if(i<commonlyItems.length-1) {
|
|
|
if (i < commonlyItems.length - 1) {
|
|
|
clone = $(`#commonly-policy-box`).clone();
|
|
|
clone.attr("id", "commonly-policy-box-" + times).find("i.policy-input-add").addClass("hide")
|
|
|
.parent().parent().find("i.policy-input-del").attr("data-id", "commonly-policy-box-" + times).removeClass("hide")
|
...
|
...
|
@@ -185,18 +188,18 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
clone.find("select.condition").html(conditionoptions);
|
|
|
clone.find("input[type=tel]").val('');
|
|
|
}
|
|
|
if(i==0) {
|
|
|
if (i == 0) {
|
|
|
$(`#commonly-policy-box`).after(clone).after(cond);
|
|
|
$("#commonly-policy-box select.condition").val(commonlyItems[0].operatorSymbol);
|
|
|
$("#commonly-policy-box input[type=tel]").val(commonlyItems[0].operatorValue);
|
|
|
}else{
|
|
|
var timestr =timeobj['time'+(i-1)];
|
|
|
} else {
|
|
|
var timestr = timeobj['time' + (i - 1)];
|
|
|
$(`#commonly-policy-box-${timestr}`).after(clone).after(cond);
|
|
|
$(`#commonly-policy-box-${timestr} select.policyparam`).val(commonlyItems[i].confNo);
|
|
|
$(`#commonly-policy-box-${timestr} select.condition`).val(commonlyItems[i].operatorSymbol);
|
|
|
$(`#commonly-policy-box-${timestr} input[type=tel]`).val(commonlyItems[i].operatorValue);
|
|
|
$(`#commonly-policy-box-${timestr} input[type=tel]`).attr("style","width:480px");
|
|
|
$(`#commonly-policy-box-${timestr} input[type=tel]`).parent().attr("style","width:490px");
|
|
|
$(`#commonly-policy-box-${timestr} input[type=tel]`).attr("style", "width:480px");
|
|
|
$(`#commonly-policy-box-${timestr} input[type=tel]`).parent().attr("style", "width:490px");
|
|
|
}
|
|
|
|
|
|
form.render();
|
...
|
...
|
@@ -206,7 +209,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
} else {
|
|
|
$("#seriousTimes").val('00:00:00 - 23:59:59');
|
|
|
$("#importantTimes").val('00:00:00 - 23:59:59');
|
|
|
$("#commonlyTimes").val('00:00:00 - 23:59:59');
|
...
|
...
|
@@ -216,22 +219,49 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
return false;
|
|
|
});
|
|
|
//全天
|
|
|
$(".allday").on("click",function (){
|
|
|
$(".allday").on("click", function () {
|
|
|
var id = $(this).data("flag");
|
|
|
$("#"+id).val('00:00:00 - 23:59:59');
|
|
|
$("#" + id).val('00:00:00 - 23:59:59');
|
|
|
});
|
|
|
//工作时间
|
|
|
$(".worktime").on("click",function (){
|
|
|
$(".worktime").on("click", function () {
|
|
|
var id = $(this).data("flag");
|
|
|
$("#"+id).val('08:00:00 - 19:59:59');
|
|
|
$("#" + id).val('08:00:00 - 19:59:59');
|
|
|
});
|
|
|
//指标信息
|
|
|
if(data.kpiId){
|
|
|
if (data.kpiId) {
|
|
|
$("#alarm-policy-kpiId").val(data.kpiId);
|
|
|
$("#alarm-policy-kpiName").val(data.kpiId + " " + data.name);
|
|
|
}
|
|
|
initpolicyParam();
|
|
|
|
|
|
function initpolicyParam() {
|
|
|
$.ajax({
|
|
|
url: "http://192.168.0.44:8080" + "/log-access/v1/lm2_logfmt_dirs/queryTreeList?access_token=" + accessToken,
|
|
|
method: "get",
|
|
|
success(res) {
|
|
|
if (res.code == 200)
|
|
|
// 资源类型下拉框
|
|
|
devTypeOption = handleTree(res.data, 'id', 'pId', 'children', 'name');
|
|
|
}
|
|
|
});
|
|
|
$.ajax({
|
|
|
url: "http://192.168.0.44:8080" + "/log-access/v1/lm2_logjoin_dirs/queryTreeList?access_token=" + accessToken,
|
|
|
method: "get",
|
|
|
success(res) {
|
|
|
if (res.code == 200)
|
|
|
// 资源类型下拉框
|
|
|
joinTypeOption = handleTree(res.data, 'id', 'pId', 'children', 'name');
|
|
|
}
|
|
|
});
|
|
|
admin.req({
|
|
|
url: "http://192.168.0.44:8080" + '/log-access/v1/lm2_logjoin_info_views?access_token=' + accessToken,
|
|
|
async: false,
|
|
|
success: function (res) {
|
|
|
// 资源类型下拉框
|
|
|
logjoinList = res.data;
|
|
|
}
|
|
|
});
|
|
|
admin.req({
|
|
|
url: `${domainName}/api-web/manage/ddic/findSucDdics/alarmpolicy_param?access_token=${accessToken}`,
|
|
|
method: 'POST',
|
...
|
...
|
@@ -239,13 +269,13 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
success: function (res) {
|
|
|
var ddiclist = res.data;
|
|
|
$.each(ddiclist, function (i, v) {
|
|
|
if(v.ddicCode=="current_kpi") {
|
|
|
if (v.ddicCode == "current_kpi") {
|
|
|
defaultoptions += '<option value="' + v.ddicCode + '">' + v.ddicName + '</option>';
|
|
|
$('select[name=serious_policy_param]').html(defaultoptions);
|
|
|
$('select[name=important_policy_param]').html(defaultoptions);
|
|
|
$('select[name=commonly_policy_param]').html(defaultoptions);
|
|
|
|
|
|
}else {
|
|
|
} else {
|
|
|
options += '<option value="' + v.ddicCode + '">' + v.ddicName + '</option>';
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -253,6 +283,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function handleTree(data, id, parentId, children, title) {
|
|
|
let config = {
|
|
|
id: id || 'id',
|
...
|
...
|
@@ -303,29 +334,29 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
return tree;
|
|
|
};
|
|
|
|
|
|
form.on('select(serious_policy_param)', function(data){
|
|
|
var seriousvalue =$(this).closest(".cont-base").find("div#seriousvalue");
|
|
|
var devTypevalue =$(this).closest(".cont-base").find("div#seriousdevTypevalue");
|
|
|
var joinTypevalue =$(this).closest(".cont-base").find("div#seriousjoinTypevalue");
|
|
|
form.on('select(serious_policy_param)', function (data) {
|
|
|
var seriousvalue = $(this).closest(".cont-base").find("div#seriousvalue");
|
|
|
var devTypevalue = $(this).closest(".cont-base").find("div#seriousdevTypevalue");
|
|
|
var joinTypevalue = $(this).closest(".cont-base").find("div#seriousjoinTypevalue");
|
|
|
|
|
|
var commondevTypevalue =$(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
if(seriousvalue){
|
|
|
var commondevTypevalue = $(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
if (seriousvalue) {
|
|
|
seriousvalue.remove();
|
|
|
}
|
|
|
if(devTypevalue){
|
|
|
if (devTypevalue) {
|
|
|
devTypevalue.remove();
|
|
|
}
|
|
|
if(joinTypevalue){
|
|
|
if (joinTypevalue) {
|
|
|
joinTypevalue.remove();
|
|
|
}
|
|
|
if(commondevTypevalue){
|
|
|
if (commondevTypevalue) {
|
|
|
commondevTypevalue.remove();
|
|
|
}
|
|
|
if (data.value != ''){
|
|
|
if (data.value != '') {
|
|
|
//加载对应的参数
|
|
|
if(data.value == "device_id"){
|
|
|
if (data.value == "device_id") {
|
|
|
var device_id = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
common.openWin("template/res/reslist", "选择设备", {oldData: seriousresIds}, ["选择"], function () {
|
|
|
var data = table.checkStatus('reslist_resListTable').data;
|
|
|
if (data.length == 0) {
|
...
|
...
|
@@ -336,7 +367,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
var device = ''
|
|
|
if (data.length == 1) {
|
|
|
device = data[0].id;
|
|
|
} else{
|
|
|
} else {
|
|
|
$.each(data, function (i, v) {
|
|
|
seriousresIds.push(v.id);
|
|
|
device += v.id + ',';
|
...
|
...
|
@@ -351,22 +382,14 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
})
|
|
|
})
|
|
|
|
|
|
}else if(data.value== "dev_type"){
|
|
|
} else if (data.value == "dev_type") {
|
|
|
//var dev_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="seriousdevTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var dev_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logfmt_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var dev_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#seriousdevTypevalue',
|
|
|
name:'devType',
|
|
|
name: 'devType',
|
|
|
tips: '=设备类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -396,36 +419,26 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: devTypeOption,
|
|
|
on: function (data) {
|
|
|
seriousresTypes = data.arr.map(item => item.id).join(',');
|
|
|
dev_type.val(seriousresTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return seriousresTypes
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}else if(data.value == "join_type"){
|
|
|
} else if (data.value == "join_type") {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="seriousjoinTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var join_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logjoin_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var join_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#seriousjoinTypevalue',
|
|
|
name:'joinType',
|
|
|
name: 'joinType',
|
|
|
tips: '=业务类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -455,33 +468,23 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: joinTypeOption,
|
|
|
on: function (data) {
|
|
|
seriousJoinTypes = data.arr.map(item => item.id).join(',');
|
|
|
join_type.val(seriousJoinTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return seriousJoinTypes
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}else if(data.value == "inKey"){
|
|
|
} else if (data.value == "inKey") {
|
|
|
//绑定资源类型下拉选择
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="seriousvalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var inkeys= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
//inkeys.hide();
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
admin.req({
|
|
|
url: "http://192.168.0.44:8080" + '/log-access/v1/lm2_logjoin_info_views?access_token=' + accessToken,
|
|
|
async: false,
|
|
|
success: function (res) {
|
|
|
// 资源类型下拉框
|
|
|
var logjoinList = res.data;
|
|
|
var inkeys = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#seriousvalue',
|
|
|
tips: '=接入名称=',
|
...
|
...
|
@@ -503,42 +506,41 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
on: function (data) {
|
|
|
seriousInkeys = data.arr.map(item => item.inKey).join(',');
|
|
|
inkeys.val(seriousInkeys);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return seriousInkeys
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
form.on('select(important_policy_param)', function(data){
|
|
|
var importantvalue =$(this).closest(".cont-base").find("div#importantvalue");
|
|
|
if(importantvalue){
|
|
|
form.on('select(important_policy_param)', function (data) {
|
|
|
var importantvalue = $(this).closest(".cont-base").find("div#importantvalue");
|
|
|
if (importantvalue) {
|
|
|
importantvalue.remove();
|
|
|
}
|
|
|
var devTypevalue =$(this).closest(".cont-base").find("div#importantdevTypevalue");
|
|
|
var joinTypevalue =$(this).closest(".cont-base").find("div#importantjoinTypevalue");
|
|
|
var commondevTypevalue =$(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
var devTypevalue = $(this).closest(".cont-base").find("div#importantdevTypevalue");
|
|
|
var joinTypevalue = $(this).closest(".cont-base").find("div#importantjoinTypevalue");
|
|
|
var commondevTypevalue = $(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
|
|
|
if(devTypevalue){
|
|
|
if (devTypevalue) {
|
|
|
devTypevalue.remove();
|
|
|
}
|
|
|
if(joinTypevalue){
|
|
|
if (joinTypevalue) {
|
|
|
joinTypevalue.remove();
|
|
|
}
|
|
|
if(commondevTypevalue){
|
|
|
if (commondevTypevalue) {
|
|
|
commondevTypevalue.remove();
|
|
|
}
|
|
|
if (data.value != ''){
|
|
|
if (data.value != '') {
|
|
|
//加载对应的参数
|
|
|
if(data.value == "device_id"){
|
|
|
if (data.value == "device_id") {
|
|
|
var device_id = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
common.openWin("template/res/reslist", "选择设备", {oldData: importantresIds}, ["选择"], function () {
|
|
|
var data = table.checkStatus('reslist_resListTable').data;
|
|
|
if (data.length == 0) {
|
...
|
...
|
@@ -549,11 +551,11 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
var device = ''
|
|
|
$.each(data, function (i, v) {
|
|
|
importantresIds.push(v.id);
|
|
|
device +=v.id + ',';
|
|
|
device += v.id + ',';
|
|
|
|
|
|
})
|
|
|
if(device.length>0){
|
|
|
device = device.substring(0,device.length-1)
|
|
|
if (device.length > 0) {
|
|
|
device = device.substring(0, device.length - 1)
|
|
|
}
|
|
|
console.log(device_id)
|
|
|
device_id.val(device);
|
...
|
...
|
@@ -561,21 +563,14 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
})
|
|
|
})
|
|
|
|
|
|
}else if(data.value== "dev_type"){
|
|
|
} else if (data.value == "dev_type") {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="importantdevTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var dev_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logfmt_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var dev_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
|
|
|
xmSelect.render({
|
|
|
el: '#importantdevTypevalue',
|
|
|
name:'importantdevType',
|
|
|
name: 'importantdevType',
|
|
|
tips: '=设备类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -605,36 +600,26 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: devTypeOption,
|
|
|
on: function (data) {
|
|
|
importantresTypes = data.arr.map(item => item.id).join(',');
|
|
|
dev_type.val(importantresTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return importantresTypes;
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}else if(data.value == "join_type"){
|
|
|
} else if (data.value == "join_type") {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="importantjoinTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var join_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logjoin_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var join_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#importantjoinTypevalue',
|
|
|
name:'importantjoinType',
|
|
|
name: 'importantjoinType',
|
|
|
tips: '=业务类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -664,34 +649,25 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: joinTypeOption,
|
|
|
on: function (data) {
|
|
|
importantJoinTypes = data.arr.map(item => item.id).join(',');
|
|
|
join_type.val(importantJoinTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return importantJoinTypes
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}else if(data.value == "inKey"){
|
|
|
} else if (data.value == "inKey") {
|
|
|
//绑定资源类型下拉选择
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="importantvalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var inkeys= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
var inkeys = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
//var importantvalue =$(this).closest(".cont-base").find("div#importantvalue");
|
|
|
//inkeys.hide();
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
admin.req({
|
|
|
url: "http://192.168.0.44:8080" + '/log-access/v1/lm2_logjoin_info_views?access_token=' + accessToken,
|
|
|
async: false,
|
|
|
success: function (res) {
|
|
|
// 资源类型下拉框
|
|
|
var logjoinList = res.data;
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#importantvalue',
|
|
|
tips: '=接入名称=',
|
...
|
...
|
@@ -706,7 +682,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
layVerType: 'msg',
|
|
|
toolbar: {
|
|
|
show: true,
|
|
|
list: [ 'CLEAR']
|
|
|
list: ['CLEAR']
|
|
|
},
|
|
|
height: 'auto',
|
|
|
data: logjoinList,
|
...
|
...
|
@@ -720,35 +696,34 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
return importantInkeys
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
form.on('select(commonly_policy_param)', function(data){
|
|
|
var commonlyvalue =$(this).closest(".cont-base").find("div#commonlyvalue");
|
|
|
if(commonlyvalue){
|
|
|
form.on('select(commonly_policy_param)', function (data) {
|
|
|
var commonlyvalue = $(this).closest(".cont-base").find("div#commonlyvalue");
|
|
|
if (commonlyvalue) {
|
|
|
commonlyvalue.remove();
|
|
|
}
|
|
|
var devTypevalue =$(this).closest(".cont-base").find("div#commonlydevTypevalue");
|
|
|
var joinTypevalue =$(this).closest(".cont-base").find("div#commonlyjoinTypevalue");
|
|
|
var commondevTypevalue =$(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
var devTypevalue = $(this).closest(".cont-base").find("div#commonlydevTypevalue");
|
|
|
var joinTypevalue = $(this).closest(".cont-base").find("div#commonlyjoinTypevalue");
|
|
|
var commondevTypevalue = $(this).closest(".cont-base").find("div[id^=devTypevalue-]");
|
|
|
|
|
|
if(devTypevalue){
|
|
|
if (devTypevalue) {
|
|
|
devTypevalue.remove();
|
|
|
}
|
|
|
if(joinTypevalue){
|
|
|
if (joinTypevalue) {
|
|
|
joinTypevalue.remove();
|
|
|
}
|
|
|
if(commondevTypevalue){
|
|
|
if (commondevTypevalue) {
|
|
|
commondevTypevalue.remove();
|
|
|
}
|
|
|
if (data.value != ''){
|
|
|
if (data.value != '') {
|
|
|
//加载对应的参数
|
|
|
if(data.value == "device_id"){
|
|
|
if (data.value == "device_id") {
|
|
|
var device_id = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
common.openWin("template/res/reslist", "选择设备", {oldData: commonlyresIds}, ["选择"], function () {
|
|
|
var data = table.checkStatus('reslist_resListTable').data;
|
|
|
if (data.length == 0) {
|
...
|
...
|
@@ -759,11 +734,11 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
var device = ''
|
|
|
$.each(data, function (i, v) {
|
|
|
commonlyresIds.push(v.id);
|
|
|
device +=v.id + ',';
|
|
|
device += v.id + ',';
|
|
|
|
|
|
})
|
|
|
if(device.length>0){
|
|
|
device = device.substring(0,device.length-1)
|
|
|
if (device.length > 0) {
|
|
|
device = device.substring(0, device.length - 1)
|
|
|
}
|
|
|
//console.log(device_id)
|
|
|
device_id.val(device);
|
...
|
...
|
@@ -771,21 +746,13 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
})
|
|
|
})
|
|
|
|
|
|
}else if(data.value== "dev_type"){
|
|
|
} else if (data.value == "dev_type") {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="commonlydevTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var dev_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logfmt_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var dev_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#commonlydevTypevalue',
|
|
|
name:'commonlydevType',
|
|
|
name: 'commonlydevType',
|
|
|
tips: '=设备类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -815,36 +782,27 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: devTypeOption,
|
|
|
on: function (data) {
|
|
|
commonlyresTypes = data.arr.map(item => item.id).join(',');
|
|
|
dev_type.val(commonlyresTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return commonlyresTypes;
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}else if(data.value == "join_type"){
|
|
|
} else if (data.value == "join_type") {
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="commonlyjoinTypevalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var join_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logjoin_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
var join_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
|
|
|
xmSelect.render({
|
|
|
el: '#commonlyjoinTypevalue',
|
|
|
name:'commonlyjoinType',
|
|
|
name: 'commonlyjoinType',
|
|
|
tips: '=业务类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -874,34 +832,23 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: joinTypeOption,
|
|
|
on: function (data) {
|
|
|
commonlyJoinTypes = data.arr.map(item => item.id).join(',');
|
|
|
join_type.val(commonlyJoinTypes);
|
|
|
if(data && data.isAdd) {
|
|
|
if (data && data.isAdd) {
|
|
|
//seriousvalue.remove();
|
|
|
//inkeys.show();
|
|
|
}
|
|
|
return commonlyJoinTypes;
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}else if(data.value == "inKey"){
|
|
|
} else if (data.value == "inKey") {
|
|
|
//绑定资源类型下拉选择
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").before('<div id="commonlyvalue" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var inkeys= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
|
|
|
//inkeys.hide();
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
admin.req({
|
|
|
url: "http://192.168.0.44:8080" + '/log-access/v1/lm2_logjoin_info_views?access_token=' + accessToken,
|
|
|
async: false,
|
|
|
success: function (res) {
|
|
|
// 资源类型下拉框
|
|
|
var logjoinList = res.data;
|
|
|
var inkeys = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
$(this).closest(".cont-base").find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#commonlyvalue',
|
|
|
tips: '=接入名称=',
|
...
|
...
|
@@ -923,15 +870,9 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
on: function (data) {
|
|
|
commonlyInkeys = data.arr.map(item => item.inKey).join(',');
|
|
|
inkeys.val(commonlyInkeys);
|
|
|
// if(data && data.isAdd) {
|
|
|
// commonlyvalue.remove();
|
|
|
// inkeys.show();
|
|
|
// }
|
|
|
return commonlyInkeys
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -940,41 +881,41 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//告警规则类型切换事件
|
|
|
form.on('radio(alarm-policy-rule-type)', function (data) {
|
|
|
var flag = $(data.elem).data("flag");
|
|
|
if(data.value == '1'){
|
|
|
if (data.value == '1') {
|
|
|
$(`.${flag}-tab-item`).find("div.cont-base").show();
|
|
|
}else{
|
|
|
} else {
|
|
|
$(`.${flag}-tab-item`).find("div.cont-base").hide();
|
|
|
$(`#${flag}Policy`).val('');
|
|
|
}
|
|
|
});
|
|
|
//选择指标
|
|
|
$("#alarmpolicy-form-select-kpi, #alarm-policy-kpiName").unbind('click').on("click",function (){
|
|
|
common.openWin("template/res/reskpilist","选择指标", {resType:null},["选择","取消"], function () {
|
|
|
$("#alarmpolicy-form-select-kpi, #alarm-policy-kpiName").unbind('click').on("click", function () {
|
|
|
common.openWin("template/res/reskpilist", "选择指标", {resType: null}, ["选择", "取消"], function () {
|
|
|
var data = layui.reskpilist().getData();
|
|
|
if(data && data.length != 1){
|
|
|
layer.msg('只能选择一个指标!', {icon: 7,time:3000});
|
|
|
if (data && data.length != 1) {
|
|
|
layer.msg('只能选择一个指标!', {icon: 7, time: 3000});
|
|
|
return false;
|
|
|
}
|
|
|
if(data && data.length > 0){
|
|
|
if (data && data.length > 0) {
|
|
|
$("#alarm-policy-kpiId").val(data[0].kpiId);
|
|
|
$("#alarm-policy-kpiName").val(data[0].kpiId + " " + data[0].kpiName);
|
|
|
$("#alarmPolicyName").val(data[0].kpiName + "告警策略");
|
|
|
$("#serious_policy_param_val").val(data[0].kpiId);
|
|
|
$("#important_policy_param_val").val(data[0].kpiId);
|
|
|
$("#commonly_policy_param_val").val(data[0].kpiId);
|
|
|
var arry = [ "base", "cpu", "mem"];
|
|
|
var arry = ["base", "cpu", "mem"];
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//增加一行策略表达式输入框
|
|
|
$("i.policy-input-add").off("click").on("click",function (){
|
|
|
$("i.policy-input-add").off("click").on("click", function () {
|
|
|
var id = $(this).data("id");
|
|
|
clonePolicyDoms(id);
|
|
|
});
|
|
|
//删除告警策略规则行
|
|
|
$("i.policy-input-del").on("click",function (){
|
|
|
$("i.policy-input-del").on("click", function () {
|
|
|
var id = $(this).data("id");
|
|
|
$(`#${id}`).remove();
|
|
|
});
|
...
|
...
|
@@ -983,9 +924,9 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
var importantpolicyItems = [];
|
|
|
var commonlypolicyItems = [];
|
|
|
//生成策略
|
|
|
$("a.createpolicybtn").on("click",function (){
|
|
|
$("a.createpolicybtn").on("click", function () {
|
|
|
var kpiId = $("#alarm-policy-kpiId").val();
|
|
|
if(!kpiId){
|
|
|
if (!kpiId) {
|
|
|
layer.msg("请先选择指标!", {
|
|
|
icon: 7
|
|
|
, time: 3000
|
...
|
...
|
@@ -993,23 +934,48 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
return false;
|
|
|
}
|
|
|
var policyFlag = $(this).data("flag");
|
|
|
var conOjb = {"0":">","1":"<","2":"=","3":">=","4":"<=","5":"!=","6":"equals","7":"!,equals","8":"contains","9":"startsWith","10":"endsWith","11":"!,contains"};
|
|
|
var conOjb = {
|
|
|
"0": ">",
|
|
|
"1": "<",
|
|
|
"2": "=",
|
|
|
"3": ">=",
|
|
|
"4": "<=",
|
|
|
"5": "!=",
|
|
|
"6": "equals",
|
|
|
"7": "!,equals",
|
|
|
"8": "contains",
|
|
|
"9": "startsWith",
|
|
|
"10": "endsWith",
|
|
|
"11": "!,contains"
|
|
|
};
|
|
|
var doms = $(`[id^=${policyFlag}-policy-box]`);
|
|
|
var policyStr = '';
|
|
|
var relationobj = {"1": 0,"3":1,"5":2,"7":3,"9":4,"11":5,"13":6,"15":7,"17":8,"19":9,"21":10}
|
|
|
if(policyFlag.indexOf("serious")!=-1) {
|
|
|
var relationobj = {
|
|
|
"1": 0,
|
|
|
"3": 1,
|
|
|
"5": 2,
|
|
|
"7": 3,
|
|
|
"9": 4,
|
|
|
"11": 5,
|
|
|
"13": 6,
|
|
|
"15": 7,
|
|
|
"17": 8,
|
|
|
"19": 9,
|
|
|
"21": 10
|
|
|
}
|
|
|
if (policyFlag.indexOf("serious") != -1) {
|
|
|
seriouspolicyItems = [];
|
|
|
$(doms).each(function (i, v) {
|
|
|
var domId = $(v).attr("id");
|
|
|
if (domId.indexOf("condition") != -1) {//条件
|
|
|
var j = relationobj[''+i+''];
|
|
|
var j = relationobj['' + i + ''];
|
|
|
var open = $(v).find('input[type=radio].condition:checked').val();
|
|
|
if (open == "||") {
|
|
|
policyStr += open;
|
|
|
seriouspolicyItems[j].relationSymbol= "1";
|
|
|
seriouspolicyItems[j].relationSymbol = "1";
|
|
|
} else {
|
|
|
policyStr += open;
|
|
|
seriouspolicyItems[j].relationSymbol= "0";
|
|
|
seriouspolicyItems[j].relationSymbol = "0";
|
|
|
}
|
|
|
} else { //值
|
|
|
var conditon = $(v).find(".condition").val();
|
...
|
...
|
@@ -1020,50 +986,50 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
if (conval && param) {
|
|
|
if (param == "current_kpi") {
|
|
|
var itemObj = {
|
|
|
"confNo":kpiId,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"operatorSymbol":conditon,
|
|
|
'operatorValue':conval,
|
|
|
"confNo": kpiId,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": 0,
|
|
|
"policyFlag":policyFlag
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
seriouspolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) { //数字类的
|
|
|
policyStr += `Double.parseDouble([${kpiId},kpiValue])${conOjb[conditon]}${conval}`;
|
|
|
} else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${kpiId},kpiValue].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
} else if(conditon == 8) { //字符串类的
|
|
|
} else if (conditon == 8) { //字符串类的
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${kpiId},kpiValue]`;
|
|
|
} else if(conditon == 11) { //字符串类的
|
|
|
} else if (conditon == 11) { //字符串类的
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${kpiId},kpiValue]`;
|
|
|
}else {
|
|
|
} else {
|
|
|
policyStr += `[${kpiId},kpiValue].${conOjb[conditon]}("${conval}")`;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
var itemObj = {
|
|
|
"confNo":param,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"operatorSymbol":conditon,
|
|
|
'operatorValue':conval,
|
|
|
"confNo": param,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": i-1,
|
|
|
"policyFlag":policyFlag
|
|
|
"sort": i - 1,
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
seriouspolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) {
|
|
|
policyStr += `[${param}]${conOjb[conditon]}"${conval}"`;
|
|
|
} else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${param}].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
}else if(conditon == 8){
|
|
|
} else if (conditon == 8) {
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${param}]`;
|
|
|
|
|
|
}else if(conditon == 11){
|
|
|
} else if (conditon == 11) {
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${param}]`;
|
|
|
|
|
|
} else {
|
...
|
...
|
@@ -1074,19 +1040,19 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}else if(policyFlag.indexOf("important")!=-1){
|
|
|
} else if (policyFlag.indexOf("important") != -1) {
|
|
|
importantpolicyItems = [];
|
|
|
$(doms).each(function (i, v) {
|
|
|
var domId = $(v).attr("id");
|
|
|
if (domId.indexOf("condition") != -1) {//条件
|
|
|
var j = relationobj[''+i+''];
|
|
|
var j = relationobj['' + i + ''];
|
|
|
var open = $(v).find('input[type=radio].condition:checked').val();
|
|
|
if (open == "||") {
|
|
|
policyStr += open;
|
|
|
importantpolicyItems[j].relationSymbol= "1";
|
|
|
importantpolicyItems[j].relationSymbol = "1";
|
|
|
} else {
|
|
|
policyStr += open;
|
|
|
importantpolicyItems[j].relationSymbol= "0";
|
|
|
importantpolicyItems[j].relationSymbol = "0";
|
|
|
}
|
|
|
} else { //值
|
|
|
var conditon = $(v).find(".condition").val();
|
...
|
...
|
@@ -1097,49 +1063,49 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
if (conval && param) {
|
|
|
if (param == "current_kpi") {
|
|
|
var itemObj = {
|
|
|
"confNo":kpiId,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"confNo": kpiId,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": 0,
|
|
|
"policyFlag":policyFlag
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
importantpolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) { //数字类的
|
|
|
policyStr += `Double.parseDouble([${kpiId},kpiValue])${conOjb[conditon]}${conval}`;
|
|
|
} else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${kpiId},kpiValue].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
} else if(conditon == 8) { //字符串类的
|
|
|
} else if (conditon == 8) { //字符串类的
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${kpiId},kpiValue]`;
|
|
|
} else if(conditon == 11) { //字符串类的
|
|
|
} else if (conditon == 11) { //字符串类的
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${kpiId},kpiValue]`;
|
|
|
}else { //字符串类的
|
|
|
} else { //字符串类的
|
|
|
policyStr += `[${kpiId},kpiValue].${conOjb[conditon]}("${conval}")`;
|
|
|
}
|
|
|
} else {
|
|
|
var itemObj = {
|
|
|
"confNo":param,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"confNo": param,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": i-1,
|
|
|
"policyFlag":policyFlag
|
|
|
"sort": i - 1,
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
importantpolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) {
|
|
|
policyStr += `[${param}]${conOjb[conditon]}"${conval}"`;
|
|
|
}else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${param}].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
}else if(conditon == 8){
|
|
|
} else if (conditon == 8) {
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${param}]`;
|
|
|
|
|
|
}else if(conditon == 11){
|
|
|
} else if (conditon == 11) {
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${param}]`;
|
|
|
|
|
|
} else {
|
...
|
...
|
@@ -1151,19 +1117,19 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
}
|
|
|
});
|
|
|
|
|
|
}else if(policyFlag.indexOf("commonly")!=-1){
|
|
|
} else if (policyFlag.indexOf("commonly") != -1) {
|
|
|
commonlypolicyItems = [];
|
|
|
$(doms).each(function (i, v) {
|
|
|
var domId = $(v).attr("id");
|
|
|
if (domId.indexOf("condition") != -1) {//条件
|
|
|
var j = relationobj[''+i+''];
|
|
|
var j = relationobj['' + i + ''];
|
|
|
var open = $(v).find('input[type=radio].condition:checked').val();
|
|
|
if (open == "||") {
|
|
|
policyStr += open;
|
|
|
commonlypolicyItems[j].relationSymbol= "1";
|
|
|
commonlypolicyItems[j].relationSymbol = "1";
|
|
|
} else {
|
|
|
policyStr += open;
|
|
|
commonlypolicyItems[j].relationSymbol= "0";
|
|
|
commonlypolicyItems[j].relationSymbol = "0";
|
|
|
}
|
|
|
} else { //值
|
|
|
var conditon = $(v).find(".condition").val();
|
...
|
...
|
@@ -1174,49 +1140,49 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
if (conval && param) {
|
|
|
if (param == "current_kpi") {
|
|
|
var itemObj = {
|
|
|
"confNo":kpiId,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"operatorSymbol":conditon,
|
|
|
'operatorValue':conval,
|
|
|
"confNo": kpiId,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": 0,
|
|
|
"policyFlag":policyFlag
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
commonlypolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) { //数字类的
|
|
|
policyStr += `Double.parseDouble([${kpiId},kpiValue])${conOjb[conditon]}${conval}`;
|
|
|
}else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${kpiId},kpiValue].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
} else if(conditon == 8) { //字符串类的
|
|
|
} else if (conditon == 8) { //字符串类的
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${kpiId},kpiValue]`;
|
|
|
} else if(conditon == 11) { //字符串类的
|
|
|
} else if (conditon == 11) { //字符串类的
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${kpiId},kpiValue]`;
|
|
|
}else { //字符串类的
|
|
|
} else { //字符串类的
|
|
|
policyStr += `[${kpiId},kpiValue].${conOjb[conditon]}("${conval}")`;
|
|
|
}
|
|
|
} else {
|
|
|
var itemObj = {
|
|
|
"confNo":param,
|
|
|
"kpiId" :kpiId,
|
|
|
"type":param,
|
|
|
"operatorSymbol":conditon,
|
|
|
"confNo": param,
|
|
|
"kpiId": kpiId,
|
|
|
"type": param,
|
|
|
"operatorSymbol": conditon,
|
|
|
'operatorValue': conval,
|
|
|
"relationSymbol": '',
|
|
|
"isTermOver": 0,
|
|
|
"sort": i-1,
|
|
|
"policyFlag":policyFlag
|
|
|
"sort": i - 1,
|
|
|
"policyFlag": policyFlag
|
|
|
}
|
|
|
commonlypolicyItems.push(itemObj);
|
|
|
if (conditon <= 5) {
|
|
|
policyStr += `[${param}]${conOjb[conditon]}"${conval}"`;
|
|
|
}else if(conditon == 7) { //字符串类的
|
|
|
} else if (conditon == 7) { //字符串类的
|
|
|
policyStr += `![${param}].${conOjb[conditon].split(",")[1]}("${conval}")`;
|
|
|
}else if(conditon == 8){
|
|
|
} else if (conditon == 8) {
|
|
|
policyStr += `("${conval}").${conOjb[conditon]}[${param}]`;
|
|
|
|
|
|
}else if(conditon == 11){
|
|
|
} else if (conditon == 11) {
|
|
|
policyStr += `!("${conval}").${conOjb[conditon].split(",")[1]}[${param}]`;
|
|
|
|
|
|
} else {
|
...
|
...
|
@@ -1228,9 +1194,9 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if(policyStr){
|
|
|
if (policyStr) {
|
|
|
$(`#${policyFlag}Policy`).val(policyStr);
|
|
|
}else{
|
|
|
} else {
|
|
|
layer.msg("请先输入策略值!", {
|
|
|
icon: 7
|
|
|
, time: 3000
|
...
|
...
|
@@ -1240,7 +1206,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
});
|
|
|
|
|
|
//保存策略
|
|
|
$("#alarmpolicy-form-save-id").on("click",function (){
|
|
|
$("#alarmpolicy-form-save-id").on("click", function () {
|
|
|
var data = form.val("add-alarmpolicy-form");
|
|
|
//移除非数进性的属性
|
|
|
delete data['serious-policy-type'];
|
...
|
...
|
@@ -1259,45 +1225,45 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
charToExpr(data, 'importantExpr');
|
|
|
charToExpr(data, 'seriousExpr');
|
|
|
var params = {};
|
|
|
var policyConfigObj ={}
|
|
|
var policyConfigObj = {}
|
|
|
policyConfigObj.seriousPolicyDesc = data["seriousPolicy"];
|
|
|
policyConfigObj.importantPolicyDesc = data["importantPolicy"];
|
|
|
policyConfigObj.commonlyPolicyDesc = data["commonlyPolicy"];
|
|
|
if(seriouspolicyItems.length>0) {
|
|
|
if (seriouspolicyItems.length > 0) {
|
|
|
for (let i = 0; i < seriouspolicyItems.length; i++) {
|
|
|
policyConfigItems.push(seriouspolicyItems[i]);
|
|
|
}
|
|
|
}
|
|
|
if(importantpolicyItems.length>0){
|
|
|
if (importantpolicyItems.length > 0) {
|
|
|
for (let i = 0; i < importantpolicyItems.length; i++) {
|
|
|
policyConfigItems.push(importantpolicyItems[i]);
|
|
|
}
|
|
|
}
|
|
|
if(commonlypolicyItems.length>0){
|
|
|
if (commonlypolicyItems.length > 0) {
|
|
|
for (let i = 0; i < commonlypolicyItems.length; i++) {
|
|
|
policyConfigItems.push(commonlypolicyItems[i]);
|
|
|
}
|
|
|
}
|
|
|
params.data = JSON.stringify(data);
|
|
|
params.policyConfigObj =JSON.stringify(policyConfigObj);
|
|
|
params.policyConfigObj = JSON.stringify(policyConfigObj);
|
|
|
params.policyConfigItems = policyConfigItems;
|
|
|
form.on('submit(add-alarmpolicy-form)',function () {
|
|
|
form.on('submit(add-alarmpolicy-form)', function () {
|
|
|
admin.req({
|
|
|
url : domainName + '/api-web/alarmPolicy/save?access_token='+accessToken
|
|
|
,data:JSON.stringify(params)
|
|
|
,type:'post'
|
|
|
,contentType: "application/json; charset=utf-8"
|
|
|
,done:function (res){
|
|
|
if(res.success){
|
|
|
localStorage.setItem("detailPageOfcustomPolicyId",res.str)
|
|
|
layer.msg(res.msg, { offset: '15px' , icon: 1 , time: 1000 },function (){
|
|
|
url: domainName + '/api-web/alarmPolicy/save?access_token=' + accessToken
|
|
|
, data: JSON.stringify(params)
|
|
|
, type: 'post'
|
|
|
, contentType: "application/json; charset=utf-8"
|
|
|
, done: function (res) {
|
|
|
if (res.success) {
|
|
|
localStorage.setItem("detailPageOfcustomPolicyId", res.str)
|
|
|
layer.msg(res.msg, {offset: '15px', icon: 1, time: 1000}, function () {
|
|
|
localStorage.removeItem("currentResType");
|
|
|
// if(layui.alarmpolicyIndex && layui.alarmpolicyIndex()){
|
|
|
// layui.alarmpolicyIndex().reloadAlarmPolicy()
|
|
|
// }
|
|
|
});
|
|
|
}else{
|
|
|
layer.msg(res.msg, { offset: '15px' , icon: 7 , time: 1000 });
|
|
|
} else {
|
|
|
layer.msg(res.msg, {offset: '15px', icon: 7, time: 1000});
|
|
|
}
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -1307,50 +1273,42 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
});
|
|
|
|
|
|
//克隆告警策略元素
|
|
|
function clonePolicyDoms(id){
|
|
|
function clonePolicyDoms(id) {
|
|
|
var times = new Date().getTime()
|
|
|
var cond = `<div class="layui-form-item cont-base" id="${id}-${times}-condition">
|
|
|
<input type="radio" class="condition" name="policy-${times}-condition" value="&&" title="且" checked><input type="radio" class="condition" name="policy-${times}-condition" value="||" title="或" >
|
|
|
</div>`;
|
|
|
var clone = $(`#${id}`).clone();
|
|
|
clone.attr("id",id+"-"+times).find("i.policy-input-add").addClass("hide")
|
|
|
.parent().parent().find("i.policy-input-del").attr("data-id",id + "-"+times).removeClass("hide")
|
|
|
clone.attr("id", id + "-" + times).find("i.policy-input-add").addClass("hide")
|
|
|
.parent().parent().find("i.policy-input-del").attr("data-id", id + "-" + times).removeClass("hide")
|
|
|
.parent().parent().find("div.paramval").addClass("hide")
|
|
|
.parent().parent().find("input.layui-input").val("");
|
|
|
//console.log(clone.find("select.policyparam").html(options))
|
|
|
clone.find("select.policyparam").html(options);
|
|
|
clone.find("select.condition").html(conditionoptions);
|
|
|
clone.find("input[type=tel]").attr("style","width:480px").val('');
|
|
|
clone.find("input[type=tel]").parent().attr("style","width:490px");
|
|
|
clone.find("input[type=tel]").attr("style", "width:480px").val('');
|
|
|
clone.find("input[type=tel]").parent().attr("style", "width:490px");
|
|
|
//获取最后一个添加的id
|
|
|
var doms = $(`div[id^=${id}][id$='condition'][id!=${id}]`);
|
|
|
var lastid ='';
|
|
|
if($(doms)&&$(doms).length>0) {
|
|
|
var lastid = '';
|
|
|
if ($(doms) && $(doms).length > 0) {
|
|
|
$(doms).each(function (i, v) {
|
|
|
var $domId = $(v).attr("id");
|
|
|
var trimdomid = $domId.substring(0,$domId.length-10)
|
|
|
var trimdomid = $domId.substring(0, $domId.length - 10)
|
|
|
if (trimdomid > lastid) {
|
|
|
lastid = trimdomid;
|
|
|
}
|
|
|
});
|
|
|
}else {
|
|
|
} else {
|
|
|
lastid = id;
|
|
|
}
|
|
|
$(`#${lastid}`).after(clone).after(cond);
|
|
|
clone.find("input[type=tel]").before('<div id="devTypevalue-'+times+'" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var dev_type= $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
clone.find("input[type=tel]").unbind('click').on("click",function () {
|
|
|
$.ajax({
|
|
|
url:"http://192.168.0.44:8080" +"/log-access/v1/lm2_logfmt_dirs/queryTreeList?access_token="+accessToken,
|
|
|
method:"get",
|
|
|
success(res){
|
|
|
if (res.code==200)
|
|
|
// 资源类型下拉框
|
|
|
var data = res.data;
|
|
|
let option = handleTree(res.data, 'id', 'pId','children','name');
|
|
|
clone.find("input[type=tel]").before('<div id="devTypevalue-' + times + '" class="xm-select-demo" style="width:478px;position: absolute;z-index: 999"></div>');
|
|
|
var dev_type = $(this).closest(".cont-base").find("input[type=tel]");
|
|
|
clone.find("input[type=tel]").unbind('click').on("click", function () {
|
|
|
xmSelect.render({
|
|
|
el: '#devTypevalue-'+times,
|
|
|
name:'devType',
|
|
|
el: '#devTypevalue-' + times,
|
|
|
name: 'devType',
|
|
|
tips: '=设备类型=',
|
|
|
radio: false,
|
|
|
clickClose: false,
|
...
|
...
|
@@ -1380,24 +1338,22 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//是否严格遵守父子模式
|
|
|
strict: true
|
|
|
},
|
|
|
data:option,
|
|
|
data: devTypeOption,
|
|
|
on: function (data) {
|
|
|
let resTypes = data.arr.map(item => item.id).join(',');
|
|
|
dev_type.val(resTypes);
|
|
|
return resTypes;
|
|
|
}
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
form.render();
|
|
|
//渲染新增事件
|
|
|
$("i.policy-input-add").off("click").on("click",function (){
|
|
|
$("i.policy-input-add").off("click").on("click", function () {
|
|
|
clonePolicyDoms($(this).data("id"));
|
|
|
});
|
|
|
//删除告警策略规则行
|
|
|
$("i.policy-input-del").off("click").on("click",function (){
|
|
|
$("i.policy-input-del").off("click").on("click", function () {
|
|
|
var id = $(this).data("id");
|
|
|
$(`#${id}`).remove();
|
|
|
$(`#${id}-condition`).remove();
|
...
|
...
|
@@ -1428,7 +1384,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist','tabl |
|
|
//如果是详情页过来的,则不能改变指标和默认状态
|
|
|
if (data && data.from === 'detail') {
|
|
|
$("#alarmpolicy-form-select-kpi, #alarm-policy-kpiName").off('click');
|
|
|
$('#add-alarmpolicy-form').find('[name="policyType"]').attr("disabled","disabled");
|
|
|
$('#add-alarmpolicy-form').find('[name="policyType"]').attr("disabled", "disabled");
|
|
|
}
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|