fix: 修复管理端前端类型校验问题

- 修正知识库与 Bot 设置页相关组件的类型定义和空值处理

- 补齐工作流与公开聊天页的前端类型约束和动态导入类型

- 收敛本次改动文件的局部格式与样式规范,确保 pnpm check:type 通过
This commit is contained in:
2026-04-05 20:36:25 +08:00
parent b5dd427920
commit bb72e19c84
15 changed files with 361 additions and 244 deletions

View File

@@ -1,9 +1,11 @@
<script setup lang="ts">
import {computed} from 'vue';
import type { TagProps } from 'element-plus';
import {useAccess} from '@easyflow/access';
import { computed } from 'vue';
import {MoreFilled} from '@element-plus/icons-vue';
import { useAccess } from '@easyflow/access';
import { MoreFilled } from '@element-plus/icons-vue';
import {
ElAvatar,
ElButton,
@@ -48,7 +50,7 @@ export interface CardListProps {
actions?: ActionButton[];
cornerTagField?: string;
cornerTagMap?: Record<string, string>;
cornerTagTypeMap?: Record<string, string>;
cornerTagTypeMap?: Record<string, TagProps['type']>;
defaultIcon: any;
data: any[];
primaryAction?: CardPrimaryAction;
@@ -97,7 +99,9 @@ const resolvedActions = computed<ResolvedActionButton[]>(() => {
});
const inlineActions = computed(() => {
return resolvedActions.value.filter((action) => action.placement === 'inline');
return resolvedActions.value.filter(
(action) => action.placement === 'inline',
);
});
const menuActions = computed(() => {
@@ -128,7 +132,10 @@ function handleActionClick(event: Event, action: ActionButton, item: any) {
v-for="(item, index) in props.data"
:key="item.id ?? index"
shadow="never"
:class="['card-item', { 'card-item--interactive': resolvedPrimaryAction }]"
:class="[
'card-item',
{ 'card-item--interactive': resolvedPrimaryAction },
]"
:role="resolvedPrimaryAction ? 'button' : undefined"
:tabindex="resolvedPrimaryAction ? 0 : undefined"
@click="handlePrimaryAction(item)"
@@ -171,9 +178,7 @@ function handleActionClick(event: Event, action: ActionButton, item: any) {
:type="cornerTagTypeMap[item[cornerTagField]] || 'info'"
round
>
{{
cornerTagMap[item[cornerTagField]] || item[cornerTagField]
}}
{{ cornerTagMap[item[cornerTagField]] || item[cornerTagField] }}
</ElTag>
</slot>
</div>
@@ -232,7 +237,9 @@ function handleActionClick(event: Event, action: ActionButton, item: any) {
<ElDropdownItem
v-for="action in menuActions"
:key="action.text"
:class="{ 'card-menu-item--danger': action.tone === 'danger' }"
:class="{
'card-menu-item--danger': action.tone === 'danger',
}"
@click="action.onClick(item)"
>
<div class="menu-action-content">