fix: change workspace
This commit is contained in:
parent
63c91138ed
commit
91eb873312
@ -28,6 +28,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import TopMenu from './top-menu/index.vue'
|
import TopMenu from './top-menu/index.vue'
|
||||||
import Avatar from './avatar/index.vue'
|
import Avatar from './avatar/index.vue'
|
||||||
import TopAbout from './top-about/index.vue'
|
import TopAbout from './top-about/index.vue'
|
||||||
@ -35,15 +36,27 @@ import { EditionConst } from '@/utils/permission/data'
|
|||||||
import { hasPermission } from '@/utils/permission/index'
|
import { hasPermission } from '@/utils/permission/index'
|
||||||
import type { WorkspaceItem } from '@/api/type/workspace'
|
import type { WorkspaceItem } from '@/api/type/workspace'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
const currentWorkspace = computed(() => {
|
const currentWorkspace = computed(() => {
|
||||||
return user.workspace_list.find((w) => w.id == user.workspace_id)
|
return user.workspace_list.find((w) => w.id == user.workspace_id)
|
||||||
})
|
})
|
||||||
|
|
||||||
function changeWorkspace(item: WorkspaceItem) {
|
function changeWorkspace(item: WorkspaceItem) {
|
||||||
|
const {
|
||||||
|
meta: { activeMenu },
|
||||||
|
} = route as any
|
||||||
if (item.id === user.workspace_id) return
|
if (item.id === user.workspace_id) return
|
||||||
user.setWorkspaceId(item.id || 'default')
|
user.setWorkspaceId(item.id || 'default')
|
||||||
window.location.reload()
|
if (activeMenu.includes('application')) {
|
||||||
|
router.push('/application')
|
||||||
|
} else if (activeMenu.includes('knowledge')) {
|
||||||
|
router.push('/knowledge')
|
||||||
|
} else {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const ModelRouter = {
|
|||||||
PermissionConst.KNOWLEDGE_READ.getWorkspacePermissionWorkspaceManageRole,
|
PermissionConst.KNOWLEDGE_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||||
],
|
],
|
||||||
group: 'workspace',
|
group: 'workspace',
|
||||||
|
meta: { activeMenu: '/knowledge' },
|
||||||
order: 2,
|
order: 2,
|
||||||
},
|
},
|
||||||
redirect: '/knowledge',
|
redirect: '/knowledge',
|
||||||
|
|||||||
@ -11,6 +11,7 @@ const ModelRouter = {
|
|||||||
PermissionConst.MODEL_READ.getWorkspacePermission,
|
PermissionConst.MODEL_READ.getWorkspacePermission,
|
||||||
PermissionConst.MODEL_READ.getWorkspacePermissionWorkspaceManageRole,
|
PermissionConst.MODEL_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||||
],
|
],
|
||||||
|
meta: { activeMenu: '/model' },
|
||||||
group: 'workspace',
|
group: 'workspace',
|
||||||
order: 4,
|
order: 4,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-show="show" class="workflow-dropdown-menu border border-r-6 white-bg">
|
<div v-show="show" class="workflow-dropdown-menu border border-r-6 white-bg">
|
||||||
<el-tabs v-model="activeName" class="workflow-dropdown-tabs">
|
<el-tabs v-model="activeName" class="workflow-dropdown-tabs" @tab-change="handleClick">
|
||||||
<div v-show="activeName === 'base'" style="display: flex; width: 100%; justify-content: center" class="mb-12 mt-12">
|
<div
|
||||||
<el-input v-model="search_text" class="mr-12 ml-12"
|
v-show="activeName === 'base'"
|
||||||
:placeholder="$t('views.applicationWorkflow.searchBar.placeholder')">
|
style="display: flex; width: 100%; justify-content: center"
|
||||||
|
class="mb-12 mt-12"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="search_text"
|
||||||
|
class="mr-12 ml-12"
|
||||||
|
:placeholder="$t('views.applicationWorkflow.searchBar.placeholder')"
|
||||||
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<el-icon class="el-input__icon">
|
<el-icon class="el-input__icon">
|
||||||
<search />
|
<search />
|
||||||
@ -18,25 +25,37 @@
|
|||||||
<template v-for="(node, index) in filter_menu_nodes" :key="index">
|
<template v-for="(node, index) in filter_menu_nodes" :key="index">
|
||||||
<el-text type="info" size="small" class="color-secondary ml-12">{{
|
<el-text type="info" size="small" class="color-secondary ml-12">{{
|
||||||
node.label
|
node.label
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
<div class="flex-wrap" style="gap: 12px; padding: 12px;">
|
<div class="flex-wrap" style="gap: 12px; padding: 12px">
|
||||||
<template v-for="(item, index) in node.list" :key="index">
|
<template v-for="(item, index) in node.list" :key="index">
|
||||||
<el-popover placement="right" :width="280" :show-after="500">
|
<el-popover placement="right" :width="280" :show-after="500">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<div class="list-item flex align-center border border-r-6 p-8-12 cursor"
|
<div
|
||||||
style="width: calc(50% - 6px)" @click.stop="clickNodes(item)" @mousedown.stop="onmousedown(item)">
|
class="list-item flex align-center border border-r-6 p-8-12 cursor"
|
||||||
<component :is="iconComponent(`${item.type}-icon`)" class="mr-8" :size="32" />
|
style="width: calc(50% - 6px)"
|
||||||
|
@click.stop="clickNodes(item)"
|
||||||
|
@mousedown.stop="onmousedown(item)"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="iconComponent(`${item.type}-icon`)"
|
||||||
|
class="mr-8"
|
||||||
|
:size="32"
|
||||||
|
/>
|
||||||
<div class="lighter">{{ item.label }}</div>
|
<div class="lighter">{{ item.label }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<div class="flex align-center mb-8">
|
<div class="flex align-center mb-8">
|
||||||
<component :is="iconComponent(`${item.type}-icon`)" class="mr-8" :size="32" />
|
<component
|
||||||
|
:is="iconComponent(`${item.type}-icon`)"
|
||||||
|
class="mr-8"
|
||||||
|
:size="32"
|
||||||
|
/>
|
||||||
<div class="lighter color-text-primary">{{ item.label }}</div>
|
<div class="lighter color-text-primary">{{ item.label }}</div>
|
||||||
</div>
|
</div>
|
||||||
<el-text type="info" size="small" class="color-secondary lighter">{{
|
<el-text type="info" size="small" class="color-secondary lighter">{{
|
||||||
item.text
|
item.text
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</template>
|
</template>
|
||||||
@ -52,13 +71,23 @@
|
|||||||
<el-tab-pane :label="$t('views.tool.title')" name="tool">
|
<el-tab-pane :label="$t('views.tool.title')" name="tool">
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<template #left>
|
<template #left>
|
||||||
<folder-tree :source="SourceTypeEnum.TOOL" :data="toolTreeData" :currentNodeKey="folder.currentFolder?.id"
|
<folder-tree
|
||||||
@handleNodeClick="folderClickHandle" :shareTitle="$t('views.shared.shared_tool')"
|
:source="SourceTypeEnum.TOOL"
|
||||||
:showShared="user.isEE()" class="p-8" :canOperation="false" />
|
:data="toolTreeData"
|
||||||
|
:currentNodeKey="folder.currentFolder?.id"
|
||||||
|
@handleNodeClick="folderClickHandle"
|
||||||
|
:shareTitle="$t('views.shared.shared_tool')"
|
||||||
|
:showShared="user.isEE()"
|
||||||
|
class="p-8"
|
||||||
|
:canOperation="false"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<el-scrollbar height="450">
|
<el-scrollbar height="450">
|
||||||
<NodeContent :list="toolList" @clickNodes="(val: any) => clickNodes(toolLibNode, val, 'tool')"
|
<NodeContent
|
||||||
@onmousedown="(val: any) => onmousedown(toolLibNode, val, 'tool')" />
|
:list="toolList"
|
||||||
|
@clickNodes="(val: any) => clickNodes(toolLibNode, val, 'tool')"
|
||||||
|
@onmousedown="(val: any) => onmousedown(toolLibNode, val, 'tool')"
|
||||||
|
/>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -66,14 +95,21 @@
|
|||||||
<el-tab-pane :label="$t('views.application.title')" name="application">
|
<el-tab-pane :label="$t('views.application.title')" name="application">
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<template #left>
|
<template #left>
|
||||||
<folder-tree :source="SourceTypeEnum.APPLICATION" :data="applicationTreeData"
|
<folder-tree
|
||||||
:currentNodeKey="folder.currentFolder?.id" @handleNodeClick="folderClickHandle" class="p-8"
|
:source="SourceTypeEnum.APPLICATION"
|
||||||
:canOperation="false" />
|
:data="applicationTreeData"
|
||||||
|
:currentNodeKey="folder.currentFolder?.id"
|
||||||
|
@handleNodeClick="folderClickHandle"
|
||||||
|
class="p-8"
|
||||||
|
:canOperation="false"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<el-scrollbar height="450">
|
<el-scrollbar height="450">
|
||||||
<NodeContent :list="applicationList"
|
<NodeContent
|
||||||
|
:list="applicationList"
|
||||||
@clickNodes="(val: any) => clickNodes(applicationNode, val, 'application')"
|
@clickNodes="(val: any) => clickNodes(applicationNode, val, 'application')"
|
||||||
@onmousedown="(val: any) => onmousedown(applicationNode, val, 'application')" />
|
@onmousedown="(val: any) => onmousedown(applicationNode, val, 'application')"
|
||||||
|
/>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -90,7 +126,6 @@ import useStore from '@/stores'
|
|||||||
import NodeContent from './NodeContent.vue'
|
import NodeContent from './NodeContent.vue'
|
||||||
import { SourceTypeEnum } from '@/enums/common'
|
import { SourceTypeEnum } from '@/enums/common'
|
||||||
import sharedWorkspaceApi from '@/api/shared-workspace'
|
import sharedWorkspaceApi from '@/api/shared-workspace'
|
||||||
import { CaretRight } from '@element-plus/icons-vue'
|
|
||||||
import ApplicationApi from '@/api/application/application'
|
import ApplicationApi from '@/api/application/application'
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
const search_text = ref<string>('')
|
const search_text = ref<string>('')
|
||||||
@ -209,10 +244,12 @@ async function getShareTool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getToolList() {
|
async function getToolList() {
|
||||||
if (folder.currentFolder.id === "share") {
|
if (folder.currentFolder.id === 'share') {
|
||||||
toolList.value = sharedToolList.value
|
toolList.value = sharedToolList.value
|
||||||
} else {
|
} else {
|
||||||
const res = await ToolApi.getToolList({ folder_id: folder.currentFolder?.id || user.getWorkspaceId() })
|
const res = await ToolApi.getToolList({
|
||||||
|
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
|
||||||
|
})
|
||||||
toolList.value = res.data.tools
|
toolList.value = res.data.tools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,33 +260,41 @@ const applicationList = ref<any[]>([])
|
|||||||
function getApplicationFolder() {
|
function getApplicationFolder() {
|
||||||
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {}, loading).then((res: any) => {
|
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {}, loading).then((res: any) => {
|
||||||
applicationTreeData.value = res.data
|
applicationTreeData.value = res.data
|
||||||
folder.setCurrentFolder(res.data?.[0] || {})
|
folder.setCurrentFolder(res.data?.[0] || {})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getApplicationList() {
|
async function getApplicationList() {
|
||||||
const res = await ApplicationApi.getAllApplication({ folder_id: folder.currentFolder?.id || user.getWorkspaceId() })
|
const res = await ApplicationApi.getAllApplication({
|
||||||
|
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
|
||||||
|
})
|
||||||
applicationList.value = res.data.filter((item) => item.resource_type === 'application')
|
applicationList.value = res.data.filter((item) => item.resource_type === 'application')
|
||||||
}
|
}
|
||||||
|
|
||||||
function folderClickHandle(row: any) {
|
function folderClickHandle(row: any) {
|
||||||
folder.setCurrentFolder(row)
|
folder.setCurrentFolder(row)
|
||||||
if (activeName.value === 'tool') {
|
if (activeName.value === 'tool') {
|
||||||
getToolList();
|
getToolList()
|
||||||
} else {
|
} else {
|
||||||
getApplicationList()
|
getApplicationList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
async function handleClick(val: string) {
|
||||||
if (user.isEE()) {
|
console.log(val)
|
||||||
await getShareTool()
|
if (val === 'tool') {
|
||||||
|
if (user.isEE()) {
|
||||||
|
await getShareTool()
|
||||||
|
}
|
||||||
|
await getToolFolder()
|
||||||
|
getToolList()
|
||||||
|
} else if (val === 'application') {
|
||||||
|
getApplicationFolder()
|
||||||
|
getApplicationList()
|
||||||
}
|
}
|
||||||
await getToolFolder()
|
}
|
||||||
getToolList()
|
|
||||||
getApplicationFolder()
|
onMounted(() => {})
|
||||||
getApplicationList()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.workflow-dropdown-menu {
|
.workflow-dropdown-menu {
|
||||||
|
|||||||
@ -20,7 +20,12 @@
|
|||||||
</el-avatar>
|
</el-avatar>
|
||||||
<LogoIcon v-else height="32px" />
|
<LogoIcon v-else height="32px" />
|
||||||
</div>
|
</div>
|
||||||
<h4 v-show="!isPcCollapse">{{ applicationDetail?.name }}</h4>
|
<h4
|
||||||
|
v-show="!isPcCollapse"
|
||||||
|
:style="{ color: applicationDetail?.custom_theme?.header_font_color }"
|
||||||
|
>
|
||||||
|
{{ applicationDetail?.name }}
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -252,7 +257,7 @@ function refreshFieldTitle(chatId: string, abstract: string) {
|
|||||||
</style>
|
</style>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.chat-pc-popper {
|
.chat-pc-popper {
|
||||||
background: #ffffff!important;
|
background: #ffffff !important;
|
||||||
.el-menu {
|
.el-menu {
|
||||||
background: var(--el-color-primary-light-06) !important;
|
background: var(--el-color-primary-light-06) !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,6 @@
|
|||||||
iconName="app-mobile-open-history"
|
iconName="app-mobile-open-history"
|
||||||
style="font-size: 20px"
|
style="font-size: 20px"
|
||||||
class="ml-16 cursor"
|
class="ml-16 cursor"
|
||||||
:style="{
|
|
||||||
color: applicationDetail?.custom_theme?.header_font_color,
|
|
||||||
}"
|
|
||||||
@click.prevent.stop="show = true"
|
@click.prevent.stop="show = true"
|
||||||
/>
|
/>
|
||||||
<div class="mr-12 ml-16 flex">
|
<div class="mr-12 ml-16 flex">
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div class="authentication-setting p-16-24">
|
<div class="authentication-setting p-16-24">
|
||||||
<h4 class="mb-16">{{ $t('views.system.authentication.title') }}</h4>
|
<h4 class="mb-16">{{ $t('views.system.authentication.title') }}</h4>
|
||||||
|
|
||||||
<el-tabs v-model="activeName" class="mt-4" @tab-click="handleClick">
|
<el-tabs v-model="activeName" class="mt-4">
|
||||||
<template v-for="(item, index) in tabList" :key="index">
|
<template v-for="(item, index) in tabList" :key="index">
|
||||||
<el-tab-pane :label="item.label" :name="item.name">
|
<el-tab-pane :label="item.label" :name="item.name">
|
||||||
<component :is="item.component" />
|
<component :is="item.component" />
|
||||||
@ -50,7 +50,7 @@ const tabList = [
|
|||||||
// },
|
// },
|
||||||
]
|
]
|
||||||
|
|
||||||
function handleClick() {}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// if (user.isExpire()) {
|
// if (user.isExpire()) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div class="authentication-setting p-16-24">
|
<div class="authentication-setting p-16-24">
|
||||||
<h4 class="mb-16">{{ $t('views.system.authentication.title') }}</h4>
|
<h4 class="mb-16">{{ $t('views.system.authentication.title') }}</h4>
|
||||||
|
|
||||||
<el-tabs v-model="activeName" class="mt-4" @tab-click="handleClick">
|
<el-tabs v-model="activeName" class="mt-4">
|
||||||
<template v-for="(item, index) in tabList" :key="index">
|
<template v-for="(item, index) in tabList" :key="index">
|
||||||
<el-tab-pane :label="item.label" :name="item.name">
|
<el-tab-pane :label="item.label" :name="item.name">
|
||||||
<component :is="item.component" />
|
<component :is="item.component" />
|
||||||
@ -55,7 +55,6 @@ const tabList = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
function handleClick() {}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (user.isExpire()) {
|
if (user.isExpire()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user