@@ -80,25 +80,19 @@ import { ref, watch, reactive, computed } from 'vue'
8080import { useRoute } from ' vue-router'
8181import type { FormInstance , FormRules } from ' element-plus'
8282import { loadSharedApi } from ' @/utils/dynamics-api/shared-api'
83+ import useStore from ' @/stores'
8384import { t } from ' @/locales'
84- import useStore from " @/stores" ;
8585
86+ const props = defineProps <{
87+ apiType: ' systemShare' | ' workspace' | ' systemManage'
88+ }>()
8689const route = useRoute ()
8790const {
8891 params : { id, documentId }, // id为knowledgeID
8992} = route as any
9093
9194const { user } = useStore ()
9295
93- const apiType = computed (() => {
94- if (route .path .includes (' shared' )) {
95- return ' systemShare'
96- } else if (route .path .includes (' resource-management' )) {
97- return ' systemManage'
98- } else {
99- return ' workspace'
100- }
101- })
10296const emit = defineEmits ([' refresh' ])
10397const formRef = ref ()
10498
@@ -138,7 +132,8 @@ watch(dialogVisible, (bool) => {
138132const defaultProps = {
139133 children: ' children' ,
140134 label: ' name' ,
141- isLeaf : (data : any ) => data .resource_type && data .resource_type !== ' folder' ,
135+ isLeaf : (data : any ) =>
136+ data .resource_type ? data .resource_type !== ' folder' : data .workspace_id === ' None' ,
142137 disabled : (data : any , node : any ) => {
143138 return data .id === id
144139 },
@@ -147,8 +142,8 @@ const defaultProps = {
147142const loadTree = (node : any , resolve : any ) => {
148143 if (node .isLeaf ) return resolve ([])
149144 const folder_id = node .level === 0 ? user .getWorkspaceId () : node .data .id
150- loadSharedApi ({ type: ' knowledge' , systemType: apiType . value })
151- .getKnowledgeList ({folder_id: folder_id }, optionLoading )
145+ loadSharedApi ({ type: ' knowledge' , systemType: props . apiType })
146+ .getKnowledgeList ({ folder_id: folder_id }, optionLoading )
152147 .then ((res : any ) => {
153148 resolve (res .data )
154149 })
@@ -160,7 +155,7 @@ function changeKnowledge(id: string) {
160155}
161156
162157function getDocument(id : string ) {
163- loadSharedApi ({ type: ' document' , systemType: apiType . value })
158+ loadSharedApi ({ type: ' document' , systemType: props . apiType })
164159 .getDocumentList (id , optionLoading )
165160 .then ((res : any ) => {
166161 documentList .value = res .data ?.filter ((v : any ) => v .id !== documentId )
@@ -179,7 +174,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
179174 const obj = {
180175 id_list: paragraphList .value ,
181176 }
182- loadSharedApi ({ type: ' paragraph' , systemType: apiType . value })
177+ loadSharedApi ({ type: ' paragraph' , systemType: props . apiType })
183178 .putMigrateMulParagraph (
184179 id ,
185180 documentId ,
0 commit comments