perf: 卡片入口视觉效果重做
This commit is contained in:
@@ -3,7 +3,10 @@ import type { FormInstance } from 'element-plus';
|
||||
|
||||
import type { BotInfo } from '@easyflow/types';
|
||||
|
||||
import type { ActionButton } from '#/components/page/CardList.vue';
|
||||
import type {
|
||||
ActionButton,
|
||||
CardPrimaryAction,
|
||||
} from '#/components/page/CardList.vue';
|
||||
|
||||
import { computed, markRaw, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -70,36 +73,35 @@ const headerButtons = [
|
||||
function resolveNavTitle(row: BotInfo) {
|
||||
return (row as Record<string, any>)?.title || row?.name || '';
|
||||
}
|
||||
const primaryAction: CardPrimaryAction = {
|
||||
icon: Setting,
|
||||
text: $t('button.setting'),
|
||||
onClick(row: BotInfo) {
|
||||
router.push({
|
||||
path: `/ai/bots/setting/${row.id}`,
|
||||
query: {
|
||||
pageKey: '/ai/bots',
|
||||
navTitle: resolveNavTitle(row),
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const actions: ActionButton[] = [
|
||||
{
|
||||
icon: Edit,
|
||||
text: $t('button.edit'),
|
||||
className: '',
|
||||
permission: '',
|
||||
placement: 'inline',
|
||||
onClick(row: BotInfo) {
|
||||
modalRef.value?.open('edit', row);
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: Setting,
|
||||
text: $t('button.setting'),
|
||||
className: '',
|
||||
permission: '',
|
||||
onClick(row: BotInfo) {
|
||||
router.push({
|
||||
path: '/ai/bots/setting/' + row.id,
|
||||
query: {
|
||||
pageKey: '/ai/bots',
|
||||
navTitle: resolveNavTitle(row),
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: Delete,
|
||||
text: $t('button.delete'),
|
||||
className: 'item-danger',
|
||||
tone: 'danger',
|
||||
permission: '/api/v1/bot/remove',
|
||||
placement: 'inline',
|
||||
onClick(row: BotInfo) {
|
||||
removeBot(row);
|
||||
},
|
||||
@@ -298,6 +300,7 @@ const getSideList = async () => {
|
||||
<CardList
|
||||
:default-icon="defaultAvatar"
|
||||
:data="pageList"
|
||||
:primary-action="primaryAction"
|
||||
:actions="actions"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user