feat: 增加知识库新类型FAQ知识库
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import {computed} from 'vue';
|
||||
|
||||
import { useAccess } from '@easyflow/access';
|
||||
import {useAccess} from '@easyflow/access';
|
||||
|
||||
import { MoreFilled } from '@element-plus/icons-vue';
|
||||
import {MoreFilled} from '@element-plus/icons-vue';
|
||||
import {
|
||||
ElAvatar,
|
||||
ElButton,
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ElDropdownItem,
|
||||
ElDropdownMenu,
|
||||
ElIcon,
|
||||
ElTag,
|
||||
ElText,
|
||||
} from 'element-plus';
|
||||
|
||||
@@ -31,12 +32,16 @@ export interface CardListProps {
|
||||
actions?: ActionButton[];
|
||||
defaultIcon: any;
|
||||
data: any[];
|
||||
tagField?: string;
|
||||
tagMap?: Record<string, string>;
|
||||
}
|
||||
const props = withDefaults(defineProps<CardListProps>(), {
|
||||
iconField: 'icon',
|
||||
titleField: 'title',
|
||||
descField: 'description',
|
||||
actions: () => [],
|
||||
tagField: '',
|
||||
tagMap: () => ({}),
|
||||
});
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
const filterActions = computed(() => {
|
||||
@@ -72,12 +77,22 @@ const hiddenActions = computed(() => {
|
||||
:src="item[iconField] || defaultIcon"
|
||||
:size="36"
|
||||
/>
|
||||
<ElText truncated size="large" class="font-medium">
|
||||
{{ item[titleField] }}
|
||||
</ElText>
|
||||
<div class="title-row">
|
||||
<ElText truncated size="large" class="font-medium">
|
||||
{{ item[titleField] }}
|
||||
</ElText>
|
||||
<ElTag
|
||||
v-if="tagField && item[tagField]"
|
||||
size="small"
|
||||
effect="plain"
|
||||
type="info"
|
||||
>
|
||||
{{ tagMap[item[tagField]] || item[tagField] }}
|
||||
</ElTag>
|
||||
</div>
|
||||
</div>
|
||||
<ElText line-clamp="2" class="item-desc w-full">
|
||||
{{ item[titleField] }}
|
||||
{{ item[descField] }}
|
||||
</ElText>
|
||||
</div>
|
||||
<template #footer>
|
||||
@@ -198,4 +213,13 @@ const hiddenActions = computed(() => {
|
||||
.item-danger {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user