...
|
...
|
@@ -4,6 +4,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
var $ = layui.$;
|
|
|
var common = layui.common;
|
|
|
var table = layui.table;
|
|
|
var fieldExpandArr=[];//获取扩展的表格字段
|
|
|
|
|
|
//对外暴露的接口
|
|
|
exports('resindex', function (data) {
|
...
|
...
|
@@ -169,46 +170,77 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
} else {
|
|
|
cols = commonCols.resTypeCls[resType];
|
|
|
}
|
|
|
resTableList = table.render({
|
|
|
elem: '#resindexList'
|
|
|
, id: 'resindexList'
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, toolbar: '<div><button id="resTableIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>'
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: '100'
|
|
|
, cellMinWidth: 80
|
|
|
, page: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
//2021/10/18 徐毫杰 阿里云服务器更改样式
|
|
|
if(resType=='ALI_CLOUD_PLAT'){
|
|
|
$('.layui-table-view').height(170);
|
|
|
$('.layui-table-main').height(70);
|
|
|
}
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("resTableIndex_cols_save");
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#resTableIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'resTableList',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: resTableList.config.cols
|
|
|
//start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
|
|
|
, done: function (res) {
|
|
|
if (res && res.data ) {
|
|
|
let arr=res.data;
|
|
|
if(fieldExpandArr.indexOf(resType)!=-1){
|
|
|
}else{
|
|
|
fieldExpandArr.push(resType);
|
|
|
if(arr.length>0){
|
|
|
arr.map(item=>{
|
|
|
let listStr='';
|
|
|
if(item.list && item.list.length>0){
|
|
|
listStr=item.list.join(',')
|
|
|
}
|
|
|
cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
|
|
|
templet:` <div>
|
|
|
<div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
|
|
|
data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
|
|
|
{{d.`+item.field+` ? d.`+item.field+` : ''}}
|
|
|
</div></div>`})
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
resTableList = table.render({
|
|
|
elem: '#resindexList'
|
|
|
, id: 'resindexList'
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, toolbar: '<div><button id="resTableIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>'
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: '100'
|
|
|
, cellMinWidth: 80
|
|
|
, page: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
//2021/10/18 徐毫杰 阿里云服务器更改样式
|
|
|
if(resType=='ALI_CLOUD_PLAT'){
|
|
|
$('.layui-table-view').height(170);
|
|
|
$('.layui-table-main').height(70);
|
|
|
}
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("resTableIndex_cols_save");
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#resTableIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'resTableList',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: resTableList.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},300)
|
|
|
});
|
|
|
}
|
|
|
//左侧树
|
...
|
...
|
@@ -752,148 +784,179 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
var index = layer.load(2); //加载层
|
|
|
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
//start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + resType
|
|
|
, type: "get"
|
|
|
, data: {
|
|
|
ptId: $("#virtual_platForm_select").val(),
|
|
|
busId: bizId,
|
|
|
keyWords: $("#treetable_keyword").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
state: $("#treetable_res_state").val(),
|
|
|
resCategory: 'resources',
|
|
|
collProtocols : collProtocols
|
|
|
|
|
|
}
|
|
|
url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
|
|
|
, done: function (res) {
|
|
|
layer.close(index);
|
|
|
if (res.code == 0) {
|
|
|
//渲染表格
|
|
|
var tableTreeVirtual;
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'tableTreeVirtual',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
if (res && res.data ) {
|
|
|
let arr=res.data;
|
|
|
if(fieldExpandArr.indexOf(resType)!=-1){
|
|
|
}else{
|
|
|
fieldExpandArr.push(resType);
|
|
|
if(arr.length>0){
|
|
|
arr.map(item=>{
|
|
|
let listStr='';
|
|
|
if(item.list && item.list.length>0){
|
|
|
listStr=item.list.join(',')
|
|
|
}
|
|
|
cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
|
|
|
templet:` <div>
|
|
|
<div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
|
|
|
data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
|
|
|
{{d.`+item.field+` ? d.`+item.field+` : ''}}
|
|
|
</div></div>`})
|
|
|
})
|
|
|
}
|
|
|
tableTreeVirtual = table.render({
|
|
|
elem: '#virtual_platform_treeTable',
|
|
|
autoColumnWidth: false,
|
|
|
page: false,
|
|
|
limit: 9999,
|
|
|
data: res.data,
|
|
|
tree: {
|
|
|
iconIndex: 1
|
|
|
},
|
|
|
cols: [cols]
|
|
|
, height: 'full-220',
|
|
|
done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
common.treeTableDragCols('#virtual_platform_treeTable', '#resTreeList-top-head-info-tpl');
|
|
|
loadRightResTypeSelectEvent(curTreeNode.data.id,"tree")
|
|
|
// 保存列顺序
|
|
|
$('#virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){
|
|
|
common.saveTableCols({
|
|
|
domId: 'tableTreeVirtual',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: tableTreeVirtual.config.cols
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + resType
|
|
|
, type: "get"
|
|
|
, data: {
|
|
|
ptId: $("#virtual_platForm_select").val(),
|
|
|
busId: bizId,
|
|
|
keyWords: $("#treetable_keyword").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
state: $("#treetable_res_state").val(),
|
|
|
resCategory: 'resources',
|
|
|
collProtocols : collProtocols
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
layer.close(index);
|
|
|
if (res.code == 0) {
|
|
|
//渲染表格
|
|
|
var tableTreeVirtual;
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'tableTreeVirtual',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
});
|
|
|
/**
|
|
|
/**表格的增删改都会回调此方法
|
|
|
* 与table.on(tool(lay-filter))用法一致。
|
|
|
**/
|
|
|
/*tableTreeVirtual.on('tool(tableEvent)',function (obj) {
|
|
|
if(!obj.data.treeList){
|
|
|
var field = obj.field; //单元格字段
|
|
|
var value = obj.value; //修改后的值
|
|
|
var data = obj.data; //当前行数据
|
|
|
var event = obj.event; //当前单元格事件属性值
|
|
|
var subResType = '';
|
|
|
if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';
|
|
|
}else if(data.resType.indexOf('CLUSTER')>-1){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';
|
|
|
}else if(data.resType.indexOf('PHYSICSHOST')>-1){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';
|
|
|
}else{
|
|
|
subResType = data.resType
|
|
|
tableTreeVirtual = table.render({
|
|
|
elem: '#virtual_platform_treeTable',
|
|
|
autoColumnWidth: false,
|
|
|
page: false,
|
|
|
limit: 9999,
|
|
|
data: res.data,
|
|
|
tree: {
|
|
|
iconIndex: 1
|
|
|
},
|
|
|
cols: [cols]
|
|
|
, height: 'full-220',
|
|
|
done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
common.treeTableDragCols('#virtual_platform_treeTable', '#resTreeList-top-head-info-tpl');
|
|
|
loadRightResTypeSelectEvent(curTreeNode.data.id,"tree")
|
|
|
// 保存列顺序
|
|
|
$('#virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){
|
|
|
common.saveTableCols({
|
|
|
domId: 'tableTreeVirtual',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: tableTreeVirtual.config.cols
|
|
|
});
|
|
|
});
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
}
|
|
|
if(event === 'loadChildren'){
|
|
|
$.ajax({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
|
|
|
, type: "get"
|
|
|
, data: {
|
|
|
ptId: $("#virtual_platForm_select").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
busId: $("#treetableBizTypes").val(),
|
|
|
keyWords: $("#treetable_keyword").val(),
|
|
|
state: $("#treetable_state").val(),
|
|
|
access_token:accessToken,
|
|
|
parentId:data.resId
|
|
|
}
|
|
|
,success:function (res) {
|
|
|
if(res.data.length>0){
|
|
|
obj.loadChildren(res.data);
|
|
|
commonCols.colsClickEvent();
|
|
|
});
|
|
|
/**
|
|
|
/**表格的增删改都会回调此方法
|
|
|
* 与table.on(tool(lay-filter))用法一致。
|
|
|
**/
|
|
|
/*tableTreeVirtual.on('tool(tableEvent)',function (obj) {
|
|
|
if(!obj.data.treeList){
|
|
|
var field = obj.field; //单元格字段
|
|
|
var value = obj.value; //修改后的值
|
|
|
var data = obj.data; //当前行数据
|
|
|
var event = obj.event; //当前单元格事件属性值
|
|
|
var subResType = '';
|
|
|
if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';
|
|
|
}else if(data.resType.indexOf('CLUSTER')>-1){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';
|
|
|
}else if(data.resType.indexOf('PHYSICSHOST')>-1){
|
|
|
subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';
|
|
|
}else{
|
|
|
subResType = data.resType
|
|
|
}
|
|
|
if(event === 'loadChildren'){
|
|
|
$.ajax({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
|
|
|
, type: "get"
|
|
|
, data: {
|
|
|
ptId: $("#virtual_platForm_select").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
busId: $("#treetableBizTypes").val(),
|
|
|
keyWords: $("#treetable_keyword").val(),
|
|
|
state: $("#treetable_state").val(),
|
|
|
access_token:accessToken,
|
|
|
parentId:data.resId
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
,success:function (res) {
|
|
|
if(res.data.length>0){
|
|
|
obj.loadChildren(res.data);
|
|
|
commonCols.colsClickEvent();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});*/
|
|
|
//统计总数
|
|
|
// $('#virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#treetable-countTpl').html()).render(res.data.length));
|
|
|
});
|
|
|
} else {
|
|
|
console.log(data.msg);
|
|
|
}
|
|
|
//关键字回车事件
|
|
|
$('#treetable_keyword').keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
renderTreeTable(curTreeNode.data.id)
|
|
|
return false;
|
|
|
});*/
|
|
|
//统计总数
|
|
|
// $('#virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#treetable-countTpl').html()).render(res.data.length));
|
|
|
});
|
|
|
} else {
|
|
|
console.log(data.msg);
|
|
|
}
|
|
|
});
|
|
|
//选择资源状态
|
|
|
form.on('select(treetable_resStatus)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
// //选择业务
|
|
|
// form.on('select(treetableBizTypes)', function (data) {
|
|
|
// renderTreeTable(curTreeNode.data.id);
|
|
|
// });
|
|
|
//选择平台
|
|
|
form.on('select(virtual_platForm_select)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
//选择资源连接状态
|
|
|
form.on('select(treetable_state)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
form.on('select(treetable_res_state)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
//关键字回车事件
|
|
|
$('#treetable_keyword').keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
renderTreeTable(curTreeNode.data.id)
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
//选择资源状态
|
|
|
form.on('select(treetable_resStatus)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
// //选择业务
|
|
|
// form.on('select(treetableBizTypes)', function (data) {
|
|
|
// renderTreeTable(curTreeNode.data.id);
|
|
|
// });
|
|
|
//选择平台
|
|
|
form.on('select(virtual_platForm_select)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
//选择资源连接状态
|
|
|
form.on('select(treetable_state)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
form.on('select(treetable_res_state)', function (data) {
|
|
|
renderTreeTable(curTreeNode.data.id);
|
|
|
});
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.close(index);
|
|
|
});
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.close(index);
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -995,116 +1058,148 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
}
|
|
|
//渲染表格
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'parentResListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if(retCols){
|
|
|
cols = retCols;
|
|
|
}
|
|
|
|
|
|
parentResListTable = table.render({
|
|
|
elem: '#resListTable'
|
|
|
, id: 'resListTable'
|
|
|
, toolbar: '#resList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: resindexKeyword,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
|
|
parentId: $("#res_cluster").val(),
|
|
|
sortKey: sortKey,
|
|
|
state: $("#state").val(),
|
|
|
linkState: $("#link_state").val(),
|
|
|
hostState: $("#host_state").val(),
|
|
|
powerState: $("#power_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
//start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
|
|
|
, done: function (res) {
|
|
|
if (res && res.data ) {
|
|
|
let arr=res.data;
|
|
|
if(fieldExpandArr.indexOf(resType)!=-1){
|
|
|
}else{
|
|
|
fieldExpandArr.push(resType);
|
|
|
if(arr.length>0){
|
|
|
arr.map(item=>{
|
|
|
let listStr='';
|
|
|
if(item.list && item.list.length>0){
|
|
|
listStr=item.list.join(',')
|
|
|
}
|
|
|
cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
|
|
|
templet:` <div>
|
|
|
<div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
|
|
|
data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
|
|
|
{{d.`+item.field+` ? d.`+item.field+` : ''}}
|
|
|
</div></div>`})
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'parentResListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if(retCols){
|
|
|
cols = retCols;
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, limit: 150
|
|
|
, limits: [150, 200, 300]
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
//更改样式
|
|
|
function noClick($that) {
|
|
|
$that.css("color", "#666");
|
|
|
$that.css("text-decoration", "none");
|
|
|
$that.attr("lay-tips", "未监控到数据");
|
|
|
}
|
|
|
|
|
|
// 共享设备,厂商是H3C、HDS的设备不让点击并且提示暂无监控信息
|
|
|
var $hsc_ = $('span[data-restype="STORAGE_SHARE"][data-provider="H3C"]');
|
|
|
$.each($hsc_, function (i, v) {
|
|
|
noClick($(this));
|
|
|
});
|
|
|
var $hds = $('span[data-restype="STORAGE_SHARE"][data-provider="HDS"]');
|
|
|
$.each($hds, function (i, v) {
|
|
|
noClick($(this));
|
|
|
});
|
|
|
//华为云,阿里云不让点击,并且提示暂无监控信息
|
|
|
// var $hds = $('span[data-restype="HUAWEI_CLOUD_PLAT"]');
|
|
|
// $.each($hds, function (i, v) {
|
|
|
// noClick($(this));
|
|
|
// });
|
|
|
// var $hds = $('span[data-restype="ALI_CLOUD_PLAT"]');
|
|
|
// $.each($hds, function (i, v) {
|
|
|
// noClick($(this));
|
|
|
// });
|
|
|
|
|
|
soulTable.render(this)
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
parentResListTable = table.render({
|
|
|
elem: '#resListTable'
|
|
|
, id: 'resListTable'
|
|
|
, toolbar: '#resList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: resindexKeyword,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
|
|
parentId: $("#res_cluster").val(),
|
|
|
sortKey: sortKey,
|
|
|
state: $("#state").val(),
|
|
|
linkState: $("#link_state").val(),
|
|
|
hostState: $("#host_state").val(),
|
|
|
powerState: $("#power_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, limit: 150
|
|
|
, limits: [150, 200, 300]
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
//更改样式
|
|
|
function noClick($that) {
|
|
|
$that.css("color", "#666");
|
|
|
$that.css("text-decoration", "none");
|
|
|
$that.attr("lay-tips", "未监控到数据");
|
|
|
}
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(resListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
if (obj.field == 'ip') {
|
|
|
sortKey = 'INET_ATON(' + obj.field + ') ' + obj.type;
|
|
|
// 共享设备,厂商是H3C、HDS的设备不让点击并且提示暂无监控信息
|
|
|
var $hsc_ = $('span[data-restype="STORAGE_SHARE"][data-provider="H3C"]');
|
|
|
$.each($hsc_, function (i, v) {
|
|
|
noClick($(this));
|
|
|
});
|
|
|
var $hds = $('span[data-restype="STORAGE_SHARE"][data-provider="HDS"]');
|
|
|
$.each($hds, function (i, v) {
|
|
|
noClick($(this));
|
|
|
});
|
|
|
//华为云,阿里云不让点击,并且提示暂无监控信息
|
|
|
// var $hds = $('span[data-restype="HUAWEI_CLOUD_PLAT"]');
|
|
|
// $.each($hds, function (i, v) {
|
|
|
// noClick($(this));
|
|
|
// });
|
|
|
// var $hds = $('span[data-restype="ALI_CLOUD_PLAT"]');
|
|
|
// $.each($hds, function (i, v) {
|
|
|
// noClick($(this));
|
|
|
// });
|
|
|
|
|
|
soulTable.render(this)
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(resListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
if (obj.field == 'ip') {
|
|
|
sortKey = 'INET_ATON(' + obj.field + ') ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
}
|
|
|
} else {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
sortKey = '';
|
|
|
}
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("parentResIndex_cols_save");
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("parentResIndex_cols_save");
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#parentResIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'parentResListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: parentResListTable.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
// 渲染统计数据
|
|
|
loadRightResTypeSelectEvent(resType,"normal");
|
|
|
}
|
|
|
//保存列顺序
|
|
|
$("#parentResIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'parentResListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: parentResListTable.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
// 渲染统计数据
|
|
|
loadRightResTypeSelectEvent(resType,"normal");
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
},300)
|
|
|
|
|
|
}
|
|
|
|
|
|
//资源列表
|
...
|
...
|
@@ -1132,85 +1227,116 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' |
|
|
$('#power_state_div').show();
|
|
|
}
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'resListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
resListTable = table.render({
|
|
|
elem: '#resListTable'
|
|
|
, id: 'resListTable'
|
|
|
, toolbar: '<div><button id="resIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: resindexKeyword !== '' ? resindexKeyword : id,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
|
|
parentId: $("#res_cluster").val(),
|
|
|
sortKey: sortKey,
|
|
|
state: $("#state").val(),
|
|
|
linkState: $("#link_state").val(),
|
|
|
hostState: $("#host_state").val(),
|
|
|
powerState: $("#power_state").val(),
|
|
|
provider: $("#res_vendor").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, limit: 150
|
|
|
, limits: [150, 200, 300]
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
soulTable.render(this)
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(resListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("resIndex_cols_save");
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#resIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'resListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: resListTable.config.cols
|
|
|
//start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
|
|
|
, done: function (res) {
|
|
|
if (res && res.data ) {
|
|
|
let arr=res.data;
|
|
|
if(fieldExpandArr.indexOf(resType)!=-1){
|
|
|
}else{
|
|
|
fieldExpandArr.push(resType);
|
|
|
if(arr.length>0){
|
|
|
arr.map(item=>{
|
|
|
let listStr='';
|
|
|
if(item.list && item.list.length>0){
|
|
|
listStr=item.list.join(',')
|
|
|
}
|
|
|
cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
|
|
|
templet:` <div>
|
|
|
<div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
|
|
|
data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
|
|
|
{{d.`+item.field+` ? d.`+item.field+` : ''}}
|
|
|
</div></div>`})
|
|
|
})
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
$(this).addClass("hide");
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'resListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType
|
|
|
},function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
resListTable = table.render({
|
|
|
elem: '#resListTable'
|
|
|
, id: 'resListTable'
|
|
|
, toolbar: '<div><button id="resIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: resindexKeyword !== '' ? resindexKeyword : id,
|
|
|
busId: bizId,
|
|
|
resHealth: $("#resStatus").val(),
|
|
|
colonlyId: $("#res_colony").val(),
|
|
|
parentId: $("#res_cluster").val(),
|
|
|
sortKey: sortKey,
|
|
|
state: $("#state").val(),
|
|
|
linkState: $("#link_state").val(),
|
|
|
hostState: $("#host_state").val(),
|
|
|
powerState: $("#power_state").val(),
|
|
|
provider: $("#res_vendor").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, limit: 150
|
|
|
, limits: [150, 200, 300]
|
|
|
, cols: [cols]
|
|
|
, done: function (res, curr, count) {
|
|
|
soulTable.render(this)
|
|
|
|
|
|
//调用收藏方法
|
|
|
resFavorites();
|
|
|
resTopo();
|
|
|
|
|
|
commonCols.colsClickEvent(editFlag);
|
|
|
loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(resListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("resIndex_cols_save");
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#resIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'resListTable',
|
|
|
moduleId: 'resIndex',
|
|
|
resType: resType,
|
|
|
cols: resListTable.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
$(this).addClass("hide");
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|