diff --git a/apps/admin/src/features/workspace/WorkspacePage.tsx b/apps/admin/src/features/workspace/WorkspacePage.tsx
index 78ddcfc..b80bbfb 100644
--- a/apps/admin/src/features/workspace/WorkspacePage.tsx
+++ b/apps/admin/src/features/workspace/WorkspacePage.tsx
@@ -8,7 +8,9 @@ export function WorkspacePage() {
const client = createApiClient();
const queryClient = useQueryClient();
const [fieldOpen, setFieldOpen] = useState(false);
+ const [formOpen, setFormOpen] = useState(false);
const [form] = Form.useForm();
+ const [inquiryForm] = Form.useForm();
const query = useQuery({
queryKey: ["admin-workspace"],
queryFn: () => client.getAdminWorkspace(),
@@ -39,6 +41,20 @@ export function WorkspacePage() {
mutationFn: (id: string) => client.deleteAdminField(id),
onSuccess: () => void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] }),
});
+ const forms = useQuery({
+ queryKey: ["admin-inquiry-forms"],
+ queryFn: () => client.listAdminInquiryForms(),
+ });
+ const createForm = useMutation({
+ mutationFn: (values: { name: string; fieldsSnapshot: unknown[] }) =>
+ client.createAdminInquiryForm(values),
+ onSuccess: () => {
+ message.success("咨询表单已创建");
+ setFormOpen(false);
+ inquiryForm.resetFields();
+ void queryClient.invalidateQueries({ queryKey: ["admin-inquiry-forms"] });
+ },
+ });
if (query.isLoading) return ;
if (query.isError || !query.data) return 工作空间加载失败,请刷新重试。;
const { modules, fields, installations } = query.data;
@@ -59,6 +75,30 @@ export function WorkspacePage() {
>
{installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}
+ setFormOpen(true)}>
+ 新增表单
+
+ }
+ >
+ v{value} },
+ {
+ title: "字段数",
+ dataIndex: "fieldsSnapshot",
+ render: (value: unknown[]) => value?.length ?? 0,
+ },
+ { title: "状态", dataIndex: "isEnabled", render: (value) => (value ? "启用" : "停用") },
+ ]}
+ />
+