feat: add application management API and update ApplicationResourceIndex.vue
This commit is contained in:
parent
46b7e5c38f
commit
be759701cc
319
ui/src/api/system-resource-management/application.ts
Normal file
319
ui/src/api/system-resource-management/application.ts
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
import {Result} from '@/request/Result'
|
||||||
|
import {get, post, postStream, del, put, request, download, exportFile} from '@/request/index'
|
||||||
|
import type {pageRequest} from '@/api/type/common'
|
||||||
|
import type {ApplicationFormType} from '@/api/type/application'
|
||||||
|
import {type Ref} from 'vue'
|
||||||
|
import useStore from '@/stores'
|
||||||
|
|
||||||
|
const prefix = '/system/resource/application'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部应用
|
||||||
|
* @param 参数
|
||||||
|
*/
|
||||||
|
const getAllApplication: (param?: any, loading?: Ref<boolean>) => Promise<Result<any[]>> = (
|
||||||
|
param,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}`, param, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分页应用
|
||||||
|
* param {
|
||||||
|
"name": "string",
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const getApplication: (
|
||||||
|
page: pageRequest,
|
||||||
|
param: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (page, param, loading) => {
|
||||||
|
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建应用
|
||||||
|
* @param 参数
|
||||||
|
*/
|
||||||
|
const postApplication: (
|
||||||
|
data: ApplicationFormType,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (data, loading) => {
|
||||||
|
return post(`${prefix}`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用
|
||||||
|
* @param 参数
|
||||||
|
*/
|
||||||
|
const putApplication: (
|
||||||
|
application_id: string,
|
||||||
|
data: ApplicationFormType,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return put(`${prefix}/${application_id}`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用
|
||||||
|
* @param 参数 application_id
|
||||||
|
*/
|
||||||
|
const delApplication: (
|
||||||
|
application_id: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<boolean>> = (application_id, loading) => {
|
||||||
|
return del(`${prefix}/${application_id}`, undefined, {}, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用详情
|
||||||
|
* @param 参数 application_id
|
||||||
|
*/
|
||||||
|
const getApplicationDetail: (
|
||||||
|
application_id: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, loading) => {
|
||||||
|
return get(`${prefix}/${application_id}`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取AccessToken
|
||||||
|
* @param 参数 application_id
|
||||||
|
*/
|
||||||
|
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||||
|
application_id,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${application_id}/access_token`, undefined, loading)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取应用设置
|
||||||
|
* @param application_id 应用id
|
||||||
|
* @param loading 加载器
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getApplicationSetting: (
|
||||||
|
application_id: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, loading) => {
|
||||||
|
return get(`${prefix}/${application_id}/setting`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改AccessToken
|
||||||
|
* @param 参数 application_id
|
||||||
|
* data {
|
||||||
|
* "is_active": true
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
const putAccessToken: (
|
||||||
|
application_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return put(`${prefix}/${application_id}/access_token`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出应用
|
||||||
|
*/
|
||||||
|
|
||||||
|
const exportApplication = (
|
||||||
|
application_id: string,
|
||||||
|
application_name: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => {
|
||||||
|
return exportFile(
|
||||||
|
application_name + '.mk',
|
||||||
|
`${prefix}/${application_id}/export`,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入应用
|
||||||
|
*/
|
||||||
|
const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||||
|
data,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return post(`${prefix}/import`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计
|
||||||
|
* @param 参数 application_id, data
|
||||||
|
*/
|
||||||
|
const getStatistics: (
|
||||||
|
application_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return get(`${prefix}/${application_id}/application_stats`, data, loading)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 打开调试对话id
|
||||||
|
* @param application_id 应用id
|
||||||
|
* @param loading 加载器
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const open: (application_id: string, loading?: Ref<boolean>) => Promise<Result<string>> = (
|
||||||
|
application_id,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${application_id}/open`, {}, loading)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 对话
|
||||||
|
* @param 参数
|
||||||
|
* chat_id: string
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
const chat: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => {
|
||||||
|
const prefix = (window.MaxKB?.prefix ? window.MaxKB?.prefix : '/admin') + '/api'
|
||||||
|
return postStream(`${prefix}/chat_message/${chat_id}`, data)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取对话用户认证类型
|
||||||
|
* @param loading 加载器
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getChatUserAuthType: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
||||||
|
return get(`/chat_user/auth/types`, {}, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平台状态
|
||||||
|
*/
|
||||||
|
const getPlatformStatus: (application_id: string) => Promise<Result<any>> = (application_id) => {
|
||||||
|
return get(`${prefix}/${application_id}/platform/status`)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更新平台状态
|
||||||
|
*/
|
||||||
|
const updatePlatformStatus: (application_id: string, data: any) => Promise<Result<any>> = (
|
||||||
|
application_id,
|
||||||
|
data,
|
||||||
|
) => {
|
||||||
|
return post(`${prefix}/${application_id}/platform/status`, data)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取平台配置
|
||||||
|
*/
|
||||||
|
const getPlatformConfig: (application_id: string, type: string) => Promise<Result<any>> = (
|
||||||
|
application_id,
|
||||||
|
type,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${application_id}/platform/${type}`)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更新平台配置
|
||||||
|
*/
|
||||||
|
const updatePlatformConfig: (
|
||||||
|
application_id: string,
|
||||||
|
type: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, type, data, loading) => {
|
||||||
|
return post(`${prefix}/${application_id}/platform/${type}`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 应用发布
|
||||||
|
* @param application_id
|
||||||
|
* @param loading
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const publish: (
|
||||||
|
application_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return put(`${prefix}/${application_id}/publish`, data, {}, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param application_id
|
||||||
|
* @param data
|
||||||
|
* @param loading
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const playDemoText: (application_id: string, data: any, loading?: Ref<boolean>) => Promise<any> = (
|
||||||
|
application_id,
|
||||||
|
data,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return download(
|
||||||
|
`${prefix}/${application_id}/play_demo_text`,
|
||||||
|
'post',
|
||||||
|
data,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本转语音
|
||||||
|
*/
|
||||||
|
const postTextToSpeech: (
|
||||||
|
application_id: String,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return download(
|
||||||
|
`${prefix}/${application_id}/text_to_speech`,
|
||||||
|
'post',
|
||||||
|
data,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 语音转文本
|
||||||
|
*/
|
||||||
|
const speechToText: (
|
||||||
|
application_id: String,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
|
return post(`${prefix}/${application_id}/speech_to_text`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mcp 节点
|
||||||
|
*/
|
||||||
|
const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||||
|
application_id,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${application_id}/mcp_tools`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getAllApplication,
|
||||||
|
getApplication,
|
||||||
|
postApplication,
|
||||||
|
putApplication,
|
||||||
|
delApplication,
|
||||||
|
getApplicationDetail,
|
||||||
|
getAccessToken,
|
||||||
|
putAccessToken,
|
||||||
|
exportApplication,
|
||||||
|
importApplication,
|
||||||
|
getStatistics,
|
||||||
|
open,
|
||||||
|
chat,
|
||||||
|
getChatUserAuthType,
|
||||||
|
getApplicationSetting,
|
||||||
|
getPlatformStatus,
|
||||||
|
updatePlatformStatus,
|
||||||
|
getPlatformConfig,
|
||||||
|
publish,
|
||||||
|
updatePlatformConfig,
|
||||||
|
playDemoText,
|
||||||
|
postTextToSpeech,
|
||||||
|
speechToText,
|
||||||
|
getMcpTools,
|
||||||
|
}
|
||||||
@ -225,4 +225,5 @@ export default {
|
|||||||
emptyMessage1: 'Retrieval Testing results will show here',
|
emptyMessage1: 'Retrieval Testing results will show here',
|
||||||
emptyMessage2: 'No matching sections found',
|
emptyMessage2: 'No matching sections found',
|
||||||
},
|
},
|
||||||
|
publishTime: 'Publish Time',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,4 +211,5 @@ export default {
|
|||||||
emptyMessage1: '命中段落显示在这里',
|
emptyMessage1: '命中段落显示在这里',
|
||||||
emptyMessage2: '没有命中的分段',
|
emptyMessage2: '没有命中的分段',
|
||||||
},
|
},
|
||||||
|
publishTime: '发布时间',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,4 +211,5 @@ export default {
|
|||||||
emptyMessage1: '命中的段落顯示在這裡',
|
emptyMessage1: '命中的段落顯示在這裡',
|
||||||
emptyMessage2: '沒有命中的分段',
|
emptyMessage2: '沒有命中的分段',
|
||||||
},
|
},
|
||||||
|
publishTime: '發佈時間',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { PermissionConst, EditionConst, RoleConst } from '@/utils/permission/data'
|
import {PermissionConst, EditionConst, RoleConst} from '@/utils/permission/data'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
import {ComplexPermission} from '@/utils/permission/type'
|
||||||
|
|
||||||
const systemRouter = {
|
const systemRouter = {
|
||||||
path: '/system',
|
path: '/system',
|
||||||
name: 'system',
|
name: 'system',
|
||||||
meta: { title: 'views.system.title' },
|
meta: {title: 'views.system.title'},
|
||||||
hidden: true,
|
hidden: true,
|
||||||
component: () => import('@/layout/layout-template/SystemMainLayout.vue'),
|
component: () => import('@/layout/layout-template/SystemMainLayout.vue'),
|
||||||
children: [
|
children: [
|
||||||
@ -78,6 +78,12 @@ const systemRouter = {
|
|||||||
parentPath: '/system',
|
parentPath: '/system',
|
||||||
parentName: 'system',
|
parentName: 'system',
|
||||||
permission: [
|
permission: [
|
||||||
|
new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN],
|
||||||
|
[PermissionConst.RESOURCE_APPLICATION_READ],
|
||||||
|
[EditionConst.IS_EE],
|
||||||
|
'OR',
|
||||||
|
),
|
||||||
new ComplexPermission(
|
new ComplexPermission(
|
||||||
[RoleConst.ADMIN],
|
[RoleConst.ADMIN],
|
||||||
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
|
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
|
||||||
@ -99,6 +105,26 @@ const systemRouter = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: '/system/resource-management/application',
|
||||||
|
name: 'ApplicationResourceIndex',
|
||||||
|
meta: {
|
||||||
|
title: 'views.application.title',
|
||||||
|
activeMenu: '/system',
|
||||||
|
parentPath: '/system',
|
||||||
|
parentName: 'system',
|
||||||
|
sameRoute: 'workspace',
|
||||||
|
permission: [
|
||||||
|
new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN],
|
||||||
|
[PermissionConst.RESOURCE_APPLICATION_READ],
|
||||||
|
[EditionConst.IS_EE],
|
||||||
|
'OR',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
component: () => import('@/views/system-resource-management/ApplicationResourceIndex.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/system/resource-management/knowledge',
|
path: '/system/resource-management/knowledge',
|
||||||
name: 'KnowledgeResourceIndex',
|
name: 'KnowledgeResourceIndex',
|
||||||
@ -172,18 +198,18 @@ const systemRouter = {
|
|||||||
parentName: 'system',
|
parentName: 'system',
|
||||||
sameRoute: 'authorization',
|
sameRoute: 'authorization',
|
||||||
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
|
||||||
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
|
||||||
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
|
||||||
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
@ -199,7 +225,7 @@ const systemRouter = {
|
|||||||
sameRoute: 'authorization',
|
sameRoute: 'authorization',
|
||||||
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),]
|
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
|
||||||
},
|
},
|
||||||
component: () => import('@/views/system/resource-authorization/index.vue'),
|
component: () => import('@/views/system/resource-authorization/index.vue'),
|
||||||
},
|
},
|
||||||
@ -215,7 +241,7 @@ const systemRouter = {
|
|||||||
sameRoute: 'authorization',
|
sameRoute: 'authorization',
|
||||||
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),]
|
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
|
||||||
},
|
},
|
||||||
component: () => import('@/views/system/resource-authorization/index.vue'),
|
component: () => import('@/views/system/resource-authorization/index.vue'),
|
||||||
},
|
},
|
||||||
@ -231,7 +257,7 @@ const systemRouter = {
|
|||||||
sameRoute: 'authorization',
|
sameRoute: 'authorization',
|
||||||
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),]
|
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
|
||||||
},
|
},
|
||||||
component: () => import('@/views/system/resource-authorization/index.vue'),
|
component: () => import('@/views/system/resource-authorization/index.vue'),
|
||||||
},
|
},
|
||||||
@ -247,7 +273,7 @@ const systemRouter = {
|
|||||||
sameRoute: 'authorization',
|
sameRoute: 'authorization',
|
||||||
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
|
||||||
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole],[],'OR'),]
|
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
|
||||||
},
|
},
|
||||||
component: () => import('@/views/system/resource-authorization/index.vue'),
|
component: () => import('@/views/system/resource-authorization/index.vue'),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Permission, Role, Edition } from '@/utils/permission/type'
|
import {Permission, Role, Edition} from '@/utils/permission/type'
|
||||||
// class Operate(Enum):
|
// class Operate(Enum):
|
||||||
// """
|
// """
|
||||||
// 一个权限组的操作权限
|
// 一个权限组的操作权限
|
||||||
@ -219,6 +219,7 @@ const PermissionConst = {
|
|||||||
RESOURCE_TOOL_EXPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EXPORT'),
|
RESOURCE_TOOL_EXPORT: new Permission('SYSTEM_RESOURCE_TOOL:READ+EXPORT'),
|
||||||
|
|
||||||
RESOURCE_KNOWLEDGE_READ: new Permission('SYSTEM_RESOURCE_KNOWLEDGE:READ'),
|
RESOURCE_KNOWLEDGE_READ: new Permission('SYSTEM_RESOURCE_KNOWLEDGE:READ'),
|
||||||
|
RESOURCE_APPLICATION_READ: new Permission('SYSTEM_RESOURCE_APPLICATION:READ'),
|
||||||
|
|
||||||
RESOURCE_MODEL_READ: new Permission('SYSTEM_RESOURCE_MODEL:READ'),
|
RESOURCE_MODEL_READ: new Permission('SYSTEM_RESOURCE_MODEL:READ'),
|
||||||
|
|
||||||
@ -277,4 +278,4 @@ const EditionConst = {
|
|||||||
IS_EE: new Edition('X-PACK-EE'),
|
IS_EE: new Edition('X-PACK-EE'),
|
||||||
IS_CE: new Edition('X-PACK-CE'),
|
IS_CE: new Edition('X-PACK-CE'),
|
||||||
}
|
}
|
||||||
export { PermissionConst, RoleConst, EditionConst }
|
export {PermissionConst, RoleConst, EditionConst}
|
||||||
|
|||||||
@ -15,9 +15,9 @@
|
|||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
@change="search_type_change"
|
@change="search_type_change"
|
||||||
>
|
>
|
||||||
<el-option :label="$t('common.creator')" value="create_user" />
|
<el-option :label="$t('common.creator')" value="create_user"/>
|
||||||
|
|
||||||
<el-option :label="$t('common.name')" value="name" />
|
<el-option :label="$t('common.name')" value="name"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input
|
<el-input
|
||||||
v-if="search_type === 'name'"
|
v-if="search_type === 'name'"
|
||||||
@ -34,13 +34,13 @@
|
|||||||
clearable
|
clearable
|
||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
>
|
>
|
||||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.nick_name" />
|
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-table
|
<app-table
|
||||||
:data="knowledgeList"
|
:data="applicationList"
|
||||||
:pagination-config="paginationConfig"
|
:pagination-config="paginationConfig"
|
||||||
@sizeChange="getList"
|
@sizeChange="getList"
|
||||||
@changePage="getList"
|
@changePage="getList"
|
||||||
@ -57,10 +57,10 @@
|
|||||||
style="background: none"
|
style="background: none"
|
||||||
class="mr-8"
|
class="mr-8"
|
||||||
>
|
>
|
||||||
<img :src="scope.row?.icon" alt="" />
|
<img :src="scope.row?.icon" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar v-else class="avatar-green" shape="square" :size="24">
|
<el-avatar v-else class="avatar-green" shape="square" :size="24">
|
||||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ scope.row.name }}
|
{{ scope.row.name }}
|
||||||
@ -71,16 +71,84 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
prop="tool_type"
|
prop="tool_type"
|
||||||
:label="$t('views.system.resource_management.type')"
|
:label="$t('views.system.resource_management.type')"
|
||||||
width="110"
|
width="160"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="scope">
|
||||||
<span v-if="row.type === 1">{{
|
<el-tag type="warning" v-if="isWorkFlow(scope.row.type)" style="height: 22px">
|
||||||
$t('views.knowledge.knowledgeType.webKnowledge')
|
{{ $t('views.application.workflow') }}
|
||||||
}}</span>
|
</el-tag>
|
||||||
<span v-else-if="row.type === 2">{{
|
<el-tag class="blue-tag" v-else style="height: 22px">
|
||||||
$t('views.knowledge.knowledgeType.larkKnowledge')
|
{{ $t('views.application.simple') }}
|
||||||
}}</span>
|
</el-tag>
|
||||||
<span v-else>{{ $t('views.knowledge.knowledgeType.generalKnowledge') }}</span>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
width="150"
|
||||||
|
prop="is_publish"
|
||||||
|
:label="$t('common.status.label')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div>
|
||||||
|
<span>{{ $t('common.status.label') }}</span>
|
||||||
|
<el-popover :width="200" trigger="click" :visible="statusVisible">
|
||||||
|
<template #reference>
|
||||||
|
<el-button
|
||||||
|
style="margin-top: -2px"
|
||||||
|
:type="statusArr && statusArr.length > 0 ? 'primary' : ''"
|
||||||
|
link
|
||||||
|
@click="statusVisible = !statusVisible"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<Filter/>
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<div class="filter">
|
||||||
|
<div class="form-item mb-16">
|
||||||
|
<div @click.stop>
|
||||||
|
<el-scrollbar height="300" style="margin: 0 0 0 10px">
|
||||||
|
<el-checkbox-group
|
||||||
|
v-model="statusArr"
|
||||||
|
style="display: flex; flex-direction: column"
|
||||||
|
>
|
||||||
|
<el-checkbox
|
||||||
|
v-for="item in statusOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<el-button size="small" @click="filterStatusChange('clear')"
|
||||||
|
>{{ $t('common.clear') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="filterStatusChange" size="small"
|
||||||
|
>{{ $t('common.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default="scope">
|
||||||
|
<div v-if="scope.row.is_publish" class="flex align-center">
|
||||||
|
<el-icon class="color-success mr-8" style="font-size: 16px">
|
||||||
|
<SuccessFilled/>
|
||||||
|
</el-icon>
|
||||||
|
<span class="color-secondary">
|
||||||
|
{{ $t('views.application.status.published') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex align-center">
|
||||||
|
<AppIcon iconName="app-disabled" class="color-secondary mr-8"></AppIcon>
|
||||||
|
<span class="color-secondary">
|
||||||
|
{{ $t('views.application.status.unpublished') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@ -102,7 +170,7 @@
|
|||||||
@click="workspaceVisible = !workspaceVisible"
|
@click="workspaceVisible = !workspaceVisible"
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Filter />
|
<Filter/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -127,23 +195,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<el-button size="small" @click="filterWorkspaceChange('clear')"
|
<el-button size="small" @click="filterWorkspaceChange('clear')"
|
||||||
>{{ $t('common.clear') }}
|
>{{ $t('common.clear') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" @click="filterWorkspaceChange" size="small"
|
<el-button type="primary" @click="filterWorkspaceChange" size="small"
|
||||||
>{{ $t('common.confirm') }}
|
>{{ $t('common.confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="nick_name" :label="$t('common.creator')" show-overflow-tooltip />
|
|
||||||
<el-table-column :label="$t('views.document.table.updateTime')" width="180">
|
<el-table-column prop="nick_name" :label="$t('common.creator')" show-overflow-tooltip
|
||||||
|
width="120"/>
|
||||||
|
<el-table-column :label="$t('views.application.publishTime')" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ datetimeFormat(row.update_time) }}
|
{{ datetimeFormat(row.update_time) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('common.createTime')" width="180">
|
<el-table-column :label="$t('views.document.table.updateTime')" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ datetimeFormat(row.update_time) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="$t('common.createTime')" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ datetimeFormat(row.create_time) }}
|
{{ datetimeFormat(row.create_time) }}
|
||||||
</template>
|
</template>
|
||||||
@ -154,16 +229,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, reactive, computed } from 'vue'
|
import {onMounted, ref, reactive, computed} from 'vue'
|
||||||
import KnowledgeResourceApi from '@/api/system-resource-management/knowledge'
|
import ApplicationResourceApi from '@/api/system-resource-management/application'
|
||||||
import { t } from '@/locales'
|
import {t} from '@/locales'
|
||||||
import { isAppIcon } from '@/utils/common'
|
import {isAppIcon} from '@/utils/common'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import {datetimeFormat} from '@/utils/time'
|
||||||
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
import UserApi from '@/api/user/user.ts'
|
import {isWorkFlow} from "@/utils/application.ts";
|
||||||
|
|
||||||
const { user } = useStore()
|
const {user} = useStore()
|
||||||
|
|
||||||
const search_type = ref('name')
|
const search_type = ref('name')
|
||||||
const search_form = ref<any>({
|
const search_form = ref<any>({
|
||||||
@ -174,7 +249,7 @@ const user_options = ref<any[]>([])
|
|||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const changeStateloading = ref(false)
|
const changeStateloading = ref(false)
|
||||||
const knowledgeList = ref<any[]>([])
|
const applicationList = ref<any[]>([])
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 30,
|
page_size: 30,
|
||||||
@ -183,6 +258,16 @@ const paginationConfig = reactive({
|
|||||||
const workspaceOptions = ref<any[]>([])
|
const workspaceOptions = ref<any[]>([])
|
||||||
const workspaceVisible = ref(false)
|
const workspaceVisible = ref(false)
|
||||||
const workspaceArr = ref<any[]>([])
|
const workspaceArr = ref<any[]>([])
|
||||||
|
const statusVisible = ref(false)
|
||||||
|
const statusArr = ref<any[]>([])
|
||||||
|
const statusOptions = ref<any[]>([{
|
||||||
|
label: t('views.application.status.published'),
|
||||||
|
value: true,
|
||||||
|
}, {
|
||||||
|
label: t('views.application.status.unpublished'),
|
||||||
|
value: false,
|
||||||
|
}])
|
||||||
|
|
||||||
function filterWorkspaceChange(val: string) {
|
function filterWorkspaceChange(val: string) {
|
||||||
if (val === 'clear') {
|
if (val === 'clear') {
|
||||||
workspaceArr.value = []
|
workspaceArr.value = []
|
||||||
@ -190,6 +275,15 @@ function filterWorkspaceChange(val: string) {
|
|||||||
getList()
|
getList()
|
||||||
workspaceVisible.value = false
|
workspaceVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterStatusChange(val: string) {
|
||||||
|
if (val === 'clear') {
|
||||||
|
statusArr.value = []
|
||||||
|
}
|
||||||
|
getList()
|
||||||
|
statusVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
if (user.isEE()) {
|
||||||
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
@ -199,27 +293,30 @@ async function getWorkspaceList() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const search_type_change = () => {
|
const search_type_change = () => {
|
||||||
search_form.value = { name: '', create_user: '' }
|
search_form.value = {name: '', create_user: ''}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
const params = {
|
const params = {
|
||||||
[search_type.value]: search_form.value[search_type.value],
|
[search_type.value]: search_form.value[search_type.value],
|
||||||
}
|
}
|
||||||
KnowledgeResourceApi.getKnowledgeListPage(paginationConfig, params, loading).then((res: any) => {
|
if (workspaceArr.value.length > 0) {
|
||||||
|
params['workspace_ids'] = JSON.stringify(workspaceArr.value)
|
||||||
|
}
|
||||||
|
if (statusArr.value.length > 0) {
|
||||||
|
params['status'] = JSON.stringify(statusArr.value)
|
||||||
|
}
|
||||||
|
ApplicationResourceApi.getApplication(paginationConfig, params, loading).then((res: any) => {
|
||||||
paginationConfig.total = res.data?.total
|
paginationConfig.total = res.data?.total
|
||||||
knowledgeList.value = res.data?.records
|
applicationList.value = res.data?.records
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getWorkspaceList()
|
getWorkspaceList()
|
||||||
getList()
|
getList()
|
||||||
|
|
||||||
UserApi.getAllMemberList('').then((res: any) => {
|
|
||||||
user_options.value = res.data
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user