...
|
...
|
@@ -18,7 +18,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols |
|
|
var curBizResType = '';//当前业务所在的资源类型
|
|
|
|
|
|
var sortKey = '';
|
|
|
|
|
|
var fieldExpandArr=[];//获取扩展的表格字段
|
|
|
|
|
|
function autoHeight(el) {
|
|
|
// var height = el.parents('.layui-card').height();
|
...
|
...
|
@@ -441,74 +441,104 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols |
|
|
resTypeList.push(v.value);
|
|
|
busId = v.pid;
|
|
|
});
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: 'OperatingSystem'
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizListTable = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
// //, toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resTypeList.toString()
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources',
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
getResCount(busId, resTypeList.toString());
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
bizLoadRightResTypeSelectEvent(busId, 'OperatingSystem', 'normal', res.obj);
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: 'OperatingSystem',
|
|
|
cols: bizListTable.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);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
setTimeout(function (){
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: 'OperatingSystem'
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizListTable = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
// //, toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resTypeList.toString()
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources',
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
getResCount(busId, resTypeList.toString());
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
bizLoadRightResTypeSelectEvent(busId, 'OperatingSystem', 'normal', res.obj);
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: 'OperatingSystem',
|
|
|
cols: bizListTable.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
//获取业务下的资源类型健康统计
|
...
|
...
|
@@ -550,75 +580,106 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols |
|
|
renderBizSerach(resType, busId, true);
|
|
|
form.render(null, 'biz-list-form');
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizParentList',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizParentList = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this)
|
|
|
getResCount(busId, resType)
|
|
|
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'normal', res.obj);
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizParentList',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizParentList.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);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizParentList',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizParentList = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this)
|
|
|
getResCount(busId, resType)
|
|
|
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'normal', res.obj);
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizParentList',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizParentList.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
//资源列表
|
...
|
...
|
@@ -633,76 +694,107 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols |
|
|
|
|
|
form.render(null, 'biz-list-form');
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizListTable = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
//, toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this)
|
|
|
getResCount(busId, resType)
|
|
|
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'normal', res.obj);
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizListTable.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);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
bizListTable = table.render({
|
|
|
elem: '#bizListTable'
|
|
|
//, toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont"></i></button></div>' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
|
|
|
, defaultToolbar: ['filter']
|
|
|
, drag: {toolbar: false}
|
|
|
, url: common.domainName + '/api-web/home/res-list/' + resType
|
|
|
, where: {
|
|
|
access_token: accessToken,
|
|
|
resName: $("#bizindex_keyword").val(),
|
|
|
resHealth: $("#biz_resStatus").val(),
|
|
|
busId: busId,
|
|
|
colonlyId: $("#biz_res_colony").val(),
|
|
|
parentId: $("#biz_res_cluster").val(),
|
|
|
linkState: $("#bizlink_state").val(),
|
|
|
state: $("#biz_state").val(),
|
|
|
resCategory: 'resources'
|
|
|
}
|
|
|
, height: 'full-165'
|
|
|
, cellMinWidth: 80
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
soulTable.render(this)
|
|
|
getResCount(busId, resType)
|
|
|
|
|
|
commonCols.colsClickEvent();
|
|
|
|
|
|
//表格排序监听 joke add 20200408
|
|
|
table.on('sort(bizListTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
})
|
|
|
|
|
|
//触发拖动列事件,参数为保存按钮的id
|
|
|
common.dragCols("bizIndex_cols_save");
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'normal', res.obj);
|
|
|
|
|
|
//保存列顺序
|
|
|
$("#bizIndex_cols_save").unbind("click").on("click", function () {
|
|
|
var params = {
|
|
|
domId: 'bizListTable',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizListTable.config.cols
|
|
|
}
|
|
|
common.saveTableCols(params);
|
|
|
});
|
|
|
resTopo();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
//树表格
|
...
|
...
|
@@ -729,147 +821,177 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols |
|
|
}
|
|
|
|
|
|
var cols = commonCols.resTypeCls[resType];
|
|
|
|
|
|
//start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + resType
|
|
|
, data: {
|
|
|
ptId: $("#biz_virtual_platForm_select").val(),
|
|
|
health: $("#biz_treetable_resStatus").val(),
|
|
|
busId: busId,
|
|
|
keyWords: $("#biz_treetable_keyword").val(),
|
|
|
state: $("#biz_treetable_res_state").val()
|
|
|
}
|
|
|
url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
|
|
|
, done: function (res) {
|
|
|
if (res.code == 0) {
|
|
|
var bizTableTreeVirtual;
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizTableTreeVirtual',
|
|
|
moduleId: 'bizIndex',
|
|
|
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>`})
|
|
|
})
|
|
|
}
|
|
|
bizTableTreeVirtual = table.render({
|
|
|
elem: '#biz_virtual_platform_treeTable',
|
|
|
data: res.data,
|
|
|
treeConfig: { //表格树所需配置
|
|
|
showField: 'resName' //表格树显示的字段
|
|
|
, treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。
|
|
|
, treepid: ''//父级id字段名称
|
|
|
, iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer
|
|
|
},
|
|
|
tree: {
|
|
|
iconIndex: 1
|
|
|
},
|
|
|
page: false,
|
|
|
limit: 9999,
|
|
|
autoColumnWidth: false,
|
|
|
cols: [cols]
|
|
|
, height: 'full-220',
|
|
|
done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
common.treeTableDragCols('#biz_virtual_platform_treeTable', '#bizTreeList-top-head-info-tpl');
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'tree', res.obj);
|
|
|
// 保存列顺序
|
|
|
$('#biz_virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function () {
|
|
|
common.saveTableCols({
|
|
|
domId: 'bizTableTreeVirtual',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizTableTreeVirtual.config.cols
|
|
|
});
|
|
|
});
|
|
|
commonCols.colsClickEvent();
|
|
|
resTopo();
|
|
|
// vmware 隐藏统计信息
|
|
|
$('#biz_virtual_platform_treeTable').next().find('.layui-table-tool').hide();
|
|
|
}
|
|
|
} else {
|
|
|
console.log(res.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function (){
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + resType
|
|
|
, data: {
|
|
|
ptId: $("#biz_virtual_platForm_select").val(),
|
|
|
health: $("#biz_treetable_resStatus").val(),
|
|
|
busId: busId,
|
|
|
keyWords: $("#biz_treetable_keyword").val(),
|
|
|
state: $("#biz_treetable_res_state").val()
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
if (res.code == 0) {
|
|
|
var bizTableTreeVirtual;
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'bizTableTreeVirtual',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
});
|
|
|
/*bizTableTreeVirtual.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
|
|
|
bizTableTreeVirtual = table.render({
|
|
|
elem: '#biz_virtual_platform_treeTable',
|
|
|
data: res.data,
|
|
|
treeConfig: { //表格树所需配置
|
|
|
showField: 'resName' //表格树显示的字段
|
|
|
, treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。
|
|
|
, treepid: ''//父级id字段名称
|
|
|
, iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer
|
|
|
},
|
|
|
tree: {
|
|
|
iconIndex: 1
|
|
|
},
|
|
|
page: false,
|
|
|
limit: 9999,
|
|
|
autoColumnWidth: false,
|
|
|
cols: [cols]
|
|
|
, height: 'full-220',
|
|
|
done: function (res) {
|
|
|
soulTable.render(this);
|
|
|
common.treeTableDragCols('#biz_virtual_platform_treeTable', '#bizTreeList-top-head-info-tpl');
|
|
|
bizLoadRightResTypeSelectEvent(busId, resType, 'tree', res.obj);
|
|
|
// 保存列顺序
|
|
|
$('#biz_virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function () {
|
|
|
common.saveTableCols({
|
|
|
domId: 'bizTableTreeVirtual',
|
|
|
moduleId: 'bizIndex',
|
|
|
resType: resType,
|
|
|
cols: bizTableTreeVirtual.config.cols
|
|
|
});
|
|
|
});
|
|
|
commonCols.colsClickEvent();
|
|
|
resTopo();
|
|
|
// vmware 隐藏统计信息
|
|
|
$('#biz_virtual_platform_treeTable').next().find('.layui-table-tool').hide();
|
|
|
}
|
|
|
if(event === 'loadChildren'){
|
|
|
$.ajax({
|
|
|
url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
|
|
|
, type: "get"
|
|
|
, data: {
|
|
|
ptId: $("#biz_virtual_platForm_select").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
busId: busId,
|
|
|
keyWords: $("#biz_treetable_keyword").val(),
|
|
|
state: $("#biz_treetable_state").val(),
|
|
|
access_token:accessToken,
|
|
|
parentId:data.resId
|
|
|
}
|
|
|
, success: function (res) {
|
|
|
if (res.data.length > 0) {
|
|
|
obj.loadChildren(res.data);
|
|
|
commonCols.colsClickEvent();
|
|
|
});
|
|
|
/*bizTableTreeVirtual.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: $("#biz_virtual_platForm_select").val(),
|
|
|
health: $("#treetable_resStatus").val(),
|
|
|
busId: busId,
|
|
|
keyWords: $("#biz_treetable_keyword").val(),
|
|
|
state: $("#biz_treetable_state").val(),
|
|
|
access_token:accessToken,
|
|
|
parentId:data.resId
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
, success: function (res) {
|
|
|
if (res.data.length > 0) {
|
|
|
obj.loadChildren(res.data);
|
|
|
commonCols.colsClickEvent();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});*/
|
|
|
//统计总数
|
|
|
// $('#biz_virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#biz-treetable-countTpl').html()).render(res.data.length));
|
|
|
});*/
|
|
|
//统计总数
|
|
|
// $('#biz_virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#biz-treetable-countTpl').html()).render(res.data.length));
|
|
|
});
|
|
|
} else {
|
|
|
console.log(data.msg);
|
|
|
}
|
|
|
layer.closeAll();
|
|
|
//关键字回车事件
|
|
|
$('#biz_treetable_keyword').keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id)
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
console.log(data.msg);
|
|
|
}
|
|
|
layer.closeAll();
|
|
|
//关键字回车事件
|
|
|
$('#biz_treetable_keyword').keydown(function (e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id)
|
|
|
//lsq 业务视图页增加搜索按钮 2022-06-27
|
|
|
$('#searchBizTreeTable').unbind('click').on('click', function () {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
//lsq 业务视图页增加搜索按钮 2022-06-27
|
|
|
$('#searchBizTreeTable').unbind('click').on('click', function () {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
return false;
|
|
|
})
|
|
|
//选择资源状态
|
|
|
form.on('select(biz_treetable_resStatus)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//选择业务
|
|
|
form.on('select(treetableBizTypes)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//选择业务
|
|
|
form.on('select(biz_treetable_res_state)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
})
|
|
|
//选择资源状态
|
|
|
form.on('select(biz_treetable_resStatus)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//选择业务
|
|
|
form.on('select(treetableBizTypes)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//选择业务
|
|
|
form.on('select(biz_treetable_res_state)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
|
|
|
//选择平台
|
|
|
form.on('select(biz_virtual_platForm_select)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//资源连接状态选择时间
|
|
|
form.on('select(biz_treetable_state)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.closeAll();
|
|
|
});
|
|
|
//选择平台
|
|
|
form.on('select(biz_virtual_platForm_select)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
//资源连接状态选择时间
|
|
|
form.on('select(biz_treetable_state)', function (data) {
|
|
|
renderTreeTable(busId, curTreeNode.data.id);
|
|
|
});
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.closeAll();
|
|
|
});
|
|
|
},300)
|
|
|
}
|
|
|
|
|
|
//获取资源统计
|
...
|
...
|
|