Skip to content

Commit cc20e20

Browse files
feat: bugs
1 parent 0eeb79a commit cc20e20

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

ui/src/views/document/component/SelectKnowledgeDialog.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import { ref, watch, computed } from 'vue'
6060
import { useRoute } from 'vue-router'
6161
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
62-
import useStore from "@/stores";
62+
import useStore from '@/stores'
6363
const route = useRoute()
6464
const {
6565
params: { id }, // id为knowledgeID
@@ -90,18 +90,18 @@ const form = ref<any>({
9090
const defaultProps = {
9191
children: 'children',
9292
label: 'name',
93-
isLeaf: (data: any) => data.resource_type && data.resource_type !== 'folder',
93+
isLeaf: (data: any) =>
94+
data.resource_type ? data.resource_type !== 'folder' : data.workspace_id === 'None',
9495
disabled: (data: any, node: any) => {
9596
return data.id === id
9697
},
9798
}
9899
99100
const loadTree = (node: any, resolve: any) => {
100-
console.log(node)
101101
if (node.isLeaf) return resolve([])
102102
const folder_id = node.level === 0 ? user.getWorkspaceId() : node.data.id
103103
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
104-
.getKnowledgeList({folder_id: folder_id}, loading)
104+
.getKnowledgeList({ folder_id: folder_id }, loading)
105105
.then((res: any) => {
106106
resolve(res.data)
107107
})

ui/src/views/paragraph/component/ParagraphCard.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
@refresh="refresh"
7373
:apiType="apiType"
7474
/>
75-
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
75+
<SelectDocumentDialog
76+
ref="SelectDocumentDialogRef"
77+
@refresh="refreshMigrateParagraph"
78+
:apiType="apiType"
79+
/>
7680
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
7781
</el-card>
7882
</template>

ui/src/views/paragraph/component/SelectDocumentDialog.vue

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,25 +80,19 @@ import { ref, watch, reactive, computed } from 'vue'
8080
import { useRoute } from 'vue-router'
8181
import type { FormInstance, FormRules } from 'element-plus'
8282
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
83+
import useStore from '@/stores'
8384
import { t } from '@/locales'
84-
import useStore from "@/stores";
8585
86+
const props = defineProps<{
87+
apiType: 'systemShare' | 'workspace' | 'systemManage'
88+
}>()
8689
const route = useRoute()
8790
const {
8891
params: { id, documentId }, // id为knowledgeID
8992
} = route as any
9093
9194
const { 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-
})
10296
const emit = defineEmits(['refresh'])
10397
const formRef = ref()
10498
@@ -138,7 +132,8 @@ watch(dialogVisible, (bool) => {
138132
const 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 = {
147142
const 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
162157
function 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,

ui/src/views/paragraph/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@
142142
:apiType="apiType"
143143
@refresh="refresh"
144144
/>
145-
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
145+
<SelectDocumentDialog
146+
ref="SelectDocumentDialogRef"
147+
@refresh="refreshMigrateParagraph"
148+
:apiType="apiType"
149+
/>
146150
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
147151
</div>
148152
</template>

0 commit comments

Comments
 (0)