feat: 重构 Skill 管理与编辑工作台
- 统一列表、分类、新建与详情页的产品交互 - 提供 Markdown 实时编辑、源码与脚本资源工作台 - 实现能力自动保存、导入导出及完整状态反馈
This commit is contained in:
@@ -25,6 +25,8 @@ import BotApprovalSnapshotPreview from '#/views/system/approval/components/BotAp
|
||||
import KnowledgeApprovalSnapshotPreview from '#/views/system/approval/components/KnowledgeApprovalSnapshotPreview.vue';
|
||||
import WorkflowApprovalSnapshotPreview from '#/views/system/approval/components/WorkflowApprovalSnapshotPreview.vue';
|
||||
|
||||
import { formatApprovalAccount } from './approval-format';
|
||||
|
||||
const route = useRoute();
|
||||
const loading = ref(false);
|
||||
const detail = ref<any>(null);
|
||||
@@ -171,23 +173,6 @@ function formatPayload(payload: Record<string, any>) {
|
||||
return JSON.stringify(payload || {}, null, 2);
|
||||
}
|
||||
|
||||
function formatAccountDisplay(
|
||||
name?: string,
|
||||
account?: null | string,
|
||||
fallbackId?: null | number | string,
|
||||
) {
|
||||
if (name && account) {
|
||||
return `${name}(${account})`;
|
||||
}
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
if (account) {
|
||||
return account;
|
||||
}
|
||||
return fallbackId || '-';
|
||||
}
|
||||
|
||||
function formatOperatorId(
|
||||
account?: null | string,
|
||||
fallbackId?: null | number | string,
|
||||
@@ -334,7 +319,7 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="$t('approval.fields.applicant')">
|
||||
{{
|
||||
formatAccountDisplay(
|
||||
formatApprovalAccount(
|
||||
detail.applicantName,
|
||||
detail.applicantAccount,
|
||||
detail.applicantId,
|
||||
@@ -390,7 +375,7 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('approval.fields.actedBy')" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ formatAccountDisplay(row.actedByName, row.actedBy) }}
|
||||
{{ formatApprovalAccount(row.actedByName, row.actedBy) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
|
||||
@@ -29,6 +29,7 @@ import PageData from '#/components/page/PageData.vue';
|
||||
import { $t } from '#/locales';
|
||||
import { router } from '#/router';
|
||||
|
||||
import { formatApprovalAccount } from './approval-format';
|
||||
import ApprovalFlowModal from './ApprovalFlowModal.vue';
|
||||
|
||||
type ApprovalTabName = 'flow' | 'initiated' | 'pending' | 'processed';
|
||||
@@ -785,6 +786,20 @@ function formatApplicationReason(value?: null | string) {
|
||||
{{ formatApplicationReason(row.applicationReason) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.applicant')"
|
||||
min-width="180"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
formatApprovalAccount(
|
||||
row.applicantName,
|
||||
row.applicantAccount,
|
||||
row.applicantId,
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.resourceType')"
|
||||
width="120"
|
||||
@@ -969,6 +984,20 @@ function formatApplicationReason(value?: null | string) {
|
||||
{{ formatApplicationReason(row.applicationReason) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.applicant')"
|
||||
min-width="180"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
formatApprovalAccount(
|
||||
row.applicantName,
|
||||
row.applicantAccount,
|
||||
row.applicantId,
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.resourceType')"
|
||||
width="120"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { formatApprovalAccount } from './approval-format';
|
||||
|
||||
describe('formatApprovalAccount', () => {
|
||||
it('formats the applicant consistently with approval detail', () => {
|
||||
expect(formatApprovalAccount('陈子默', 'czm', '7')).toBe('陈子默(czm)');
|
||||
});
|
||||
|
||||
it('falls back when applicant account information is unavailable', () => {
|
||||
expect(formatApprovalAccount(null, null, '7')).toBe('7');
|
||||
expect(formatApprovalAccount()).toBe('-');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 格式化审批账号信息,与审批详情保持“姓名(账号)”展示规则。
|
||||
*
|
||||
* @param name 展示名称
|
||||
* @param account 登录账号
|
||||
* @param fallbackId 无账号信息时使用的 ID
|
||||
* @returns 可直接展示的账号文本
|
||||
*/
|
||||
export function formatApprovalAccount(
|
||||
name?: null | string,
|
||||
account?: null | string,
|
||||
fallbackId?: null | number | string,
|
||||
) {
|
||||
if (name && account) {
|
||||
return `${name}(${account})`;
|
||||
}
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
if (account) {
|
||||
return account;
|
||||
}
|
||||
return fallbackId || '-';
|
||||
}
|
||||
Reference in New Issue
Block a user