feat: 支持动态咨询字段类型

This commit is contained in:
que01 committed 2026-09-23 09:45:07 +08:00
1 parent 3186757d93
commit 6d2c12c3df
4 files changed
+28 -3

No files matched your search

+18 -1
View File
@@ -282,7 +282,24 @@ export class PublicWorkspaceController {
].includes(String(value.type))
? (value.type as RuntimeInquiryField["type"])
: "text";
return [{ key: value.key, label: value.label, type, required: value.required === true }];
const options = Array.isArray(value.options)
? value.options.flatMap((option) => {
if (!option || typeof option !== "object") return [];
const item = option as Record<string, unknown>;
return typeof item.label === "string" && typeof item.value === "string"
? [{ label: item.label, value: item.value }]
: [];
})
: undefined;
return [
{
key: value.key,
label: value.label,
type,
required: value.required === true,
...(options?.length ? { options } : {}),
},
];
});
const inquiryForm = inquiryForms[0] ?? null;
const runtimeWorkspace: RuntimeWorkspace = {