From 31f8435d391338d19cf4bc994f972d4c3f3dacbf Mon Sep 17 00:00:00 2001 From: Gary Fu Date: Mon, 1 Jan 2024 19:25:36 +0800 Subject: [PATCH] =?UTF-8?q?tab=E4=BC=98=E5=8C=96=EF=BC=8C=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common-table/index.vue | 7 ++++++- src/stores/TabsViewStore.js | 8 +++++++- src/views/tools/Tables.vue | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/common-table/index.vue b/src/components/common-table/index.vue index 986190f..7882cc4 100644 --- a/src/components/common-table/index.vue +++ b/src/components/common-table/index.vue @@ -56,6 +56,10 @@ const props = defineProps({ type: String, default: 'small' }, + buttonsColumnAttrs: { + type: Object, + default: null + }, pageInfo: { type: Object, default: null @@ -78,7 +82,8 @@ const calcColumns = computed(() => { labelKey: 'common.label.operation', isOperation: true, slot: props.buttonsSlot, - buttons: props.buttons + buttons: props.buttons, + attrs: props.buttonsColumnAttrs } _columns = [..._columns, buttonColumn] } diff --git a/src/stores/TabsViewStore.js b/src/stores/TabsViewStore.js index e31bbad..c4408c1 100644 --- a/src/stores/TabsViewStore.js +++ b/src/stores/TabsViewStore.js @@ -45,12 +45,18 @@ export const useTabsViewStore = defineStore('tabsView', () => { return historyTab.meta && historyTab.meta.replaceTabHistory && historyTab.meta.replaceTabHistory === tab.name } + const isSameReplaceHistory = (historyTab, tab) => { + return historyTab.meta && historyTab.meta.replaceTabHistory && tab.meta && tab.meta.replaceTabHistory && + historyTab.meta.replaceTabHistory === tab.meta.replaceTabHistory + } + const addHistoryTab = (tab) => { // 添加tab if (isTabMode.value) { const idx = historyTabs.value.findIndex(v => v.path === tab.path) if (idx < 0) { - const replaceIdx = historyTabs.value.findIndex(v => checkMataReplaceHistory(v, tab) || checkMataReplaceHistory(tab, v)) + const replaceIdx = historyTabs.value.findIndex(v => checkMataReplaceHistory(v, tab) || + checkMataReplaceHistory(tab, v) || isSameReplaceHistory(v, tab)) if (replaceIdx > -1) { console.info(replaceIdx, historyTabs.value[replaceIdx]) if (replaceIdx !== undefined) { diff --git a/src/views/tools/Tables.vue b/src/views/tools/Tables.vue index 4101233..af2abc1 100644 --- a/src/views/tools/Tables.vue +++ b/src/views/tools/Tables.vue @@ -72,6 +72,7 @@ const buttons = ref([{ :columns="columns" :buttons="buttons" buttons-slot="buttons" + :buttons-column-attrs="{width:'300px'}" >