refactor: 退役运行时视觉模块并泛化模板门禁

This commit is contained in:
que01 committed 2026-09-26 22:30:26 +08:00
1 parent 25d1fe983c
commit e2e2340bfe
56 files changed
+290 -1037

No files matched your search

@@ -22,8 +22,7 @@ export function OverviewPage() {
const error = results.find((result) => result.isError)?.error;
const retry = () => results.forEach((result) => void result.refetch());
const brand = results[0].data;
const workspace = results[1].data as
{ inquiryForm?: { isEnabled?: boolean }; modules?: Array<{ isEnabled?: boolean }> } | undefined;
const workspace = results[1].data as { inquiryForm?: { isEnabled?: boolean } } | undefined;
const trust = results[2].data;
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
const submissions = results[4].data;
@@ -75,15 +74,6 @@ export function OverviewPage() {
<Statistic title="咨询提交" value={submissions?.length ?? 0} suffix="条" />
</Card>
</Col>
<Col xs={24} sm={12} lg={6}>
<Card>
<Statistic
title="工作空间模块"
value={workspace?.modules?.filter((item) => item.isEnabled).length ?? 0}
suffix="个启用"
/>
</Card>
</Col>
</Row>
<Row gutter={[16, 16]}>
<Col xs={24} lg={12}>
@@ -16,7 +16,6 @@ import { createApiClient } from "../../lib/api.js";
import { ApiClientError } from "@personal-brand/api-client";
import type {
BrandFieldDefinition,
BrandModule,
BrandTemplateKey,
InquiryForm,
} from "@personal-brand/api-client";
@@ -134,11 +133,6 @@ export function WorkspacePage() {
void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
},
});
const updateModule = useMutation({
mutationFn: ({ id, body }: { id: string; body: Partial<BrandModule> }) =>
client.updateAdminModule(id, body),
onSuccess: () => void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] }),
});
const createField = useMutation({
mutationFn: (values: Omit<BrandFieldDefinition, "id" | "source">) =>
client.createAdminField(values),
@@ -242,7 +236,7 @@ export function WorkspacePage() {
</Card>
);
}
const { modules, fields, installations } = query.data;
const { fields, installations } = query.data;
return (
<Space direction="vertical" size="large" style={{ width: "100%" }}>
<AdminPageHeader
@@ -478,13 +472,7 @@ export function WorkspacePage() {
<Typography.Text strong>
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
</Typography.Text>
<Space wrap>
{combinationPreview.data.runtime.modules.map((item) => (
<Tag key={item.key}>
{item.title} · {item.variant}
</Tag>
))}
</Space>
<Space wrap></Space>
<Typography.Text type="secondary">
能力:
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
@@ -565,52 +553,6 @@ export function WorkspacePage() {
<MutationError error={createForm.error} />
<MutationError error={updateForm.error} />
</Card>
<Card title="页面模块">
<Table
rowKey="id"
dataSource={modules}
columns={[
{ title: "模块", dataIndex: "title" },
{ title: "类型", dataIndex: "type", render: (value) => <Tag>{value}</Tag> },
{ title: "来源", dataIndex: "source" },
{
title: "状态",
dataIndex: "isEnabled",
render: (value, item: BrandModule) => (
<Select
size="small"
value={Boolean(value)}
onChange={(next) =>
updateModule.mutate({ id: item.id, body: { isEnabled: Boolean(next) } })
}
options={[
{ value: true, label: "启用" },
{ value: false, label: "停用" },
]}
/>
),
},
{
title: "排序",
dataIndex: "sortOrder",
render: (value, item: BrandModule) => (
<Input
size="small"
type="number"
defaultValue={Number(value)}
onBlur={(event) =>
updateModule.mutate({
id: item.id,
body: { sortOrder: Number(event.target.value) },
})
}
/>
),
},
]}
/>
<MutationError error={updateModule.error} />
</Card>
<Card
title="自定义字段"
extra={