feat: 增加行业模板安装确认

This commit is contained in:
que01 committed 2026-09-22 23:43:41 +08:00
1 parent 0d98d23892
commit 6e8a49162c
2 files changed
+25 -1

No files matched your search

@@ -29,6 +29,12 @@ export function WorkspacePage() {
const [fieldOpen, setFieldOpen] = useState(false);
const [formOpen, setFormOpen] = useState(false);
const [visualTarget, setVisualTarget] = useState<string | null>(null);
const [industryTarget, setIndustryTarget] = useState<{
key: "personal" | "food";
name: string;
description: string;
capabilities: string[];
} | null>(null);
const [form] = Form.useForm<Record<string, unknown>>();
const [inquiryForm] = Form.useForm<Record<string, unknown>>();
const query = useQuery({
@@ -257,7 +263,7 @@ export function WorkspacePage() {
{(templateCatalog.data?.industries ?? []).map((item) => (
<Button
key={item.key}
onClick={() => install.mutate(item.key)}
onClick={() => setIndustryTarget(item)}
loading={install.isPending}
>
安装{item.name}
@@ -307,6 +313,23 @@ export function WorkspacePage() {
)}
<MutationError error={install.error} />
</Card>
<Modal
title="确认安装行业模板"
open={industryTarget !== null}
onCancel={() => setIndustryTarget(null)}
onOk={() => {
if (industryTarget) install.mutate(industryTarget.key);
setIndustryTarget(null);
}}
confirmLoading={install.isPending}
>
<Typography.Title level={5}>{industryTarget?.name}</Typography.Title>
<Typography.Paragraph>{industryTarget?.description}</Typography.Paragraph>
<Typography.Paragraph type="secondary">
模板会初始化模块、字段和默认业务表达,不会覆盖已有品牌内容。依赖能力:
{industryTarget?.capabilities.join("、") || "无"}。
</Typography.Paragraph>
</Modal>
<Card
title="动态咨询表单"
extra={