fix: 修复breadcrumb未刷新列表问题

fix: 修复breadcrumb未刷新列表问题
This commit is contained in:
wangdan-fit2cloud 2024-07-01 02:47:21 -07:00 committed by GitHub
commit a6bcceb716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 13 deletions

View File

@ -112,7 +112,7 @@
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div>
<CreateApplicationDialog ref="CreateApplicationDialogRef" /> <CreateApplicationDialog ref="CreateApplicationDialogRef" @refresh="refresh" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -127,7 +127,7 @@ const router = useRouter()
const { const {
meta: { activeMenu }, meta: { activeMenu },
params: { id } params: { id }
} = route } = route as any
onBeforeRouteLeave((to, from) => { onBeforeRouteLeave((to, from) => {
common.saveBreadcrumb(null) common.saveBreadcrumb(null)
@ -140,19 +140,14 @@ const loading = ref(false)
const breadcrumbData = computed(() => common.breadcrumb) const breadcrumbData = computed(() => common.breadcrumb)
const current = computed(() => { const current = computed(() => {
const {
params: { id }
} = route
return list.value?.filter((v) => v.id === id)?.[0] return list.value?.filter((v) => v.id === id)?.[0]
}) })
const isApplication = computed(() => { const isApplication = computed(() => {
const { meta } = route as any return activeMenu.includes('application')
return meta?.activeMenu.includes('application')
}) })
const isDataset = computed(() => { const isDataset = computed(() => {
const { meta } = route as any return activeMenu.includes('dataset')
return meta?.activeMenu.includes('dataset')
}) })
function openCreateDialog() { function openCreateDialog() {
@ -207,6 +202,12 @@ function getApplication() {
loading.value = false loading.value = false
}) })
} }
function refresh() {
if (isApplication.value) {
common.saveBreadcrumb(null)
getApplication()
}
}
onMounted(() => { onMounted(() => {
if (!breadcrumbData.value) { if (!breadcrumbData.value) {
if (isDataset.value) { if (isDataset.value) {

View File

@ -198,6 +198,7 @@ import emptyImg from '@/assets/hit-test-empty.png'
const route = useRoute() const route = useRoute()
const { const {
meta: { activeMenu },
params: { id } params: { id }
} = route as any } = route as any
@ -223,12 +224,10 @@ const questionTitle = ref('')
const isDisabledChart = computed(() => !inputValue.value) const isDisabledChart = computed(() => !inputValue.value)
const isApplication = computed(() => { const isApplication = computed(() => {
const { meta } = route as any return activeMenu.includes('application')
return meta?.activeMenu.includes('application')
}) })
const isDataset = computed(() => { const isDataset = computed(() => {
const { meta } = route as any return activeMenu.includes('dataset')
return meta?.activeMenu.includes('dataset')
}) })
function changeHandle(val: string) { function changeHandle(val: string) {