diff --git a/core/core-frontend/src/views/workbranch/ShortcutTable.vue b/core/core-frontend/src/views/workbranch/ShortcutTable.vue index 1c34c1470c..ff78594e24 100644 --- a/core/core-frontend/src/views/workbranch/ShortcutTable.vue +++ b/core/core-frontend/src/views/workbranch/ShortcutTable.vue @@ -10,7 +10,7 @@ import dvDashboardSpineMobile from '@/assets/svg/dv-dashboard-spine-mobile.svg' import icon_pc_outlined from '@/assets/svg/icon_pc_outlined.svg' import icon_cancel_store from '@/assets/svg/icon_cancel_store.svg' import { useI18n } from '@/hooks/web/useI18n' -import { ref, reactive, onMounted, computed } from 'vue' +import { ref, reactive, onMounted, computed, watch } from 'vue' import type { TabsPaneContext } from 'element-plus-secondary' import GridTable from '@/components/grid-table/src/GridTable.vue' import { useRouter } from 'vue-router' @@ -34,6 +34,7 @@ const appStore = useAppStoreWithOut() const embeddedStore = useEmbedded() import { useShareStoreWithOut } from '@/store/modules/share' +import { cloneDeep } from 'lodash-es' const shareStore = useShareStoreWithOut() const { push } = useRouter() defineProps({ @@ -89,8 +90,8 @@ const getBusiListWithPermission = () => { busiFlagList.push(baseFlagList[parseInt(key)]) } } - tablePaneList.value[0].disabled = !busiFlagList?.length - tablePaneList.value[1].disabled = + baseTablePaneList.value[0].disabled = !busiFlagList?.length + baseTablePaneList.value[1].disabled = !busiFlagList.includes('panel') && !busiFlagList.includes('screen') return busiFlagList } @@ -141,17 +142,40 @@ const loadTableData = () => { }) } -const tablePaneList = ref([ +const baseTablePaneList = ref([ { title: t('work_branch.recently_used'), name: 'recent', disabled: false }, { title: t('work_branch.my_collection'), name: 'store', disabled: false }, { title: t('visualization.share_out'), name: 'share', disabled: false } ]) +const dfTablePaneList = ref([]) + const loadedDataFilling = data => { - tablePaneList.value.push(data) + dfTablePaneList.value.push(data) } const busiAuthList = getBusiListWithPermission() + +const tablePaneList = computed(() => { + const list = cloneDeep(!!busiAuthList.length ? baseTablePaneList.value : []) + for (const valueElement of dfTablePaneList.value) { + list.push(valueElement) + } + return list +}) + +const firstChangeActiveName = ref(false) + +watch( + () => tablePaneList.value.length, + (v1, v2) => { + if (tablePaneList.value.length > 0 && !firstChangeActiveName.value) { + firstChangeActiveName.value = true + activeName.value = tablePaneList.value[0].name + } + } +) + onMounted(() => { !!busiAuthList.length && handleClick({ @@ -251,7 +275,7 @@ const getEmptyDesc = (): string => {