diff --git a/admin/view/template/db.detail.html b/admin/view/template/db.detail.html index e7f67999..2c865b0a 100644 --- a/admin/view/template/db.detail.html +++ b/admin/view/template/db.detail.html @@ -493,6 +493,7 @@ return false; } setTableName(TableName); + UpdateWebUri(SchemaName,TableName); $("#TableListContair a").removeClass("active"); $("#"+key).parent("a").addClass("active"); ChangeTableFlowBtnHref(SchemaName,TableName); @@ -657,7 +658,7 @@ $("#TableFieldsContair").html(html); } - function showSchemaTableList(id){ + function showSchemaTableList(id,initTableName){ $("#DatabaseListContair a").removeClass("active"); $("#"+id).addClass("active"); var SchemaName = $("#"+id).find("h3").text(); @@ -666,8 +667,9 @@ setSchemaName(SchemaName); $("#tableToServerListContair").attr("DbName",DbName); $("#tableToServerListContair").attr("schema",SchemaName); - var showTableList = function(data){ + var showTableList = function(data,initTableName){ $("#TableListContair").html(""); + var initTableNameCanGetTableToServerList = false $.each(data,function(index,v) { var html = ""; var title = ""; @@ -700,6 +702,9 @@ if (v.AddStatus == false){ html+= '
'; }else{ + if( initTableName == v.TableName ) { + initTableNameCanGetTableToServerList = true + } html+= '
'; } html += "
"; @@ -707,17 +712,20 @@ html += ''; $("#TableListContair").append(html); }); + if(initTableNameCanGetTableToServerList && initTableName !="" && initTableName != null && initTableName != undefined) { + GetTableToServerList(SchemaName,initTableName); + } } if (!DataBaseMap.has(SchemaName) || DataBaseMap.get(SchemaName) == undefined){ var callback = function (data) { DataBaseMap.set(SchemaName,data); - showTableList(data); + showTableList(data,initTableName); }; var ajaxParam = {DbName:DbName,SchemaName:SchemaName}; Ajax("GET",url, ajaxParam,callback,true); }else{ - showTableList(DataBaseMap.get(SchemaName)); + showTableList(DataBaseMap.get(SchemaName),initTableName); } showBatchDelOrAddBtn(); } @@ -1022,6 +1030,37 @@ } }); + function InitSchemaAndTableSelect() { + var urlParams = new URLSearchParams(window.location.search); + var schema= urlParams.get("schema"); + var table= urlParams.get("TableName"); + if(schema == "" || schema ==null || schema == undefined){ + // 全量任务和表同步列表提交过来的url这个字段不一样,这里只在这里修改,后续再统一 + schema=urlParams.get("SchemaName"); + } + if(schema == "" || schema ==null || schema == undefined){ + return + } + if(schema=="*"){ + schema = "AllDataBases"; + } + if(table=="*"){ + table = "AllTables"; + } + $("#DatabaseListContair h3:contains('"+schema+"')").each(function(){ + showSchemaTableList($(this).closest("a").attr("id"),table) + }); + } + function UpdateWebUri(SchemaName,TableName) { + if(SchemaName=="AllDataBases"){ + SchemaName = "%2a"; + } + if(TableName=="AllTables"){ + TableName = "%2a"; + } + window.history.replaceState(null, null, '?DbName='+getDbName()+"&SchemaName="+SchemaName+"&TableName="+TableName); + } + InitSchemaAndTableSelect(); {{template "db.detail.table.add" .}}