perf: optimize breadcrumb
parent
da74718b67
commit
ff763c4944
|
|
@ -155,7 +155,7 @@
|
||||||
>
|
>
|
||||||
<el-row v-if="applicationList.length > 0" :gutter="15" class="w-full">
|
<el-row v-if="applicationList.length > 0" :gutter="15" class="w-full">
|
||||||
<template v-for="(item, index) in applicationList" :key="index">
|
<template v-for="(item, index) in applicationList" :key="index">
|
||||||
<el-col
|
<!-- <el-col
|
||||||
v-if="item.resource_type === 'folder'"
|
v-if="item.resource_type === 'folder'"
|
||||||
:xs="24"
|
:xs="24"
|
||||||
:sm="12"
|
:sm="12"
|
||||||
|
|
@ -181,8 +181,8 @@
|
||||||
</el-text>
|
</el-text>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<el-col v-else :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
||||||
<CardBox
|
<CardBox
|
||||||
:title="item.name"
|
:title="item.name"
|
||||||
:description="item.desc"
|
:description="item.desc"
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
>
|
>
|
||||||
<el-row v-if="knowledge.knowledgeList.length > 0" :gutter="15" class="w-full">
|
<el-row v-if="knowledge.knowledgeList.length > 0" :gutter="15" class="w-full">
|
||||||
<template v-for="(item, index) in knowledge.knowledgeList" :key="index">
|
<template v-for="(item, index) in knowledge.knowledgeList" :key="index">
|
||||||
<el-col
|
<!-- <el-col
|
||||||
v-if="item.resource_type === 'folder'"
|
v-if="item.resource_type === 'folder'"
|
||||||
:xs="24"
|
:xs="24"
|
||||||
:sm="12"
|
:sm="12"
|
||||||
|
|
@ -173,15 +173,15 @@
|
||||||
</el-text>
|
</el-text>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<el-col v-else :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
||||||
<CardBox
|
<CardBox
|
||||||
:title="item.name"
|
:title="item.name"
|
||||||
:description="item.desc"
|
:description="item.desc"
|
||||||
class="cursor"
|
class="cursor"
|
||||||
@click="
|
@click="
|
||||||
router.push({
|
router.push({
|
||||||
path: `/knowledge/${item.id}/${folder.currentFolder.id || 'shared'}/document`,
|
path: `/knowledge/${item.id}/${folder.currentFolder.id ? (folder.currentFolder.id !== 'share' ? item.folder_id : 'share') : 'shared'}/document`,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,21 @@
|
||||||
ref="multipleTableRef"
|
ref="multipleTableRef"
|
||||||
class="mt-16"
|
class="mt-16"
|
||||||
:data="props.data"
|
:data="props.data"
|
||||||
:pagination-config="paginationConfig"
|
|
||||||
@sizeChange="handleSizeChange"
|
|
||||||
@changePage="props.getData"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
:maxTableHeight="320"
|
:maxTableHeight="260"
|
||||||
:row-key="(row: any) => row.id"
|
:row-key="(row: any) => row.id"
|
||||||
|
:expand-row-keys="defaultExpandKeys"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
||||||
<el-table-column prop="name" :label="$t('common.name')">
|
<el-table-column prop="name" :label="$t('common.name')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-space :size="8">
|
<el-space :size="8">
|
||||||
<!-- 文件夹 icon -->
|
<!-- 文件夹 icon -->
|
||||||
<AppIcon v-if="row.resource_type === 'folder'" iconName="app-folder" style="font-size: 20px"></AppIcon>
|
<AppIcon
|
||||||
|
v-if="row.resource_type === 'folder'"
|
||||||
|
iconName="app-folder"
|
||||||
|
style="font-size: 20px"
|
||||||
|
></AppIcon>
|
||||||
<!-- 知识库 icon -->
|
<!-- 知识库 icon -->
|
||||||
<KnowledgeIcon :size="20" v-else-if="isKnowledge" :type="row.icon" />
|
<KnowledgeIcon :size="20" v-else-if="isKnowledge" :type="row.icon" />
|
||||||
<!-- 应用/工具 自定义 icon -->
|
<!-- 应用/工具 自定义 icon -->
|
||||||
|
|
@ -156,6 +158,7 @@ const props = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['submitPermissions'])
|
const emit = defineEmits(['submitPermissions'])
|
||||||
|
|
||||||
|
const defaultExpandKeys = computed(() => (props.data?.length > 0 ? [props.data[0]?.id] : []))
|
||||||
const permissionOptionMap = computed(() => {
|
const permissionOptionMap = computed(() => {
|
||||||
return {
|
return {
|
||||||
rootFolder: getPermissionOptions(true, true),
|
rootFolder: getPermissionOptions(true, true),
|
||||||
|
|
@ -164,18 +167,16 @@ const permissionOptionMap = computed(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const getRowPermissionOptions = (row: any) => {
|
const getRowPermissionOptions = (row: any) => {
|
||||||
const isFolder = row.resource_type === 'folder'
|
const isFolder = row.resource_type === 'folder'
|
||||||
const isRoot = isFolder && row.folder_id === null
|
const isRoot = isFolder && row.folder_id === null
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
return permissionOptionMap.value.rootFolder
|
return permissionOptionMap.value.rootFolder
|
||||||
}
|
}
|
||||||
if (isFolder) {
|
if (isFolder) {
|
||||||
return permissionOptionMap.value.folder
|
return permissionOptionMap.value.folder
|
||||||
}
|
}
|
||||||
return permissionOptionMap.value.resource
|
return permissionOptionMap.value.resource
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const permissionOptions = computed(() => {
|
const permissionOptions = computed(() => {
|
||||||
|
|
@ -239,20 +240,7 @@ const search_type_change = () => {
|
||||||
searchForm.value = { name: '', permission: undefined }
|
searchForm.value = { name: '', permission: undefined }
|
||||||
}
|
}
|
||||||
|
|
||||||
const paginationConfig = reactive({
|
|
||||||
current_page: 1,
|
|
||||||
page_size: 20,
|
|
||||||
total: 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
function handleSizeChange() {
|
|
||||||
paginationConfig.current_page = 1
|
|
||||||
if (props.getData) {
|
|
||||||
props.getData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function searchHandle() {
|
function searchHandle() {
|
||||||
paginationConfig.current_page = 1
|
|
||||||
if (props.getData) {
|
if (props.getData) {
|
||||||
props.getData()
|
props.getData()
|
||||||
}
|
}
|
||||||
|
|
@ -319,7 +307,7 @@ onMounted(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
paginationConfig,
|
// paginationConfig,
|
||||||
searchForm,
|
searchForm,
|
||||||
searchType,
|
searchType,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue