This commit is contained in:
Mr Chen 2024-02-03 04:44:06 +08:00
parent b1e8839ace
commit 04568df3df
3 changed files with 23 additions and 10 deletions

View File

@ -37,4 +37,12 @@
#mongodb_search xm-select .xm-label .xm-label-block{
height: 20px;
line-height: 20px;
}
#mongodb td:last-child, th:last-child {
width: 44px;
position:sticky;
right:0; /* 首行永远固定在左侧 */
z-index:1;
background-color:white;
}

View File

@ -16,6 +16,7 @@
</div>
<!-- mongodb start -->
<!-- show w-full -->
<div class="tab-con show w-full" id="mongodb" style="padding: 0px;">
<div class="tootls_group tootls_top">
<div class="pull-left">

View File

@ -152,7 +152,13 @@ function mongodbGetDbName(){
var mogodb_db_list;
function mongodbCollectionName(){
return mogodb_db_list.getValue('value')[0];
// console.log(mogodb_db_list);
var v = mogodb_db_list.getValue('value');
if (v.length == 0){
console.log($('#mongodb').data('collection'));
return $('#mongodb').data('collection');
}
return v[0];
}
function mongodbGetList(){
@ -214,6 +220,7 @@ function mongodbGetCollections(name){
//isAdd, 此次操作是新增还是删除
var isAdd = data.isAdd;
if (isAdd){
$('#mongodb').data('collection',change[0].value);
mongodbDataList(1);
}
},
@ -243,7 +250,7 @@ function mongodbDataList(p){
var sid = mongodbGetSid();
var db = mongodbGetDbName();
var collection = mongodbCollectionName();
console.log({'sid':sid,'db':db,'collection':collection,"p":p});
// console.log({'sid':sid,'db':db,'collection':collection,"p":p});
mgdbPostCB('get_data_list',{'sid':sid,'db':db,'collection':collection,"p":p} ,function(rdata){
if (rdata.data.status){
var data = rdata.data.data;
@ -257,7 +264,7 @@ function mongodbDataList(p){
for (var i =0 ; i<fields.length ; i++) {
header_field += '<th>'+fields[i]+'</th>';
}
header_field += '<th width="200" class="text-right">操作</th>';
header_field += '<th class="text-right">操作</th>';
$('.mongodb_table thead tr').html(header_field);
@ -278,8 +285,7 @@ function mongodbDataList(p){
}
}
tbody += '<td style="width:200px;text-align:right;">\
<a href="javascript:;" data-index="'+i+'" class="btlink edit" title="编辑">编辑</a> | \
tbody += '<td style="text-align:right;">\
<a href="javascript:;" data-index="'+i+'" class="btlink" title="删除">删除</a>\
</td>';
@ -287,8 +293,8 @@ function mongodbDataList(p){
}
// console.log($(window).width()-230);
$('#mongodb_table').css('width', $(window).width()+80).parent().css('width', $(window).width()-240).css('overflow','scroll');
$('#mongodb').css('width',$(window).width()-240).css('overflow','hidden');
$('#mongodb_table').css('width', $(document).width()+240).parent().css('width', $(document).width()-240).css('overflow','scroll');
$('#mongodb').css('width',$(document).width()-240).css('overflow','hidden');
$('.mongodb_table tbody').html(tbody);
$('.mongodb_list_page').html(data.page);
}
@ -360,15 +366,13 @@ function redisGetKeyList(page,search = ''){
tbody += '<td>'+data[i].type+'</td>';
tbody += '<td>'+data[i].len+'</td>';
if (data[i].endtime == -1){
tbody += '<td>永久</td>';
} else {
tbody += '<td>'+data[i].endtime+'</td>';
}
tbody += '<td style="text-align:right; color:#bbb">\
tbody += '<td style="width:200px;text-align:right; color:#bbb">\
<a href="javascript:;" data-index="'+i+'" class="btlink edit" title="编辑">编辑</a> | \
<a href="javascript:;" class="btlink" onclick="redisDeleteKey(\''+data[i].name+'\')">删除</a>\
</td>';