feat: update folder retrieval to include id and refactor folder path handling
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
CaptainB 2025-12-09 19:45:00 +08:00
parent 7b9fae5d24
commit a23f34b224
5 changed files with 24 additions and 17 deletions

View File

@ -6,7 +6,17 @@ import { type Ref } from 'vue'
const prefix = '/system/resource/application'
/**
*
* @param param
* @param loading
*/
const getAllApplication: (param?: any, loading?: Ref<boolean>) => Promise<Result<any[]>> = (
param,
loading,
) => {
return get(`${prefix}`, param, loading)
}
/**
*
* param {
@ -314,6 +324,7 @@ const getMcpTools: (application_id: string, loading?: Ref<boolean>) => Promise<R
}
export default {
getAllApplication,
getApplication,
putApplication,
delApplication,

View File

@ -2,14 +2,8 @@ import { Result } from '@/request/Result'
import { get, post, del, put } from '@/request/index'
import { type Ref } from 'vue'
import useStore from '@/stores'
const prefix: any = { _value: '/workspace/' }
Object.defineProperty(prefix, 'value', {
get: function () {
const { user } = useStore()
return this._value + user.getWorkspaceId()
},
})
const prefix = '/system/resource'
/**
*
@ -22,7 +16,7 @@ const getFolder: (
data?: any,
loading?: Ref<boolean>,
) => Promise<Result<Array<any>>> = (source, data, loading) => {
return get(`${prefix.value}/${source}/folder`, data, loading)
return get(`${prefix}/${source}/folder`, data, loading)
}

View File

@ -153,7 +153,9 @@ const props = defineProps({
const emit = defineEmits(['clickNodes', 'onmousedown'])
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
if (route.path.includes('shared')) {
return 'systemShare'
} else if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
@ -247,7 +249,7 @@ const toolTreeData = ref<any[]>([])
const toolList = ref<any[]>([])
async function getToolFolder() {
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
toolTreeData.value = res.data
folder.setCurrentFolder(res.data?.[0] || {})
}
@ -256,7 +258,7 @@ async function getToolList() {
const res = await loadSharedApi({
type: 'tool',
isShared: folder.currentFolder?.id === 'share',
systemType: 'workspace',
systemType: apiType.value,
}).getToolList({
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
tool_type: 'CUSTOM',
@ -269,7 +271,7 @@ const applicationTreeData = ref<any[]>([])
const applicationList = ref<any[]>([])
function getApplicationFolder() {
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {}, apiType.value, loading).then((res: any) => {
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {id: props.id}, apiType.value, loading).then((res: any) => {
applicationTreeData.value = res.data
folder.setCurrentFolder(res.data?.[0] || {})
})
@ -278,7 +280,7 @@ function getApplicationFolder() {
async function getApplicationList() {
const res = await loadSharedApi({
type: 'application',
systemType: 'workspace',
systemType: apiType.value,
}).getAllApplication({
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
})

View File

@ -210,7 +210,7 @@ const toolTreeData = ref<any[]>([])
const toolList = ref<any[]>([])
async function getToolFolder() {
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
toolTreeData.value = res.data
folder.setCurrentFolder(res.data?.[0] || {})
}

View File

@ -230,7 +230,7 @@ const toolTreeData = ref<any[]>([])
const toolList = ref<any[]>([])
async function getToolFolder() {
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
toolTreeData.value = res.data
folder.setCurrentFolder(res.data?.[0] || {})
}