|
@@ -19,7 +19,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -19,7 +19,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
19
|
var admin = layui.admin;
|
19
|
var admin = layui.admin;
|
20
|
var commonDetail = layui.commonDetail;
|
20
|
var commonDetail = layui.commonDetail;
|
21
|
var domainName = common.domainName;
|
21
|
var domainName = common.domainName;
|
22
|
-
|
22
|
+ var resHealthKeyWord = '';
|
|
|
23
|
+ var resindexKeyword = '';
|
23
|
var resTypeSelectExclude = ['HOST_MINICOMPUTER', 'HOST_MINICOMPUTER_SERVER', 'HOST_BMC', 'HOST_X86SERVER']
|
24
|
var resTypeSelectExclude = ['HOST_MINICOMPUTER', 'HOST_MINICOMPUTER_SERVER', 'HOST_BMC', 'HOST_X86SERVER']
|
24
|
|
25
|
|
25
|
var curTreeNode = '';
|
26
|
var curTreeNode = '';
|
|
@@ -55,8 +56,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -55,8 +56,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
55
|
$('#resindexTable').on('click', '[data-res-card]', function () {
|
56
|
$('#resindexTable').on('click', '[data-res-card]', function () {
|
56
|
var nodeId = $(this).attr("data-res-card");
|
57
|
var nodeId = $(this).attr("data-res-card");
|
57
|
currentResType = nodeId;//将当前点击的资源类型付给参数
|
58
|
currentResType = nodeId;//将当前点击的资源类型付给参数
|
58
|
- selectedTreeNode('[data-id="' + currentResType + '"]','[data-id="' + currentResType.split('_')[0] + '"]');
|
|
|
59
|
- renderList(currentResType,'');
|
59
|
+ selectedTreeNode('[data-id="' + currentResType + '"]', '[data-id="' + currentResType.split('_')[0] + '"]');
|
|
|
60
|
+ renderList(currentResType, '');
|
60
|
// renderList($(this).data("res-card"));
|
61
|
// renderList($(this).data("res-card"));
|
61
|
// $("div[data-id='"+nodeId+"']").find(".layui-tree-entry:first span.layui-tree-txt").trigger("click")
|
62
|
// $("div[data-id='"+nodeId+"']").find(".layui-tree-entry:first span.layui-tree-txt").trigger("click")
|
62
|
});
|
63
|
});
|
|
@@ -126,7 +127,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -126,7 +127,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
126
|
$('#resDetailContent').empty();
|
127
|
$('#resDetailContent').empty();
|
127
|
$('#resDetailContent').hide();
|
128
|
$('#resDetailContent').hide();
|
128
|
$('#treeTableContent').hide();
|
129
|
$('#treeTableContent').hide();
|
129
|
-
|
130
|
+ $('#resindex_keyword').val(resindexKeyword)
|
130
|
//如果是阿里云,则显示阿里云的列表
|
131
|
//如果是阿里云,则显示阿里云的列表
|
131
|
if(resType && resType == 'ALI_CLOUD_PLAT'){
|
132
|
if(resType && resType == 'ALI_CLOUD_PLAT'){
|
132
|
$(".resindexlist").show();
|
133
|
$(".resindexlist").show();
|
|
@@ -141,7 +142,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -141,7 +142,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
141
|
|
142
|
|
142
|
window.setResizeEvents('autoHeight', autoHeight);
|
143
|
window.setResizeEvents('autoHeight', autoHeight);
|
143
|
admin.req({
|
144
|
admin.req({
|
144
|
- url: common.domainName + '/api-web/home/resource/healthByResType?pResType=' + resType,
|
145
|
+ url: common.domainName + '/api-web/home/resource/healthByResType?pResType=' + resType +'&keyword=' + resHealthKeyWord,
|
145
|
}).done(function (res) {
|
146
|
}).done(function (res) {
|
146
|
laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
147
|
laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
147
|
resindexTable.html(html);
|
148
|
resindexTable.html(html);
|
|
@@ -149,40 +150,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -149,40 +150,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
149
|
});
|
150
|
});
|
150
|
}
|
151
|
}
|
151
|
|
152
|
|
152
|
- admin.req({
|
|
|
153
|
- url: common.domainName + '/api-web/home/resType/getTree?notExist=machineroom&table=resources&exist=HOST_MINICOMPUTER_SERVER',
|
|
|
154
|
- type: 'get',
|
|
|
155
|
- sync: true,
|
|
|
156
|
- done: function (res) {
|
|
|
157
|
- layer.close(loading);
|
|
|
158
|
- loadResTree(res.data);
|
|
|
159
|
- //joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
160
|
- if (res.data.length === 0) {
|
|
|
161
|
- var resindexTable = $('#resindexTable');
|
|
|
162
|
- autoHeight(resindexTable);
|
|
|
163
|
- laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
|
|
164
|
- resindexTable.html(html);
|
|
|
165
|
- });
|
|
|
166
|
- }
|
|
|
167
|
- loadParamSelect();
|
|
|
168
|
- //joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
169
|
- }
|
|
|
170
|
- }).error(function () {
|
|
|
171
|
- layer.close(loading);
|
|
|
172
|
- //joke add 20200407
|
|
|
173
|
- //树无数据提示
|
|
|
174
|
- tree.render({
|
|
|
175
|
- elem: '#resindextree',
|
|
|
176
|
- showLine: false,
|
|
|
177
|
- data: new Array()
|
|
|
178
|
- });
|
|
|
179
|
- //右侧无数据提示
|
|
|
180
|
- var resindexTable = $('#resindexTable');
|
|
|
181
|
- autoHeight(resindexTable);
|
|
|
182
|
- laytpl($('#resindexTpl').html()).render({list: new Array()}, function (html) {
|
|
|
183
|
- resindexTable.html(html);
|
|
|
184
|
- });
|
|
|
185
|
- });
|
153
|
+
|
186
|
|
154
|
|
187
|
//不带分页的列表
|
155
|
//不带分页的列表
|
188
|
function renderTableList(resType) {
|
156
|
function renderTableList(resType) {
|
|
@@ -243,7 +211,44 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -243,7 +211,44 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
243
|
});
|
211
|
});
|
244
|
}
|
212
|
}
|
245
|
//左侧树
|
213
|
//左侧树
|
246
|
- function loadResTree(data) {
|
214
|
+ function loadResTree(val) {
|
|
|
215
|
+ admin.req({
|
|
|
216
|
+ url: common.domainName + '/api-web/home/resType/getTree?notExist=machineroom&table=resources&exist=HOST_MINICOMPUTER_SERVER&keyword='+val,
|
|
|
217
|
+ type: 'get',
|
|
|
218
|
+ sync: true,
|
|
|
219
|
+ done: function (res) {
|
|
|
220
|
+ layer.close(loading);
|
|
|
221
|
+ treeList(res.data);
|
|
|
222
|
+ //joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
223
|
+ if (res.data.length === 0) {
|
|
|
224
|
+ var resindexTable = $('#resindexTable');
|
|
|
225
|
+ autoHeight(resindexTable);
|
|
|
226
|
+ laytpl($('#resindexTpl').html()).render({list: res.data}, function (html) {
|
|
|
227
|
+ resindexTable.html(html);
|
|
|
228
|
+ });
|
|
|
229
|
+ }
|
|
|
230
|
+ loadParamSelect();
|
|
|
231
|
+ //joke add 20200407,如果没有资源树,则默认资源页给提示无数据 开始
|
|
|
232
|
+ }
|
|
|
233
|
+ }).error(function () {
|
|
|
234
|
+ layer.close(loading);
|
|
|
235
|
+ //joke add 20200407
|
|
|
236
|
+ //树无数据提示
|
|
|
237
|
+ tree.render({
|
|
|
238
|
+ elem: '#resindextree',
|
|
|
239
|
+ showLine: false,
|
|
|
240
|
+ data: new Array()
|
|
|
241
|
+ });
|
|
|
242
|
+ //右侧无数据提示
|
|
|
243
|
+ var resindexTable = $('#resindexTable');
|
|
|
244
|
+ autoHeight(resindexTable);
|
|
|
245
|
+ laytpl($('#resindexTpl').html()).render({list: new Array()}, function (html) {
|
|
|
246
|
+ resindexTable.html(html);
|
|
|
247
|
+ });
|
|
|
248
|
+ });
|
|
|
249
|
+ }
|
|
|
250
|
+
|
|
|
251
|
+ function treeList(data){
|
247
|
//默认展开全部一级节点
|
252
|
//默认展开全部一级节点
|
248
|
$.each(data,function (i,v) {
|
253
|
$.each(data,function (i,v) {
|
249
|
v.spread = true;
|
254
|
v.spread = true;
|
|
@@ -309,7 +314,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -309,7 +314,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
309
|
}
|
314
|
}
|
310
|
}
|
315
|
}
|
311
|
}
|
316
|
}
|
312
|
-
|
|
|
313
|
//回选树节点
|
317
|
//回选树节点
|
314
|
function selectedTreeNode(target,parentTarget) {
|
318
|
function selectedTreeNode(target,parentTarget) {
|
315
|
var el = $(target).find('.layui-tree-txt').eq(0);
|
319
|
var el = $(target).find('.layui-tree-txt').eq(0);
|
|
@@ -687,12 +691,20 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -687,12 +691,20 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
687
|
//回车搜索
|
691
|
//回车搜索
|
688
|
$('#resindex_keyword').keydown(function (e) {
|
692
|
$('#resindex_keyword').keydown(function (e) {
|
689
|
if (e.keyCode === 13) {
|
693
|
if (e.keyCode === 13) {
|
|
|
694
|
+ resindexKeyword = $(this).val();
|
690
|
// renderList(currentResType);
|
695
|
// renderList(currentResType);
|
691
|
reloadTable();
|
696
|
reloadTable();
|
692
|
return false;
|
697
|
return false;
|
693
|
}
|
698
|
}
|
694
|
});
|
699
|
});
|
695
|
-
|
700
|
+ $(".layui-input-search").keydown(function (e) {
|
|
|
701
|
+ if (e.keyCode === 13) {
|
|
|
702
|
+ loadResTree($(this).val());
|
|
|
703
|
+ resHealthKeyWord = $(this).val();
|
|
|
704
|
+ resindexKeyword = $(this).val();
|
|
|
705
|
+ }
|
|
|
706
|
+ });
|
|
|
707
|
+ loadResTree('');
|
696
|
//资源详细信息
|
708
|
//资源详细信息
|
697
|
function renderDetail(resId, resType) {
|
709
|
function renderDetail(resId, resType) {
|
698
|
$('#resIndexContent').hide();
|
710
|
$('#resIndexContent').hide();
|
|
@@ -950,7 +962,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -950,7 +962,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
950
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
962
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
951
|
, where: {
|
963
|
, where: {
|
952
|
access_token: accessToken,
|
964
|
access_token: accessToken,
|
953
|
- resName: $("#resindex_keyword").val(),
|
965
|
+ resName: resindexKeyword,
|
954
|
busId: bizId,
|
966
|
busId: bizId,
|
955
|
resHealth: $("#resStatus").val(),
|
967
|
resHealth: $("#resStatus").val(),
|
956
|
colonlyId: $("#res_colony").val(),
|
968
|
colonlyId: $("#res_colony").val(),
|
|
@@ -1040,6 +1052,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1040,6 +1052,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1040
|
$('#resDetailContent').empty();
|
1052
|
$('#resDetailContent').empty();
|
1041
|
$('#resDetailContent').hide();
|
1053
|
$('#resDetailContent').hide();
|
1042
|
$('#treeTableContent').hide();
|
1054
|
$('#treeTableContent').hide();
|
|
|
1055
|
+ $('#resindex_keyword').val(resindexKeyword)
|
1043
|
//加载查询条件
|
1056
|
//加载查询条件
|
1044
|
renderSerach(resType);
|
1057
|
renderSerach(resType);
|
1045
|
|
1058
|
|
|
@@ -1077,7 +1090,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1077,7 +1090,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1077
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
1090
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
1078
|
, where: {
|
1091
|
, where: {
|
1079
|
access_token: accessToken,
|
1092
|
access_token: accessToken,
|
1080
|
- resName: $("#resindex_keyword").val() !== '' ? $("#resindex_keyword").val() : id,
|
1093
|
+ resName: resindexKeyword !== '' ? resindexKeyword : id,
|
1081
|
busId: bizId,
|
1094
|
busId: bizId,
|
1082
|
resHealth: $("#resStatus").val(),
|
1095
|
resHealth: $("#resStatus").val(),
|
1083
|
colonlyId: $("#res_colony").val(),
|
1096
|
colonlyId: $("#res_colony").val(),
|
|
@@ -1108,8 +1121,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1108,8 +1121,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1108
|
resTopo();
|
1121
|
resTopo();
|
1109
|
|
1122
|
|
1110
|
commonCols.colsClickEvent(editFlag);
|
1123
|
commonCols.colsClickEvent(editFlag);
|
1111
|
-
|
|
|
1112
|
- loadRightResTypeSelectEvent(curTreeNode.data.id, "normal", res.obj);
|
1124
|
+ loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);
|
1113
|
|
1125
|
|
1114
|
//表格排序监听 joke add 20200408
|
1126
|
//表格排序监听 joke add 20200408
|
1115
|
table.on('sort(resListTable)', function (obj) {
|
1127
|
table.on('sort(resListTable)', function (obj) {
|
|
@@ -1164,7 +1176,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1164,7 +1176,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1164
|
//加载资源池、集群等查询条件
|
1176
|
//加载资源池、集群等查询条件
|
1165
|
function renderSerach(resType,subflag) {
|
1177
|
function renderSerach(resType,subflag) {
|
1166
|
//清空查询条件 joke add 20200409 开始
|
1178
|
//清空查询条件 joke add 20200409 开始
|
1167
|
- $('#resindex_keyword').val('');
|
|
|
1168
|
$('#resStatus').val('');
|
1179
|
$('#resStatus').val('');
|
1169
|
// $('#resListBizTypes').val('');
|
1180
|
// $('#resListBizTypes').val('');
|
1170
|
if(xmSelect.get("#resListBizTypes") && xmSelect.get("#resListBizTypes")[0]){
|
1181
|
if(xmSelect.get("#resListBizTypes") && xmSelect.get("#resListBizTypes")[0]){
|
|
@@ -1398,7 +1409,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1398,7 +1409,6 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1398
|
//加载右侧资源类型下拉框
|
1409
|
//加载右侧资源类型下拉框
|
1399
|
function loadRightResTypeSelectEvent(resType, type, obj) {
|
1410
|
function loadRightResTypeSelectEvent(resType, type, obj) {
|
1400
|
layer.closeAll('tips');
|
1411
|
layer.closeAll('tips');
|
1401
|
-
|
|
|
1402
|
var str = '';
|
1412
|
var str = '';
|
1403
|
var domStr = 'resListContent'
|
1413
|
var domStr = 'resListContent'
|
1404
|
var fun = reloadTable;
|
1414
|
var fun = reloadTable;
|
|
@@ -1440,10 +1450,10 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1440,10 +1450,10 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1440
|
}
|
1450
|
}
|
1441
|
|
1451
|
|
1442
|
});
|
1452
|
});
|
1443
|
- if(resType == 'HOST_MINICOMPUTER' || resType=='HUAWEI_CLOUD_CLUSTER' || resType=='HUAWEI_CLOUD_COLONY' || resType=='HUAWEI_CLOUD_PHYSICSHOST' ||
|
1453
|
+ if (resType == 'HOST_MINICOMPUTER' || resType == 'HUAWEI_CLOUD_CLUSTER' || resType == 'HUAWEI_CLOUD_COLONY' || resType == 'HUAWEI_CLOUD_PHYSICSHOST' ||
|
1444
|
resType == 'HUAWEI_CLOUD_STORAGE' || resType == 'HUAWEI_CLOUD_SWITCHBOARD' || resType == 'HUAWEI_CLOUD_FIREWALL' || resType == 'ALI_CLOUD_RDS'
|
1454
|
resType == 'HUAWEI_CLOUD_STORAGE' || resType == 'HUAWEI_CLOUD_SWITCHBOARD' || resType == 'HUAWEI_CLOUD_FIREWALL' || resType == 'ALI_CLOUD_RDS'
|
1445
|
- || resType == 'ALI_CLOUD_SLB' || resType == 'ALI_CLOUD_OSS'||resType=='VIRTUALIZATION_VMWARE_VHOST'||resType=='MIDDLEWARE_WEBLOGIC'
|
|
|
1446
|
- ){//屏蔽连接状态
|
1455
|
+ || resType == 'ALI_CLOUD_SLB' || resType == 'ALI_CLOUD_OSS' || resType == 'VIRTUALIZATION_VMWARE_VHOST' || resType == 'MIDDLEWARE_WEBLOGIC'
|
|
|
1456
|
+ ) {//屏蔽连接状态
|
1447
|
$('.info-box-count').eq(3).hide();
|
1457
|
$('.info-box-count').eq(3).hide();
|
1448
|
$('#link_state_div').hide();
|
1458
|
$('#link_state_div').hide();
|
1449
|
}
|
1459
|
}
|
|
@@ -1459,7 +1469,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1459,7 +1469,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1459
|
}
|
1469
|
}
|
1460
|
, where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
1470
|
, where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
1461
|
access_token: accessToken,
|
1471
|
access_token: accessToken,
|
1462
|
- resName: $("#resindex_keyword").val(),
|
1472
|
+ resName: resindexKeyword,
|
1463
|
busId: bizId,
|
1473
|
busId: bizId,
|
1464
|
resHealth: $("#resStatus").val(),
|
1474
|
resHealth: $("#resStatus").val(),
|
1465
|
colonlyId: $("#res_colony").val(),
|
1475
|
colonlyId: $("#res_colony").val(),
|
|
@@ -1704,4 +1714,4 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
@@ -1704,4 +1714,4 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
1704
|
|
1714
|
|
1705
|
return {getData: getCheckData};
|
1715
|
return {getData: getCheckData};
|
1706
|
});
|
1716
|
});
|
1707
|
-}); |
|
|
|
|
1717
|
+}); |