SQL工作台:完善复用当前选项卡功能,现在会记住设置的选项卡,而不是仅当前激活的选项卡

This commit is contained in:
datagear 2019-04-28 13:00:37 +08:00
parent 1a64c67397
commit 109f5f7e4b
1 changed files with 24 additions and 14 deletions

View File

@ -462,18 +462,9 @@ Schema schema 数据库不允许为null
}
else if(msgData.sqlResultType == "RESULT_SET")
{
var tabId = null;
var tabId = po.element("#lockSqlResultTabButton").attr("lock-tab-id");
if(po.element("#lockSqlResultTabButton").hasClass("ui-state-active"))
{
var tabsNav = po.getTabsNav(po.sqlResultTabs);
var activeTab = po.getActiveTab(po.sqlResultTabs, tabsNav);
if(activeTab.hasClass("sql-result-tab"))
tabId = po.getTabsTabId(po.sqlResultTabs, tabsNav, activeTab);
}
if(tabId == null)
if(!tabId)
tabId = po.genSqlResultTabId();
po.renderSqlResultTab(tabId, msgData.sqlStatement.sql, msgData.modelSqlResult, (po.executingSqlCount == 1));
@ -1121,18 +1112,29 @@ Schema schema 数据库不允许为null
activeTabForm.submit();
});
po.element("#lockSqlResultTabButton").click(function()
{
var $this = $(this);
var tabsNav = po.getTabsNav(po.sqlResultTabs);
if($this.hasClass("ui-state-active"))
{
$(this).removeClass("ui-state-active");
$this.removeAttr("lock-tab-id");
$this.removeClass("ui-state-active");
}
else
{
$(this).addClass("ui-state-active");
var activeTab = po.getActiveTab(po.sqlResultTabs, tabsNav);
if(activeTab.hasClass("sql-result-tab"))
{
var tabId = po.getTabsTabId(po.sqlResultTabs, tabsNav, activeTab);
$this.attr("lock-tab-id", tabId);
$this.addClass("ui-state-active");
}
}
});
@ -1191,6 +1193,14 @@ Schema schema 数据库不允许为null
{
$(".result-message-buttons", resultOperations).hide();
$(".sql-result-buttons", resultOperations).show();
var lockSqlResultTabButton = po.element("#lockSqlResultTabButton");
var newTabId = po.getTabsTabId($this, tabsNav, newTab);
if(newTabId == lockSqlResultTabButton.attr("lock-tab-id"))
lockSqlResultTabButton.addClass("ui-state-active");
else
lockSqlResultTabButton.removeClass("ui-state-active");
}
else if(newTab.hasClass("result-message-tab"))
{