...
|
...
|
@@ -19,7 +19,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
var admin = layui.admin;
|
|
|
var commonDetail = layui.commonDetail;
|
|
|
var domainName = common.domainName;
|
|
|
|
|
|
var resHealthKeyWord = '';
|
|
|
var resindexKeyword = '';
|
|
|
var resTypeSelectExclude = ['HOST_MINICOMPUTER', 'HOST_MINICOMPUTER_SERVER', 'HOST_BMC', 'HOST_X86SERVER']
|
|
|
|
|
|
var curTreeNode = '';
|
...
|
...
|
@@ -55,8 +56,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
$('#resindexTable').on('click', '[data-res-card]', function () {
|
|
|
var nodeId = $(this).attr("data-res-card");
|
|
|
currentResType = nodeId;//将当前点击的资源类型付给参数
|
|
|
selectedTreeNode('[data-id="' + currentResType + '"]','[data-id="' + currentResType.split('_')[0] + '"]');
|
|
|
renderList(currentResType,'');
|
|
|
selectedTreeNode('[data-id="' + currentResType + '"]', '[data-id="' + currentResType.split('_')[0] + '"]');
|
|
|
renderList(currentResType, '');
|
|
|
// renderList($(this).data("res-card"));
|
|
|
// $("div[data-id='"+nodeId+"']").find(".layui-tree-entry:first span.layui-tree-txt").trigger("click")
|
|
|
});
|
...
|
...
|
@@ -126,7 +127,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
$('#resDetailContent').empty();
|
|
|
$('#resDetailContent').hide();
|
|
|
$('#treeTableContent').hide();
|
|
|
|
|
|
$('#resindex_keyword').val(resindexKeyword)
|
|
|
//如果是阿里云,则显示阿里云的列表
|
|
|
if(resType && resType == 'ALI_CLOUD_PLAT'){
|
|
|
$(".resindexlist").show();
|
...
|
...
|
@@ -141,7 +142,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
|
|
|
window.setResizeEvents('autoHeight', autoHeight);
|
|
|
admin.req({
|
|
|
url: common.domainName + '/api-web/home/resource/healthByResType?pResType=' + resType,
|
|
|
url: common.domainName + '/api-web/home/resource/healthByResType?pResType=' + resType +'&keyword=' + resHealthKeyWord,
|
|
|
}).done(function (res) {
|
|
|
laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
|
|
resindexTable.html(html);
|
...
|
...
|
@@ -149,40 +150,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
});
|
|
|
}
|
|
|
|
|
|
admin.req({
|
|
|
url: common.domainName + '/api-web/home/resType/getTree?notExist=machineroom&table=resources&exist=HOST_MINICOMPUTER_SERVER',
|
|
|
type: 'get',
|
|
|
sync: true,
|
|
|
done: function (res) {
|
|
|
layer.close(loading);
|
|
|
loadResTree(res.data);
|
|
|
//joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
if (res.data.length === 0) {
|
|
|
var resindexTable = $('#resindexTable');
|
|
|
autoHeight(resindexTable);
|
|
|
laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
|
|
resindexTable.html(html);
|
|
|
});
|
|
|
}
|
|
|
loadParamSelect();
|
|
|
//joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.close(loading);
|
|
|
//joke add 20200407
|
|
|
//树无数据提示
|
|
|
tree.render({
|
|
|
elem: '#resindextree',
|
|
|
showLine: false,
|
|
|
data: new Array()
|
|
|
});
|
|
|
//右侧无数据提示
|
|
|
var resindexTable = $('#resindexTable');
|
|
|
autoHeight(resindexTable);
|
|
|
laytpl($('#resindexTpl').html()).render({list: new Array()}, function (html) {
|
|
|
resindexTable.html(html);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
//不带分页的列表
|
|
|
function renderTableList(resType) {
|
...
|
...
|
@@ -243,7 +211,44 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
});
|
|
|
}
|
|
|
//左侧树
|
|
|
function loadResTree(data) {
|
|
|
function loadResTree(val) {
|
|
|
admin.req({
|
|
|
url: common.domainName + '/api-web/home/resType/getTree?notExist=machineroom&table=resources&exist=HOST_MINICOMPUTER_SERVER&keyword='+val,
|
|
|
type: 'get',
|
|
|
sync: true,
|
|
|
done: function (res) {
|
|
|
layer.close(loading);
|
|
|
treeList(res.data);
|
|
|
//joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
if (res.data.length === 0) {
|
|
|
var resindexTable = $('#resindexTable');
|
|
|
autoHeight(resindexTable);
|
|
|
laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
|
|
resindexTable.html(html);
|
|
|
});
|
|
|
}
|
|
|
loadParamSelect();
|
|
|
//joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.close(loading);
|
|
|
//joke add 20200407
|
|
|
//树无数据提示
|
|
|
tree.render({
|
|
|
elem: '#resindextree',
|
|
|
showLine: false,
|
|
|
data: new Array()
|
|
|
});
|
|
|
//右侧无数据提示
|
|
|
var resindexTable = $('#resindexTable');
|
|
|
autoHeight(resindexTable);
|
|
|
laytpl($('#resindexTpl').html()).render({list: new Array()}, function (html) {
|
|
|
resindexTable.html(html);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function treeList(data){
|
|
|
//默认展开全部一级节点
|
|
|
$.each(data,function (i,v) {
|
|
|
v.spread = true;
|
...
|
...
|
@@ -309,7 +314,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//回选树节点
|
|
|
function selectedTreeNode(target,parentTarget) {
|
|
|
var el = $(target).find('.layui-tree-txt').eq(0);
|
...
|
...
|
@@ -687,12 +691,20 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
//回车搜索
|
|
|
$('#resindex_keyword').keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
resindexKeyword = $(this).val();
|
|
|
// renderList(currentResType);
|
|
|
reloadTable();
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$(".layui-input-search").keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
loadResTree($(this).val());
|
|
|
resHealthKeyWord = $(this).val();
|
|
|
resindexKeyword = $(this).val();
|
|
|
}
|
|
|
});
|
|
|
loadResTree('');
|
|
|
//资源详细信息
|
|
|
function renderDetail(resId, resType) {
|
|
|
$('#resIndexContent').hide();
|
...
|
...
|
@@ -950,7 +962,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#resindex_keyword").val(),
|
|
|
resName: resindexKeyword,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
...
|
...
|
@@ -1040,6 +1052,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
$('#resDetailContent').empty();
|
|
|
$('#resDetailContent').hide();
|
|
|
$('#treeTableContent').hide();
|
|
|
$('#resindex_keyword').val(resindexKeyword)
|
|
|
//加载查询条件
|
|
|
renderSerach(resType);
|
|
|
|
...
|
...
|
@@ -1077,7 +1090,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#resindex_keyword").val() !== '' ? $("#resindex_keyword").val() : id,
|
|
|
resName: resindexKeyword !== '' ? resindexKeyword : id,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
...
|
...
|
@@ -1108,8 +1121,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
|
|
|
loadRightResTypeSelectEvent(curTreeNode.data.id, "normal", res.obj);
|
|
|
loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(resListTable)', function (obj) {
|
...
|
...
|
@@ -1164,7 +1176,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
//加载资源池、集群等查询条件
|
|
|
function renderSerach(resType,subflag) {
|
|
|
//清空查询条件 joke add 20200409 开始
|
|
|
$('#resindex_keyword').val('');
|
|
|
$('#resStatus').val('');
|
|
|
// $('#resListBizTypes').val('');
|
|
|
if(xmSelect.get("#resListBizTypes") && xmSelect.get("#resListBizTypes")[0]){
|
...
|
...
|
@@ -1398,7 +1409,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
//加载右侧资源类型下拉框
|
|
|
function loadRightResTypeSelectEvent(resType, type, obj) {
|
|
|
layer.closeAll('tips');
|
|
|
|
|
|
var str = '';
|
|
|
var domStr = 'resListContent'
|
|
|
var fun = reloadTable;
|
...
|
...
|
@@ -1440,10 +1450,10 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
}
|
|
|
|
|
|
});
|
|
|
if(resType == 'HOST_MINICOMPUTER' || resType=='HUAWEI_CLOUD_CLUSTER' || resType=='HUAWEI_CLOUD_COLONY' || resType=='HUAWEI_CLOUD_PHYSICSHOST' ||
|
|
|
if (resType == 'HOST_MINICOMPUTER' || resType == 'HUAWEI_CLOUD_CLUSTER' || resType == 'HUAWEI_CLOUD_COLONY' || resType == 'HUAWEI_CLOUD_PHYSICSHOST' ||
|
|
|
resType == 'HUAWEI_CLOUD_STORAGE' || resType == 'HUAWEI_CLOUD_SWITCHBOARD' || resType == 'HUAWEI_CLOUD_FIREWALL' || resType == 'ALI_CLOUD_RDS'
|
|
|
|| resType == 'ALI_CLOUD_SLB' || resType == 'ALI_CLOUD_OSS'||resType=='VIRTUALIZATION_VMWARE_VHOST'||resType=='MIDDLEWARE_WEBLOGIC'
|
|
|
){//屏蔽连接状态
|
|
|
|| resType == 'ALI_CLOUD_SLB' || resType == 'ALI_CLOUD_OSS' || resType == 'VIRTUALIZATION_VMWARE_VHOST' || resType == 'MIDDLEWARE_WEBLOGIC'
|
|
|
) {//屏蔽连接状态
|
|
|
$('.info-box-count').eq(3).hide();
|
|
|
$('#link_state_div').hide();
|
|
|
}
|
...
|
...
|
@@ -1459,7 +1469,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
}
|
|
|
, where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
|
|
access_token: accessToken,
|
|
|
resName: $("#resindex_keyword").val(),
|
|
|
resName: resindexKeyword,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
...
|
...
|
@@ -1704,4 +1714,4 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
|
|
|
return {getData: getCheckData};
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
}); |
...
|
...
|
|