2025-05-08 08:23:03 +00:00
|
|
|
<template>
|
2025-07-04 09:42:12 +00:00
|
|
|
<LayoutContainer showCollapse class="tool-manage">
|
2025-05-08 08:23:03 +00:00
|
|
|
<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-26 12:25:24 +00:00
|
|
|
:source="SourceTypeEnum.TOOL"
|
2025-05-12 10:19:28 +00:00
|
|
|
:data="folderList"
|
2025-06-30 07:43:23 +00:00
|
|
|
:currentNodeKey="folder.currentFolder?.id"
|
2025-06-30 08:33:49 +00:00
|
|
|
@handleNodeClick="folderClickHandle"
|
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-07-04 09:42:12 +00:00
|
|
|
<ToolListContainer>
|
2025-06-24 06:49:09 +00:00
|
|
|
<template #header>
|
2025-06-30 08:33:49 +00:00
|
|
|
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandle" />
|
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-26 12:25:24 +00:00
|
|
|
import { SourceTypeEnum } 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-08 08:23:03 +00:00
|
|
|
|
2025-06-19 09:10:39 +00:00
|
|
|
function getFolder(bool?: boolean) {
|
|
|
|
|
const params = {}
|
2025-06-26 12:25:24 +00:00
|
|
|
folder.asyncGetFolder(SourceTypeEnum.TOOL, params, loading).then((res: any) => {
|
2025-06-19 09:10:39 +00:00
|
|
|
folderList.value = res.data
|
|
|
|
|
if (bool) {
|
|
|
|
|
// 初始化刷新
|
2025-06-30 07:43:23 +00:00
|
|
|
folder.setCurrentFolder(res.data?.[0] || {})
|
2025-06-19 09:10:39 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-30 08:33:49 +00:00
|
|
|
function folderClickHandle(row: any) {
|
2025-06-30 07:43:23 +00:00
|
|
|
folder.setCurrentFolder(row)
|
2025-06-24 06:49:09 +00:00
|
|
|
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>
|