mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: Fix document routing issues
This commit is contained in:
parent
caafea2cc0
commit
e0bbf06357
|
|
@ -2,6 +2,13 @@ import { SourceTypeEnum } from '@/enums/common'
|
|||
import { get_next_route } from '@/utils/permission'
|
||||
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
/* type 类型
|
||||
BASE = 0, '通用类型'
|
||||
WEB = 1, 'web站点类型'
|
||||
LARK = 2, '飞书类型'
|
||||
YUQUE = 3, '语雀类型'
|
||||
WORKFLOW = 4, '工作流类型'
|
||||
*/
|
||||
const DocumentRouter = {
|
||||
path: '/knowledge/:id/:folderId/:type',
|
||||
name: 'KnowledgeDetail',
|
||||
|
|
@ -186,9 +193,11 @@ const DocumentRouter = {
|
|||
return PermissionConst.RESOURCE_KNOWLEDGE_WORKFLOW_READ
|
||||
}
|
||||
},
|
||||
].map(p => () => {
|
||||
].map((p) => () => {
|
||||
const to: any = get_next_route()
|
||||
if (to.params.type !== '4') {return false}
|
||||
if (to.params.type !== '4') {
|
||||
return false
|
||||
}
|
||||
return p()
|
||||
}),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ const ModelRouter = {
|
|||
|
||||
// 上传文档
|
||||
{
|
||||
path: '/knowledge/document/upload/:folderId',
|
||||
path: '/knowledge/document/upload/:folderId/:type',
|
||||
name: 'UploadDocument',
|
||||
meta: { activeMenu: '/knowledge' },
|
||||
component: () => import('@/views/document/UploadDocument.vue'),
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
path: '/knowledge/import/:folderId',
|
||||
path: '/knowledge/import/:folderId/:type',
|
||||
name: 'ImportLarkDocument',
|
||||
meta: { activeMenu: '/knowledge' },
|
||||
component: () => import('@/views/document/ImportLarkDocument.vue'),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export const routes: Array<RouteRecordRaw> = [
|
|||
meta: { activeMenu: '/application' },
|
||||
component: () => import('@/views/application-workflow/index.vue'),
|
||||
},
|
||||
// 高级编排
|
||||
// 知识库工作流
|
||||
{
|
||||
path: '/knowledge/:from/:id/:folderId/workflow',
|
||||
name: 'KnowledgeWorkflow',
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const documentsType = computed(() => knowledge.documentsType)
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { folderId },
|
||||
params: { folderId, type }, // type为知识库类型的类型
|
||||
query: { id }, // id为knowledgeID,有id的是上传文档
|
||||
} = route
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ async function next() {
|
|||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
path: `/knowledge/${id}/${folderId}/${type}/document`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ async function next() {
|
|||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
path: `/knowledge/${id}/${folderId}/${type}/document`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ function submit() {
|
|||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
path: `/knowledge/${id}/${folderId}/${type}/document`,
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/document/upload/${folderId}`,
|
||||
path: `/knowledge/document/upload/${folderId}/${type}`,
|
||||
query: { id: id },
|
||||
})
|
||||
"
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/import/${folderId}`,
|
||||
path: `/knowledge/import/${folderId}/${type}`,
|
||||
query: {
|
||||
id: id,
|
||||
folder_token: knowledgeDetail?.meta.folder_token,
|
||||
|
|
@ -739,7 +739,7 @@ import AddTagDialog from '@/views/document/tag/MulAddTagDialog.vue'
|
|||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
params: { id, folderId, type }, // id为knowledgeID
|
||||
} = route as any
|
||||
const { common } = useStore()
|
||||
const storeKey = 'documents'
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/${data?.id}/${folderId}/document`,
|
||||
path: `/knowledge/${data?.id}/${folderId}/${type}/document`,
|
||||
})
|
||||
"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toDocument') }}</el-button
|
||||
|
|
@ -96,7 +96,7 @@ const props = defineProps({
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
params: { id, folderId, type }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
|
|
|
|||
|
|
@ -365,9 +365,7 @@ const publish = () => {
|
|||
const node = res.node
|
||||
const err_message = res.errMessage
|
||||
if (typeof err_message == 'string') {
|
||||
MsgError(
|
||||
res.node.properties?.stepName + ` ${t('views.workflow.node')},` + err_message,
|
||||
)
|
||||
MsgError(res.node.properties?.stepName + ` ${t('views.workflow.node')},` + err_message)
|
||||
} else {
|
||||
const keys = Object.keys(err_message)
|
||||
MsgError(
|
||||
|
|
@ -402,9 +400,7 @@ const clickShowDebug = () => {
|
|||
const node = res.node
|
||||
const err_message = res.errMessage
|
||||
if (typeof err_message == 'string') {
|
||||
MsgError(
|
||||
res.node.properties?.stepName + ` ${t('views.workflow.node')},` + err_message,
|
||||
)
|
||||
MsgError(res.node.properties?.stepName + ` ${t('views.workflow.node')},` + err_message)
|
||||
} else {
|
||||
const keys = Object.keys(err_message)
|
||||
MsgError(
|
||||
|
|
@ -499,7 +495,9 @@ const go = () => {
|
|||
}
|
||||
|
||||
const get_resource_management_route = () => {
|
||||
return `/knowledge/${from}/${id}/WORK_FLOW/document`
|
||||
return `/knowledge/${id}/${folderId}/4/document`
|
||||
|
||||
// return `/system/resource-management/knowledge`
|
||||
}
|
||||
|
||||
const get_route = () => {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ const submitHandle = async () => {
|
|||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/0/document`,
|
||||
})
|
||||
emit('refresh')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ const submitHandle = async () => {
|
|||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/2/document`,
|
||||
query: {
|
||||
from: apiType.value,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ const submitHandle = async () => {
|
|||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/1/document`,
|
||||
query: {
|
||||
from: apiType.value,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@
|
|||
:title="$t('views.system.resource_management.management')"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/${row.id}/resource-management/document`,
|
||||
path: `/knowledge/${row.id}/resource-management/${row.type}/document`,
|
||||
})
|
||||
"
|
||||
>
|
||||
|
|
@ -222,7 +222,7 @@
|
|||
<el-dropdown-item
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/${row.id}/resource-management/setting`,
|
||||
path: `/knowledge/${row.id}/resource-management/${row.type}/setting`,
|
||||
})
|
||||
"
|
||||
v-if="permissionPrecise.edit()"
|
||||
|
|
|
|||
Loading…
Reference in New Issue