refactor: 退役运行时视觉模块并泛化模板门禁
This commit is contained in:
1 parent
25d1fe983c
commit
e2e2340bfe
56 files changed
+290
-1037
No files matched your search
@@ -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={
|
||||
|
||||
Reference in new issue
Block a user