2025-05-08 08:23:03 +00:00
|
|
|
<template>
|
|
|
|
|
<LayoutContainer class="tool-manage">
|
|
|
|
|
<template #left>
|
2025-06-26 09:00:11 +00:00
|
|
|
<h4 class="p-12-16 pb-0 mt-12">{{ $t('views.tool.title') }}</h4>
|
2025-05-12 10:19:28 +00:00
|
|
|
<folder-tree
|
2025-06-19 03:46:52 +00:00
|
|
|
:source="FolderSource.TOOL"
|
2025-05-12 10:19:28 +00:00
|
|
|
:data="folderList"
|
|
|
|
|
:currentNodeKey="currentFolder?.id"
|
|
|
|
|
@handleNodeClick="folderClickHandel"
|
2025-06-20 19:14:59 +00:00
|
|
|
@refreshTree="refreshFolder"
|
2025-06-25 13:58:01 +00:00
|
|
|
:shareTitle="$t('views.shared.shared_tool')"
|
2025-06-23 07:52:03 +00:00
|
|
|
:showShared="permissionPrecise['is_share']()"
|
2025-05-15 02:25:05 +00:00
|
|
|
class="p-8"
|
2025-05-12 10:19:28 +00:00
|
|
|
/>
|
2025-05-08 08:23:03 +00:00
|
|
|
</template>
|
2025-06-24 06:49:09 +00:00
|
|
|
<ToolListContainer>
|
|
|
|
|
<template #header>
|
|
|
|
|
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandel" />
|
2025-05-15 02:25:05 +00:00
|
|
|
</template>
|
2025-06-24 06:49:09 +00:00
|
|
|
</ToolListContainer>
|
2025-05-08 08:23:03 +00:00
|
|
|
</LayoutContainer>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2025-06-09 13:27:12 +00:00
|
|
|
import { onMounted, ref, reactive, computed } from 'vue'
|
2025-06-24 06:49:09 +00:00
|
|
|
import ToolListContainer from '@/views/tool/component/ToolListContainer.vue'
|
2025-06-19 03:46:52 +00:00
|
|
|
import { FolderSource } from '@/enums/common'
|
2025-06-23 07:52:03 +00:00
|
|
|
import permissionMap from '@/permission'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
2025-06-24 06:49:09 +00:00
|
|
|
import useStore from '@/stores'
|
2025-06-23 07:52:03 +00:00
|
|
|
const route = useRoute()
|
2025-06-24 06:49:09 +00:00
|
|
|
const { folder, tool } = useStore()
|
2025-05-15 02:25:05 +00:00
|
|
|
|
2025-06-24 14:12:17 +00:00
|
|
|
const apiType = computed(() => {
|
2025-06-23 07:52:03 +00:00
|
|
|
if (route.path.includes('shared')) {
|
|
|
|
|
return 'systemShare'
|
|
|
|
|
} else if (route.path.includes('resource-management')) {
|
|
|
|
|
return 'systemManage'
|
|
|
|
|
} else {
|
|
|
|
|
return 'workspace'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const permissionPrecise = computed(() => {
|
2025-06-24 14:12:17 +00:00
|
|
|
return permissionMap['tool'][apiType.value]
|
2025-06-23 07:52:03 +00:00
|
|
|
})
|
|
|
|
|
|
2025-05-08 08:23:03 +00:00
|
|
|
const loading = ref(false)
|
2025-05-12 10:28:58 +00:00
|
|
|
|
2025-05-09 06:42:51 +00:00
|
|
|
const folderList = ref<any[]>([])
|
2025-05-12 10:19:28 +00:00
|
|
|
const currentFolder = ref<any>({})
|
2025-05-08 08:23:03 +00:00
|
|
|
|
2025-06-19 09:10:39 +00:00
|
|
|
function getFolder(bool?: boolean) {
|
|
|
|
|
const params = {}
|
|
|
|
|
folder.asyncGetFolder(FolderSource.TOOL, params, loading).then((res: any) => {
|
|
|
|
|
folderList.value = res.data
|
|
|
|
|
if (bool) {
|
|
|
|
|
// 初始化刷新
|
|
|
|
|
currentFolder.value = res.data?.[0] || {}
|
2025-06-24 06:49:09 +00:00
|
|
|
folder.setCurrentFolder(currentFolder.value)
|
2025-06-19 09:10:39 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function folderClickHandel(row: any) {
|
|
|
|
|
currentFolder.value = row
|
2025-06-24 06:49:09 +00:00
|
|
|
folder.setCurrentFolder(currentFolder.value)
|
|
|
|
|
tool.setToolList([])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshFolder() {
|
|
|
|
|
getFolder()
|
2025-06-19 09:10:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getFolder(true)
|
2025-05-08 08:23:03 +00:00
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|